@aeriajs/builtins 0.0.76 → 0.0.77
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.js +3 -2
- package/dist/collections/file/download.mjs +3 -3
- package/dist/collections/file/index.d.ts +2 -2
- package/dist/collections/file/insert.js +3 -2
- package/dist/collections/file/insert.mjs +3 -3
- package/dist/collections/file/remove.js +3 -2
- package/dist/collections/file/remove.mjs +3 -3
- package/dist/collections/file/removeAll.js +3 -2
- package/dist/collections/file/removeAll.mjs +3 -3
- package/dist/collections/log/index.d.ts +1 -1
- package/dist/collections/resourceUsage/index.d.ts +1 -1
- package/dist/collections/user/activate.d.ts +1 -1
- package/dist/collections/user/activate.js +3 -2
- package/dist/collections/user/activate.mjs +3 -3
- package/dist/collections/user/authenticate.js +4 -8
- package/dist/collections/user/authenticate.mjs +0 -4
- package/dist/collections/user/createAccount.js +3 -3
- package/dist/collections/user/createAccount.mjs +2 -3
- package/dist/collections/user/getCurrentUser.js +3 -3
- package/dist/collections/user/getCurrentUser.mjs +2 -3
- package/dist/collections/user/getInfo.js +3 -2
- package/dist/collections/user/getInfo.mjs +3 -3
- package/dist/collections/user/index.d.ts +2 -5
- package/dist/collections/user/index.js +0 -3
- package/dist/collections/user/index.mjs +0 -3
- package/dist/collections/user/insert.js +0 -3
- package/dist/collections/user/insert.mjs +1 -4
- package/dist/index.d.ts +6 -9
- package/package.json +6 -6
|
@@ -9,7 +9,7 @@ var FileReadError;
|
|
|
9
9
|
FileReadError["DocumentNotFound"] = "DOCUMENT_NOT_FOUND";
|
|
10
10
|
FileReadError["FileNotFound"] = "FILE_NOT_FOUND";
|
|
11
11
|
})(FileReadError || (exports.FileReadError = FileReadError = {}));
|
|
12
|
-
|
|
12
|
+
const download = async (payload, context) => {
|
|
13
13
|
const { fileId, options = [] } = payload;
|
|
14
14
|
const file = await context.collection.model.findOne({
|
|
15
15
|
_id: new core_1.ObjectId(fileId),
|
|
@@ -71,4 +71,5 @@ exports.download = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
return fs.createReadStream(file.absolute_path);
|
|
74
|
-
}
|
|
74
|
+
};
|
|
75
|
+
exports.download = download;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { ObjectId } from "@aeriajs/core";
|
|
3
3
|
import { left } from "@aeriajs/common";
|
|
4
4
|
import * as fs from "fs";
|
|
5
5
|
export var FileReadError = /* @__PURE__ */ ((FileReadError2) => {
|
|
@@ -7,7 +7,7 @@ export var FileReadError = /* @__PURE__ */ ((FileReadError2) => {
|
|
|
7
7
|
FileReadError2["FileNotFound"] = "FILE_NOT_FOUND";
|
|
8
8
|
return FileReadError2;
|
|
9
9
|
})(FileReadError || {});
|
|
10
|
-
export const download =
|
|
10
|
+
export const download = async (payload, context) => {
|
|
11
11
|
const { fileId, options = [] } = payload;
|
|
12
12
|
const file = await context.collection.model.findOne({
|
|
13
13
|
_id: new ObjectId(fileId)
|
|
@@ -62,4 +62,4 @@ export const download = defineExposedFunction(async (payload, context) => {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
return fs.createReadStream(file.absolute_path);
|
|
65
|
-
}
|
|
65
|
+
};
|
|
@@ -28,7 +28,7 @@ export declare const tempFile: Omit<import("@aeriajs/types").Collection<{
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
}>, "description" | "functions" | "
|
|
31
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
32
32
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
33
33
|
readonly $id: "tempFile";
|
|
34
34
|
readonly temporary: {
|
|
@@ -499,7 +499,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
|
|
|
499
499
|
};
|
|
500
500
|
}>) => Promise<any>;
|
|
501
501
|
};
|
|
502
|
-
}>, "description" | "functions" | "
|
|
502
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
503
503
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
504
504
|
readonly $id: "file";
|
|
505
505
|
readonly owned: "always";
|
|
@@ -4,7 +4,7 @@ exports.insert = void 0;
|
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const promises_1 = require("fs/promises");
|
|
6
6
|
const core_1 = require("@aeriajs/core");
|
|
7
|
-
|
|
7
|
+
const insert = async (payload, context) => {
|
|
8
8
|
if (!context.token.authenticated) {
|
|
9
9
|
throw new Error('');
|
|
10
10
|
}
|
|
@@ -40,4 +40,5 @@ exports.insert = (0, core_1.defineExposedFunction)(async (payload, context) => {
|
|
|
40
40
|
...payload,
|
|
41
41
|
what,
|
|
42
42
|
}, context);
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
|
+
exports.insert = insert;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { createHash } from "crypto";
|
|
3
3
|
import { writeFile, unlink } from "fs/promises";
|
|
4
|
-
import {
|
|
5
|
-
export const insert =
|
|
4
|
+
import { insert as originalInsert } from "@aeriajs/core";
|
|
5
|
+
export const insert = async (payload, context) => {
|
|
6
6
|
if (!context.token.authenticated) {
|
|
7
7
|
throw new Error("");
|
|
8
8
|
}
|
|
@@ -39,4 +39,4 @@ export const insert = defineExposedFunction(async (payload, context) => {
|
|
|
39
39
|
...payload,
|
|
40
40
|
what
|
|
41
41
|
}, context);
|
|
42
|
-
}
|
|
42
|
+
};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.remove = void 0;
|
|
4
4
|
const core_1 = require("@aeriajs/core");
|
|
5
5
|
const fs = require("fs/promises");
|
|
6
|
-
|
|
6
|
+
const remove = async (payload, context) => {
|
|
7
7
|
const file = await context.collection.model.findOne({
|
|
8
8
|
_id: payload.filters._id,
|
|
9
9
|
}, {
|
|
@@ -21,4 +21,5 @@ exports.remove = (0, core_1.defineExposedFunction)(async (payload, context) => {
|
|
|
21
21
|
console.trace(err);
|
|
22
22
|
}
|
|
23
23
|
return (0, core_1.remove)(payload, context);
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
|
+
exports.remove = remove;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { remove as originalRemove } from "@aeriajs/core";
|
|
3
3
|
import * as fs from "fs/promises";
|
|
4
|
-
export const remove =
|
|
4
|
+
export const remove = async (payload, context) => {
|
|
5
5
|
const file = await context.collection.model.findOne({
|
|
6
6
|
_id: payload.filters._id
|
|
7
7
|
}, {
|
|
@@ -18,4 +18,4 @@ export const remove = defineExposedFunction(async (payload, context) => {
|
|
|
18
18
|
console.trace(err);
|
|
19
19
|
}
|
|
20
20
|
return originalRemove(payload, context);
|
|
21
|
-
}
|
|
21
|
+
};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.removeAll = void 0;
|
|
4
4
|
const core_1 = require("@aeriajs/core");
|
|
5
5
|
const fs = require("fs/promises");
|
|
6
|
-
|
|
6
|
+
const removeAll = async (payload, context) => {
|
|
7
7
|
const files = context.collection.model.find({
|
|
8
8
|
_id: {
|
|
9
9
|
$in: payload.filters,
|
|
@@ -23,4 +23,5 @@ exports.removeAll = (0, core_1.defineExposedFunction)(async (payload, context) =
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
return (0, core_1.remove)(payload, context);
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
|
+
exports.removeAll = removeAll;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { remove as originalRemoveAll } from "@aeriajs/core";
|
|
3
3
|
import * as fs from "fs/promises";
|
|
4
|
-
export const removeAll =
|
|
4
|
+
export const removeAll = async (payload, context) => {
|
|
5
5
|
const files = context.collection.model.find({
|
|
6
6
|
_id: {
|
|
7
7
|
$in: payload.filters
|
|
@@ -20,4 +20,4 @@ export const removeAll = defineExposedFunction(async (payload, context) => {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
return originalRemoveAll(payload, context);
|
|
23
|
-
}
|
|
23
|
+
};
|
|
@@ -31,7 +31,7 @@ export declare const log: Omit<import("@aeriajs/types").Collection<{
|
|
|
31
31
|
readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
|
|
32
32
|
readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/core").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
|
|
33
33
|
};
|
|
34
|
-
}>, "description" | "functions" | "
|
|
34
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
35
35
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
36
36
|
readonly $id: "log";
|
|
37
37
|
readonly required: readonly ["context", "message"];
|
|
@@ -33,7 +33,7 @@ export declare const resourceUsage: Omit<import("@aeriajs/types").Collection<{
|
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
}>, "description" | "functions" | "
|
|
36
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
37
37
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
38
38
|
readonly $id: "resourceUsage";
|
|
39
39
|
readonly required: readonly ["usage"];
|
|
@@ -7,4 +7,4 @@ export declare enum ActivationErrors {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const activate: (payload: {
|
|
9
9
|
password: string;
|
|
10
|
-
}, context: Context<typeof description>) => Promise<import("@aeriajs/types").
|
|
10
|
+
}, context: Context<typeof description>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
|
|
@@ -10,7 +10,7 @@ var ActivationErrors;
|
|
|
10
10
|
ActivationErrors["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
|
|
11
11
|
ActivationErrors["InvalidLink"] = "INVALID_LINK";
|
|
12
12
|
})(ActivationErrors || (exports.ActivationErrors = ActivationErrors = {}));
|
|
13
|
-
|
|
13
|
+
const activate = async (payload, context) => {
|
|
14
14
|
const { u: userId, t: token, } = context.request.query;
|
|
15
15
|
if (!userId || !token) {
|
|
16
16
|
return (0, common_1.left)(ActivationErrors.InvalidLink);
|
|
@@ -58,4 +58,5 @@ exports.activate = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
58
58
|
return context.response.writeHead(302, {
|
|
59
59
|
location: '/user/activation',
|
|
60
60
|
});
|
|
61
|
-
}
|
|
61
|
+
};
|
|
62
|
+
exports.activate = activate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { ObjectId } from "@aeriajs/core";
|
|
3
3
|
import { left, right } from "@aeriajs/common";
|
|
4
4
|
import * as bcrypt from "bcrypt";
|
|
5
5
|
export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
|
|
@@ -8,7 +8,7 @@ export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
|
|
|
8
8
|
ActivationErrors2["InvalidLink"] = "INVALID_LINK";
|
|
9
9
|
return ActivationErrors2;
|
|
10
10
|
})(ActivationErrors || {});
|
|
11
|
-
export const activate =
|
|
11
|
+
export const activate = async (payload, context) => {
|
|
12
12
|
const {
|
|
13
13
|
u: userId,
|
|
14
14
|
t: token
|
|
@@ -65,4 +65,4 @@ export const activate = defineExposedFunction(async (payload, context) => {
|
|
|
65
65
|
return context.response.writeHead(302, {
|
|
66
66
|
location: "/user/activation"
|
|
67
67
|
});
|
|
68
|
-
}
|
|
68
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.authenticate = exports.getDefaultUser = exports.AuthenticationErrors = void 0;
|
|
4
|
-
const core_1 = require("@aeriajs/core");
|
|
5
4
|
const bcrypt_1 = require("bcrypt");
|
|
6
|
-
const
|
|
5
|
+
const core_1 = require("@aeriajs/core");
|
|
7
6
|
const common_1 = require("@aeriajs/common");
|
|
8
7
|
var AuthenticationErrors;
|
|
9
8
|
(function (AuthenticationErrors) {
|
|
@@ -48,7 +47,7 @@ const getUser = async (userId, context) => {
|
|
|
48
47
|
}, {});
|
|
49
48
|
tokenContent.userinfo = pick(leanUser, context.config.tokenUserProperties);
|
|
50
49
|
}
|
|
51
|
-
const token = await (0,
|
|
50
|
+
const token = await (0, core_1.signToken)(tokenContent);
|
|
52
51
|
return {
|
|
53
52
|
user: leanUser,
|
|
54
53
|
token: {
|
|
@@ -58,7 +57,7 @@ const getUser = async (userId, context) => {
|
|
|
58
57
|
};
|
|
59
58
|
};
|
|
60
59
|
const getDefaultUser = async () => {
|
|
61
|
-
const token = await (0,
|
|
60
|
+
const token = await (0, core_1.signToken)({
|
|
62
61
|
_id: null,
|
|
63
62
|
roles: ['root'],
|
|
64
63
|
userinfo: {},
|
|
@@ -85,7 +84,7 @@ const authenticate = async (props, context) => {
|
|
|
85
84
|
return (0, common_1.left)(AuthenticationErrors.Unauthenticated);
|
|
86
85
|
}
|
|
87
86
|
const decodedToken = token
|
|
88
|
-
? await (0,
|
|
87
|
+
? await (0, core_1.decodeToken)(token.content)
|
|
89
88
|
: context.token;
|
|
90
89
|
return (0, common_1.right)(decodedToken.sub
|
|
91
90
|
? await getUser(decodedToken.sub, context)
|
|
@@ -117,6 +116,3 @@ const authenticate = async (props, context) => {
|
|
|
117
116
|
return (0, common_1.right)(await getUser(user._id, context));
|
|
118
117
|
};
|
|
119
118
|
exports.authenticate = authenticate;
|
|
120
|
-
(0, core_1.defineFunctionAttributes)(exports.authenticate, {
|
|
121
|
-
exposed: true,
|
|
122
|
-
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import { defineFunctionAttributes } from "@aeriajs/core";
|
|
3
2
|
import { compare as bcryptCompare } from "bcrypt";
|
|
4
3
|
import { signToken, decodeToken } from "@aeriajs/core";
|
|
5
4
|
import { left, right } from "@aeriajs/common";
|
|
@@ -111,6 +110,3 @@ export const authenticate = async (props, context) => {
|
|
|
111
110
|
}
|
|
112
111
|
return right(await getUser(user._id, context));
|
|
113
112
|
};
|
|
114
|
-
defineFunctionAttributes(authenticate, {
|
|
115
|
-
exposed: true
|
|
116
|
-
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAccount = void 0;
|
|
4
|
-
const core_1 = require("@aeriajs/core");
|
|
5
4
|
const common_1 = require("@aeriajs/common");
|
|
6
5
|
const validation_1 = require("@aeriajs/validation");
|
|
7
6
|
const bcrypt = require("bcrypt");
|
|
8
|
-
|
|
7
|
+
const createAccount = async (payload, context) => {
|
|
9
8
|
const user = Object.assign({}, payload);
|
|
10
9
|
if (!context.config.security.allowSignup) {
|
|
11
10
|
throw new Error('signup disallowed');
|
|
@@ -60,4 +59,5 @@ exports.createAccount = (0, core_1.defineExposedFunction)(async (payload, contex
|
|
|
60
59
|
throw new Error();
|
|
61
60
|
}
|
|
62
61
|
return (0, common_1.right)(newUser);
|
|
63
|
-
}
|
|
62
|
+
};
|
|
63
|
+
exports.createAccount = createAccount;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import { defineExposedFunction } from "@aeriajs/core";
|
|
3
2
|
import { isLeft, unwrapEither, left, right } from "@aeriajs/common";
|
|
4
3
|
import { validate } from "@aeriajs/validation";
|
|
5
4
|
import * as bcrypt from "bcrypt";
|
|
6
|
-
export const createAccount =
|
|
5
|
+
export const createAccount = async (payload, context) => {
|
|
7
6
|
const user = Object.assign({}, payload);
|
|
8
7
|
if (!context.config.security.allowSignup) {
|
|
9
8
|
throw new Error("signup disallowed");
|
|
@@ -58,4 +57,4 @@ export const createAccount = defineExposedFunction(async (payload, context) => {
|
|
|
58
57
|
throw new Error();
|
|
59
58
|
}
|
|
60
59
|
return right(newUser);
|
|
61
|
-
}
|
|
60
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCurrentUser = exports.ActivationErrors = void 0;
|
|
4
|
-
const core_1 = require("@aeriajs/core");
|
|
5
4
|
const common_1 = require("@aeriajs/common");
|
|
6
5
|
var ActivationErrors;
|
|
7
6
|
(function (ActivationErrors) {
|
|
@@ -9,7 +8,7 @@ var ActivationErrors;
|
|
|
9
8
|
ActivationErrors["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
|
|
10
9
|
ActivationErrors["InvalidLink"] = "INVALID_LINK";
|
|
11
10
|
})(ActivationErrors || (exports.ActivationErrors = ActivationErrors = {}));
|
|
12
|
-
|
|
11
|
+
const getCurrentUser = async (_payload, context) => {
|
|
13
12
|
if (!context.token.authenticated) {
|
|
14
13
|
return (0, common_1.left)({});
|
|
15
14
|
}
|
|
@@ -23,4 +22,5 @@ exports.getCurrentUser = (0, core_1.defineExposedFunction)(async (_payload, cont
|
|
|
23
22
|
}
|
|
24
23
|
const nonNullableUser = user;
|
|
25
24
|
return (0, common_1.right)(nonNullableUser);
|
|
26
|
-
}
|
|
25
|
+
};
|
|
26
|
+
exports.getCurrentUser = getCurrentUser;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import { defineExposedFunction } from "@aeriajs/core";
|
|
3
2
|
import { left, right } from "@aeriajs/common";
|
|
4
3
|
export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
|
|
5
4
|
ActivationErrors2["UserNotFound"] = "USER_NOT_FOUND";
|
|
@@ -7,7 +6,7 @@ export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
|
|
|
7
6
|
ActivationErrors2["InvalidLink"] = "INVALID_LINK";
|
|
8
7
|
return ActivationErrors2;
|
|
9
8
|
})(ActivationErrors || {});
|
|
10
|
-
export const getCurrentUser =
|
|
9
|
+
export const getCurrentUser = async (_payload, context) => {
|
|
11
10
|
if (!context.token.authenticated) {
|
|
12
11
|
return left({});
|
|
13
12
|
}
|
|
@@ -21,4 +20,4 @@ export const getCurrentUser = defineExposedFunction(async (_payload, context) =>
|
|
|
21
20
|
}
|
|
22
21
|
const nonNullableUser = user;
|
|
23
22
|
return right(nonNullableUser);
|
|
24
|
-
}
|
|
23
|
+
};
|
|
@@ -10,7 +10,7 @@ var ActivationErrors;
|
|
|
10
10
|
ActivationErrors["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
|
|
11
11
|
ActivationErrors["InvalidLink"] = "INVALID_LINK";
|
|
12
12
|
})(ActivationErrors || (exports.ActivationErrors = ActivationErrors = {}));
|
|
13
|
-
|
|
13
|
+
const getInfo = async (payload, context) => {
|
|
14
14
|
const { userId, token, } = payload;
|
|
15
15
|
if (!userId || !token) {
|
|
16
16
|
return (0, common_1.left)(ActivationErrors.InvalidLink);
|
|
@@ -32,4 +32,5 @@ exports.getInfo = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
32
32
|
name: user.name,
|
|
33
33
|
email: user.email,
|
|
34
34
|
});
|
|
35
|
-
}
|
|
35
|
+
};
|
|
36
|
+
exports.getInfo = getInfo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { ObjectId } from "@aeriajs/core";
|
|
3
3
|
import { left, right } from "@aeriajs/common";
|
|
4
4
|
import * as bcrypt from "bcrypt";
|
|
5
5
|
export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
|
|
@@ -8,7 +8,7 @@ export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
|
|
|
8
8
|
ActivationErrors2["InvalidLink"] = "INVALID_LINK";
|
|
9
9
|
return ActivationErrors2;
|
|
10
10
|
})(ActivationErrors || {});
|
|
11
|
-
export const getInfo =
|
|
11
|
+
export const getInfo = async (payload, context) => {
|
|
12
12
|
const {
|
|
13
13
|
userId,
|
|
14
14
|
token
|
|
@@ -33,4 +33,4 @@ export const getInfo = defineExposedFunction(async (payload, context) => {
|
|
|
33
33
|
name: user.name,
|
|
34
34
|
email: user.email
|
|
35
35
|
});
|
|
36
|
-
}
|
|
36
|
+
};
|
|
@@ -730,7 +730,7 @@ export declare const user: {
|
|
|
730
730
|
};
|
|
731
731
|
};
|
|
732
732
|
};
|
|
733
|
-
}>) => Promise<import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").
|
|
733
|
+
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
|
|
734
734
|
readonly createAccount: (payload: Omit<Pick<{
|
|
735
735
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
736
736
|
readonly $id: "file";
|
|
@@ -1394,9 +1394,6 @@ export declare const user: {
|
|
|
1394
1394
|
}];
|
|
1395
1395
|
};
|
|
1396
1396
|
};
|
|
1397
|
-
exposedFunctions: {
|
|
1398
|
-
readonly authenticate: true;
|
|
1399
|
-
};
|
|
1400
1397
|
} & {
|
|
1401
1398
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
1402
1399
|
readonly $id: "user";
|
|
@@ -2229,7 +2226,7 @@ export declare const user: {
|
|
|
2229
2226
|
};
|
|
2230
2227
|
};
|
|
2231
2228
|
};
|
|
2232
|
-
}>) => Promise<import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").
|
|
2229
|
+
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
|
|
2233
2230
|
readonly createAccount: (payload: Omit<Pick<{
|
|
2234
2231
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
2235
2232
|
readonly $id: "file";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { insert as originalInsert } from "@aeriajs/core";
|
|
3
3
|
import * as bcrypt from "bcrypt";
|
|
4
4
|
export const insert = async (payload, context) => {
|
|
5
5
|
if (payload.what.password) {
|
|
@@ -7,6 +7,3 @@ export const insert = async (payload, context) => {
|
|
|
7
7
|
}
|
|
8
8
|
return originalInsert(payload, context);
|
|
9
9
|
};
|
|
10
|
-
defineFunctionAttributes(insert, {
|
|
11
|
-
exposed: true
|
|
12
|
-
});
|
package/dist/index.d.ts
CHANGED
|
@@ -417,7 +417,7 @@ export declare const collections: {
|
|
|
417
417
|
};
|
|
418
418
|
}>) => Promise<any>;
|
|
419
419
|
};
|
|
420
|
-
}>, "description" | "functions" | "
|
|
420
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
421
421
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
422
422
|
readonly $id: "file";
|
|
423
423
|
readonly owned: "always";
|
|
@@ -913,7 +913,7 @@ export declare const collections: {
|
|
|
913
913
|
};
|
|
914
914
|
};
|
|
915
915
|
};
|
|
916
|
-
}>, "description" | "functions" | "
|
|
916
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
917
917
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
918
918
|
readonly $id: "tempFile";
|
|
919
919
|
readonly temporary: {
|
|
@@ -1008,7 +1008,7 @@ export declare const collections: {
|
|
|
1008
1008
|
readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
|
|
1009
1009
|
readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/core").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
|
|
1010
1010
|
};
|
|
1011
|
-
}>, "description" | "functions" | "
|
|
1011
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
1012
1012
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
1013
1013
|
readonly $id: "log";
|
|
1014
1014
|
readonly required: readonly ["context", "message"];
|
|
@@ -1109,7 +1109,7 @@ export declare const collections: {
|
|
|
1109
1109
|
};
|
|
1110
1110
|
};
|
|
1111
1111
|
};
|
|
1112
|
-
}>, "description" | "functions" | "
|
|
1112
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
1113
1113
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
1114
1114
|
readonly $id: "resourceUsage";
|
|
1115
1115
|
readonly required: readonly ["usage"];
|
|
@@ -1915,7 +1915,7 @@ export declare const collections: {
|
|
|
1915
1915
|
};
|
|
1916
1916
|
};
|
|
1917
1917
|
};
|
|
1918
|
-
}>) => Promise<import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").
|
|
1918
|
+
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
|
|
1919
1919
|
readonly createAccount: (payload: Omit<Pick<{
|
|
1920
1920
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
1921
1921
|
readonly $id: "file";
|
|
@@ -2579,9 +2579,6 @@ export declare const collections: {
|
|
|
2579
2579
|
}];
|
|
2580
2580
|
};
|
|
2581
2581
|
};
|
|
2582
|
-
exposedFunctions: {
|
|
2583
|
-
readonly authenticate: true;
|
|
2584
|
-
};
|
|
2585
2582
|
} & {
|
|
2586
2583
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
2587
2584
|
readonly $id: "user";
|
|
@@ -3414,7 +3411,7 @@ export declare const collections: {
|
|
|
3414
3411
|
};
|
|
3415
3412
|
};
|
|
3416
3413
|
};
|
|
3417
|
-
}>) => Promise<import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").
|
|
3414
|
+
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
|
|
3418
3415
|
readonly createAccount: (payload: Omit<Pick<{
|
|
3419
3416
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
3420
3417
|
readonly $id: "file";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/builtins",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.77",
|
|
4
4
|
"description": "## Installation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"mongodb": "^6.5.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@aeriajs/core": "^0.0.
|
|
49
|
-
"@aeriajs/common": "^0.0.
|
|
50
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
51
|
-
"@aeriajs/types": "^0.0.
|
|
52
|
-
"@aeriajs/validation": "^0.0.
|
|
48
|
+
"@aeriajs/core": "^0.0.77",
|
|
49
|
+
"@aeriajs/common": "^0.0.44",
|
|
50
|
+
"@aeriajs/entrypoint": "^0.0.44",
|
|
51
|
+
"@aeriajs/types": "^0.0.41",
|
|
52
|
+
"@aeriajs/validation": "^0.0.47"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"test": "echo skipping",
|