@aeriajs/builtins 0.0.75 → 0.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collections/file/description.d.ts +2 -2
- package/dist/collections/file/description.js +2 -2
- package/dist/collections/file/description.mjs +2 -2
- package/dist/collections/file/download.js +3 -2
- package/dist/collections/file/download.mjs +3 -3
- package/dist/collections/file/index.d.ts +36 -36
- package/dist/collections/file/insert.d.ts +2 -2
- package/dist/collections/file/insert.js +3 -2
- package/dist/collections/file/insert.mjs +3 -3
- package/dist/collections/file/remove.js +3 -2
- package/dist/collections/file/remove.mjs +3 -3
- package/dist/collections/file/removeAll.js +3 -2
- package/dist/collections/file/removeAll.mjs +3 -3
- package/dist/collections/log/index.d.ts +1 -1
- package/dist/collections/resourceUsage/index.d.ts +1 -1
- package/dist/collections/user/activate.d.ts +1 -1
- package/dist/collections/user/activate.js +3 -2
- package/dist/collections/user/activate.mjs +3 -3
- package/dist/collections/user/authenticate.js +4 -8
- package/dist/collections/user/authenticate.mjs +0 -4
- package/dist/collections/user/createAccount.js +3 -3
- package/dist/collections/user/createAccount.mjs +2 -3
- package/dist/collections/user/description.d.ts +2 -2
- package/dist/collections/user/description.js +2 -2
- package/dist/collections/user/description.mjs +2 -2
- package/dist/collections/user/getCurrentUser.d.ts +107 -0
- package/dist/collections/user/getCurrentUser.js +26 -0
- package/dist/collections/user/getCurrentUser.mjs +23 -0
- package/dist/collections/user/getInfo.js +3 -2
- package/dist/collections/user/getInfo.mjs +3 -3
- package/dist/collections/user/index.d.ts +486 -69
- package/dist/collections/user/index.js +14 -8
- package/dist/collections/user/index.mjs +14 -8
- package/dist/collections/user/insert.d.ts +2 -2
- package/dist/collections/user/insert.js +0 -3
- package/dist/collections/user/insert.mjs +1 -4
- package/dist/functions/describe.d.ts +2 -2
- package/dist/functions/describe.js +1 -2
- package/dist/functions/describe.mjs +1 -2
- package/dist/index.d.ts +524 -107
- package/package.json +6 -8
|
@@ -35,14 +35,14 @@ export declare const description: {
|
|
|
35
35
|
};
|
|
36
36
|
readonly actions: {
|
|
37
37
|
readonly deleteAll: {
|
|
38
|
-
readonly
|
|
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
|
|
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
|
-
|
|
58
|
+
label: 'Remover',
|
|
59
59
|
ask: true,
|
|
60
60
|
selection: true,
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
individualActions: {
|
|
64
64
|
remove: {
|
|
65
|
-
|
|
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
|
-
|
|
54
|
+
label: "Remover",
|
|
55
55
|
ask: true,
|
|
56
56
|
selection: true
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
individualActions: {
|
|
60
60
|
remove: {
|
|
61
|
-
|
|
61
|
+
label: "Remover",
|
|
62
62
|
icon: "trash",
|
|
63
63
|
ask: true
|
|
64
64
|
}
|
|
@@ -9,7 +9,7 @@ var FileReadError;
|
|
|
9
9
|
FileReadError["DocumentNotFound"] = "DOCUMENT_NOT_FOUND";
|
|
10
10
|
FileReadError["FileNotFound"] = "FILE_NOT_FOUND";
|
|
11
11
|
})(FileReadError || (exports.FileReadError = FileReadError = {}));
|
|
12
|
-
|
|
12
|
+
const download = async (payload, context) => {
|
|
13
13
|
const { fileId, options = [] } = payload;
|
|
14
14
|
const file = await context.collection.model.findOne({
|
|
15
15
|
_id: new core_1.ObjectId(fileId),
|
|
@@ -71,4 +71,5 @@ exports.download = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
return fs.createReadStream(file.absolute_path);
|
|
74
|
-
}
|
|
74
|
+
};
|
|
75
|
+
exports.download = download;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { ObjectId } from "@aeriajs/core";
|
|
3
3
|
import { left } from "@aeriajs/common";
|
|
4
4
|
import * as fs from "fs";
|
|
5
5
|
export var FileReadError = /* @__PURE__ */ ((FileReadError2) => {
|
|
@@ -7,7 +7,7 @@ export var FileReadError = /* @__PURE__ */ ((FileReadError2) => {
|
|
|
7
7
|
FileReadError2["FileNotFound"] = "FILE_NOT_FOUND";
|
|
8
8
|
return FileReadError2;
|
|
9
9
|
})(FileReadError || {});
|
|
10
|
-
export const download =
|
|
10
|
+
export const download = async (payload, context) => {
|
|
11
11
|
const { fileId, options = [] } = payload;
|
|
12
12
|
const file = await context.collection.model.findOne({
|
|
13
13
|
_id: new ObjectId(fileId)
|
|
@@ -62,4 +62,4 @@ export const download = defineExposedFunction(async (payload, context) => {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
return fs.createReadStream(file.absolute_path);
|
|
65
|
-
}
|
|
65
|
+
};
|
|
@@ -28,7 +28,7 @@ export declare const tempFile: Omit<import("@aeriajs/types").Collection<{
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
}>, "description" | "functions" | "item" | "security" | "
|
|
31
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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" | "
|
|
502
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
51
|
+
readonly label: "Remover";
|
|
52
52
|
readonly icon: "trash";
|
|
53
53
|
readonly ask: true;
|
|
54
54
|
};
|
|
@@ -4,7 +4,7 @@ exports.insert = void 0;
|
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const promises_1 = require("fs/promises");
|
|
6
6
|
const core_1 = require("@aeriajs/core");
|
|
7
|
-
|
|
7
|
+
const insert = async (payload, context) => {
|
|
8
8
|
if (!context.token.authenticated) {
|
|
9
9
|
throw new Error('');
|
|
10
10
|
}
|
|
@@ -40,4 +40,5 @@ exports.insert = (0, core_1.defineExposedFunction)(async (payload, context) => {
|
|
|
40
40
|
...payload,
|
|
41
41
|
what,
|
|
42
42
|
}, context);
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
|
+
exports.insert = insert;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { createHash } from "crypto";
|
|
3
3
|
import { writeFile, unlink } from "fs/promises";
|
|
4
|
-
import {
|
|
5
|
-
export const insert =
|
|
4
|
+
import { insert as originalInsert } from "@aeriajs/core";
|
|
5
|
+
export const insert = async (payload, context) => {
|
|
6
6
|
if (!context.token.authenticated) {
|
|
7
7
|
throw new Error("");
|
|
8
8
|
}
|
|
@@ -39,4 +39,4 @@ export const insert = defineExposedFunction(async (payload, context) => {
|
|
|
39
39
|
...payload,
|
|
40
40
|
what
|
|
41
41
|
}, context);
|
|
42
|
-
}
|
|
42
|
+
};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.remove = void 0;
|
|
4
4
|
const core_1 = require("@aeriajs/core");
|
|
5
5
|
const fs = require("fs/promises");
|
|
6
|
-
|
|
6
|
+
const remove = async (payload, context) => {
|
|
7
7
|
const file = await context.collection.model.findOne({
|
|
8
8
|
_id: payload.filters._id,
|
|
9
9
|
}, {
|
|
@@ -21,4 +21,5 @@ exports.remove = (0, core_1.defineExposedFunction)(async (payload, context) => {
|
|
|
21
21
|
console.trace(err);
|
|
22
22
|
}
|
|
23
23
|
return (0, core_1.remove)(payload, context);
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
|
+
exports.remove = remove;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { remove as originalRemove } from "@aeriajs/core";
|
|
3
3
|
import * as fs from "fs/promises";
|
|
4
|
-
export const remove =
|
|
4
|
+
export const remove = async (payload, context) => {
|
|
5
5
|
const file = await context.collection.model.findOne({
|
|
6
6
|
_id: payload.filters._id
|
|
7
7
|
}, {
|
|
@@ -18,4 +18,4 @@ export const remove = defineExposedFunction(async (payload, context) => {
|
|
|
18
18
|
console.trace(err);
|
|
19
19
|
}
|
|
20
20
|
return originalRemove(payload, context);
|
|
21
|
-
}
|
|
21
|
+
};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.removeAll = void 0;
|
|
4
4
|
const core_1 = require("@aeriajs/core");
|
|
5
5
|
const fs = require("fs/promises");
|
|
6
|
-
|
|
6
|
+
const removeAll = async (payload, context) => {
|
|
7
7
|
const files = context.collection.model.find({
|
|
8
8
|
_id: {
|
|
9
9
|
$in: payload.filters,
|
|
@@ -23,4 +23,5 @@ exports.removeAll = (0, core_1.defineExposedFunction)(async (payload, context) =
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
return (0, core_1.remove)(payload, context);
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
|
+
exports.removeAll = removeAll;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { remove as originalRemoveAll } from "@aeriajs/core";
|
|
3
3
|
import * as fs from "fs/promises";
|
|
4
|
-
export const removeAll =
|
|
4
|
+
export const removeAll = async (payload, context) => {
|
|
5
5
|
const files = context.collection.model.find({
|
|
6
6
|
_id: {
|
|
7
7
|
$in: payload.filters
|
|
@@ -20,4 +20,4 @@ export const removeAll = defineExposedFunction(async (payload, context) => {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
return originalRemoveAll(payload, context);
|
|
23
|
-
}
|
|
23
|
+
};
|
|
@@ -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" | "
|
|
34
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
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" | "
|
|
36
|
+
}>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
|
|
37
37
|
item: import("@aeriajs/types").SchemaWithId<{
|
|
38
38
|
readonly $id: "resourceUsage";
|
|
39
39
|
readonly required: readonly ["usage"];
|
|
@@ -7,4 +7,4 @@ export declare enum ActivationErrors {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const activate: (payload: {
|
|
9
9
|
password: string;
|
|
10
|
-
}, context: Context<typeof description>) => Promise<import("@aeriajs/types").
|
|
10
|
+
}, context: Context<typeof description>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
|
|
@@ -10,7 +10,7 @@ var ActivationErrors;
|
|
|
10
10
|
ActivationErrors["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
|
|
11
11
|
ActivationErrors["InvalidLink"] = "INVALID_LINK";
|
|
12
12
|
})(ActivationErrors || (exports.ActivationErrors = ActivationErrors = {}));
|
|
13
|
-
|
|
13
|
+
const activate = async (payload, context) => {
|
|
14
14
|
const { u: userId, t: token, } = context.request.query;
|
|
15
15
|
if (!userId || !token) {
|
|
16
16
|
return (0, common_1.left)(ActivationErrors.InvalidLink);
|
|
@@ -58,4 +58,5 @@ exports.activate = (0, core_1.defineExposedFunction)(async (payload, context) =>
|
|
|
58
58
|
return context.response.writeHead(302, {
|
|
59
59
|
location: '/user/activation',
|
|
60
60
|
});
|
|
61
|
-
}
|
|
61
|
+
};
|
|
62
|
+
exports.activate = activate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { ObjectId } from "@aeriajs/core";
|
|
3
3
|
import { left, right } from "@aeriajs/common";
|
|
4
4
|
import * as bcrypt from "bcrypt";
|
|
5
5
|
export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
|
|
@@ -8,7 +8,7 @@ export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
|
|
|
8
8
|
ActivationErrors2["InvalidLink"] = "INVALID_LINK";
|
|
9
9
|
return ActivationErrors2;
|
|
10
10
|
})(ActivationErrors || {});
|
|
11
|
-
export const activate =
|
|
11
|
+
export const activate = async (payload, context) => {
|
|
12
12
|
const {
|
|
13
13
|
u: userId,
|
|
14
14
|
t: token
|
|
@@ -65,4 +65,4 @@ export const activate = defineExposedFunction(async (payload, context) => {
|
|
|
65
65
|
return context.response.writeHead(302, {
|
|
66
66
|
location: "/user/activation"
|
|
67
67
|
});
|
|
68
|
-
}
|
|
68
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.authenticate = exports.getDefaultUser = exports.AuthenticationErrors = void 0;
|
|
4
|
-
const core_1 = require("@aeriajs/core");
|
|
5
4
|
const bcrypt_1 = require("bcrypt");
|
|
6
|
-
const
|
|
5
|
+
const core_1 = require("@aeriajs/core");
|
|
7
6
|
const common_1 = require("@aeriajs/common");
|
|
8
7
|
var AuthenticationErrors;
|
|
9
8
|
(function (AuthenticationErrors) {
|
|
@@ -48,7 +47,7 @@ const getUser = async (userId, context) => {
|
|
|
48
47
|
}, {});
|
|
49
48
|
tokenContent.userinfo = pick(leanUser, context.config.tokenUserProperties);
|
|
50
49
|
}
|
|
51
|
-
const token = await (0,
|
|
50
|
+
const token = await (0, core_1.signToken)(tokenContent);
|
|
52
51
|
return {
|
|
53
52
|
user: leanUser,
|
|
54
53
|
token: {
|
|
@@ -58,7 +57,7 @@ const getUser = async (userId, context) => {
|
|
|
58
57
|
};
|
|
59
58
|
};
|
|
60
59
|
const getDefaultUser = async () => {
|
|
61
|
-
const token = await (0,
|
|
60
|
+
const token = await (0, core_1.signToken)({
|
|
62
61
|
_id: null,
|
|
63
62
|
roles: ['root'],
|
|
64
63
|
userinfo: {},
|
|
@@ -85,7 +84,7 @@ const authenticate = async (props, context) => {
|
|
|
85
84
|
return (0, common_1.left)(AuthenticationErrors.Unauthenticated);
|
|
86
85
|
}
|
|
87
86
|
const decodedToken = token
|
|
88
|
-
? await (0,
|
|
87
|
+
? await (0, core_1.decodeToken)(token.content)
|
|
89
88
|
: context.token;
|
|
90
89
|
return (0, common_1.right)(decodedToken.sub
|
|
91
90
|
? await getUser(decodedToken.sub, context)
|
|
@@ -117,6 +116,3 @@ const authenticate = async (props, context) => {
|
|
|
117
116
|
return (0, common_1.right)(await getUser(user._id, context));
|
|
118
117
|
};
|
|
119
118
|
exports.authenticate = authenticate;
|
|
120
|
-
(0, core_1.defineFunctionAttributes)(exports.authenticate, {
|
|
121
|
-
exposed: true,
|
|
122
|
-
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import { defineFunctionAttributes } from "@aeriajs/core";
|
|
3
2
|
import { compare as bcryptCompare } from "bcrypt";
|
|
4
3
|
import { signToken, decodeToken } from "@aeriajs/core";
|
|
5
4
|
import { left, right } from "@aeriajs/common";
|
|
@@ -111,6 +110,3 @@ export const authenticate = async (props, context) => {
|
|
|
111
110
|
}
|
|
112
111
|
return right(await getUser(user._id, context));
|
|
113
112
|
};
|
|
114
|
-
defineFunctionAttributes(authenticate, {
|
|
115
|
-
exposed: true
|
|
116
|
-
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAccount = void 0;
|
|
4
|
-
const core_1 = require("@aeriajs/core");
|
|
5
4
|
const common_1 = require("@aeriajs/common");
|
|
6
5
|
const validation_1 = require("@aeriajs/validation");
|
|
7
6
|
const bcrypt = require("bcrypt");
|
|
8
|
-
|
|
7
|
+
const createAccount = async (payload, context) => {
|
|
9
8
|
const user = Object.assign({}, payload);
|
|
10
9
|
if (!context.config.security.allowSignup) {
|
|
11
10
|
throw new Error('signup disallowed');
|
|
@@ -60,4 +59,5 @@ exports.createAccount = (0, core_1.defineExposedFunction)(async (payload, contex
|
|
|
60
59
|
throw new Error();
|
|
61
60
|
}
|
|
62
61
|
return (0, common_1.right)(newUser);
|
|
63
|
-
}
|
|
62
|
+
};
|
|
63
|
+
exports.createAccount = createAccount;
|