@aeriajs/builtins 0.0.89 → 0.0.91
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAccount = void 0;
|
|
4
|
+
const types_1 = require("@aeriajs/types");
|
|
4
5
|
const common_1 = require("@aeriajs/common");
|
|
5
6
|
const validation_1 = require("@aeriajs/validation");
|
|
6
7
|
const bcrypt = require("bcrypt");
|
|
@@ -38,7 +39,10 @@ const createAccount = async (payload, context) => {
|
|
|
38
39
|
],
|
|
39
40
|
});
|
|
40
41
|
if ((0, common_1.isLeft)(validationEither)) {
|
|
41
|
-
return
|
|
42
|
+
return context.error(types_1.HTTPStatus.BadRequest, {
|
|
43
|
+
code: types_1.ACError.MalformedInput,
|
|
44
|
+
details: (0, common_1.unwrapEither)(validationEither),
|
|
45
|
+
});
|
|
42
46
|
}
|
|
43
47
|
if (context.config.security.signupDefaults) {
|
|
44
48
|
Object.assign(user, context.config.security.signupDefaults);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { HTTPStatus, ACError } from "@aeriajs/types";
|
|
3
|
+
import { isLeft, unwrapEither } from "@aeriajs/common";
|
|
3
4
|
import { validate } from "@aeriajs/validation";
|
|
4
5
|
import * as bcrypt from "bcrypt";
|
|
5
6
|
export const createAccount = async (payload, context) => {
|
|
@@ -36,7 +37,10 @@ export const createAccount = async (payload, context) => {
|
|
|
36
37
|
]
|
|
37
38
|
});
|
|
38
39
|
if (isLeft(validationEither)) {
|
|
39
|
-
return
|
|
40
|
+
return context.error(HTTPStatus.BadRequest, {
|
|
41
|
+
code: ACError.MalformedInput,
|
|
42
|
+
details: unwrapEither(validationEither)
|
|
43
|
+
});
|
|
40
44
|
}
|
|
41
45
|
if (context.config.security.signupDefaults) {
|
|
42
46
|
Object.assign(user, context.config.security.signupDefaults);
|
|
@@ -103,7 +103,12 @@ export declare const user: {
|
|
|
103
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
104
|
readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<any>[]>;
|
|
105
105
|
readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
106
|
-
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").
|
|
106
|
+
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
107
|
+
readonly code: import("@aeriajs/types").ACError.MalformedInput;
|
|
108
|
+
readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
|
|
109
|
+
} & {
|
|
110
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
|
|
111
|
+
}> | {
|
|
107
112
|
tempId: any;
|
|
108
113
|
}>;
|
|
109
114
|
readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
@@ -1622,7 +1627,12 @@ export declare const user: {
|
|
|
1622
1627
|
readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<any>;
|
|
1623
1628
|
readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<any>[]>;
|
|
1624
1629
|
readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
1625
|
-
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").
|
|
1630
|
+
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
1631
|
+
readonly code: import("@aeriajs/types").ACError.MalformedInput;
|
|
1632
|
+
readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
|
|
1633
|
+
} & {
|
|
1634
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
|
|
1635
|
+
}> | {
|
|
1626
1636
|
tempId: any;
|
|
1627
1637
|
}>;
|
|
1628
1638
|
readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
@@ -6,127 +6,11 @@ type Payload = {
|
|
|
6
6
|
revalidate?: boolean;
|
|
7
7
|
router?: boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare const describe: (contextOrPayload: RouteContext | Payload) => Promise<import("@aeriajs/types").GenericResponse | (
|
|
10
|
-
user: Pick<import("@aeriajs/types").SchemaWithId<{
|
|
11
|
-
readonly $id: "user";
|
|
12
|
-
readonly required: readonly ["name", "roles", "email"];
|
|
13
|
-
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
14
|
-
readonly indexes: readonly ["name"];
|
|
15
|
-
readonly freshItem: {
|
|
16
|
-
readonly active: true;
|
|
17
|
-
};
|
|
18
|
-
readonly properties: {
|
|
19
|
-
readonly name: {
|
|
20
|
-
readonly type: "string";
|
|
21
|
-
};
|
|
22
|
-
readonly given_name: {
|
|
23
|
-
readonly getter: (document: any) => string;
|
|
24
|
-
};
|
|
25
|
-
readonly family_name: {
|
|
26
|
-
readonly getter: (document: any) => string;
|
|
27
|
-
};
|
|
28
|
-
readonly active: {
|
|
29
|
-
readonly type: "boolean";
|
|
30
|
-
};
|
|
31
|
-
readonly roles: {
|
|
32
|
-
readonly type: "array";
|
|
33
|
-
readonly items: {
|
|
34
|
-
readonly type: "string";
|
|
35
|
-
};
|
|
36
|
-
readonly uniqueItems: true;
|
|
37
|
-
};
|
|
38
|
-
readonly email: {
|
|
39
|
-
readonly type: "string";
|
|
40
|
-
readonly inputType: "email";
|
|
41
|
-
readonly unique: true;
|
|
42
|
-
};
|
|
43
|
-
readonly password: {
|
|
44
|
-
readonly type: "string";
|
|
45
|
-
readonly inputType: "password";
|
|
46
|
-
readonly hidden: true;
|
|
47
|
-
};
|
|
48
|
-
readonly phone_number: {
|
|
49
|
-
readonly type: "string";
|
|
50
|
-
readonly mask: "(##) #####-####";
|
|
51
|
-
};
|
|
52
|
-
readonly picture_file: {
|
|
53
|
-
readonly $ref: "file";
|
|
54
|
-
readonly accept: readonly ["image/*"];
|
|
55
|
-
};
|
|
56
|
-
readonly picture: {
|
|
57
|
-
readonly getter: (value: any) => any;
|
|
58
|
-
};
|
|
59
|
-
readonly group: {
|
|
60
|
-
readonly type: "string";
|
|
61
|
-
};
|
|
62
|
-
readonly self_registered: {
|
|
63
|
-
readonly type: "boolean";
|
|
64
|
-
readonly readOnly: true;
|
|
65
|
-
};
|
|
66
|
-
readonly updated_at: {
|
|
67
|
-
readonly type: "string";
|
|
68
|
-
readonly format: "date-time";
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
readonly presets: readonly ["crud", "view", "duplicate"];
|
|
72
|
-
readonly layout: {
|
|
73
|
-
readonly name: "grid";
|
|
74
|
-
readonly options: {
|
|
75
|
-
readonly title: "name";
|
|
76
|
-
readonly badge: "roles";
|
|
77
|
-
readonly picture: "picture_file";
|
|
78
|
-
readonly information: "email";
|
|
79
|
-
readonly active: "active";
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
readonly individualActions: {
|
|
83
|
-
readonly 'ui:spawnEdit': {
|
|
84
|
-
readonly label: "action.edit";
|
|
85
|
-
readonly icon: "pencil";
|
|
86
|
-
readonly translate: true;
|
|
87
|
-
};
|
|
88
|
-
readonly 'route:/dashboard/user/changepass': {
|
|
89
|
-
readonly label: "change_password";
|
|
90
|
-
readonly icon: "key";
|
|
91
|
-
readonly fetchItem: true;
|
|
92
|
-
readonly translate: true;
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
readonly icon: "users";
|
|
96
|
-
readonly filters: readonly ["name", "roles", "email", "phone_number"];
|
|
97
|
-
readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
|
|
98
|
-
readonly tableMeta: readonly ["email"];
|
|
99
|
-
readonly formLayout: {
|
|
100
|
-
readonly fields: {
|
|
101
|
-
readonly given_name: {
|
|
102
|
-
readonly span: 3;
|
|
103
|
-
};
|
|
104
|
-
readonly family_name: {
|
|
105
|
-
readonly span: 3;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
}>, "name" | "roles" | "email" | "active"> & {
|
|
110
|
-
_id: import("@aeriajs/core").ObjectId | null;
|
|
111
|
-
};
|
|
112
|
-
token: import("@aeriajs/types").TokenRecipient;
|
|
113
|
-
} | import("@aeriajs/types").EndpointError<{
|
|
9
|
+
export declare const describe: (contextOrPayload: RouteContext | Payload) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").EndpointError<{
|
|
114
10
|
readonly code: import("@aeriajs/types").ACError.AuthorizationError;
|
|
115
11
|
} & {
|
|
116
12
|
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
117
|
-
}> | {
|
|
118
|
-
user: {
|
|
119
|
-
_id: null;
|
|
120
|
-
name: string;
|
|
121
|
-
email: string;
|
|
122
|
-
roles: string[];
|
|
123
|
-
active: boolean;
|
|
124
|
-
};
|
|
125
|
-
token: {
|
|
126
|
-
type: string;
|
|
127
|
-
content: string;
|
|
128
|
-
};
|
|
129
|
-
} | import("@aeriajs/types").EndpointError<{
|
|
13
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
130
14
|
readonly code: import("../collections/user/authenticate.js").AuthenticationError.InvalidCredentials;
|
|
131
15
|
} & {
|
|
132
16
|
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
@@ -134,7 +18,7 @@ export declare const describe: (contextOrPayload: RouteContext | Payload) => Pro
|
|
|
134
18
|
readonly code: import("../collections/user/authenticate.js").AuthenticationError.InactiveUser;
|
|
135
19
|
} & {
|
|
136
20
|
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
137
|
-
}>
|
|
21
|
+
}> | {
|
|
138
22
|
descriptions: Record<string, Description>;
|
|
139
23
|
roles?: string[] | undefined;
|
|
140
24
|
auth?: undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1308,7 +1308,12 @@ export declare const collections: {
|
|
|
1308
1308
|
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>;
|
|
1309
1309
|
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>[]>;
|
|
1310
1310
|
readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
1311
|
-
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").
|
|
1311
|
+
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
1312
|
+
readonly code: import("@aeriajs/types").ACError.MalformedInput;
|
|
1313
|
+
readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
|
|
1314
|
+
} & {
|
|
1315
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
|
|
1316
|
+
}> | {
|
|
1312
1317
|
tempId: any;
|
|
1313
1318
|
}>;
|
|
1314
1319
|
readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
@@ -2827,7 +2832,12 @@ export declare const collections: {
|
|
|
2827
2832
|
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>;
|
|
2828
2833
|
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>[]>;
|
|
2829
2834
|
readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
2830
|
-
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").
|
|
2835
|
+
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
2836
|
+
readonly code: import("@aeriajs/types").ACError.MalformedInput;
|
|
2837
|
+
readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
|
|
2838
|
+
} & {
|
|
2839
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
|
|
2840
|
+
}> | {
|
|
2831
2841
|
tempId: any;
|
|
2832
2842
|
}>;
|
|
2833
2843
|
readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/builtins",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.91",
|
|
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.91",
|
|
49
|
+
"@aeriajs/common": "^0.0.57",
|
|
50
|
+
"@aeriajs/entrypoint": "^0.0.57",
|
|
51
|
+
"@aeriajs/types": "^0.0.54",
|
|
52
|
+
"@aeriajs/validation": "^0.0.60"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"test": "echo skipping",
|