not-node 6.2.18 → 6.2.19
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/.husky/pre-commit +4 -0
- package/package.json +7 -4
- package/src/auth/roles.js +9 -1
- package/src/auth/rules.js +5 -5
- package/src/cli/actions/env.mjs +1 -1
- package/src/cli/actions/nginx.mjs +1 -1
- package/src/cli/actions/pm2.mjs +1 -1
- package/src/common.js +1 -1
- package/src/domain.js +36 -24
- package/src/identity/providers/session.js +3 -0
- package/src/manifest/batchRunner.js +5 -1
- package/src/manifest/registrator/fields.js +4 -4
- package/src/manifest/route.js +1 -0
- package/src/model/exceptions.js +3 -3
- package/src/model/versioning.js +2 -2
- package/test/auth/routes.js +34 -10
- package/test/fakes.js +52 -0
- package/test/identity/providers/session.js +14 -5
- package/test/identity/providers/token.js +1 -1
- package/test/init/additional.js +31 -33
- package/test/init/app.js +66 -10
- package/test/init/bodyparser.js +4 -1
- package/test/init/compression.js +4 -1
- package/test/init/cors.js +5 -1
- package/test/init/csp.js +2 -2
- package/test/init/db.js +5 -1
- package/test/init/env.js +12 -2
- package/test/init/express.js +4 -1
- package/test/init/fileupload.js +4 -1
- package/test/init/http.js +21 -4
- package/test/init/middleware.js +13 -1
- package/test/init/routes.js +1 -0
- package/test/init/sessions/mongoose.js +5 -1
- package/test/init/sessions/redis.js +5 -1
- package/test/init/sessions.js +21 -15
- package/test/init/static.js +4 -1
- package/test/init/template.js +5 -1
- package/test/model/versioning.js +3 -3
- package/test/module/fields.js +45 -20
- package/test/module/index.js +26 -15
- package/test/notApp.js +221 -187
- package/test/notDomain.js +799 -707
- package/test/notManifestFilter.js +385 -322
- package/test/notModule.js +689 -644
- package/test/notRoute.js +112 -99
- package/test/testies/module/fields/collection.js +16 -14
- package/test/testies/module/fields/single.js +11 -11
package/test/notRoute.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const { DEFAULT_USER_ROLE_FOR_ADMIN } = require("../src/auth");
|
|
2
|
+
const notAppIdentity = require("../src/identity");
|
|
3
|
+
|
|
1
4
|
const HttpError = require("../src/error").Http,
|
|
2
5
|
notRoute = require("../src/manifest/route"),
|
|
3
6
|
expect = require("chai").expect;
|
|
@@ -24,12 +27,10 @@ describe("notRoute", function () {
|
|
|
24
27
|
|
|
25
28
|
describe("selectRule", function () {
|
|
26
29
|
it("User(auth) request, post.list action", function () {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
},
|
|
30
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
31
|
+
auth: true,
|
|
32
|
+
});
|
|
33
|
+
let req = {},
|
|
33
34
|
actionData = {
|
|
34
35
|
method: "get",
|
|
35
36
|
rules: [
|
|
@@ -56,11 +57,10 @@ describe("notRoute", function () {
|
|
|
56
57
|
});
|
|
57
58
|
});
|
|
58
59
|
it("User(!auth) request, post.list action", function () {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
60
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
61
|
+
auth: false,
|
|
62
|
+
});
|
|
63
|
+
let req = {},
|
|
64
64
|
actionData = {
|
|
65
65
|
method: "get",
|
|
66
66
|
rules: [
|
|
@@ -88,11 +88,7 @@ describe("notRoute", function () {
|
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
it("User(auth) request, post.listAll action", function () {
|
|
91
|
-
let req = {
|
|
92
|
-
session: {
|
|
93
|
-
user: true,
|
|
94
|
-
},
|
|
95
|
-
},
|
|
91
|
+
let req = {},
|
|
96
92
|
actionData = {
|
|
97
93
|
method: "get",
|
|
98
94
|
rules: [
|
|
@@ -116,12 +112,11 @@ describe("notRoute", function () {
|
|
|
116
112
|
});
|
|
117
113
|
|
|
118
114
|
it("User(auth, manager) request, post.listAll action", function () {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
},
|
|
115
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
116
|
+
auth: true,
|
|
117
|
+
role: ["manager"],
|
|
118
|
+
});
|
|
119
|
+
let req = {},
|
|
125
120
|
actionData = {
|
|
126
121
|
method: "get",
|
|
127
122
|
rules: [
|
|
@@ -148,12 +143,13 @@ describe("notRoute", function () {
|
|
|
148
143
|
});
|
|
149
144
|
|
|
150
145
|
it("Admin request, post.listAll action", function () {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
146
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
147
|
+
auth: true,
|
|
148
|
+
root: true,
|
|
149
|
+
primaryRole: DEFAULT_USER_ROLE_FOR_ADMIN,
|
|
150
|
+
role: [DEFAULT_USER_ROLE_FOR_ADMIN],
|
|
151
|
+
});
|
|
152
|
+
let req = {},
|
|
157
153
|
actionData = {
|
|
158
154
|
method: "get",
|
|
159
155
|
rules: [
|
|
@@ -179,10 +175,11 @@ describe("notRoute", function () {
|
|
|
179
175
|
});
|
|
180
176
|
|
|
181
177
|
it("Guest request, post.list action", function () {
|
|
178
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
179
|
+
auth: false,
|
|
180
|
+
});
|
|
182
181
|
let req = {
|
|
183
|
-
|
|
184
|
-
user: false,
|
|
185
|
-
},
|
|
182
|
+
get() {},
|
|
186
183
|
},
|
|
187
184
|
actionData = {
|
|
188
185
|
method: "get",
|
|
@@ -202,11 +199,10 @@ describe("notRoute", function () {
|
|
|
202
199
|
});
|
|
203
200
|
|
|
204
201
|
it("actionData - null", function () {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
},
|
|
202
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
203
|
+
auth: false,
|
|
204
|
+
});
|
|
205
|
+
let req = {},
|
|
210
206
|
actionData = false,
|
|
211
207
|
routerAction = new notRoute(
|
|
212
208
|
{},
|
|
@@ -240,9 +236,7 @@ describe("notRoute", function () {
|
|
|
240
236
|
};
|
|
241
237
|
it("Guest request post.list", function (done) {
|
|
242
238
|
let req = {
|
|
243
|
-
|
|
244
|
-
user: false,
|
|
245
|
-
},
|
|
239
|
+
get() {},
|
|
246
240
|
},
|
|
247
241
|
actionData = {
|
|
248
242
|
method: "get",
|
|
@@ -281,11 +275,14 @@ describe("notRoute", function () {
|
|
|
281
275
|
return fakeMod;
|
|
282
276
|
},
|
|
283
277
|
};
|
|
278
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
279
|
+
auth: true,
|
|
280
|
+
root: true,
|
|
281
|
+
primaryRole: DEFAULT_USER_ROLE_FOR_ADMIN,
|
|
282
|
+
role: [DEFAULT_USER_ROLE_FOR_ADMIN],
|
|
283
|
+
});
|
|
284
284
|
let req = {
|
|
285
|
-
|
|
286
|
-
user: true,
|
|
287
|
-
role: "root",
|
|
288
|
-
},
|
|
285
|
+
get() {},
|
|
289
286
|
},
|
|
290
287
|
actionData = {
|
|
291
288
|
method: "get",
|
|
@@ -331,11 +328,14 @@ describe("notRoute", function () {
|
|
|
331
328
|
return fakeMod;
|
|
332
329
|
},
|
|
333
330
|
};
|
|
331
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
332
|
+
auth: true,
|
|
333
|
+
root: false,
|
|
334
|
+
primaryRole: "manager",
|
|
335
|
+
role: ["manager"],
|
|
336
|
+
});
|
|
334
337
|
let req = {
|
|
335
|
-
|
|
336
|
-
user: true,
|
|
337
|
-
role: "manager",
|
|
338
|
-
},
|
|
338
|
+
get() {},
|
|
339
339
|
},
|
|
340
340
|
actionData = {
|
|
341
341
|
method: "get",
|
|
@@ -381,10 +381,11 @@ describe("notRoute", function () {
|
|
|
381
381
|
return fakeMod;
|
|
382
382
|
},
|
|
383
383
|
};
|
|
384
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
385
|
+
auth: true,
|
|
386
|
+
});
|
|
384
387
|
let req = {
|
|
385
|
-
|
|
386
|
-
user: true,
|
|
387
|
-
},
|
|
388
|
+
get() {},
|
|
388
389
|
},
|
|
389
390
|
actionData = {
|
|
390
391
|
method: "get",
|
|
@@ -432,11 +433,14 @@ describe("notRoute", function () {
|
|
|
432
433
|
return fakeMod;
|
|
433
434
|
},
|
|
434
435
|
};
|
|
436
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
437
|
+
auth: true,
|
|
438
|
+
root: true,
|
|
439
|
+
primaryRole: DEFAULT_USER_ROLE_FOR_ADMIN,
|
|
440
|
+
role: [DEFAULT_USER_ROLE_FOR_ADMIN],
|
|
441
|
+
});
|
|
435
442
|
let req = {
|
|
436
|
-
|
|
437
|
-
user: true,
|
|
438
|
-
role: "root",
|
|
439
|
-
},
|
|
443
|
+
get() {},
|
|
440
444
|
},
|
|
441
445
|
actionData = {
|
|
442
446
|
method: "get",
|
|
@@ -487,11 +491,14 @@ describe("notRoute", function () {
|
|
|
487
491
|
return fakeMod;
|
|
488
492
|
},
|
|
489
493
|
};
|
|
494
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
495
|
+
auth: true,
|
|
496
|
+
root: true,
|
|
497
|
+
primaryRole: DEFAULT_USER_ROLE_FOR_ADMIN,
|
|
498
|
+
role: [DEFAULT_USER_ROLE_FOR_ADMIN],
|
|
499
|
+
});
|
|
490
500
|
let req = {
|
|
491
|
-
|
|
492
|
-
user: true,
|
|
493
|
-
role: "root",
|
|
494
|
-
},
|
|
501
|
+
get() {},
|
|
495
502
|
},
|
|
496
503
|
actionData = {
|
|
497
504
|
method: "get",
|
|
@@ -543,11 +550,14 @@ describe("notRoute", function () {
|
|
|
543
550
|
return fakeMod;
|
|
544
551
|
},
|
|
545
552
|
};
|
|
553
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
554
|
+
auth: true,
|
|
555
|
+
root: true,
|
|
556
|
+
primaryRole: DEFAULT_USER_ROLE_FOR_ADMIN,
|
|
557
|
+
role: [DEFAULT_USER_ROLE_FOR_ADMIN],
|
|
558
|
+
});
|
|
546
559
|
let req = {
|
|
547
|
-
|
|
548
|
-
user: true,
|
|
549
|
-
role: "root",
|
|
550
|
-
},
|
|
560
|
+
get() {},
|
|
551
561
|
},
|
|
552
562
|
actionData = {
|
|
553
563
|
method: "get",
|
|
@@ -599,10 +609,11 @@ describe("notRoute", function () {
|
|
|
599
609
|
return fakeMod;
|
|
600
610
|
},
|
|
601
611
|
};
|
|
612
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
613
|
+
auth: true,
|
|
614
|
+
});
|
|
602
615
|
let req = {
|
|
603
|
-
|
|
604
|
-
user: true,
|
|
605
|
-
},
|
|
616
|
+
get() {},
|
|
606
617
|
},
|
|
607
618
|
actionData = {
|
|
608
619
|
method: "get",
|
|
@@ -654,10 +665,11 @@ describe("notRoute", function () {
|
|
|
654
665
|
return fakeMod;
|
|
655
666
|
},
|
|
656
667
|
};
|
|
668
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
669
|
+
auth: true,
|
|
670
|
+
});
|
|
657
671
|
let req = {
|
|
658
|
-
|
|
659
|
-
user: true,
|
|
660
|
-
},
|
|
672
|
+
get() {},
|
|
661
673
|
},
|
|
662
674
|
actionData = {
|
|
663
675
|
method: "get",
|
|
@@ -709,11 +721,15 @@ describe("notRoute", function () {
|
|
|
709
721
|
return fakeMod;
|
|
710
722
|
},
|
|
711
723
|
};
|
|
724
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
725
|
+
auth: true,
|
|
726
|
+
root: false,
|
|
727
|
+
role: ["manager"],
|
|
728
|
+
primaryRole: "manager",
|
|
729
|
+
});
|
|
730
|
+
|
|
712
731
|
let req = {
|
|
713
|
-
|
|
714
|
-
user: true,
|
|
715
|
-
role: "manager",
|
|
716
|
-
},
|
|
732
|
+
get() {},
|
|
717
733
|
},
|
|
718
734
|
actionData = {
|
|
719
735
|
method: "get",
|
|
@@ -739,7 +755,7 @@ describe("notRoute", function () {
|
|
|
739
755
|
actionData
|
|
740
756
|
);
|
|
741
757
|
routerAction
|
|
742
|
-
.exec(req)
|
|
758
|
+
.exec(req, false, done)
|
|
743
759
|
.then((result) => {
|
|
744
760
|
expect(result).to.deep.equal("__list");
|
|
745
761
|
done();
|
|
@@ -767,10 +783,7 @@ describe("notRoute", function () {
|
|
|
767
783
|
},
|
|
768
784
|
};
|
|
769
785
|
let req = {
|
|
770
|
-
|
|
771
|
-
user: true,
|
|
772
|
-
role: "manager",
|
|
773
|
-
},
|
|
786
|
+
get() {},
|
|
774
787
|
},
|
|
775
788
|
actionData = {
|
|
776
789
|
method: "get",
|
|
@@ -821,10 +834,7 @@ describe("notRoute", function () {
|
|
|
821
834
|
},
|
|
822
835
|
};
|
|
823
836
|
let req = {
|
|
824
|
-
|
|
825
|
-
user: true,
|
|
826
|
-
role: "manager",
|
|
827
|
-
},
|
|
837
|
+
get() {},
|
|
828
838
|
},
|
|
829
839
|
actionData = {
|
|
830
840
|
method: "get",
|
|
@@ -857,12 +867,14 @@ describe("notRoute", function () {
|
|
|
857
867
|
});
|
|
858
868
|
|
|
859
869
|
it("Wrong rule", function () {
|
|
860
|
-
let
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
870
|
+
let reported = false;
|
|
871
|
+
notAppIdentity.identity = require("./fakes").fakeIdentity({
|
|
872
|
+
auth: true,
|
|
873
|
+
root: false,
|
|
874
|
+
role: ["user", "confirmed"],
|
|
875
|
+
primaryRole: "manager",
|
|
876
|
+
});
|
|
877
|
+
let req = {},
|
|
866
878
|
actionData = {
|
|
867
879
|
method: "get",
|
|
868
880
|
rules: [
|
|
@@ -877,20 +889,25 @@ describe("notRoute", function () {
|
|
|
877
889
|
],
|
|
878
890
|
},
|
|
879
891
|
routerAction = new notRoute(
|
|
880
|
-
{
|
|
892
|
+
{
|
|
893
|
+
report(e) {
|
|
894
|
+
console.error(e);
|
|
895
|
+
reported = true;
|
|
896
|
+
},
|
|
897
|
+
getModule() {},
|
|
898
|
+
},
|
|
881
899
|
"not-user",
|
|
882
900
|
"post",
|
|
883
901
|
"list",
|
|
884
902
|
actionData
|
|
885
903
|
);
|
|
886
904
|
routerAction.exec(req, false, (err) => {
|
|
887
|
-
expect(err).to.be.
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
"rule for router not found; not-user; post"
|
|
891
|
-
)
|
|
905
|
+
expect(err).to.be.instanceof(Error);
|
|
906
|
+
expect(err.message).to.be.deep.equal(
|
|
907
|
+
"rule for router not found; not-user; post"
|
|
892
908
|
);
|
|
893
909
|
});
|
|
910
|
+
expect(reported).to.be.false;
|
|
894
911
|
});
|
|
895
912
|
|
|
896
913
|
it("Route is not runnable", function () {
|
|
@@ -906,6 +923,7 @@ describe("notRoute", function () {
|
|
|
906
923
|
getModule() {
|
|
907
924
|
return fakeMod;
|
|
908
925
|
},
|
|
926
|
+
report() {},
|
|
909
927
|
},
|
|
910
928
|
req = {
|
|
911
929
|
session: {
|
|
@@ -947,12 +965,7 @@ describe("notRoute", function () {
|
|
|
947
965
|
throwned = true;
|
|
948
966
|
},
|
|
949
967
|
},
|
|
950
|
-
req = {
|
|
951
|
-
session: {
|
|
952
|
-
user: true,
|
|
953
|
-
role: "user",
|
|
954
|
-
},
|
|
955
|
-
},
|
|
968
|
+
req = {},
|
|
956
969
|
actionData = {
|
|
957
970
|
method: "get",
|
|
958
971
|
rules: [
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
exports
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
module.exports = {
|
|
2
|
+
FIELDS: {
|
|
3
|
+
collectionItem: {
|
|
4
|
+
ui: {
|
|
5
|
+
component: "UITextfield",
|
|
6
|
+
placeholder: "collectionItem",
|
|
7
|
+
label: "collectionItem",
|
|
8
|
+
readonly: true,
|
|
9
|
+
},
|
|
10
|
+
model: {
|
|
11
|
+
type: String,
|
|
12
|
+
searchable: true,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
15
17
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
ui: {
|
|
3
|
+
component: "UITextfield",
|
|
4
|
+
placeholder: "single",
|
|
5
|
+
label: "single",
|
|
6
|
+
readonly: true,
|
|
7
|
+
},
|
|
8
|
+
model: {
|
|
9
|
+
type: String,
|
|
10
|
+
searchable: true,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
13
|
};
|