@aeriajs/builtins 0.0.164 → 0.0.166

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,480 +1,6 @@
1
+ import type { Collection } from '@aeriajs/types';
1
2
  import { description } from './description.js';
2
- export declare const user: {
3
- description: {
4
- readonly $id: "user";
5
- readonly icon: "users";
6
- readonly required: readonly ["name", "roles", "email"];
7
- readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
8
- readonly indexes: readonly ["name"];
9
- readonly properties: {
10
- readonly name: {
11
- readonly type: "string";
12
- };
13
- readonly given_name: {
14
- readonly getter: (doc: object) => string | undefined;
15
- };
16
- readonly family_name: {
17
- readonly getter: (doc: object) => string | undefined;
18
- };
19
- readonly active: {
20
- readonly type: "boolean";
21
- };
22
- readonly roles: {
23
- readonly type: "array";
24
- readonly items: {
25
- readonly type: "string";
26
- };
27
- readonly uniqueItems: true;
28
- };
29
- readonly email: {
30
- readonly type: "string";
31
- readonly inputType: "email";
32
- readonly unique: true;
33
- };
34
- readonly password: {
35
- readonly type: "string";
36
- readonly inputType: "password";
37
- readonly hidden: true;
38
- };
39
- readonly phone_number: {
40
- readonly type: "string";
41
- readonly mask: "(##) #####-####";
42
- };
43
- readonly picture_file: {
44
- readonly $ref: "file";
45
- readonly accept: readonly ["image/*"];
46
- };
47
- readonly picture: {
48
- readonly getter: (doc: object) => string | undefined;
49
- };
50
- readonly group: {
51
- readonly type: "string";
52
- };
53
- readonly self_registered: {
54
- readonly type: "boolean";
55
- readonly readOnly: true;
56
- };
57
- readonly updated_at: {
58
- readonly type: "string";
59
- readonly format: "date-time";
60
- };
61
- };
62
- readonly presets: readonly ["crud", "duplicate"];
63
- readonly layout: {
64
- readonly name: "grid";
65
- readonly options: {
66
- readonly title: "name";
67
- readonly badge: "roles";
68
- readonly picture: "picture_file";
69
- readonly information: "email";
70
- readonly active: "active";
71
- };
72
- };
73
- readonly individualActions: {
74
- readonly changePassword: {
75
- readonly label: "change_password";
76
- readonly icon: "key";
77
- readonly translate: true;
78
- readonly route: {
79
- readonly name: "/dashboard/user/changepass";
80
- readonly fetchItem: true;
81
- };
82
- };
83
- readonly copyActivationLink: {
84
- readonly label: "copy_activation_link";
85
- readonly icon: "link";
86
- readonly translate: true;
87
- };
88
- };
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
- };
103
- functions: {
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
- readonly _tag: "Result";
108
- readonly error: undefined;
109
- readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
110
- } | import("@aeriajs/types").Result.Error<{
111
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
112
- } & {
113
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
114
- }> | import("@aeriajs/types").Result.Error<{
115
- readonly code: import("@aeriajs/types").ACError.OwnershipError;
116
- } & {
117
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
118
- }>>;
119
- upload: <TContext extends import("@aeriajs/types").Context>(_props: unknown, context: TContext) => Promise<import("@aeriajs/types").Result.Error<{
120
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
121
- readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
122
- } & {
123
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
124
- }> | {
125
- readonly _tag: "Result";
126
- readonly error: undefined;
127
- readonly result: {
128
- readonly tempId: any;
129
- };
130
- }>;
131
- removeFile: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemoveFilePayload, context: TContext, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
132
- readonly _tag: "Result";
133
- readonly error: undefined;
134
- readonly result: any;
135
- } | import("@aeriajs/types").Result.Error<{
136
- readonly code: import("@aeriajs/types").ACError.OwnershipError;
137
- } & {
138
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
139
- }>>;
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
- email: string;
143
- password: string;
144
- } | {
145
- token?: import("@aeriajs/types").TokenRecipient;
146
- revalidate: true;
147
- }, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
148
- readonly code: import("@aeriajs/types").ACError.AuthorizationError;
149
- } & {
150
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
151
- }> | {
152
- readonly _tag: "Result";
153
- readonly error: undefined;
154
- readonly result: {
155
- user: {
156
- _id: null;
157
- name: string;
158
- email: string;
159
- roles: string[];
160
- active: boolean;
161
- };
162
- token: {
163
- type: string;
164
- content: string;
165
- };
166
- };
167
- } | {
168
- readonly _tag: "Result";
169
- readonly error: undefined;
170
- readonly result: import("../../authentication.js").SuccessfulAuthentication;
171
- } | import("@aeriajs/types").Result.Error<{
172
- readonly code: import("../../authentication.js").AuthenticationError.InvalidCredentials;
173
- } & {
174
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
175
- }> | import("@aeriajs/types").Result.Error<{
176
- readonly code: import("../../authentication.js").AuthenticationError.InactiveUser;
177
- } & {
178
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
179
- }>>;
180
- activate: (payload: {
181
- password: string;
182
- }, context: import("@aeriajs/types").Context<typeof description> & {
183
- request: {
184
- query: {
185
- u?: string;
186
- t?: string;
187
- };
188
- payload: {
189
- password?: string;
190
- };
191
- };
192
- }) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Result.Error<{
193
- readonly code: import("./activate.js").ActivationError.InvalidLink;
194
- } & {
195
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
196
- }> | import("@aeriajs/types").Result.Error<{
197
- readonly code: import("./activate.js").ActivationError.UserNotFound;
198
- } & {
199
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
200
- }> | import("@aeriajs/types").Result.Error<{
201
- readonly code: import("./activate.js").ActivationError.AlreadyActiveUser;
202
- } & {
203
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
204
- }> | import("@aeriajs/types").Result.Error<{
205
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
206
- } & {
207
- httpStatus: import("@aeriajs/types").HTTPStatus.UnprocessableContent;
208
- }> | {
209
- readonly _tag: "Result";
210
- readonly error: undefined;
211
- readonly result: {
212
- readonly userId: any;
213
- };
214
- } | undefined>;
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<{
220
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
221
- readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
222
- } & {
223
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
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: {
325
- userId: string;
326
- token: string;
327
- }, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
328
- readonly code: import("./getInfo.js").ActivationError.InvalidLink;
329
- } & {
330
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
331
- }> | import("@aeriajs/types").Result.Error<{
332
- readonly code: import("./getInfo.js").ActivationError.UserNotFound;
333
- } & {
334
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
335
- }> | import("@aeriajs/types").Result.Error<{
336
- readonly code: import("./getInfo.js").ActivationError.AlreadyActiveUser;
337
- } & {
338
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
339
- }> | {
340
- readonly _tag: "Result";
341
- readonly error: undefined;
342
- readonly result: {
343
- readonly name: any;
344
- readonly email: any;
345
- };
346
- }>;
347
- getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
348
- readonly _tag: "Result";
349
- readonly error: undefined;
350
- readonly result: import("@aeriajs/types").SchemaWithId<{
351
- readonly $id: "user";
352
- readonly icon: "users";
353
- readonly required: readonly ["name", "roles", "email"];
354
- readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
355
- readonly indexes: readonly ["name"];
356
- readonly properties: {
357
- readonly name: {
358
- readonly type: "string";
359
- };
360
- readonly given_name: {
361
- readonly getter: (doc: object) => string | undefined;
362
- };
363
- readonly family_name: {
364
- readonly getter: (doc: object) => string | undefined;
365
- };
366
- readonly active: {
367
- readonly type: "boolean";
368
- };
369
- readonly roles: {
370
- readonly type: "array";
371
- readonly items: {
372
- readonly type: "string";
373
- };
374
- readonly uniqueItems: true;
375
- };
376
- readonly email: {
377
- readonly type: "string";
378
- readonly inputType: "email";
379
- readonly unique: true;
380
- };
381
- readonly password: {
382
- readonly type: "string";
383
- readonly inputType: "password";
384
- readonly hidden: true;
385
- };
386
- readonly phone_number: {
387
- readonly type: "string";
388
- readonly mask: "(##) #####-####";
389
- };
390
- readonly picture_file: {
391
- readonly $ref: "file";
392
- readonly accept: readonly ["image/*"];
393
- };
394
- readonly picture: {
395
- readonly getter: (doc: object) => string | undefined;
396
- };
397
- readonly group: {
398
- readonly type: "string";
399
- };
400
- readonly self_registered: {
401
- readonly type: "boolean";
402
- readonly readOnly: true;
403
- };
404
- readonly updated_at: {
405
- readonly type: "string";
406
- readonly format: "date-time";
407
- };
408
- };
409
- readonly presets: readonly ["crud", "duplicate"];
410
- readonly layout: {
411
- readonly name: "grid";
412
- readonly options: {
413
- readonly title: "name";
414
- readonly badge: "roles";
415
- readonly picture: "picture_file";
416
- readonly information: "email";
417
- readonly active: "active";
418
- };
419
- };
420
- readonly individualActions: {
421
- readonly changePassword: {
422
- readonly label: "change_password";
423
- readonly icon: "key";
424
- readonly translate: true;
425
- readonly route: {
426
- readonly name: "/dashboard/user/changepass";
427
- readonly fetchItem: true;
428
- };
429
- };
430
- readonly copyActivationLink: {
431
- readonly label: "copy_activation_link";
432
- readonly icon: "link";
433
- readonly translate: true;
434
- };
435
- };
436
- readonly filters: readonly ["name", "roles", "email", "phone_number"];
437
- readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
438
- readonly tableMeta: readonly ["email"];
439
- readonly formLayout: {
440
- readonly fields: {
441
- readonly given_name: {
442
- readonly span: 3;
443
- };
444
- readonly family_name: {
445
- readonly span: 3;
446
- };
447
- };
448
- };
449
- }>;
450
- }>;
451
- getActivationLink: (payload: {
452
- userId: import("@aeriajs/core").ObjectId | string;
453
- }, context: import("@aeriajs/types").Context) => Promise<{
454
- readonly _tag: "Error";
455
- readonly error: import("@aeriajs/types").StrictEndpointError<import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.MalformedInput, unknown, import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound>;
456
- readonly result: undefined;
457
- } | import("@aeriajs/types").Result.Error<{
458
- readonly code: import("./activate.js").ActivationError.AlreadyActiveUser;
459
- } & {
460
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
461
- }> | {
462
- readonly _tag: "Result";
463
- readonly error: undefined;
464
- readonly result: {
465
- readonly url: string;
466
- };
467
- }>;
468
- };
469
- contracts: {
470
- readonly getCurrentUser: {
471
- readonly response: {
472
- readonly $ref: "user";
473
- };
474
- };
475
- };
476
- exposedFunctions: any;
477
- } & {
3
+ export declare const user: Omit<Collection<never>, "functions" | "description" | "middlewares" | "item" | "exposedFunctions" | "security"> & {
478
4
  item: import("@aeriajs/types").SchemaWithId<{
479
5
  readonly $id: "user";
480
6
  readonly icon: "users";
@@ -500,6 +26,7 @@ export declare const user: {
500
26
  readonly type: "string";
501
27
  };
502
28
  readonly uniqueItems: true;
29
+ readonly minItems: 1;
503
30
  };
504
31
  readonly email: {
505
32
  readonly type: "string";
@@ -600,6 +127,7 @@ export declare const user: {
600
127
  readonly type: "string";
601
128
  };
602
129
  readonly uniqueItems: true;
130
+ readonly minItems: 1;
603
131
  };
604
132
  readonly email: {
605
133
  readonly type: "string";
@@ -821,6 +349,7 @@ export declare const user: {
821
349
  readonly type: "string";
822
350
  };
823
351
  readonly uniqueItems: true;
352
+ readonly minItems: 1;
824
353
  };
825
354
  readonly email: {
826
355
  readonly type: "string";
@@ -947,6 +476,7 @@ export declare const user: {
947
476
  readonly type: "string";
948
477
  };
949
478
  readonly uniqueItems: true;
479
+ readonly minItems: 1;
950
480
  };
951
481
  readonly email: {
952
482
  readonly type: "string";
@@ -1042,10 +572,17 @@ export declare const user: {
1042
572
  }>;
1043
573
  };
1044
574
  contracts: {
1045
- readonly getCurrentUser: {
1046
- readonly response: {
1047
- readonly $ref: "user";
1048
- };
1049
- };
575
+ get?: import("@aeriajs/types").Contract | undefined;
576
+ getAll?: import("@aeriajs/types").Contract | undefined;
577
+ remove?: import("@aeriajs/types").Contract | undefined;
578
+ upload?: import("@aeriajs/types").Contract | undefined;
579
+ removeFile?: import("@aeriajs/types").Contract | undefined;
580
+ insert?: import("@aeriajs/types").Contract | undefined;
581
+ authenticate?: import("@aeriajs/types").Contract | undefined;
582
+ activate?: import("@aeriajs/types").Contract | undefined;
583
+ createAccount?: import("@aeriajs/types").Contract | undefined;
584
+ getInfo?: import("@aeriajs/types").Contract | undefined;
585
+ getCurrentUser?: import("@aeriajs/types").Contract | undefined;
586
+ getActivationLink?: import("@aeriajs/types").Contract | undefined;
1050
587
  };
1051
588
  };
@@ -41,6 +41,9 @@ const exposedFunctions = {
41
41
  exports.user = (0, core_1.defineCollection)({
42
42
  description: description_js_1.description,
43
43
  functions,
44
+ });
45
+ Object.assign(exports.user, {
46
+ exposedFunctions,
44
47
  contracts: {
45
48
  getCurrentUser: {
46
49
  response: {
@@ -48,5 +51,4 @@ exports.user = (0, core_1.defineCollection)({
48
51
  },
49
52
  },
50
53
  },
51
- exposedFunctions: exposedFunctions,
52
54
  });
@@ -38,13 +38,15 @@ const exposedFunctions = {
38
38
  };
39
39
  export const user = defineCollection({
40
40
  description,
41
- functions,
41
+ functions
42
+ });
43
+ Object.assign(user, {
44
+ exposedFunctions,
42
45
  contracts: {
43
46
  getCurrentUser: {
44
47
  response: {
45
48
  $ref: "user"
46
49
  }
47
50
  }
48
- },
49
- exposedFunctions
51
+ }
50
52
  });
@@ -82,7 +82,7 @@ export declare const describe: (contextOrPayload: RouteContext | typeof Payload)
82
82
  descriptions: Record<string, Description>;
83
83
  roles?: string[];
84
84
  auth?: Awaited<ReturnType<typeof authenticate>> extends Result.Either<unknown, infer Right> ? Partial<Right> : never;
85
- router?: any;
85
+ router?: unknown;
86
86
  };
87
87
  }>;
88
88
  export {};