mushroom-cli 1.2.0-alpha.21 → 1.2.0-alpha.22
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/README.md +6 -0
- package/dist/common.js +16 -8
- package/dist/gen/gen-ts-driver.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/common.js
CHANGED
|
@@ -51,14 +51,18 @@ export function getEntities(projectApiConfiguration, roles, getAll) {
|
|
|
51
51
|
var _a;
|
|
52
52
|
if (!action.grant || !action.enabled || (action.codeHint && action.codeHint.disabled))
|
|
53
53
|
return;
|
|
54
|
-
|
|
54
|
+
const allow = roles?.includes('*') || action.grant === '*';
|
|
55
55
|
if (!allow) {
|
|
56
|
-
action.grant = action.grant
|
|
56
|
+
action.grant = action.grant
|
|
57
|
+
.split('|')
|
|
58
|
+
.map((roleGroup) => {
|
|
57
59
|
if (!roleGroup)
|
|
58
60
|
return null;
|
|
59
|
-
const ok = roleGroup.split('+').every(grantedRole => roles?.includes(grantedRole));
|
|
61
|
+
const ok = roleGroup.split('+').every((grantedRole) => roles?.includes(grantedRole));
|
|
60
62
|
return ok ? roleGroup : null;
|
|
61
|
-
})
|
|
63
|
+
})
|
|
64
|
+
.filter((roleGroup) => roleGroup)
|
|
65
|
+
.join('|');
|
|
62
66
|
if (!action.grant)
|
|
63
67
|
return;
|
|
64
68
|
}
|
|
@@ -81,14 +85,18 @@ export function getEntities(projectApiConfiguration, roles, getAll) {
|
|
|
81
85
|
var _a;
|
|
82
86
|
if (!view.grant || !view.enabled)
|
|
83
87
|
return;
|
|
84
|
-
|
|
88
|
+
const allow = roles?.indexOf('*') !== -1 || view.grant === '*';
|
|
85
89
|
if (!allow) {
|
|
86
|
-
view.grant = view.grant
|
|
90
|
+
view.grant = view.grant
|
|
91
|
+
.split('|')
|
|
92
|
+
.map((roleGroup) => {
|
|
87
93
|
if (!roleGroup)
|
|
88
94
|
return null;
|
|
89
|
-
const ok = roleGroup.split('+').every(grantedRole => roles?.includes(grantedRole));
|
|
95
|
+
const ok = roleGroup.split('+').every((grantedRole) => roles?.includes(grantedRole));
|
|
90
96
|
return ok ? roleGroup : null;
|
|
91
|
-
})
|
|
97
|
+
})
|
|
98
|
+
.filter((roleGroup) => roleGroup)
|
|
99
|
+
.join('|');
|
|
92
100
|
if (!view.grant)
|
|
93
101
|
return;
|
|
94
102
|
}
|
|
@@ -315,6 +315,8 @@ export interface CustomMethodBodyRequest<TBody> extends MushroomRequest {
|
|
|
315
315
|
switch (actionName) {
|
|
316
316
|
case 'findMany': {
|
|
317
317
|
iApiClassBody += ` & MushroomListResource<${typescriptClassName}>`;
|
|
318
|
+
if (includeTotal)
|
|
319
|
+
iApiClassBody += ` & MushroomCountResource<${typescriptClassName}>`;
|
|
318
320
|
break;
|
|
319
321
|
}
|
|
320
322
|
case 'findById': {
|
|
@@ -492,6 +494,8 @@ export interface CustomMethodBodyRequest<TBody> extends MushroomRequest {
|
|
|
492
494
|
switch (actionName) {
|
|
493
495
|
case 'findMany': {
|
|
494
496
|
iApiClassBody += ` & MushroomListResource<${typescriptClassName}>`;
|
|
497
|
+
if (includeTotal)
|
|
498
|
+
iApiClassBody += ` & MushroomCountResource<${typescriptClassName}>`;
|
|
495
499
|
break;
|
|
496
500
|
}
|
|
497
501
|
case 'findById': {
|