@aeriajs/builtins 0.0.163 → 0.0.165

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.
@@ -4,9 +4,9 @@ exports.description = void 0;
4
4
  const mongodb_1 = require("mongodb");
5
5
  const core_1 = require("@aeriajs/core");
6
6
  const entrypoint_1 = require("@aeriajs/entrypoint");
7
- const link = async (_id) => {
7
+ const link = async (fileId) => {
8
8
  const config = await (0, entrypoint_1.getConfig)();
9
- return `${config.publicUrl || ''}/file/${_id}`;
9
+ return `${config.publicUrl || ''}/file/${fileId}`;
10
10
  };
11
11
  const timestamp = (lastModified) => lastModified instanceof Date
12
12
  ? new Date(lastModified).getTime()
@@ -2,9 +2,9 @@
2
2
  import { ObjectId } from "mongodb";
3
3
  import { defineDescription } from "@aeriajs/core";
4
4
  import { getConfig } from "@aeriajs/entrypoint";
5
- const link = async (_id) => {
5
+ const link = async (fileId) => {
6
6
  const config = await getConfig();
7
- return `${config.publicUrl || ""}/file/${_id}`;
7
+ return `${config.publicUrl || ""}/file/${fileId}`;
8
8
  };
9
9
  const timestamp = (lastModified) => lastModified instanceof Date ? new Date(lastModified).getTime() : "fresh";
10
10
  export const description = defineDescription({
@@ -1,13 +1,115 @@
1
1
  import type { Context, SchemaWithId } from '@aeriajs/types';
2
2
  import type { description } from './description.js';
3
- import { Result, HTTPStatus, ACError } from '@aeriajs/types';
4
- export declare const createAccount: (payload: Partial<SchemaWithId<typeof description>>, context: Context<typeof description>) => Promise<Result.Error<{
3
+ import { HTTPStatus, ACError } from '@aeriajs/types';
4
+ export declare enum CreateAccountError {
5
+ SignupDisallowed = "SIGNUP_DISALLOWED"
6
+ }
7
+ export declare const createAccount: (payload: Partial<SchemaWithId<typeof description>>, context: Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
8
+ readonly code: CreateAccountError;
9
+ } & {
10
+ httpStatus: HTTPStatus.Forbidden;
11
+ }> | import("@aeriajs/types").Result.Error<{
5
12
  readonly code: ACError.MalformedInput;
6
- readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
13
+ readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
7
14
  } & {
8
15
  httpStatus: HTTPStatus.BadRequest;
9
- }> | {
10
- readonly _tag: "Result";
11
- readonly error: undefined;
12
- readonly result: any;
13
- }>;
16
+ }> | import("@aeriajs/types").InsertReturnType<SchemaWithId<{
17
+ readonly $id: "user";
18
+ readonly icon: "users";
19
+ readonly required: readonly ["name", "roles", "email"];
20
+ readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
21
+ readonly indexes: readonly ["name"];
22
+ readonly properties: {
23
+ readonly name: {
24
+ readonly type: "string";
25
+ };
26
+ readonly given_name: {
27
+ readonly getter: (doc: object) => string | undefined;
28
+ };
29
+ readonly family_name: {
30
+ readonly getter: (doc: object) => string | undefined;
31
+ };
32
+ readonly active: {
33
+ readonly type: "boolean";
34
+ };
35
+ readonly roles: {
36
+ readonly type: "array";
37
+ readonly items: {
38
+ readonly type: "string";
39
+ };
40
+ readonly uniqueItems: true;
41
+ };
42
+ readonly email: {
43
+ readonly type: "string";
44
+ readonly inputType: "email";
45
+ readonly unique: true;
46
+ };
47
+ readonly password: {
48
+ readonly type: "string";
49
+ readonly inputType: "password";
50
+ readonly hidden: true;
51
+ };
52
+ readonly phone_number: {
53
+ readonly type: "string";
54
+ readonly mask: "(##) #####-####";
55
+ };
56
+ readonly picture_file: {
57
+ readonly $ref: "file";
58
+ readonly accept: readonly ["image/*"];
59
+ };
60
+ readonly picture: {
61
+ readonly getter: (doc: object) => string | undefined;
62
+ };
63
+ readonly group: {
64
+ readonly type: "string";
65
+ };
66
+ readonly self_registered: {
67
+ readonly type: "boolean";
68
+ readonly readOnly: true;
69
+ };
70
+ readonly updated_at: {
71
+ readonly type: "string";
72
+ readonly format: "date-time";
73
+ };
74
+ };
75
+ readonly presets: readonly ["crud", "duplicate"];
76
+ readonly layout: {
77
+ readonly name: "grid";
78
+ readonly options: {
79
+ readonly title: "name";
80
+ readonly badge: "roles";
81
+ readonly picture: "picture_file";
82
+ readonly information: "email";
83
+ readonly active: "active";
84
+ };
85
+ };
86
+ readonly individualActions: {
87
+ readonly changePassword: {
88
+ readonly label: "change_password";
89
+ readonly icon: "key";
90
+ readonly translate: true;
91
+ readonly route: {
92
+ readonly name: "/dashboard/user/changepass";
93
+ readonly fetchItem: true;
94
+ };
95
+ };
96
+ readonly copyActivationLink: {
97
+ readonly label: "copy_activation_link";
98
+ readonly icon: "link";
99
+ readonly translate: true;
100
+ };
101
+ };
102
+ readonly filters: readonly ["name", "roles", "email", "phone_number"];
103
+ readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
104
+ readonly tableMeta: readonly ["email"];
105
+ readonly formLayout: {
106
+ readonly fields: {
107
+ readonly given_name: {
108
+ readonly span: 3;
109
+ };
110
+ readonly family_name: {
111
+ readonly span: 3;
112
+ };
113
+ };
114
+ };
115
+ }>>>;
@@ -1,13 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAccount = void 0;
3
+ exports.createAccount = exports.CreateAccountError = void 0;
4
4
  const types_1 = require("@aeriajs/types");
5
5
  const validation_1 = require("@aeriajs/validation");
6
6
  const bcrypt = require("bcrypt");
7
+ var CreateAccountError;
8
+ (function (CreateAccountError) {
9
+ CreateAccountError["SignupDisallowed"] = "SIGNUP_DISALLOWED";
10
+ })(CreateAccountError || (exports.CreateAccountError = CreateAccountError = {}));
7
11
  const createAccount = async (payload, context) => {
8
12
  const userCandidate = Object.assign({}, payload);
9
13
  if (!context.config.security.allowSignup) {
10
- throw new Error('signup disallowed');
14
+ return context.error(types_1.HTTPStatus.Forbidden, {
15
+ code: CreateAccountError.SignupDisallowed,
16
+ });
11
17
  }
12
18
  delete userCandidate._id;
13
19
  delete userCandidate.roles;
@@ -40,8 +46,9 @@ const createAccount = async (payload, context) => {
40
46
  details: error,
41
47
  });
42
48
  }
49
+ let roles = [], defaults = {};
43
50
  if (context.config.security.signupDefaults) {
44
- Object.assign(user, context.config.security.signupDefaults);
51
+ ({ roles = [], ...defaults } = context.config.security.signupDefaults);
45
52
  }
46
53
  if (user.password) {
47
54
  user.password = await bcrypt.hash(user.password, 10);
@@ -51,13 +58,12 @@ const createAccount = async (payload, context) => {
51
58
  self_registered: true,
52
59
  });
53
60
  }
54
- const { insertedId } = await context.collection.model.insertOne(user);
55
- const newUser = await context.collection.model.findOne({
56
- _id: insertedId,
61
+ return context.collections.user.functions.insert({
62
+ what: {
63
+ ...user,
64
+ ...defaults,
65
+ roles,
66
+ },
57
67
  });
58
- if (!newUser) {
59
- throw new Error();
60
- }
61
- return types_1.Result.result(newUser);
62
68
  };
63
69
  exports.createAccount = createAccount;
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
- import { Result, HTTPStatus, ACError } from "@aeriajs/types";
2
+ import { HTTPStatus, ACError } from "@aeriajs/types";
3
3
  import { validate } from "@aeriajs/validation";
4
4
  import * as bcrypt from "bcrypt";
5
+ export var CreateAccountError = /* @__PURE__ */ ((CreateAccountError2) => {
6
+ CreateAccountError2["SignupDisallowed"] = "SIGNUP_DISALLOWED";
7
+ return CreateAccountError2;
8
+ })(CreateAccountError || {});
5
9
  export const createAccount = async (payload, context) => {
6
10
  const userCandidate = Object.assign({}, payload);
7
11
  if (!context.config.security.allowSignup) {
8
- throw new Error("signup disallowed");
12
+ return context.error(HTTPStatus.Forbidden, {
13
+ code: "SIGNUP_DISALLOWED" /* SignupDisallowed */
14
+ });
9
15
  }
10
16
  delete userCandidate._id;
11
17
  delete userCandidate.roles;
@@ -38,8 +44,9 @@ export const createAccount = async (payload, context) => {
38
44
  details: error
39
45
  });
40
46
  }
47
+ let roles = [], defaults = {};
41
48
  if (context.config.security.signupDefaults) {
42
- Object.assign(user, context.config.security.signupDefaults);
49
+ ({ roles = [], ...defaults } = context.config.security.signupDefaults);
43
50
  }
44
51
  if (user.password) {
45
52
  user.password = await bcrypt.hash(user.password, 10);
@@ -49,12 +56,11 @@ export const createAccount = async (payload, context) => {
49
56
  self_registered: true
50
57
  });
51
58
  }
52
- const { insertedId } = await context.collection.model.insertOne(user);
53
- const newUser = await context.collection.model.findOne({
54
- _id: insertedId
59
+ return context.collections.user.functions.insert({
60
+ what: {
61
+ ...user,
62
+ ...defaults,
63
+ roles
64
+ }
55
65
  });
56
- if (!newUser) {
57
- throw new Error();
58
- }
59
- return Result.result(newUser);
60
66
  };
@@ -101,9 +101,9 @@ export declare const user: {
101
101
  };
102
102
  };
103
103
  functions: {
104
- readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
105
- readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<import("@aeriajs/types").Result.Either<any, any>>;
106
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
104
+ get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
105
+ getAll: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>> | undefined, context: TContext, options?: import("@aeriajs/core").GetAllOptions) => Promise<import("@aeriajs/types").Result.Either<any, any>>;
106
+ remove: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
107
107
  readonly _tag: "Result";
108
108
  readonly error: undefined;
109
109
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
@@ -116,7 +116,7 @@ export declare const user: {
116
116
  } & {
117
117
  httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
118
118
  }>>;
119
- readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
119
+ upload: <TContext extends import("@aeriajs/types").Context>(_props: unknown, context: TContext) => Promise<import("@aeriajs/types").Result.Error<{
120
120
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
121
121
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
122
122
  } & {
@@ -128,7 +128,7 @@ export declare const user: {
128
128
  readonly tempId: any;
129
129
  };
130
130
  }>;
131
- readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
131
+ removeFile: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemoveFilePayload, context: TContext, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
132
132
  readonly _tag: "Result";
133
133
  readonly error: undefined;
134
134
  readonly result: any;
@@ -137,8 +137,8 @@ export declare const user: {
137
137
  } & {
138
138
  httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
139
139
  }>>;
140
- readonly insert: (payload: NoInfer<import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>>, context: import("@aeriajs/types").Context<any>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
141
- readonly authenticate: (props: {
140
+ insert: <TDescription extends import("@aeriajs/types").Description, TInsertPayload extends import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TDescription>>>(payload: NoInfer<TInsertPayload>, context: import("@aeriajs/types").Context<TDescription>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<TDescription>>>;
141
+ authenticate: (props: {
142
142
  email: string;
143
143
  password: string;
144
144
  } | {
@@ -177,7 +177,7 @@ export declare const user: {
177
177
  } & {
178
178
  httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
179
179
  }>>;
180
- readonly activate: (payload: {
180
+ activate: (payload: {
181
181
  password: string;
182
182
  }, context: import("@aeriajs/types").Context<typeof description> & {
183
183
  request: {
@@ -212,17 +212,116 @@ export declare const user: {
212
212
  readonly userId: any;
213
213
  };
214
214
  } | undefined>;
215
- readonly createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof description>>, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
215
+ createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof description>>, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
216
+ readonly code: import("./createAccount.js").CreateAccountError;
217
+ } & {
218
+ httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
219
+ }> | import("@aeriajs/types").Result.Error<{
216
220
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
217
- readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
221
+ readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
218
222
  } & {
219
223
  httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
220
- }> | {
221
- readonly _tag: "Result";
222
- readonly error: undefined;
223
- readonly result: any;
224
- }>;
225
- readonly getInfo: (payload: {
224
+ }> | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
225
+ readonly $id: "user";
226
+ readonly icon: "users";
227
+ readonly required: readonly ["name", "roles", "email"];
228
+ readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
229
+ readonly indexes: readonly ["name"];
230
+ readonly properties: {
231
+ readonly name: {
232
+ readonly type: "string";
233
+ };
234
+ readonly given_name: {
235
+ readonly getter: (doc: object) => string | undefined;
236
+ };
237
+ readonly family_name: {
238
+ readonly getter: (doc: object) => string | undefined;
239
+ };
240
+ readonly active: {
241
+ readonly type: "boolean";
242
+ };
243
+ readonly roles: {
244
+ readonly type: "array";
245
+ readonly items: {
246
+ readonly type: "string";
247
+ };
248
+ readonly uniqueItems: true;
249
+ };
250
+ readonly email: {
251
+ readonly type: "string";
252
+ readonly inputType: "email";
253
+ readonly unique: true;
254
+ };
255
+ readonly password: {
256
+ readonly type: "string";
257
+ readonly inputType: "password";
258
+ readonly hidden: true;
259
+ };
260
+ readonly phone_number: {
261
+ readonly type: "string";
262
+ readonly mask: "(##) #####-####";
263
+ };
264
+ readonly picture_file: {
265
+ readonly $ref: "file";
266
+ readonly accept: readonly ["image/*"];
267
+ };
268
+ readonly picture: {
269
+ readonly getter: (doc: object) => string | undefined;
270
+ };
271
+ readonly group: {
272
+ readonly type: "string";
273
+ };
274
+ readonly self_registered: {
275
+ readonly type: "boolean";
276
+ readonly readOnly: true;
277
+ };
278
+ readonly updated_at: {
279
+ readonly type: "string";
280
+ readonly format: "date-time";
281
+ };
282
+ };
283
+ readonly presets: readonly ["crud", "duplicate"];
284
+ readonly layout: {
285
+ readonly name: "grid";
286
+ readonly options: {
287
+ readonly title: "name";
288
+ readonly badge: "roles";
289
+ readonly picture: "picture_file";
290
+ readonly information: "email";
291
+ readonly active: "active";
292
+ };
293
+ };
294
+ readonly individualActions: {
295
+ readonly changePassword: {
296
+ readonly label: "change_password";
297
+ readonly icon: "key";
298
+ readonly translate: true;
299
+ readonly route: {
300
+ readonly name: "/dashboard/user/changepass";
301
+ readonly fetchItem: true;
302
+ };
303
+ };
304
+ readonly copyActivationLink: {
305
+ readonly label: "copy_activation_link";
306
+ readonly icon: "link";
307
+ readonly translate: true;
308
+ };
309
+ };
310
+ readonly filters: readonly ["name", "roles", "email", "phone_number"];
311
+ readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
312
+ readonly tableMeta: readonly ["email"];
313
+ readonly formLayout: {
314
+ readonly fields: {
315
+ readonly given_name: {
316
+ readonly span: 3;
317
+ };
318
+ readonly family_name: {
319
+ readonly span: 3;
320
+ };
321
+ };
322
+ };
323
+ }>>>;
324
+ getInfo: (payload: {
226
325
  userId: string;
227
326
  token: string;
228
327
  }, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
@@ -245,7 +344,7 @@ export declare const user: {
245
344
  readonly email: any;
246
345
  };
247
346
  }>;
248
- readonly getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
347
+ getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
249
348
  readonly _tag: "Result";
250
349
  readonly error: undefined;
251
350
  readonly result: import("@aeriajs/types").SchemaWithId<{
@@ -349,7 +448,7 @@ export declare const user: {
349
448
  };
350
449
  }>;
351
450
  }>;
352
- readonly getActivationLink: (payload: {
451
+ getActivationLink: (payload: {
353
452
  userId: import("@aeriajs/core").ObjectId | string;
354
453
  }, context: import("@aeriajs/types").Context) => Promise<{
355
454
  readonly _tag: "Error";
@@ -577,9 +676,9 @@ export declare const user: {
577
676
  };
578
677
  };
579
678
  functions: {
580
- readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
581
- readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<import("@aeriajs/types").Result.Either<any, any>>;
582
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
679
+ get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
680
+ getAll: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>> | undefined, context: TContext, options?: import("@aeriajs/core").GetAllOptions) => Promise<import("@aeriajs/types").Result.Either<any, any>>;
681
+ remove: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
583
682
  readonly _tag: "Result";
584
683
  readonly error: undefined;
585
684
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
@@ -592,7 +691,7 @@ export declare const user: {
592
691
  } & {
593
692
  httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
594
693
  }>>;
595
- readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
694
+ upload: <TContext extends import("@aeriajs/types").Context>(_props: unknown, context: TContext) => Promise<import("@aeriajs/types").Result.Error<{
596
695
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
597
696
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
598
697
  } & {
@@ -604,7 +703,7 @@ export declare const user: {
604
703
  readonly tempId: any;
605
704
  };
606
705
  }>;
607
- readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
706
+ removeFile: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemoveFilePayload, context: TContext, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
608
707
  readonly _tag: "Result";
609
708
  readonly error: undefined;
610
709
  readonly result: any;
@@ -613,8 +712,8 @@ export declare const user: {
613
712
  } & {
614
713
  httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
615
714
  }>>;
616
- readonly insert: (payload: NoInfer<import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>>, context: import("@aeriajs/types").Context<any>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
617
- readonly authenticate: (props: {
715
+ insert: <TDescription extends import("@aeriajs/types").Description, TInsertPayload extends import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TDescription>>>(payload: NoInfer<TInsertPayload>, context: import("@aeriajs/types").Context<TDescription>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<TDescription>>>;
716
+ authenticate: (props: {
618
717
  email: string;
619
718
  password: string;
620
719
  } | {
@@ -653,7 +752,7 @@ export declare const user: {
653
752
  } & {
654
753
  httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
655
754
  }>>;
656
- readonly activate: (payload: {
755
+ activate: (payload: {
657
756
  password: string;
658
757
  }, context: import("@aeriajs/types").Context<typeof description> & {
659
758
  request: {
@@ -688,17 +787,116 @@ export declare const user: {
688
787
  readonly userId: any;
689
788
  };
690
789
  } | undefined>;
691
- readonly createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof description>>, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
790
+ createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof description>>, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
791
+ readonly code: import("./createAccount.js").CreateAccountError;
792
+ } & {
793
+ httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
794
+ }> | import("@aeriajs/types").Result.Error<{
692
795
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
693
- readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
796
+ readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
694
797
  } & {
695
798
  httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
696
- }> | {
697
- readonly _tag: "Result";
698
- readonly error: undefined;
699
- readonly result: any;
700
- }>;
701
- readonly getInfo: (payload: {
799
+ }> | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
800
+ readonly $id: "user";
801
+ readonly icon: "users";
802
+ readonly required: readonly ["name", "roles", "email"];
803
+ readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
804
+ readonly indexes: readonly ["name"];
805
+ readonly properties: {
806
+ readonly name: {
807
+ readonly type: "string";
808
+ };
809
+ readonly given_name: {
810
+ readonly getter: (doc: object) => string | undefined;
811
+ };
812
+ readonly family_name: {
813
+ readonly getter: (doc: object) => string | undefined;
814
+ };
815
+ readonly active: {
816
+ readonly type: "boolean";
817
+ };
818
+ readonly roles: {
819
+ readonly type: "array";
820
+ readonly items: {
821
+ readonly type: "string";
822
+ };
823
+ readonly uniqueItems: true;
824
+ };
825
+ readonly email: {
826
+ readonly type: "string";
827
+ readonly inputType: "email";
828
+ readonly unique: true;
829
+ };
830
+ readonly password: {
831
+ readonly type: "string";
832
+ readonly inputType: "password";
833
+ readonly hidden: true;
834
+ };
835
+ readonly phone_number: {
836
+ readonly type: "string";
837
+ readonly mask: "(##) #####-####";
838
+ };
839
+ readonly picture_file: {
840
+ readonly $ref: "file";
841
+ readonly accept: readonly ["image/*"];
842
+ };
843
+ readonly picture: {
844
+ readonly getter: (doc: object) => string | undefined;
845
+ };
846
+ readonly group: {
847
+ readonly type: "string";
848
+ };
849
+ readonly self_registered: {
850
+ readonly type: "boolean";
851
+ readonly readOnly: true;
852
+ };
853
+ readonly updated_at: {
854
+ readonly type: "string";
855
+ readonly format: "date-time";
856
+ };
857
+ };
858
+ readonly presets: readonly ["crud", "duplicate"];
859
+ readonly layout: {
860
+ readonly name: "grid";
861
+ readonly options: {
862
+ readonly title: "name";
863
+ readonly badge: "roles";
864
+ readonly picture: "picture_file";
865
+ readonly information: "email";
866
+ readonly active: "active";
867
+ };
868
+ };
869
+ readonly individualActions: {
870
+ readonly changePassword: {
871
+ readonly label: "change_password";
872
+ readonly icon: "key";
873
+ readonly translate: true;
874
+ readonly route: {
875
+ readonly name: "/dashboard/user/changepass";
876
+ readonly fetchItem: true;
877
+ };
878
+ };
879
+ readonly copyActivationLink: {
880
+ readonly label: "copy_activation_link";
881
+ readonly icon: "link";
882
+ readonly translate: true;
883
+ };
884
+ };
885
+ readonly filters: readonly ["name", "roles", "email", "phone_number"];
886
+ readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
887
+ readonly tableMeta: readonly ["email"];
888
+ readonly formLayout: {
889
+ readonly fields: {
890
+ readonly given_name: {
891
+ readonly span: 3;
892
+ };
893
+ readonly family_name: {
894
+ readonly span: 3;
895
+ };
896
+ };
897
+ };
898
+ }>>>;
899
+ getInfo: (payload: {
702
900
  userId: string;
703
901
  token: string;
704
902
  }, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
@@ -721,7 +919,7 @@ export declare const user: {
721
919
  readonly email: any;
722
920
  };
723
921
  }>;
724
- readonly getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
922
+ getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
725
923
  readonly _tag: "Result";
726
924
  readonly error: undefined;
727
925
  readonly result: import("@aeriajs/types").SchemaWithId<{
@@ -825,7 +1023,7 @@ export declare const user: {
825
1023
  };
826
1024
  }>;
827
1025
  }>;
828
- readonly getActivationLink: (payload: {
1026
+ getActivationLink: (payload: {
829
1027
  userId: import("@aeriajs/core").ObjectId | string;
830
1028
  }, context: import("@aeriajs/types").Context) => Promise<{
831
1029
  readonly _tag: "Error";
@@ -10,6 +10,20 @@ const createAccount_js_1 = require("./createAccount.js");
10
10
  const getInfo_js_1 = require("./getInfo.js");
11
11
  const getCurrentUser_js_1 = require("./getCurrentUser.js");
12
12
  const getActivationLink_js_1 = require("./getActivationLink.js");
13
+ const functions = {
14
+ get: core_1.get,
15
+ getAll: core_1.getAll,
16
+ remove: core_1.remove,
17
+ upload: core_1.upload,
18
+ removeFile: core_1.removeFile,
19
+ insert: insert_js_1.insert,
20
+ authenticate: authenticate_js_1.authenticate,
21
+ activate: activate_js_1.activate,
22
+ createAccount: createAccount_js_1.createAccount,
23
+ getInfo: getInfo_js_1.getInfo,
24
+ getCurrentUser: getCurrentUser_js_1.getCurrentUser,
25
+ getActivationLink: getActivationLink_js_1.getActivationLink,
26
+ };
13
27
  const exposedFunctions = {
14
28
  get: true,
15
29
  getAll: ['root'],
@@ -26,20 +40,7 @@ const exposedFunctions = {
26
40
  };
27
41
  exports.user = (0, core_1.defineCollection)({
28
42
  description: description_js_1.description,
29
- functions: {
30
- get: core_1.get,
31
- getAll: core_1.getAll,
32
- remove: core_1.remove,
33
- upload: core_1.upload,
34
- removeFile: core_1.removeFile,
35
- insert: insert_js_1.insert,
36
- authenticate: authenticate_js_1.authenticate,
37
- activate: activate_js_1.activate,
38
- createAccount: createAccount_js_1.createAccount,
39
- getInfo: getInfo_js_1.getInfo,
40
- getCurrentUser: getCurrentUser_js_1.getCurrentUser,
41
- getActivationLink: getActivationLink_js_1.getActivationLink,
42
- },
43
+ functions,
43
44
  contracts: {
44
45
  getCurrentUser: {
45
46
  response: {
@@ -8,6 +8,20 @@ import { createAccount } from "./createAccount.mjs";
8
8
  import { getInfo } from "./getInfo.mjs";
9
9
  import { getCurrentUser } from "./getCurrentUser.mjs";
10
10
  import { getActivationLink } from "./getActivationLink.mjs";
11
+ const functions = {
12
+ get,
13
+ getAll,
14
+ remove,
15
+ upload,
16
+ removeFile,
17
+ insert,
18
+ authenticate,
19
+ activate,
20
+ createAccount,
21
+ getInfo,
22
+ getCurrentUser,
23
+ getActivationLink
24
+ };
11
25
  const exposedFunctions = {
12
26
  get: true,
13
27
  getAll: ["root"],
@@ -24,20 +38,7 @@ const exposedFunctions = {
24
38
  };
25
39
  export const user = defineCollection({
26
40
  description,
27
- functions: {
28
- get,
29
- getAll,
30
- remove,
31
- upload,
32
- removeFile,
33
- insert,
34
- authenticate,
35
- activate,
36
- createAccount,
37
- getInfo,
38
- getCurrentUser,
39
- getActivationLink
40
- },
41
+ functions,
41
42
  contracts: {
42
43
  getCurrentUser: {
43
44
  response: {
@@ -56,7 +56,7 @@ export declare const describe: (contextOrPayload: RouteContext | typeof Payload)
56
56
  readonly _tag: "Error";
57
57
  readonly error: {
58
58
  readonly code: ACError.MalformedInput;
59
- readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
59
+ readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
60
60
  };
61
61
  readonly result: undefined;
62
62
  } | {
package/dist/index.d.ts CHANGED
@@ -780,9 +780,9 @@ export declare const collections: {
780
780
  };
781
781
  };
782
782
  functions: {
783
- readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
784
- readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<import("@aeriajs/types").Result.Either<any, any>>;
785
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
783
+ get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
784
+ getAll: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>> | undefined, context: TContext, options?: import("@aeriajs/core").GetAllOptions) => Promise<import("@aeriajs/types").Result.Either<any, any>>;
785
+ remove: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
786
786
  readonly _tag: "Result";
787
787
  readonly error: undefined;
788
788
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
@@ -795,7 +795,7 @@ export declare const collections: {
795
795
  } & {
796
796
  httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
797
797
  }>>;
798
- readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
798
+ upload: <TContext extends import("@aeriajs/types").Context>(_props: unknown, context: TContext) => Promise<import("@aeriajs/types").Result.Error<{
799
799
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
800
800
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
801
801
  } & {
@@ -807,7 +807,7 @@ export declare const collections: {
807
807
  readonly tempId: any;
808
808
  };
809
809
  }>;
810
- readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
810
+ removeFile: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemoveFilePayload, context: TContext, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
811
811
  readonly _tag: "Result";
812
812
  readonly error: undefined;
813
813
  readonly result: any;
@@ -816,8 +816,8 @@ export declare const collections: {
816
816
  } & {
817
817
  httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
818
818
  }>>;
819
- readonly insert: (payload: NoInfer<import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>>, context: import("@aeriajs/types").Context<any>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
820
- readonly authenticate: (props: {
819
+ insert: <TDescription extends import("@aeriajs/types").Description, TInsertPayload extends import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TDescription>>>(payload: NoInfer<TInsertPayload>, context: import("@aeriajs/types").Context<TDescription>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<TDescription>>>;
820
+ authenticate: (props: {
821
821
  email: string;
822
822
  password: string;
823
823
  } | {
@@ -856,7 +856,7 @@ export declare const collections: {
856
856
  } & {
857
857
  httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
858
858
  }>>;
859
- readonly activate: (payload: {
859
+ activate: (payload: {
860
860
  password: string;
861
861
  }, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description> & {
862
862
  request: {
@@ -891,17 +891,116 @@ export declare const collections: {
891
891
  readonly userId: any;
892
892
  };
893
893
  } | undefined>;
894
- readonly createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof import("./collections/user/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
894
+ createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof import("./collections/user/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
895
+ readonly code: import("./collections/user/createAccount.js").CreateAccountError;
896
+ } & {
897
+ httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
898
+ }> | import("@aeriajs/types").Result.Error<{
895
899
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
896
- readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
900
+ readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
897
901
  } & {
898
902
  httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
899
- }> | {
900
- readonly _tag: "Result";
901
- readonly error: undefined;
902
- readonly result: any;
903
- }>;
904
- readonly getInfo: (payload: {
903
+ }> | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
904
+ readonly $id: "user";
905
+ readonly icon: "users";
906
+ readonly required: readonly ["name", "roles", "email"];
907
+ readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
908
+ readonly indexes: readonly ["name"];
909
+ readonly properties: {
910
+ readonly name: {
911
+ readonly type: "string";
912
+ };
913
+ readonly given_name: {
914
+ readonly getter: (doc: object) => string | undefined;
915
+ };
916
+ readonly family_name: {
917
+ readonly getter: (doc: object) => string | undefined;
918
+ };
919
+ readonly active: {
920
+ readonly type: "boolean";
921
+ };
922
+ readonly roles: {
923
+ readonly type: "array";
924
+ readonly items: {
925
+ readonly type: "string";
926
+ };
927
+ readonly uniqueItems: true;
928
+ };
929
+ readonly email: {
930
+ readonly type: "string";
931
+ readonly inputType: "email";
932
+ readonly unique: true;
933
+ };
934
+ readonly password: {
935
+ readonly type: "string";
936
+ readonly inputType: "password";
937
+ readonly hidden: true;
938
+ };
939
+ readonly phone_number: {
940
+ readonly type: "string";
941
+ readonly mask: "(##) #####-####";
942
+ };
943
+ readonly picture_file: {
944
+ readonly $ref: "file";
945
+ readonly accept: readonly ["image/*"];
946
+ };
947
+ readonly picture: {
948
+ readonly getter: (doc: object) => string | undefined;
949
+ };
950
+ readonly group: {
951
+ readonly type: "string";
952
+ };
953
+ readonly self_registered: {
954
+ readonly type: "boolean";
955
+ readonly readOnly: true;
956
+ };
957
+ readonly updated_at: {
958
+ readonly type: "string";
959
+ readonly format: "date-time";
960
+ };
961
+ };
962
+ readonly presets: readonly ["crud", "duplicate"];
963
+ readonly layout: {
964
+ readonly name: "grid";
965
+ readonly options: {
966
+ readonly title: "name";
967
+ readonly badge: "roles";
968
+ readonly picture: "picture_file";
969
+ readonly information: "email";
970
+ readonly active: "active";
971
+ };
972
+ };
973
+ readonly individualActions: {
974
+ readonly changePassword: {
975
+ readonly label: "change_password";
976
+ readonly icon: "key";
977
+ readonly translate: true;
978
+ readonly route: {
979
+ readonly name: "/dashboard/user/changepass";
980
+ readonly fetchItem: true;
981
+ };
982
+ };
983
+ readonly copyActivationLink: {
984
+ readonly label: "copy_activation_link";
985
+ readonly icon: "link";
986
+ readonly translate: true;
987
+ };
988
+ };
989
+ readonly filters: readonly ["name", "roles", "email", "phone_number"];
990
+ readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
991
+ readonly tableMeta: readonly ["email"];
992
+ readonly formLayout: {
993
+ readonly fields: {
994
+ readonly given_name: {
995
+ readonly span: 3;
996
+ };
997
+ readonly family_name: {
998
+ readonly span: 3;
999
+ };
1000
+ };
1001
+ };
1002
+ }>>>;
1003
+ getInfo: (payload: {
905
1004
  userId: string;
906
1005
  token: string;
907
1006
  }, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
@@ -924,7 +1023,7 @@ export declare const collections: {
924
1023
  readonly email: any;
925
1024
  };
926
1025
  }>;
927
- readonly getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<{
1026
+ getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<{
928
1027
  readonly _tag: "Result";
929
1028
  readonly error: undefined;
930
1029
  readonly result: import("@aeriajs/types").SchemaWithId<{
@@ -1028,7 +1127,7 @@ export declare const collections: {
1028
1127
  };
1029
1128
  }>;
1030
1129
  }>;
1031
- readonly getActivationLink: (payload: {
1130
+ getActivationLink: (payload: {
1032
1131
  userId: import("mongodb").ObjectId | string;
1033
1132
  }, context: import("@aeriajs/types").Context) => Promise<{
1034
1133
  readonly _tag: "Error";
@@ -1256,9 +1355,9 @@ export declare const collections: {
1256
1355
  };
1257
1356
  };
1258
1357
  functions: {
1259
- readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
1260
- readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<import("@aeriajs/types").Result.Either<any, any>>;
1261
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
1358
+ get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
1359
+ getAll: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>> | undefined, context: TContext, options?: import("@aeriajs/core").GetAllOptions) => Promise<import("@aeriajs/types").Result.Either<any, any>>;
1360
+ remove: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
1262
1361
  readonly _tag: "Result";
1263
1362
  readonly error: undefined;
1264
1363
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
@@ -1271,7 +1370,7 @@ export declare const collections: {
1271
1370
  } & {
1272
1371
  httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1273
1372
  }>>;
1274
- readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
1373
+ upload: <TContext extends import("@aeriajs/types").Context>(_props: unknown, context: TContext) => Promise<import("@aeriajs/types").Result.Error<{
1275
1374
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
1276
1375
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
1277
1376
  } & {
@@ -1283,7 +1382,7 @@ export declare const collections: {
1283
1382
  readonly tempId: any;
1284
1383
  };
1285
1384
  }>;
1286
- readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
1385
+ removeFile: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemoveFilePayload, context: TContext, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
1287
1386
  readonly _tag: "Result";
1288
1387
  readonly error: undefined;
1289
1388
  readonly result: any;
@@ -1292,8 +1391,8 @@ export declare const collections: {
1292
1391
  } & {
1293
1392
  httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1294
1393
  }>>;
1295
- readonly insert: (payload: NoInfer<import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>>, context: import("@aeriajs/types").Context<any>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
1296
- readonly authenticate: (props: {
1394
+ insert: <TDescription extends import("@aeriajs/types").Description, TInsertPayload extends import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TDescription>>>(payload: NoInfer<TInsertPayload>, context: import("@aeriajs/types").Context<TDescription>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<TDescription>>>;
1395
+ authenticate: (props: {
1297
1396
  email: string;
1298
1397
  password: string;
1299
1398
  } | {
@@ -1332,7 +1431,7 @@ export declare const collections: {
1332
1431
  } & {
1333
1432
  httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
1334
1433
  }>>;
1335
- readonly activate: (payload: {
1434
+ activate: (payload: {
1336
1435
  password: string;
1337
1436
  }, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description> & {
1338
1437
  request: {
@@ -1367,17 +1466,116 @@ export declare const collections: {
1367
1466
  readonly userId: any;
1368
1467
  };
1369
1468
  } | undefined>;
1370
- readonly createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof import("./collections/user/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
1469
+ createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof import("./collections/user/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
1470
+ readonly code: import("./collections/user/createAccount.js").CreateAccountError;
1471
+ } & {
1472
+ httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1473
+ }> | import("@aeriajs/types").Result.Error<{
1371
1474
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
1372
- readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
1475
+ readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
1373
1476
  } & {
1374
1477
  httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
1375
- }> | {
1376
- readonly _tag: "Result";
1377
- readonly error: undefined;
1378
- readonly result: any;
1379
- }>;
1380
- readonly getInfo: (payload: {
1478
+ }> | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
1479
+ readonly $id: "user";
1480
+ readonly icon: "users";
1481
+ readonly required: readonly ["name", "roles", "email"];
1482
+ readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
1483
+ readonly indexes: readonly ["name"];
1484
+ readonly properties: {
1485
+ readonly name: {
1486
+ readonly type: "string";
1487
+ };
1488
+ readonly given_name: {
1489
+ readonly getter: (doc: object) => string | undefined;
1490
+ };
1491
+ readonly family_name: {
1492
+ readonly getter: (doc: object) => string | undefined;
1493
+ };
1494
+ readonly active: {
1495
+ readonly type: "boolean";
1496
+ };
1497
+ readonly roles: {
1498
+ readonly type: "array";
1499
+ readonly items: {
1500
+ readonly type: "string";
1501
+ };
1502
+ readonly uniqueItems: true;
1503
+ };
1504
+ readonly email: {
1505
+ readonly type: "string";
1506
+ readonly inputType: "email";
1507
+ readonly unique: true;
1508
+ };
1509
+ readonly password: {
1510
+ readonly type: "string";
1511
+ readonly inputType: "password";
1512
+ readonly hidden: true;
1513
+ };
1514
+ readonly phone_number: {
1515
+ readonly type: "string";
1516
+ readonly mask: "(##) #####-####";
1517
+ };
1518
+ readonly picture_file: {
1519
+ readonly $ref: "file";
1520
+ readonly accept: readonly ["image/*"];
1521
+ };
1522
+ readonly picture: {
1523
+ readonly getter: (doc: object) => string | undefined;
1524
+ };
1525
+ readonly group: {
1526
+ readonly type: "string";
1527
+ };
1528
+ readonly self_registered: {
1529
+ readonly type: "boolean";
1530
+ readonly readOnly: true;
1531
+ };
1532
+ readonly updated_at: {
1533
+ readonly type: "string";
1534
+ readonly format: "date-time";
1535
+ };
1536
+ };
1537
+ readonly presets: readonly ["crud", "duplicate"];
1538
+ readonly layout: {
1539
+ readonly name: "grid";
1540
+ readonly options: {
1541
+ readonly title: "name";
1542
+ readonly badge: "roles";
1543
+ readonly picture: "picture_file";
1544
+ readonly information: "email";
1545
+ readonly active: "active";
1546
+ };
1547
+ };
1548
+ readonly individualActions: {
1549
+ readonly changePassword: {
1550
+ readonly label: "change_password";
1551
+ readonly icon: "key";
1552
+ readonly translate: true;
1553
+ readonly route: {
1554
+ readonly name: "/dashboard/user/changepass";
1555
+ readonly fetchItem: true;
1556
+ };
1557
+ };
1558
+ readonly copyActivationLink: {
1559
+ readonly label: "copy_activation_link";
1560
+ readonly icon: "link";
1561
+ readonly translate: true;
1562
+ };
1563
+ };
1564
+ readonly filters: readonly ["name", "roles", "email", "phone_number"];
1565
+ readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
1566
+ readonly tableMeta: readonly ["email"];
1567
+ readonly formLayout: {
1568
+ readonly fields: {
1569
+ readonly given_name: {
1570
+ readonly span: 3;
1571
+ };
1572
+ readonly family_name: {
1573
+ readonly span: 3;
1574
+ };
1575
+ };
1576
+ };
1577
+ }>>>;
1578
+ getInfo: (payload: {
1381
1579
  userId: string;
1382
1580
  token: string;
1383
1581
  }, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
@@ -1400,7 +1598,7 @@ export declare const collections: {
1400
1598
  readonly email: any;
1401
1599
  };
1402
1600
  }>;
1403
- readonly getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<{
1601
+ getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<{
1404
1602
  readonly _tag: "Result";
1405
1603
  readonly error: undefined;
1406
1604
  readonly result: import("@aeriajs/types").SchemaWithId<{
@@ -1504,7 +1702,7 @@ export declare const collections: {
1504
1702
  };
1505
1703
  }>;
1506
1704
  }>;
1507
- readonly getActivationLink: (payload: {
1705
+ getActivationLink: (payload: {
1508
1706
  userId: import("mongodb").ObjectId | string;
1509
1707
  }, context: import("@aeriajs/types").Context) => Promise<{
1510
1708
  readonly _tag: "Error";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/builtins",
3
- "version": "0.0.163",
3
+ "version": "0.0.165",
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.163",
49
- "@aeriajs/common": "^0.0.99",
50
- "@aeriajs/entrypoint": "^0.0.101",
51
- "@aeriajs/types": "^0.0.85",
52
- "@aeriajs/validation": "^0.0.102"
48
+ "@aeriajs/core": "^0.0.165",
49
+ "@aeriajs/common": "^0.0.101",
50
+ "@aeriajs/entrypoint": "^0.0.103",
51
+ "@aeriajs/types": "^0.0.86",
52
+ "@aeriajs/validation": "^0.0.104"
53
53
  },
54
54
  "scripts": {
55
55
  "test": "echo skipping",