@aeriajs/builtins 0.0.75 → 0.0.76

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.
@@ -35,14 +35,14 @@ export declare const description: {
35
35
  };
36
36
  readonly actions: {
37
37
  readonly deleteAll: {
38
- readonly name: "Remover";
38
+ readonly label: "Remover";
39
39
  readonly ask: true;
40
40
  readonly selection: true;
41
41
  };
42
42
  };
43
43
  readonly individualActions: {
44
44
  readonly remove: {
45
- readonly name: "Remover";
45
+ readonly label: "Remover";
46
46
  readonly icon: "trash";
47
47
  readonly ask: true;
48
48
  };
@@ -55,14 +55,14 @@ exports.description = (0, core_1.defineDescription)({
55
55
  },
56
56
  actions: {
57
57
  deleteAll: {
58
- name: 'Remover',
58
+ label: 'Remover',
59
59
  ask: true,
60
60
  selection: true,
61
61
  },
62
62
  },
63
63
  individualActions: {
64
64
  remove: {
65
- name: 'Remover',
65
+ label: 'Remover',
66
66
  icon: 'trash',
67
67
  ask: true,
68
68
  },
@@ -51,14 +51,14 @@ export const description = defineDescription({
51
51
  },
52
52
  actions: {
53
53
  deleteAll: {
54
- name: "Remover",
54
+ label: "Remover",
55
55
  ask: true,
56
56
  selection: true
57
57
  }
58
58
  },
59
59
  individualActions: {
60
60
  remove: {
61
- name: "Remover",
61
+ label: "Remover",
62
62
  icon: "trash",
63
63
  ask: true
64
64
  }
@@ -28,7 +28,7 @@ export declare const tempFile: Omit<import("@aeriajs/types").Collection<{
28
28
  };
29
29
  };
30
30
  };
31
- }>, "description" | "functions" | "item" | "security" | "accessControl" | "exposedFunctions"> & {
31
+ }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
32
32
  item: import("@aeriajs/types").SchemaWithId<{
33
33
  readonly $id: "tempFile";
34
34
  readonly temporary: {
@@ -128,14 +128,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
128
128
  };
129
129
  readonly actions: {
130
130
  readonly deleteAll: {
131
- readonly name: "Remover";
131
+ readonly label: "Remover";
132
132
  readonly ask: true;
133
133
  readonly selection: true;
134
134
  };
135
135
  };
136
136
  readonly individualActions: {
137
137
  readonly remove: {
138
- readonly name: "Remover";
138
+ readonly label: "Remover";
139
139
  readonly icon: "trash";
140
140
  readonly ask: true;
141
141
  };
@@ -183,14 +183,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
183
183
  };
184
184
  readonly actions: {
185
185
  readonly deleteAll: {
186
- readonly name: "Remover";
186
+ readonly label: "Remover";
187
187
  readonly ask: true;
188
188
  readonly selection: true;
189
189
  };
190
190
  };
191
191
  readonly individualActions: {
192
192
  readonly remove: {
193
- readonly name: "Remover";
193
+ readonly label: "Remover";
194
194
  readonly icon: "trash";
195
195
  readonly ask: true;
196
196
  };
@@ -233,14 +233,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
233
233
  };
234
234
  readonly actions: {
235
235
  readonly deleteAll: {
236
- readonly name: "Remover";
236
+ readonly label: "Remover";
237
237
  readonly ask: true;
238
238
  readonly selection: true;
239
239
  };
240
240
  };
241
241
  readonly individualActions: {
242
242
  readonly remove: {
243
- readonly name: "Remover";
243
+ readonly label: "Remover";
244
244
  readonly icon: "trash";
245
245
  readonly ask: true;
246
246
  };
@@ -282,14 +282,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
282
282
  };
283
283
  readonly actions: {
284
284
  readonly deleteAll: {
285
- readonly name: "Remover";
285
+ readonly label: "Remover";
286
286
  readonly ask: true;
287
287
  readonly selection: true;
288
288
  };
289
289
  };
290
290
  readonly individualActions: {
291
291
  readonly remove: {
292
- readonly name: "Remover";
292
+ readonly label: "Remover";
293
293
  readonly icon: "trash";
294
294
  readonly ask: true;
295
295
  };
@@ -336,14 +336,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
336
336
  };
337
337
  readonly actions: {
338
338
  readonly deleteAll: {
339
- readonly name: "Remover";
339
+ readonly label: "Remover";
340
340
  readonly ask: true;
341
341
  readonly selection: true;
342
342
  };
343
343
  };
344
344
  readonly individualActions: {
345
345
  readonly remove: {
346
- readonly name: "Remover";
346
+ readonly label: "Remover";
347
347
  readonly icon: "trash";
348
348
  readonly ask: true;
349
349
  };
@@ -386,14 +386,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
386
386
  };
387
387
  readonly actions: {
388
388
  readonly deleteAll: {
389
- readonly name: "Remover";
389
+ readonly label: "Remover";
390
390
  readonly ask: true;
391
391
  readonly selection: true;
392
392
  };
393
393
  };
394
394
  readonly individualActions: {
395
395
  readonly remove: {
396
- readonly name: "Remover";
396
+ readonly label: "Remover";
397
397
  readonly icon: "trash";
398
398
  readonly ask: true;
399
399
  };
@@ -435,14 +435,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
435
435
  };
436
436
  readonly actions: {
437
437
  readonly deleteAll: {
438
- readonly name: "Remover";
438
+ readonly label: "Remover";
439
439
  readonly ask: true;
440
440
  readonly selection: true;
441
441
  };
442
442
  };
443
443
  readonly individualActions: {
444
444
  readonly remove: {
445
- readonly name: "Remover";
445
+ readonly label: "Remover";
446
446
  readonly icon: "trash";
447
447
  readonly ask: true;
448
448
  };
@@ -485,21 +485,21 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
485
485
  };
486
486
  readonly actions: {
487
487
  readonly deleteAll: {
488
- readonly name: "Remover";
488
+ readonly label: "Remover";
489
489
  readonly ask: true;
490
490
  readonly selection: true;
491
491
  };
492
492
  };
493
493
  readonly individualActions: {
494
494
  readonly remove: {
495
- readonly name: "Remover";
495
+ readonly label: "Remover";
496
496
  readonly icon: "trash";
497
497
  readonly ask: true;
498
498
  };
499
499
  };
500
500
  }>) => Promise<any>;
501
501
  };
502
- }>, "description" | "functions" | "item" | "security" | "accessControl" | "exposedFunctions"> & {
502
+ }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
503
503
  item: import("@aeriajs/types").SchemaWithId<{
504
504
  readonly $id: "file";
505
505
  readonly owned: "always";
@@ -537,14 +537,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
537
537
  };
538
538
  readonly actions: {
539
539
  readonly deleteAll: {
540
- readonly name: "Remover";
540
+ readonly label: "Remover";
541
541
  readonly ask: true;
542
542
  readonly selection: true;
543
543
  };
544
544
  };
545
545
  readonly individualActions: {
546
546
  readonly remove: {
547
- readonly name: "Remover";
547
+ readonly label: "Remover";
548
548
  readonly icon: "trash";
549
549
  readonly ask: true;
550
550
  };
@@ -587,14 +587,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
587
587
  };
588
588
  readonly actions: {
589
589
  readonly deleteAll: {
590
- readonly name: "Remover";
590
+ readonly label: "Remover";
591
591
  readonly ask: true;
592
592
  readonly selection: true;
593
593
  };
594
594
  };
595
595
  readonly individualActions: {
596
596
  readonly remove: {
597
- readonly name: "Remover";
597
+ readonly label: "Remover";
598
598
  readonly icon: "trash";
599
599
  readonly ask: true;
600
600
  };
@@ -642,14 +642,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
642
642
  };
643
643
  readonly actions: {
644
644
  readonly deleteAll: {
645
- readonly name: "Remover";
645
+ readonly label: "Remover";
646
646
  readonly ask: true;
647
647
  readonly selection: true;
648
648
  };
649
649
  };
650
650
  readonly individualActions: {
651
651
  readonly remove: {
652
- readonly name: "Remover";
652
+ readonly label: "Remover";
653
653
  readonly icon: "trash";
654
654
  readonly ask: true;
655
655
  };
@@ -692,14 +692,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
692
692
  };
693
693
  readonly actions: {
694
694
  readonly deleteAll: {
695
- readonly name: "Remover";
695
+ readonly label: "Remover";
696
696
  readonly ask: true;
697
697
  readonly selection: true;
698
698
  };
699
699
  };
700
700
  readonly individualActions: {
701
701
  readonly remove: {
702
- readonly name: "Remover";
702
+ readonly label: "Remover";
703
703
  readonly icon: "trash";
704
704
  readonly ask: true;
705
705
  };
@@ -741,14 +741,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
741
741
  };
742
742
  readonly actions: {
743
743
  readonly deleteAll: {
744
- readonly name: "Remover";
744
+ readonly label: "Remover";
745
745
  readonly ask: true;
746
746
  readonly selection: true;
747
747
  };
748
748
  };
749
749
  readonly individualActions: {
750
750
  readonly remove: {
751
- readonly name: "Remover";
751
+ readonly label: "Remover";
752
752
  readonly icon: "trash";
753
753
  readonly ask: true;
754
754
  };
@@ -795,14 +795,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
795
795
  };
796
796
  readonly actions: {
797
797
  readonly deleteAll: {
798
- readonly name: "Remover";
798
+ readonly label: "Remover";
799
799
  readonly ask: true;
800
800
  readonly selection: true;
801
801
  };
802
802
  };
803
803
  readonly individualActions: {
804
804
  readonly remove: {
805
- readonly name: "Remover";
805
+ readonly label: "Remover";
806
806
  readonly icon: "trash";
807
807
  readonly ask: true;
808
808
  };
@@ -845,14 +845,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
845
845
  };
846
846
  readonly actions: {
847
847
  readonly deleteAll: {
848
- readonly name: "Remover";
848
+ readonly label: "Remover";
849
849
  readonly ask: true;
850
850
  readonly selection: true;
851
851
  };
852
852
  };
853
853
  readonly individualActions: {
854
854
  readonly remove: {
855
- readonly name: "Remover";
855
+ readonly label: "Remover";
856
856
  readonly icon: "trash";
857
857
  readonly ask: true;
858
858
  };
@@ -894,14 +894,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
894
894
  };
895
895
  readonly actions: {
896
896
  readonly deleteAll: {
897
- readonly name: "Remover";
897
+ readonly label: "Remover";
898
898
  readonly ask: true;
899
899
  readonly selection: true;
900
900
  };
901
901
  };
902
902
  readonly individualActions: {
903
903
  readonly remove: {
904
- readonly name: "Remover";
904
+ readonly label: "Remover";
905
905
  readonly icon: "trash";
906
906
  readonly ask: true;
907
907
  };
@@ -944,14 +944,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
944
944
  };
945
945
  readonly actions: {
946
946
  readonly deleteAll: {
947
- readonly name: "Remover";
947
+ readonly label: "Remover";
948
948
  readonly ask: true;
949
949
  readonly selection: true;
950
950
  };
951
951
  };
952
952
  readonly individualActions: {
953
953
  readonly remove: {
954
- readonly name: "Remover";
954
+ readonly label: "Remover";
955
955
  readonly icon: "trash";
956
956
  readonly ask: true;
957
957
  };
@@ -41,14 +41,14 @@ export declare const insert: (payload: {
41
41
  };
42
42
  readonly actions: {
43
43
  readonly deleteAll: {
44
- readonly name: "Remover";
44
+ readonly label: "Remover";
45
45
  readonly ask: true;
46
46
  readonly selection: true;
47
47
  };
48
48
  };
49
49
  readonly individualActions: {
50
50
  readonly remove: {
51
- readonly name: "Remover";
51
+ readonly label: "Remover";
52
52
  readonly icon: "trash";
53
53
  readonly ask: true;
54
54
  };
@@ -31,7 +31,7 @@ export declare const log: Omit<import("@aeriajs/types").Collection<{
31
31
  readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
32
32
  readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/core").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
33
33
  };
34
- }>, "description" | "functions" | "item" | "security" | "accessControl" | "exposedFunctions"> & {
34
+ }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
35
35
  item: import("@aeriajs/types").SchemaWithId<{
36
36
  readonly $id: "log";
37
37
  readonly required: readonly ["context", "message"];
@@ -33,7 +33,7 @@ export declare const resourceUsage: Omit<import("@aeriajs/types").Collection<{
33
33
  };
34
34
  };
35
35
  };
36
- }>, "description" | "functions" | "item" | "security" | "accessControl" | "exposedFunctions"> & {
36
+ }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
37
37
  item: import("@aeriajs/types").SchemaWithId<{
38
38
  readonly $id: "resourceUsage";
39
39
  readonly required: readonly ["usage"];
@@ -76,12 +76,12 @@ export declare const description: {
76
76
  };
77
77
  readonly individualActions: {
78
78
  readonly 'ui:spawnEdit': {
79
- readonly name: "action.edit";
79
+ readonly label: "action.edit";
80
80
  readonly icon: "pencil";
81
81
  readonly translate: true;
82
82
  };
83
83
  readonly 'route:/dashboard/user/changepass': {
84
- readonly name: "change_password";
84
+ readonly label: "change_password";
85
85
  readonly icon: "key";
86
86
  readonly fetchItem: true;
87
87
  readonly translate: true;
@@ -108,12 +108,12 @@ exports.description = (0, core_1.defineDescription)({
108
108
  },
109
109
  individualActions: {
110
110
  'ui:spawnEdit': {
111
- name: 'action.edit',
111
+ label: 'action.edit',
112
112
  icon: 'pencil',
113
113
  translate: true,
114
114
  },
115
115
  'route:/dashboard/user/changepass': {
116
- name: 'change_password',
116
+ label: 'change_password',
117
117
  icon: 'key',
118
118
  fetchItem: true,
119
119
  translate: true,
@@ -102,12 +102,12 @@ export const description = defineDescription({
102
102
  },
103
103
  individualActions: {
104
104
  "ui:spawnEdit": {
105
- name: "action.edit",
105
+ label: "action.edit",
106
106
  icon: "pencil",
107
107
  translate: true
108
108
  },
109
109
  "route:/dashboard/user/changepass": {
110
- name: "change_password",
110
+ label: "change_password",
111
111
  icon: "key",
112
112
  fetchItem: true,
113
113
  translate: true
@@ -0,0 +1,107 @@
1
+ import type { Context, SchemaWithId } from '@aeriajs/types';
2
+ import type { description } from './description';
3
+ export declare enum ActivationErrors {
4
+ UserNotFound = "USER_NOT_FOUND",
5
+ AlreadyActiveUser = "ALREADY_ACTIVE_USER",
6
+ InvalidLink = "INVALID_LINK"
7
+ }
8
+ export declare const getCurrentUser: (_payload: undefined, context: Context<typeof description>) => Promise<import("@aeriajs/types").Left<{}> | import("@aeriajs/types").Right<SchemaWithId<{
9
+ readonly $id: "user";
10
+ readonly required: readonly ["name", "roles", "email"];
11
+ readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
12
+ readonly indexes: readonly ["name"];
13
+ readonly freshItem: {
14
+ readonly active: true;
15
+ };
16
+ readonly properties: {
17
+ readonly name: {
18
+ readonly type: "string";
19
+ };
20
+ readonly given_name: {
21
+ readonly getter: (document: any) => string;
22
+ };
23
+ readonly family_name: {
24
+ readonly getter: (document: any) => string;
25
+ };
26
+ readonly active: {
27
+ readonly type: "boolean";
28
+ };
29
+ readonly roles: {
30
+ readonly type: "array";
31
+ readonly items: {
32
+ readonly type: "string";
33
+ };
34
+ readonly uniqueItems: true;
35
+ };
36
+ readonly email: {
37
+ readonly type: "string";
38
+ readonly inputType: "email";
39
+ readonly unique: true;
40
+ };
41
+ readonly password: {
42
+ readonly type: "string";
43
+ readonly inputType: "password";
44
+ readonly hidden: true;
45
+ };
46
+ readonly phone_number: {
47
+ readonly type: "string";
48
+ readonly mask: "(##) #####-####";
49
+ };
50
+ readonly picture_file: {
51
+ readonly $ref: "file";
52
+ readonly accept: readonly ["image/*"];
53
+ };
54
+ readonly picture: {
55
+ readonly getter: (value: any) => any;
56
+ };
57
+ readonly group: {
58
+ readonly type: "string";
59
+ };
60
+ readonly self_registered: {
61
+ readonly type: "boolean";
62
+ readonly readOnly: true;
63
+ };
64
+ readonly updated_at: {
65
+ readonly type: "string";
66
+ readonly format: "date-time";
67
+ };
68
+ };
69
+ readonly presets: readonly ["crud", "view", "duplicate"];
70
+ readonly layout: {
71
+ readonly name: "grid";
72
+ readonly options: {
73
+ readonly title: "name";
74
+ readonly badge: "roles";
75
+ readonly picture: "picture_file";
76
+ readonly information: "email";
77
+ readonly active: "active";
78
+ };
79
+ };
80
+ readonly individualActions: {
81
+ readonly 'ui:spawnEdit': {
82
+ readonly label: "action.edit";
83
+ readonly icon: "pencil";
84
+ readonly translate: true;
85
+ };
86
+ readonly 'route:/dashboard/user/changepass': {
87
+ readonly label: "change_password";
88
+ readonly icon: "key";
89
+ readonly fetchItem: true;
90
+ readonly translate: true;
91
+ };
92
+ };
93
+ readonly icon: "users";
94
+ readonly filters: readonly ["name", "roles", "email", "phone_number"];
95
+ readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
96
+ readonly tableMeta: readonly ["email"];
97
+ readonly formLayout: {
98
+ readonly fields: {
99
+ readonly given_name: {
100
+ readonly span: 3;
101
+ };
102
+ readonly family_name: {
103
+ readonly span: 3;
104
+ };
105
+ };
106
+ };
107
+ }>>>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCurrentUser = exports.ActivationErrors = void 0;
4
+ const core_1 = require("@aeriajs/core");
5
+ const common_1 = require("@aeriajs/common");
6
+ var ActivationErrors;
7
+ (function (ActivationErrors) {
8
+ ActivationErrors["UserNotFound"] = "USER_NOT_FOUND";
9
+ ActivationErrors["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
10
+ ActivationErrors["InvalidLink"] = "INVALID_LINK";
11
+ })(ActivationErrors || (exports.ActivationErrors = ActivationErrors = {}));
12
+ exports.getCurrentUser = (0, core_1.defineExposedFunction)(async (_payload, context) => {
13
+ if (!context.token.authenticated) {
14
+ return (0, common_1.left)({});
15
+ }
16
+ const user = await context.collections.user.functions.get({
17
+ filters: {
18
+ _id: context.token.sub,
19
+ },
20
+ });
21
+ if (!user) {
22
+ throw new Error();
23
+ }
24
+ const nonNullableUser = user;
25
+ return (0, common_1.right)(nonNullableUser);
26
+ });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ import { defineExposedFunction } from "@aeriajs/core";
3
+ import { left, right } from "@aeriajs/common";
4
+ export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
5
+ ActivationErrors2["UserNotFound"] = "USER_NOT_FOUND";
6
+ ActivationErrors2["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
7
+ ActivationErrors2["InvalidLink"] = "INVALID_LINK";
8
+ return ActivationErrors2;
9
+ })(ActivationErrors || {});
10
+ export const getCurrentUser = defineExposedFunction(async (_payload, context) => {
11
+ if (!context.token.authenticated) {
12
+ return left({});
13
+ }
14
+ const user = await context.collections.user.functions.get({
15
+ filters: {
16
+ _id: context.token.sub
17
+ }
18
+ });
19
+ if (!user) {
20
+ throw new Error();
21
+ }
22
+ const nonNullableUser = user;
23
+ return right(nonNullableUser);
24
+ });