@aeriajs/builtins 0.0.72 → 0.0.74
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 +1 -1
- package/dist/collections/file/download.js +4 -7
- package/dist/collections/file/download.mjs +1 -1
- package/dist/collections/file/remove.js +2 -5
- package/dist/collections/file/remove.mjs +1 -1
- package/dist/collections/file/removeAll.js +2 -5
- package/dist/collections/file/removeAll.mjs +1 -1
- package/dist/collections/user/activate.d.ts +1 -1
- package/dist/collections/user/activate.js +3 -6
- package/dist/collections/user/activate.mjs +1 -1
- package/dist/collections/user/createAccount.d.ts +100 -1
- package/dist/collections/user/createAccount.js +2 -5
- package/dist/collections/user/createAccount.mjs +1 -1
- package/dist/collections/user/getActivationLink.d.ts +1 -0
- package/dist/collections/user/getActivationLink.js +2 -5
- package/dist/collections/user/getActivationLink.mjs +1 -1
- package/dist/collections/user/getInfo.d.ts +2 -2
- package/dist/collections/user/getInfo.js +2 -5
- package/dist/collections/user/getInfo.mjs +1 -1
- package/dist/collections/user/index.d.ts +220 -22
- package/dist/collections/user/insert.js +2 -5
- package/dist/collections/user/insert.mjs +1 -1
- package/dist/functions/describe.d.ts +2 -2
- package/dist/index.d.ts +220 -22
- package/dist/index.js +1 -13
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { Context } from '@aeriajs/types';
|
|
3
3
|
import type { description } from './description.js';
|
|
4
|
-
import fs from 'fs';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
5
|
export declare enum FileReadError {
|
|
6
6
|
DocumentNotFound = "DOCUMENT_NOT_FOUND",
|
|
7
7
|
FileNotFound = "FILE_NOT_FOUND"
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.download = exports.FileReadError = void 0;
|
|
7
4
|
const core_1 = require("@aeriajs/core");
|
|
8
5
|
const common_1 = require("@aeriajs/common");
|
|
9
|
-
const
|
|
6
|
+
const fs = require("fs");
|
|
10
7
|
var FileReadError;
|
|
11
8
|
(function (FileReadError) {
|
|
12
9
|
FileReadError["DocumentNotFound"] = "DOCUMENT_NOT_FOUND";
|
|
@@ -33,7 +30,7 @@ exports.download = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
33
30
|
}
|
|
34
31
|
let stat;
|
|
35
32
|
try {
|
|
36
|
-
stat = await
|
|
33
|
+
stat = await fs.promises.stat(file.absolute_path);
|
|
37
34
|
}
|
|
38
35
|
catch (e) {
|
|
39
36
|
context.response.writeHead(404, {
|
|
@@ -60,7 +57,7 @@ exports.download = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
60
57
|
: ''}name=${encodeURI(file.name)}`,
|
|
61
58
|
});
|
|
62
59
|
}
|
|
63
|
-
return
|
|
60
|
+
return fs.createReadStream(file.absolute_path, {
|
|
64
61
|
start,
|
|
65
62
|
end,
|
|
66
63
|
});
|
|
@@ -73,5 +70,5 @@ exports.download = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
73
70
|
: ''}name=${encodeURI(file.name)}`,
|
|
74
71
|
});
|
|
75
72
|
}
|
|
76
|
-
return
|
|
73
|
+
return fs.createReadStream(file.absolute_path);
|
|
77
74
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { defineExposedFunction, ObjectId } from "@aeriajs/core";
|
|
3
3
|
import { left } from "@aeriajs/common";
|
|
4
|
-
import fs from "fs";
|
|
4
|
+
import * as fs from "fs";
|
|
5
5
|
export var FileReadError = /* @__PURE__ */ ((FileReadError2) => {
|
|
6
6
|
FileReadError2["DocumentNotFound"] = "DOCUMENT_NOT_FOUND";
|
|
7
7
|
FileReadError2["FileNotFound"] = "FILE_NOT_FOUND";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.remove = void 0;
|
|
7
4
|
const core_1 = require("@aeriajs/core");
|
|
8
|
-
const
|
|
5
|
+
const fs = require("fs/promises");
|
|
9
6
|
exports.remove = (0, core_1.defineExposedFunction)(async (payload, context) => {
|
|
10
7
|
const file = await context.collection.model.findOne({
|
|
11
8
|
_id: payload.filters._id,
|
|
@@ -18,7 +15,7 @@ exports.remove = (0, core_1.defineExposedFunction)(async (payload, context) => {
|
|
|
18
15
|
throw new Error('');
|
|
19
16
|
}
|
|
20
17
|
try {
|
|
21
|
-
await
|
|
18
|
+
await fs.unlink(file.absolute_path);
|
|
22
19
|
}
|
|
23
20
|
catch (err) {
|
|
24
21
|
console.trace(err);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { defineExposedFunction, remove as originalRemove } from "@aeriajs/core";
|
|
3
|
-
import fs from "fs/promises";
|
|
3
|
+
import * as fs from "fs/promises";
|
|
4
4
|
export const remove = defineExposedFunction(async (payload, context) => {
|
|
5
5
|
const file = await context.collection.model.findOne({
|
|
6
6
|
_id: payload.filters._id
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.removeAll = void 0;
|
|
7
4
|
const core_1 = require("@aeriajs/core");
|
|
8
|
-
const
|
|
5
|
+
const fs = require("fs/promises");
|
|
9
6
|
exports.removeAll = (0, core_1.defineExposedFunction)(async (payload, context) => {
|
|
10
7
|
const files = context.collection.model.find({
|
|
11
8
|
_id: {
|
|
@@ -19,7 +16,7 @@ exports.removeAll = (0, core_1.defineExposedFunction)(async (payload, context) =
|
|
|
19
16
|
let file;
|
|
20
17
|
while (file = await files.next()) {
|
|
21
18
|
try {
|
|
22
|
-
await
|
|
19
|
+
await fs.unlink(file.absolute_path);
|
|
23
20
|
}
|
|
24
21
|
catch (err) {
|
|
25
22
|
console.trace(err);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { defineExposedFunction, remove as originalRemoveAll } from "@aeriajs/core";
|
|
3
|
-
import fs from "fs/promises";
|
|
3
|
+
import * as fs from "fs/promises";
|
|
4
4
|
export const removeAll = defineExposedFunction(async (payload, context) => {
|
|
5
5
|
const files = context.collection.model.find({
|
|
6
6
|
_id: {
|
|
@@ -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>>;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.activate = exports.ActivationErrors = void 0;
|
|
7
4
|
const core_1 = require("@aeriajs/core");
|
|
8
5
|
const common_1 = require("@aeriajs/common");
|
|
9
|
-
const
|
|
6
|
+
const bcrypt = require("bcrypt");
|
|
10
7
|
var ActivationErrors;
|
|
11
8
|
(function (ActivationErrors) {
|
|
12
9
|
ActivationErrors["UserNotFound"] = "USER_NOT_FOUND";
|
|
@@ -31,7 +28,7 @@ exports.activate = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
31
28
|
if (user.active) {
|
|
32
29
|
return (0, common_1.left)(ActivationErrors.AlreadyActiveUser);
|
|
33
30
|
}
|
|
34
|
-
const equal = await
|
|
31
|
+
const equal = await bcrypt.compare(user._id.toString(), token);
|
|
35
32
|
if (!equal) {
|
|
36
33
|
return (0, common_1.left)(ActivationErrors.InvalidLink);
|
|
37
34
|
}
|
|
@@ -46,7 +43,7 @@ exports.activate = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
46
43
|
}, {
|
|
47
44
|
$set: {
|
|
48
45
|
active: true,
|
|
49
|
-
password: await
|
|
46
|
+
password: await bcrypt.hash(payload.password, 10),
|
|
50
47
|
},
|
|
51
48
|
});
|
|
52
49
|
return (0, common_1.right)(true);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { defineExposedFunction, ObjectId } from "@aeriajs/core";
|
|
3
3
|
import { left, right } from "@aeriajs/common";
|
|
4
|
-
import bcrypt from "bcrypt";
|
|
4
|
+
import * as bcrypt from "bcrypt";
|
|
5
5
|
export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
|
|
6
6
|
ActivationErrors2["UserNotFound"] = "USER_NOT_FOUND";
|
|
7
7
|
ActivationErrors2["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
|
|
@@ -1,3 +1,102 @@
|
|
|
1
1
|
import type { Context, Schema } from '@aeriajs/types';
|
|
2
2
|
import type { description } from './description.js';
|
|
3
|
-
export declare const createAccount: (payload: Omit<Schema<typeof description>, 'roles'>, context: Context<typeof description>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | import("@aeriajs/types").Right<
|
|
3
|
+
export declare const createAccount: (payload: Omit<Schema<typeof description>, 'roles'>, context: Context<typeof description>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | import("@aeriajs/types").Right<import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<{
|
|
4
|
+
readonly $id: "user";
|
|
5
|
+
readonly required: readonly ["name", "roles", "email"];
|
|
6
|
+
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
7
|
+
readonly indexes: readonly ["name"];
|
|
8
|
+
readonly freshItem: {
|
|
9
|
+
readonly active: true;
|
|
10
|
+
};
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly name: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
};
|
|
15
|
+
readonly given_name: {
|
|
16
|
+
readonly getter: (document: any) => string;
|
|
17
|
+
};
|
|
18
|
+
readonly family_name: {
|
|
19
|
+
readonly getter: (document: any) => string;
|
|
20
|
+
};
|
|
21
|
+
readonly active: {
|
|
22
|
+
readonly type: "boolean";
|
|
23
|
+
};
|
|
24
|
+
readonly roles: {
|
|
25
|
+
readonly type: "array";
|
|
26
|
+
readonly items: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
};
|
|
29
|
+
readonly uniqueItems: true;
|
|
30
|
+
};
|
|
31
|
+
readonly email: {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
readonly inputType: "email";
|
|
34
|
+
readonly unique: true;
|
|
35
|
+
};
|
|
36
|
+
readonly password: {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
readonly inputType: "password";
|
|
39
|
+
readonly hidden: true;
|
|
40
|
+
};
|
|
41
|
+
readonly phone_number: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly mask: "(##) #####-####";
|
|
44
|
+
};
|
|
45
|
+
readonly picture_file: {
|
|
46
|
+
readonly $ref: "file";
|
|
47
|
+
readonly accept: readonly ["image/*"];
|
|
48
|
+
};
|
|
49
|
+
readonly picture: {
|
|
50
|
+
readonly getter: (value: any) => any;
|
|
51
|
+
};
|
|
52
|
+
readonly group: {
|
|
53
|
+
readonly type: "string";
|
|
54
|
+
};
|
|
55
|
+
readonly self_registered: {
|
|
56
|
+
readonly type: "boolean";
|
|
57
|
+
readonly readOnly: true;
|
|
58
|
+
};
|
|
59
|
+
readonly updated_at: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
readonly format: "date-time";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly presets: readonly ["crud", "view", "duplicate"];
|
|
65
|
+
readonly layout: {
|
|
66
|
+
readonly name: "grid";
|
|
67
|
+
readonly options: {
|
|
68
|
+
readonly title: "name";
|
|
69
|
+
readonly badge: "roles";
|
|
70
|
+
readonly picture: "picture_file";
|
|
71
|
+
readonly information: "email";
|
|
72
|
+
readonly active: "active";
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
readonly individualActions: {
|
|
76
|
+
readonly 'ui:spawnEdit': {
|
|
77
|
+
readonly name: "action.edit";
|
|
78
|
+
readonly icon: "pencil";
|
|
79
|
+
readonly translate: true;
|
|
80
|
+
};
|
|
81
|
+
readonly 'route:/dashboard/user/changepass': {
|
|
82
|
+
readonly name: "change_password";
|
|
83
|
+
readonly icon: "key";
|
|
84
|
+
readonly fetchItem: true;
|
|
85
|
+
readonly translate: true;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
readonly icon: "users";
|
|
89
|
+
readonly filters: readonly ["name", "roles", "email", "phone_number"];
|
|
90
|
+
readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
|
|
91
|
+
readonly tableMeta: readonly ["email"];
|
|
92
|
+
readonly formLayout: {
|
|
93
|
+
readonly fields: {
|
|
94
|
+
readonly given_name: {
|
|
95
|
+
readonly span: 3;
|
|
96
|
+
};
|
|
97
|
+
readonly family_name: {
|
|
98
|
+
readonly span: 3;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}>>, "_id">>>>;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.createAccount = void 0;
|
|
7
4
|
const core_1 = require("@aeriajs/core");
|
|
8
5
|
const common_1 = require("@aeriajs/common");
|
|
9
6
|
const validation_1 = require("@aeriajs/validation");
|
|
10
|
-
const
|
|
7
|
+
const bcrypt = require("bcrypt");
|
|
11
8
|
exports.createAccount = (0, core_1.defineExposedFunction)(async (payload, context) => {
|
|
12
9
|
const user = Object.assign({}, payload);
|
|
13
10
|
if (!context.config.security.allowSignup) {
|
|
@@ -48,7 +45,7 @@ exports.createAccount = (0, core_1.defineExposedFunction)(async (payload, contex
|
|
|
48
45
|
Object.assign(user, context.config.security.signupDefaults);
|
|
49
46
|
}
|
|
50
47
|
if (user.password) {
|
|
51
|
-
user.password = await
|
|
48
|
+
user.password = await bcrypt.hash(user.password, 10);
|
|
52
49
|
}
|
|
53
50
|
if (!context.token.authenticated) {
|
|
54
51
|
Object.assign(user, {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { defineExposedFunction } from "@aeriajs/core";
|
|
3
3
|
import { isLeft, unwrapEither, left, right } from "@aeriajs/common";
|
|
4
4
|
import { validate } from "@aeriajs/validation";
|
|
5
|
-
import bcrypt from "bcrypt";
|
|
5
|
+
import * as bcrypt from "bcrypt";
|
|
6
6
|
export const createAccount = defineExposedFunction(async (payload, context) => {
|
|
7
7
|
const user = Object.assign({}, payload);
|
|
8
8
|
if (!context.config.security.allowSignup) {
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getActivationLink = void 0;
|
|
7
4
|
const entrypoint_1 = require("@aeriajs/entrypoint");
|
|
8
|
-
const
|
|
5
|
+
const bcrypt = require("bcrypt");
|
|
9
6
|
const getActivationLink = async (userId) => {
|
|
10
7
|
const config = await (0, entrypoint_1.getConfig)();
|
|
11
|
-
const activationToken = await
|
|
8
|
+
const activationToken = await bcrypt.hash(userId.toString(), 10);
|
|
12
9
|
const link = `${config.publicUrl}/user/activate?u=${userId.toString()}&t=${activationToken}`;
|
|
13
10
|
return link;
|
|
14
11
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { getConfig } from "@aeriajs/entrypoint";
|
|
3
|
-
import bcrypt from "bcrypt";
|
|
3
|
+
import * as bcrypt from "bcrypt";
|
|
4
4
|
export const getActivationLink = async (userId) => {
|
|
5
5
|
const config = await getConfig();
|
|
6
6
|
const activationToken = await bcrypt.hash(userId.toString(), 10);
|
|
@@ -9,6 +9,6 @@ export declare const getInfo: (payload: {
|
|
|
9
9
|
userId: string;
|
|
10
10
|
token: string;
|
|
11
11
|
}, context: Context<typeof description>) => Promise<import("@aeriajs/types").Left<ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<{
|
|
12
|
-
readonly name:
|
|
13
|
-
readonly email:
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly email: string;
|
|
14
14
|
}>>;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getInfo = exports.ActivationErrors = void 0;
|
|
7
4
|
const core_1 = require("@aeriajs/core");
|
|
8
5
|
const common_1 = require("@aeriajs/common");
|
|
9
|
-
const
|
|
6
|
+
const bcrypt = require("bcrypt");
|
|
10
7
|
var ActivationErrors;
|
|
11
8
|
(function (ActivationErrors) {
|
|
12
9
|
ActivationErrors["UserNotFound"] = "USER_NOT_FOUND";
|
|
@@ -27,7 +24,7 @@ exports.getInfo = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
27
24
|
if (user.active) {
|
|
28
25
|
return (0, common_1.left)(ActivationErrors.AlreadyActiveUser);
|
|
29
26
|
}
|
|
30
|
-
const equal = await
|
|
27
|
+
const equal = await bcrypt.compare(user._id.toString(), token);
|
|
31
28
|
if (!equal) {
|
|
32
29
|
return (0, common_1.left)(ActivationErrors.InvalidLink);
|
|
33
30
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { defineExposedFunction, ObjectId } from "@aeriajs/core";
|
|
3
3
|
import { left, right } from "@aeriajs/common";
|
|
4
|
-
import bcrypt from "bcrypt";
|
|
4
|
+
import * as bcrypt from "bcrypt";
|
|
5
5
|
export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
|
|
6
6
|
ActivationErrors2["UserNotFound"] = "USER_NOT_FOUND";
|
|
7
7
|
ActivationErrors2["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
|
|
@@ -612,8 +612,8 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
612
612
|
};
|
|
613
613
|
};
|
|
614
614
|
};
|
|
615
|
-
}>, "name" | "
|
|
616
|
-
_id:
|
|
615
|
+
}>, "name" | "active" | "roles" | "email"> & {
|
|
616
|
+
_id: import("@aeriajs/core").ObjectId | null;
|
|
617
617
|
};
|
|
618
618
|
token: import("@aeriajs/types").TokenRecipient;
|
|
619
619
|
} | {
|
|
@@ -730,7 +730,7 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
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";
|
|
@@ -838,14 +838,14 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
838
838
|
name: string;
|
|
839
839
|
password: string;
|
|
840
840
|
updated_at: Date;
|
|
841
|
+
active: boolean;
|
|
841
842
|
roles: string[];
|
|
842
843
|
email: string;
|
|
843
|
-
|
|
844
|
+
picture: any;
|
|
844
845
|
phone_number: string;
|
|
845
846
|
picture_file: never;
|
|
846
847
|
given_name: string;
|
|
847
848
|
family_name: string;
|
|
848
|
-
picture: any;
|
|
849
849
|
group: string;
|
|
850
850
|
}, "picture_file">, "name" | "roles" | "email"> & Partial<{
|
|
851
851
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
@@ -954,14 +954,14 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
954
954
|
name: string;
|
|
955
955
|
password: string;
|
|
956
956
|
updated_at: Date;
|
|
957
|
+
active: boolean;
|
|
957
958
|
roles: string[];
|
|
958
959
|
email: string;
|
|
959
|
-
|
|
960
|
+
picture: any;
|
|
960
961
|
phone_number: string;
|
|
961
962
|
picture_file: never;
|
|
962
963
|
given_name: string;
|
|
963
964
|
family_name: string;
|
|
964
|
-
picture: any;
|
|
965
965
|
group: string;
|
|
966
966
|
}, "picture_file">> & {
|
|
967
967
|
updated_at?: Date | undefined;
|
|
@@ -1065,7 +1065,106 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
1065
1065
|
};
|
|
1066
1066
|
};
|
|
1067
1067
|
};
|
|
1068
|
-
}>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | import("@aeriajs/types").Right<
|
|
1068
|
+
}>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | import("@aeriajs/types").Right<import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<{
|
|
1069
|
+
readonly $id: "user";
|
|
1070
|
+
readonly required: readonly ["name", "roles", "email"];
|
|
1071
|
+
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
1072
|
+
readonly indexes: readonly ["name"];
|
|
1073
|
+
readonly freshItem: {
|
|
1074
|
+
readonly active: true;
|
|
1075
|
+
};
|
|
1076
|
+
readonly properties: {
|
|
1077
|
+
readonly name: {
|
|
1078
|
+
readonly type: "string";
|
|
1079
|
+
};
|
|
1080
|
+
readonly given_name: {
|
|
1081
|
+
readonly getter: (document: any) => string;
|
|
1082
|
+
};
|
|
1083
|
+
readonly family_name: {
|
|
1084
|
+
readonly getter: (document: any) => string;
|
|
1085
|
+
};
|
|
1086
|
+
readonly active: {
|
|
1087
|
+
readonly type: "boolean";
|
|
1088
|
+
};
|
|
1089
|
+
readonly roles: {
|
|
1090
|
+
readonly type: "array";
|
|
1091
|
+
readonly items: {
|
|
1092
|
+
readonly type: "string";
|
|
1093
|
+
};
|
|
1094
|
+
readonly uniqueItems: true;
|
|
1095
|
+
};
|
|
1096
|
+
readonly email: {
|
|
1097
|
+
readonly type: "string";
|
|
1098
|
+
readonly inputType: "email";
|
|
1099
|
+
readonly unique: true;
|
|
1100
|
+
};
|
|
1101
|
+
readonly password: {
|
|
1102
|
+
readonly type: "string";
|
|
1103
|
+
readonly inputType: "password";
|
|
1104
|
+
readonly hidden: true;
|
|
1105
|
+
};
|
|
1106
|
+
readonly phone_number: {
|
|
1107
|
+
readonly type: "string";
|
|
1108
|
+
readonly mask: "(##) #####-####";
|
|
1109
|
+
};
|
|
1110
|
+
readonly picture_file: {
|
|
1111
|
+
readonly $ref: "file";
|
|
1112
|
+
readonly accept: readonly ["image/*"];
|
|
1113
|
+
};
|
|
1114
|
+
readonly picture: {
|
|
1115
|
+
readonly getter: (value: any) => any;
|
|
1116
|
+
};
|
|
1117
|
+
readonly group: {
|
|
1118
|
+
readonly type: "string";
|
|
1119
|
+
};
|
|
1120
|
+
readonly self_registered: {
|
|
1121
|
+
readonly type: "boolean";
|
|
1122
|
+
readonly readOnly: true;
|
|
1123
|
+
};
|
|
1124
|
+
readonly updated_at: {
|
|
1125
|
+
readonly type: "string";
|
|
1126
|
+
readonly format: "date-time";
|
|
1127
|
+
};
|
|
1128
|
+
};
|
|
1129
|
+
readonly presets: readonly ["crud", "view", "duplicate"];
|
|
1130
|
+
readonly layout: {
|
|
1131
|
+
readonly name: "grid";
|
|
1132
|
+
readonly options: {
|
|
1133
|
+
readonly title: "name";
|
|
1134
|
+
readonly badge: "roles";
|
|
1135
|
+
readonly picture: "picture_file";
|
|
1136
|
+
readonly information: "email";
|
|
1137
|
+
readonly active: "active";
|
|
1138
|
+
};
|
|
1139
|
+
};
|
|
1140
|
+
readonly individualActions: {
|
|
1141
|
+
readonly 'ui:spawnEdit': {
|
|
1142
|
+
readonly name: "action.edit";
|
|
1143
|
+
readonly icon: "pencil";
|
|
1144
|
+
readonly translate: true;
|
|
1145
|
+
};
|
|
1146
|
+
readonly 'route:/dashboard/user/changepass': {
|
|
1147
|
+
readonly name: "change_password";
|
|
1148
|
+
readonly icon: "key";
|
|
1149
|
+
readonly fetchItem: true;
|
|
1150
|
+
readonly translate: true;
|
|
1151
|
+
};
|
|
1152
|
+
};
|
|
1153
|
+
readonly icon: "users";
|
|
1154
|
+
readonly filters: readonly ["name", "roles", "email", "phone_number"];
|
|
1155
|
+
readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
|
|
1156
|
+
readonly tableMeta: readonly ["email"];
|
|
1157
|
+
readonly formLayout: {
|
|
1158
|
+
readonly fields: {
|
|
1159
|
+
readonly given_name: {
|
|
1160
|
+
readonly span: 3;
|
|
1161
|
+
};
|
|
1162
|
+
readonly family_name: {
|
|
1163
|
+
readonly span: 3;
|
|
1164
|
+
};
|
|
1165
|
+
};
|
|
1166
|
+
};
|
|
1167
|
+
}>>, "_id">>>>;
|
|
1069
1168
|
readonly getInfo: (payload: {
|
|
1070
1169
|
userId: string;
|
|
1071
1170
|
token: string;
|
|
@@ -1169,10 +1268,10 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
1169
1268
|
};
|
|
1170
1269
|
};
|
|
1171
1270
|
}>) => Promise<import("@aeriajs/types").Left<import("./getInfo.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./getInfo.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./getInfo.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<{
|
|
1172
|
-
readonly name:
|
|
1173
|
-
readonly email:
|
|
1271
|
+
readonly name: string;
|
|
1272
|
+
readonly email: string;
|
|
1174
1273
|
}>>;
|
|
1175
|
-
readonly getActivationLink: (userId: ObjectId) => Promise<string>;
|
|
1274
|
+
readonly getActivationLink: (userId: import("@aeriajs/core").ObjectId) => Promise<string>;
|
|
1176
1275
|
};
|
|
1177
1276
|
accessControl: {
|
|
1178
1277
|
roles: {
|
|
@@ -1898,8 +1997,8 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
1898
1997
|
};
|
|
1899
1998
|
};
|
|
1900
1999
|
};
|
|
1901
|
-
}>, "name" | "
|
|
1902
|
-
_id:
|
|
2000
|
+
}>, "name" | "active" | "roles" | "email"> & {
|
|
2001
|
+
_id: import("@aeriajs/core").ObjectId | null;
|
|
1903
2002
|
};
|
|
1904
2003
|
token: import("@aeriajs/types").TokenRecipient;
|
|
1905
2004
|
} | {
|
|
@@ -2016,7 +2115,7 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
2016
2115
|
};
|
|
2017
2116
|
};
|
|
2018
2117
|
};
|
|
2019
|
-
}>) => 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").
|
|
2118
|
+
}>) => 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>>;
|
|
2020
2119
|
readonly createAccount: (payload: Omit<Pick<{
|
|
2021
2120
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
2022
2121
|
readonly $id: "file";
|
|
@@ -2124,14 +2223,14 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
2124
2223
|
name: string;
|
|
2125
2224
|
password: string;
|
|
2126
2225
|
updated_at: Date;
|
|
2226
|
+
active: boolean;
|
|
2127
2227
|
roles: string[];
|
|
2128
2228
|
email: string;
|
|
2129
|
-
|
|
2229
|
+
picture: any;
|
|
2130
2230
|
phone_number: string;
|
|
2131
2231
|
picture_file: never;
|
|
2132
2232
|
given_name: string;
|
|
2133
2233
|
family_name: string;
|
|
2134
|
-
picture: any;
|
|
2135
2234
|
group: string;
|
|
2136
2235
|
}, "picture_file">, "name" | "roles" | "email"> & Partial<{
|
|
2137
2236
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
@@ -2240,14 +2339,14 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
2240
2339
|
name: string;
|
|
2241
2340
|
password: string;
|
|
2242
2341
|
updated_at: Date;
|
|
2342
|
+
active: boolean;
|
|
2243
2343
|
roles: string[];
|
|
2244
2344
|
email: string;
|
|
2245
|
-
|
|
2345
|
+
picture: any;
|
|
2246
2346
|
phone_number: string;
|
|
2247
2347
|
picture_file: never;
|
|
2248
2348
|
given_name: string;
|
|
2249
2349
|
family_name: string;
|
|
2250
|
-
picture: any;
|
|
2251
2350
|
group: string;
|
|
2252
2351
|
}, "picture_file">> & {
|
|
2253
2352
|
updated_at?: Date | undefined;
|
|
@@ -2351,7 +2450,106 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
2351
2450
|
};
|
|
2352
2451
|
};
|
|
2353
2452
|
};
|
|
2354
|
-
}>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | import("@aeriajs/types").Right<
|
|
2453
|
+
}>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | import("@aeriajs/types").Right<import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<{
|
|
2454
|
+
readonly $id: "user";
|
|
2455
|
+
readonly required: readonly ["name", "roles", "email"];
|
|
2456
|
+
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
2457
|
+
readonly indexes: readonly ["name"];
|
|
2458
|
+
readonly freshItem: {
|
|
2459
|
+
readonly active: true;
|
|
2460
|
+
};
|
|
2461
|
+
readonly properties: {
|
|
2462
|
+
readonly name: {
|
|
2463
|
+
readonly type: "string";
|
|
2464
|
+
};
|
|
2465
|
+
readonly given_name: {
|
|
2466
|
+
readonly getter: (document: any) => string;
|
|
2467
|
+
};
|
|
2468
|
+
readonly family_name: {
|
|
2469
|
+
readonly getter: (document: any) => string;
|
|
2470
|
+
};
|
|
2471
|
+
readonly active: {
|
|
2472
|
+
readonly type: "boolean";
|
|
2473
|
+
};
|
|
2474
|
+
readonly roles: {
|
|
2475
|
+
readonly type: "array";
|
|
2476
|
+
readonly items: {
|
|
2477
|
+
readonly type: "string";
|
|
2478
|
+
};
|
|
2479
|
+
readonly uniqueItems: true;
|
|
2480
|
+
};
|
|
2481
|
+
readonly email: {
|
|
2482
|
+
readonly type: "string";
|
|
2483
|
+
readonly inputType: "email";
|
|
2484
|
+
readonly unique: true;
|
|
2485
|
+
};
|
|
2486
|
+
readonly password: {
|
|
2487
|
+
readonly type: "string";
|
|
2488
|
+
readonly inputType: "password";
|
|
2489
|
+
readonly hidden: true;
|
|
2490
|
+
};
|
|
2491
|
+
readonly phone_number: {
|
|
2492
|
+
readonly type: "string";
|
|
2493
|
+
readonly mask: "(##) #####-####";
|
|
2494
|
+
};
|
|
2495
|
+
readonly picture_file: {
|
|
2496
|
+
readonly $ref: "file";
|
|
2497
|
+
readonly accept: readonly ["image/*"];
|
|
2498
|
+
};
|
|
2499
|
+
readonly picture: {
|
|
2500
|
+
readonly getter: (value: any) => any;
|
|
2501
|
+
};
|
|
2502
|
+
readonly group: {
|
|
2503
|
+
readonly type: "string";
|
|
2504
|
+
};
|
|
2505
|
+
readonly self_registered: {
|
|
2506
|
+
readonly type: "boolean";
|
|
2507
|
+
readonly readOnly: true;
|
|
2508
|
+
};
|
|
2509
|
+
readonly updated_at: {
|
|
2510
|
+
readonly type: "string";
|
|
2511
|
+
readonly format: "date-time";
|
|
2512
|
+
};
|
|
2513
|
+
};
|
|
2514
|
+
readonly presets: readonly ["crud", "view", "duplicate"];
|
|
2515
|
+
readonly layout: {
|
|
2516
|
+
readonly name: "grid";
|
|
2517
|
+
readonly options: {
|
|
2518
|
+
readonly title: "name";
|
|
2519
|
+
readonly badge: "roles";
|
|
2520
|
+
readonly picture: "picture_file";
|
|
2521
|
+
readonly information: "email";
|
|
2522
|
+
readonly active: "active";
|
|
2523
|
+
};
|
|
2524
|
+
};
|
|
2525
|
+
readonly individualActions: {
|
|
2526
|
+
readonly 'ui:spawnEdit': {
|
|
2527
|
+
readonly name: "action.edit";
|
|
2528
|
+
readonly icon: "pencil";
|
|
2529
|
+
readonly translate: true;
|
|
2530
|
+
};
|
|
2531
|
+
readonly 'route:/dashboard/user/changepass': {
|
|
2532
|
+
readonly name: "change_password";
|
|
2533
|
+
readonly icon: "key";
|
|
2534
|
+
readonly fetchItem: true;
|
|
2535
|
+
readonly translate: true;
|
|
2536
|
+
};
|
|
2537
|
+
};
|
|
2538
|
+
readonly icon: "users";
|
|
2539
|
+
readonly filters: readonly ["name", "roles", "email", "phone_number"];
|
|
2540
|
+
readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
|
|
2541
|
+
readonly tableMeta: readonly ["email"];
|
|
2542
|
+
readonly formLayout: {
|
|
2543
|
+
readonly fields: {
|
|
2544
|
+
readonly given_name: {
|
|
2545
|
+
readonly span: 3;
|
|
2546
|
+
};
|
|
2547
|
+
readonly family_name: {
|
|
2548
|
+
readonly span: 3;
|
|
2549
|
+
};
|
|
2550
|
+
};
|
|
2551
|
+
};
|
|
2552
|
+
}>>, "_id">>>>;
|
|
2355
2553
|
readonly getInfo: (payload: {
|
|
2356
2554
|
userId: string;
|
|
2357
2555
|
token: string;
|
|
@@ -2455,10 +2653,10 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
|
|
|
2455
2653
|
};
|
|
2456
2654
|
};
|
|
2457
2655
|
}>) => Promise<import("@aeriajs/types").Left<import("./getInfo.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./getInfo.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./getInfo.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<{
|
|
2458
|
-
readonly name:
|
|
2459
|
-
readonly email:
|
|
2656
|
+
readonly name: string;
|
|
2657
|
+
readonly email: string;
|
|
2460
2658
|
}>>;
|
|
2461
|
-
readonly getActivationLink: (userId: ObjectId) => Promise<string>;
|
|
2659
|
+
readonly getActivationLink: (userId: import("@aeriajs/core").ObjectId) => Promise<string>;
|
|
2462
2660
|
};
|
|
2463
2661
|
functionContracts: {
|
|
2464
2662
|
readonly get?: import("@aeriajs/types").Contract | undefined;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.insert = void 0;
|
|
7
|
-
const bcrypt_1 = __importDefault(require("bcrypt"));
|
|
8
4
|
const core_1 = require("@aeriajs/core");
|
|
5
|
+
const bcrypt = require("bcrypt");
|
|
9
6
|
const insert = async (payload, context) => {
|
|
10
7
|
if (payload.what.password) {
|
|
11
|
-
payload.what.password = await
|
|
8
|
+
payload.what.password = await bcrypt.hash(payload.what.password, 10);
|
|
12
9
|
}
|
|
13
10
|
return (0, core_1.insert)(payload, context);
|
|
14
11
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import bcrypt from "bcrypt";
|
|
3
2
|
import { defineFunctionAttributes, insert as originalInsert } from "@aeriajs/core";
|
|
3
|
+
import * as bcrypt from "bcrypt";
|
|
4
4
|
export const insert = async (payload, context) => {
|
|
5
5
|
if (payload.what.password) {
|
|
6
6
|
payload.what.password = await bcrypt.hash(payload.what.password, 10);
|
|
@@ -110,8 +110,8 @@ export declare const describe: (contextOrPayload: RouteContext | Payload) => Pro
|
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
112
|
};
|
|
113
|
-
}>, "name" | "
|
|
114
|
-
_id:
|
|
113
|
+
}>, "name" | "active" | "roles" | "email"> & {
|
|
114
|
+
_id: import("@aeriajs/core").ObjectId | null;
|
|
115
115
|
};
|
|
116
116
|
token: import("@aeriajs/types").TokenRecipient;
|
|
117
117
|
} | {
|
package/dist/index.d.ts
CHANGED
|
@@ -1797,8 +1797,8 @@ export declare const collections: {
|
|
|
1797
1797
|
};
|
|
1798
1798
|
};
|
|
1799
1799
|
};
|
|
1800
|
-
}>, "name" | "
|
|
1801
|
-
_id:
|
|
1800
|
+
}>, "name" | "active" | "roles" | "email"> & {
|
|
1801
|
+
_id: import("mongodb").ObjectId | null;
|
|
1802
1802
|
};
|
|
1803
1803
|
token: import("@aeriajs/types").TokenRecipient;
|
|
1804
1804
|
} | {
|
|
@@ -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";
|
|
@@ -2023,14 +2023,14 @@ export declare const collections: {
|
|
|
2023
2023
|
name: string;
|
|
2024
2024
|
password: string;
|
|
2025
2025
|
updated_at: Date;
|
|
2026
|
+
active: boolean;
|
|
2026
2027
|
roles: string[];
|
|
2027
2028
|
email: string;
|
|
2028
|
-
|
|
2029
|
+
picture: any;
|
|
2029
2030
|
phone_number: string;
|
|
2030
2031
|
picture_file: never;
|
|
2031
2032
|
given_name: string;
|
|
2032
2033
|
family_name: string;
|
|
2033
|
-
picture: any;
|
|
2034
2034
|
group: string;
|
|
2035
2035
|
}, "picture_file">, "name" | "roles" | "email"> & Partial<{
|
|
2036
2036
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
@@ -2139,14 +2139,14 @@ export declare const collections: {
|
|
|
2139
2139
|
name: string;
|
|
2140
2140
|
password: string;
|
|
2141
2141
|
updated_at: Date;
|
|
2142
|
+
active: boolean;
|
|
2142
2143
|
roles: string[];
|
|
2143
2144
|
email: string;
|
|
2144
|
-
|
|
2145
|
+
picture: any;
|
|
2145
2146
|
phone_number: string;
|
|
2146
2147
|
picture_file: never;
|
|
2147
2148
|
given_name: string;
|
|
2148
2149
|
family_name: string;
|
|
2149
|
-
picture: any;
|
|
2150
2150
|
group: string;
|
|
2151
2151
|
}, "picture_file">> & {
|
|
2152
2152
|
updated_at?: Date | undefined;
|
|
@@ -2250,7 +2250,106 @@ export declare const collections: {
|
|
|
2250
2250
|
};
|
|
2251
2251
|
};
|
|
2252
2252
|
};
|
|
2253
|
-
}>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | import("@aeriajs/types").Right<
|
|
2253
|
+
}>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | import("@aeriajs/types").Right<import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<{
|
|
2254
|
+
readonly $id: "user";
|
|
2255
|
+
readonly required: readonly ["name", "roles", "email"];
|
|
2256
|
+
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
2257
|
+
readonly indexes: readonly ["name"];
|
|
2258
|
+
readonly freshItem: {
|
|
2259
|
+
readonly active: true;
|
|
2260
|
+
};
|
|
2261
|
+
readonly properties: {
|
|
2262
|
+
readonly name: {
|
|
2263
|
+
readonly type: "string";
|
|
2264
|
+
};
|
|
2265
|
+
readonly given_name: {
|
|
2266
|
+
readonly getter: (document: any) => string;
|
|
2267
|
+
};
|
|
2268
|
+
readonly family_name: {
|
|
2269
|
+
readonly getter: (document: any) => string;
|
|
2270
|
+
};
|
|
2271
|
+
readonly active: {
|
|
2272
|
+
readonly type: "boolean";
|
|
2273
|
+
};
|
|
2274
|
+
readonly roles: {
|
|
2275
|
+
readonly type: "array";
|
|
2276
|
+
readonly items: {
|
|
2277
|
+
readonly type: "string";
|
|
2278
|
+
};
|
|
2279
|
+
readonly uniqueItems: true;
|
|
2280
|
+
};
|
|
2281
|
+
readonly email: {
|
|
2282
|
+
readonly type: "string";
|
|
2283
|
+
readonly inputType: "email";
|
|
2284
|
+
readonly unique: true;
|
|
2285
|
+
};
|
|
2286
|
+
readonly password: {
|
|
2287
|
+
readonly type: "string";
|
|
2288
|
+
readonly inputType: "password";
|
|
2289
|
+
readonly hidden: true;
|
|
2290
|
+
};
|
|
2291
|
+
readonly phone_number: {
|
|
2292
|
+
readonly type: "string";
|
|
2293
|
+
readonly mask: "(##) #####-####";
|
|
2294
|
+
};
|
|
2295
|
+
readonly picture_file: {
|
|
2296
|
+
readonly $ref: "file";
|
|
2297
|
+
readonly accept: readonly ["image/*"];
|
|
2298
|
+
};
|
|
2299
|
+
readonly picture: {
|
|
2300
|
+
readonly getter: (value: any) => any;
|
|
2301
|
+
};
|
|
2302
|
+
readonly group: {
|
|
2303
|
+
readonly type: "string";
|
|
2304
|
+
};
|
|
2305
|
+
readonly self_registered: {
|
|
2306
|
+
readonly type: "boolean";
|
|
2307
|
+
readonly readOnly: true;
|
|
2308
|
+
};
|
|
2309
|
+
readonly updated_at: {
|
|
2310
|
+
readonly type: "string";
|
|
2311
|
+
readonly format: "date-time";
|
|
2312
|
+
};
|
|
2313
|
+
};
|
|
2314
|
+
readonly presets: readonly ["crud", "view", "duplicate"];
|
|
2315
|
+
readonly layout: {
|
|
2316
|
+
readonly name: "grid";
|
|
2317
|
+
readonly options: {
|
|
2318
|
+
readonly title: "name";
|
|
2319
|
+
readonly badge: "roles";
|
|
2320
|
+
readonly picture: "picture_file";
|
|
2321
|
+
readonly information: "email";
|
|
2322
|
+
readonly active: "active";
|
|
2323
|
+
};
|
|
2324
|
+
};
|
|
2325
|
+
readonly individualActions: {
|
|
2326
|
+
readonly 'ui:spawnEdit': {
|
|
2327
|
+
readonly name: "action.edit";
|
|
2328
|
+
readonly icon: "pencil";
|
|
2329
|
+
readonly translate: true;
|
|
2330
|
+
};
|
|
2331
|
+
readonly 'route:/dashboard/user/changepass': {
|
|
2332
|
+
readonly name: "change_password";
|
|
2333
|
+
readonly icon: "key";
|
|
2334
|
+
readonly fetchItem: true;
|
|
2335
|
+
readonly translate: true;
|
|
2336
|
+
};
|
|
2337
|
+
};
|
|
2338
|
+
readonly icon: "users";
|
|
2339
|
+
readonly filters: readonly ["name", "roles", "email", "phone_number"];
|
|
2340
|
+
readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
|
|
2341
|
+
readonly tableMeta: readonly ["email"];
|
|
2342
|
+
readonly formLayout: {
|
|
2343
|
+
readonly fields: {
|
|
2344
|
+
readonly given_name: {
|
|
2345
|
+
readonly span: 3;
|
|
2346
|
+
};
|
|
2347
|
+
readonly family_name: {
|
|
2348
|
+
readonly span: 3;
|
|
2349
|
+
};
|
|
2350
|
+
};
|
|
2351
|
+
};
|
|
2352
|
+
}>>, "_id">>>>;
|
|
2254
2353
|
readonly getInfo: (payload: {
|
|
2255
2354
|
userId: string;
|
|
2256
2355
|
token: string;
|
|
@@ -2354,10 +2453,10 @@ export declare const collections: {
|
|
|
2354
2453
|
};
|
|
2355
2454
|
};
|
|
2356
2455
|
}>) => Promise<import("@aeriajs/types").Left<import("./collections/user/getInfo.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./collections/user/getInfo.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./collections/user/getInfo.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<{
|
|
2357
|
-
readonly name:
|
|
2358
|
-
readonly email:
|
|
2456
|
+
readonly name: string;
|
|
2457
|
+
readonly email: string;
|
|
2359
2458
|
}>>;
|
|
2360
|
-
readonly getActivationLink: (userId: ObjectId) => Promise<string>;
|
|
2459
|
+
readonly getActivationLink: (userId: import("mongodb").ObjectId) => Promise<string>;
|
|
2361
2460
|
};
|
|
2362
2461
|
accessControl: {
|
|
2363
2462
|
roles: {
|
|
@@ -3083,8 +3182,8 @@ export declare const collections: {
|
|
|
3083
3182
|
};
|
|
3084
3183
|
};
|
|
3085
3184
|
};
|
|
3086
|
-
}>, "name" | "
|
|
3087
|
-
_id:
|
|
3185
|
+
}>, "name" | "active" | "roles" | "email"> & {
|
|
3186
|
+
_id: import("mongodb").ObjectId | null;
|
|
3088
3187
|
};
|
|
3089
3188
|
token: import("@aeriajs/types").TokenRecipient;
|
|
3090
3189
|
} | {
|
|
@@ -3201,7 +3300,7 @@ export declare const collections: {
|
|
|
3201
3300
|
};
|
|
3202
3301
|
};
|
|
3203
3302
|
};
|
|
3204
|
-
}>) => 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").
|
|
3303
|
+
}>) => 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>>;
|
|
3205
3304
|
readonly createAccount: (payload: Omit<Pick<{
|
|
3206
3305
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
3207
3306
|
readonly $id: "file";
|
|
@@ -3309,14 +3408,14 @@ export declare const collections: {
|
|
|
3309
3408
|
name: string;
|
|
3310
3409
|
password: string;
|
|
3311
3410
|
updated_at: Date;
|
|
3411
|
+
active: boolean;
|
|
3312
3412
|
roles: string[];
|
|
3313
3413
|
email: string;
|
|
3314
|
-
|
|
3414
|
+
picture: any;
|
|
3315
3415
|
phone_number: string;
|
|
3316
3416
|
picture_file: never;
|
|
3317
3417
|
given_name: string;
|
|
3318
3418
|
family_name: string;
|
|
3319
|
-
picture: any;
|
|
3320
3419
|
group: string;
|
|
3321
3420
|
}, "picture_file">, "name" | "roles" | "email"> & Partial<{
|
|
3322
3421
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
@@ -3425,14 +3524,14 @@ export declare const collections: {
|
|
|
3425
3524
|
name: string;
|
|
3426
3525
|
password: string;
|
|
3427
3526
|
updated_at: Date;
|
|
3527
|
+
active: boolean;
|
|
3428
3528
|
roles: string[];
|
|
3429
3529
|
email: string;
|
|
3430
|
-
|
|
3530
|
+
picture: any;
|
|
3431
3531
|
phone_number: string;
|
|
3432
3532
|
picture_file: never;
|
|
3433
3533
|
given_name: string;
|
|
3434
3534
|
family_name: string;
|
|
3435
|
-
picture: any;
|
|
3436
3535
|
group: string;
|
|
3437
3536
|
}, "picture_file">> & {
|
|
3438
3537
|
updated_at?: Date | undefined;
|
|
@@ -3536,7 +3635,106 @@ export declare const collections: {
|
|
|
3536
3635
|
};
|
|
3537
3636
|
};
|
|
3538
3637
|
};
|
|
3539
|
-
}>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | import("@aeriajs/types").Right<
|
|
3638
|
+
}>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | import("@aeriajs/types").Right<import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<{
|
|
3639
|
+
readonly $id: "user";
|
|
3640
|
+
readonly required: readonly ["name", "roles", "email"];
|
|
3641
|
+
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
3642
|
+
readonly indexes: readonly ["name"];
|
|
3643
|
+
readonly freshItem: {
|
|
3644
|
+
readonly active: true;
|
|
3645
|
+
};
|
|
3646
|
+
readonly properties: {
|
|
3647
|
+
readonly name: {
|
|
3648
|
+
readonly type: "string";
|
|
3649
|
+
};
|
|
3650
|
+
readonly given_name: {
|
|
3651
|
+
readonly getter: (document: any) => string;
|
|
3652
|
+
};
|
|
3653
|
+
readonly family_name: {
|
|
3654
|
+
readonly getter: (document: any) => string;
|
|
3655
|
+
};
|
|
3656
|
+
readonly active: {
|
|
3657
|
+
readonly type: "boolean";
|
|
3658
|
+
};
|
|
3659
|
+
readonly roles: {
|
|
3660
|
+
readonly type: "array";
|
|
3661
|
+
readonly items: {
|
|
3662
|
+
readonly type: "string";
|
|
3663
|
+
};
|
|
3664
|
+
readonly uniqueItems: true;
|
|
3665
|
+
};
|
|
3666
|
+
readonly email: {
|
|
3667
|
+
readonly type: "string";
|
|
3668
|
+
readonly inputType: "email";
|
|
3669
|
+
readonly unique: true;
|
|
3670
|
+
};
|
|
3671
|
+
readonly password: {
|
|
3672
|
+
readonly type: "string";
|
|
3673
|
+
readonly inputType: "password";
|
|
3674
|
+
readonly hidden: true;
|
|
3675
|
+
};
|
|
3676
|
+
readonly phone_number: {
|
|
3677
|
+
readonly type: "string";
|
|
3678
|
+
readonly mask: "(##) #####-####";
|
|
3679
|
+
};
|
|
3680
|
+
readonly picture_file: {
|
|
3681
|
+
readonly $ref: "file";
|
|
3682
|
+
readonly accept: readonly ["image/*"];
|
|
3683
|
+
};
|
|
3684
|
+
readonly picture: {
|
|
3685
|
+
readonly getter: (value: any) => any;
|
|
3686
|
+
};
|
|
3687
|
+
readonly group: {
|
|
3688
|
+
readonly type: "string";
|
|
3689
|
+
};
|
|
3690
|
+
readonly self_registered: {
|
|
3691
|
+
readonly type: "boolean";
|
|
3692
|
+
readonly readOnly: true;
|
|
3693
|
+
};
|
|
3694
|
+
readonly updated_at: {
|
|
3695
|
+
readonly type: "string";
|
|
3696
|
+
readonly format: "date-time";
|
|
3697
|
+
};
|
|
3698
|
+
};
|
|
3699
|
+
readonly presets: readonly ["crud", "view", "duplicate"];
|
|
3700
|
+
readonly layout: {
|
|
3701
|
+
readonly name: "grid";
|
|
3702
|
+
readonly options: {
|
|
3703
|
+
readonly title: "name";
|
|
3704
|
+
readonly badge: "roles";
|
|
3705
|
+
readonly picture: "picture_file";
|
|
3706
|
+
readonly information: "email";
|
|
3707
|
+
readonly active: "active";
|
|
3708
|
+
};
|
|
3709
|
+
};
|
|
3710
|
+
readonly individualActions: {
|
|
3711
|
+
readonly 'ui:spawnEdit': {
|
|
3712
|
+
readonly name: "action.edit";
|
|
3713
|
+
readonly icon: "pencil";
|
|
3714
|
+
readonly translate: true;
|
|
3715
|
+
};
|
|
3716
|
+
readonly 'route:/dashboard/user/changepass': {
|
|
3717
|
+
readonly name: "change_password";
|
|
3718
|
+
readonly icon: "key";
|
|
3719
|
+
readonly fetchItem: true;
|
|
3720
|
+
readonly translate: true;
|
|
3721
|
+
};
|
|
3722
|
+
};
|
|
3723
|
+
readonly icon: "users";
|
|
3724
|
+
readonly filters: readonly ["name", "roles", "email", "phone_number"];
|
|
3725
|
+
readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
|
|
3726
|
+
readonly tableMeta: readonly ["email"];
|
|
3727
|
+
readonly formLayout: {
|
|
3728
|
+
readonly fields: {
|
|
3729
|
+
readonly given_name: {
|
|
3730
|
+
readonly span: 3;
|
|
3731
|
+
};
|
|
3732
|
+
readonly family_name: {
|
|
3733
|
+
readonly span: 3;
|
|
3734
|
+
};
|
|
3735
|
+
};
|
|
3736
|
+
};
|
|
3737
|
+
}>>, "_id">>>>;
|
|
3540
3738
|
readonly getInfo: (payload: {
|
|
3541
3739
|
userId: string;
|
|
3542
3740
|
token: string;
|
|
@@ -3640,10 +3838,10 @@ export declare const collections: {
|
|
|
3640
3838
|
};
|
|
3641
3839
|
};
|
|
3642
3840
|
}>) => Promise<import("@aeriajs/types").Left<import("./collections/user/getInfo.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./collections/user/getInfo.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./collections/user/getInfo.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<{
|
|
3643
|
-
readonly name:
|
|
3644
|
-
readonly email:
|
|
3841
|
+
readonly name: string;
|
|
3842
|
+
readonly email: string;
|
|
3645
3843
|
}>>;
|
|
3646
|
-
readonly getActivationLink: (userId: ObjectId) => Promise<string>;
|
|
3844
|
+
readonly getActivationLink: (userId: import("mongodb").ObjectId) => Promise<string>;
|
|
3647
3845
|
};
|
|
3648
3846
|
functionContracts: {
|
|
3649
3847
|
readonly get?: import("@aeriajs/types").Contract | undefined;
|
package/dist/index.js
CHANGED
|
@@ -10,25 +10,13 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
15
|
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
17
|
exports.collections = exports.systemFunctions = void 0;
|
|
30
18
|
__exportStar(require("./collections/index.js"), exports);
|
|
31
|
-
exports.systemFunctions =
|
|
19
|
+
exports.systemFunctions = require("./functions/index.js");
|
|
32
20
|
const index_js_1 = require("./collections/index.js");
|
|
33
21
|
exports.collections = {
|
|
34
22
|
file: index_js_1.file,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/builtins",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"description": "## Installation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"mongodb": "^6.5.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@aeriajs/access-control": "^0.0.
|
|
50
|
-
"@aeriajs/core": "^0.0.
|
|
51
|
-
"@aeriajs/common": "^0.0.
|
|
52
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
53
|
-
"@aeriajs/types": "^0.0.
|
|
54
|
-
"@aeriajs/validation": "^0.0.
|
|
49
|
+
"@aeriajs/access-control": "^0.0.41",
|
|
50
|
+
"@aeriajs/core": "^0.0.74",
|
|
51
|
+
"@aeriajs/common": "^0.0.41",
|
|
52
|
+
"@aeriajs/entrypoint": "^0.0.41",
|
|
53
|
+
"@aeriajs/types": "^0.0.38",
|
|
54
|
+
"@aeriajs/validation": "^0.0.44"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"test": "echo skipping",
|