mushroom-cli 1.2.0-alpha.21 → 1.2.0-alpha.23
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 +6 -2
- 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
|
}
|
|
@@ -259,7 +259,7 @@ export function genTypescriptDriverString(aliasProject, source) {
|
|
|
259
259
|
extensionsCodeLines.push('FileExtension.useFile(mushroom);');
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
let code = `import mushroom, { defineAsyncResource, defineAsyncView, fireEvent, createRestfulAsyncFunction, IdType, IMushroom, Mushroom, MushroomRequest, MushroomRequestSetting, MushroomRestfulRequest, MushroomResponse, MushroomResponseDataType, MushroomResourceBase, MushroomListResource, MushroomFindByIdResource, MushroomCreateResource, MushroomBatchCreateResource, MushroomUpdateResource, MushroomBatchUpdateResource, MushroomPartialUpdateResource, MushroomDeleteResource, MushroomBatchDeleteResource, MushroomExtensibleResource, MushroomViewFunction, MushroomError, IMushroomOfflineResponse, MushroomOfflineResponse, MushroomOfflineResponseState } from "mushroomjs";
|
|
262
|
+
let code = `import mushroom, { defineAsyncResource, defineAsyncView, fireEvent, createRestfulAsyncFunction, IdType, IMushroom, Mushroom, MushroomRequest, MushroomRequestSetting, MushroomRestfulRequest, MushroomResponse, MushroomResponseDataType, MushroomResourceBase, MushroomListResource, MushroomCountResource, MushroomFindByIdResource, MushroomCreateResource, MushroomBatchCreateResource, MushroomUpdateResource, MushroomBatchUpdateResource, MushroomPartialUpdateResource, MushroomDeleteResource, MushroomBatchDeleteResource, MushroomExtensibleResource, MushroomViewFunction, MushroomError, IMushroomOfflineResponse, MushroomOfflineResponse, MushroomOfflineResponseState } from "mushroomjs";
|
|
263
263
|
${extensionsImportLines.join('\n')}
|
|
264
264
|
export * from "mushroomjs";
|
|
265
265
|
export const extensions = {
|
|
@@ -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';
|
|
318
320
|
break;
|
|
319
321
|
}
|
|
320
322
|
case 'findById': {
|
|
@@ -437,7 +439,7 @@ export function genDtsString(aliasProject, source) {
|
|
|
437
439
|
extensionsTypes.push('FileExtension.IMushroomFile & ');
|
|
438
440
|
}
|
|
439
441
|
}
|
|
440
|
-
let code = `import { IdType, IMushroom, Mushroom, MushroomRequest, MushroomRequestSetting, MushroomRestfulRequest, MushroomResponse, MushroomResponseDataType, MushroomResourceBase, MushroomListResource, MushroomFindByIdResource, MushroomCreateResource, MushroomBatchCreateResource, MushroomUpdateResource, MushroomBatchUpdateResource, MushroomPartialUpdateResource, MushroomDeleteResource, MushroomBatchDeleteResource, MushroomExtensibleResource, MushroomViewFunction, MushroomError, IMushroomOfflineResponse, MushroomOfflineResponse, MushroomOfflineResponseState } from "mushroomjs";
|
|
442
|
+
let code = `import { IdType, IMushroom, Mushroom, MushroomRequest, MushroomRequestSetting, MushroomRestfulRequest, MushroomResponse, MushroomResponseDataType, MushroomResourceBase, MushroomListResource, MushroomCountResource, MushroomFindByIdResource, MushroomCreateResource, MushroomBatchCreateResource, MushroomUpdateResource, MushroomBatchUpdateResource, MushroomPartialUpdateResource, MushroomDeleteResource, MushroomBatchDeleteResource, MushroomExtensibleResource, MushroomViewFunction, MushroomError, IMushroomOfflineResponse, MushroomOfflineResponse, MushroomOfflineResponseState } from "mushroomjs";
|
|
441
443
|
${extensionsImportLines.join('\n')}
|
|
442
444
|
export * from "mushroomjs";
|
|
443
445
|
export declare const extensions = {
|
|
@@ -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';
|
|
495
499
|
break;
|
|
496
500
|
}
|
|
497
501
|
case 'findById': {
|