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 CHANGED
@@ -132,6 +132,12 @@ npx mushroom-cli parameters --no-check-update
132
132
 
133
133
  ## Version
134
134
 
135
+ ### 1.2.0-alpha.22
136
+
137
+ Improvement:
138
+
139
+ - gen-ts: generate type for getCountAsync declaration
140
+
135
141
  ### 1.2.0-alpha.21
136
142
 
137
143
  Improvement:
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
- let allow = roles?.includes('*') || action.grant === '*';
54
+ const allow = roles?.includes('*') || action.grant === '*';
55
55
  if (!allow) {
56
- action.grant = action.grant.split('|').map(roleGroup => {
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
- }).filter(roleGroup => roleGroup).join('|');
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
- let allow = roles?.indexOf('*') !== -1 || view.grant === '*';
88
+ const allow = roles?.indexOf('*') !== -1 || view.grant === '*';
85
89
  if (!allow) {
86
- view.grant = view.grant.split('|').map(roleGroup => {
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
- }).filter(roleGroup => roleGroup).join('|');
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': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mushroom-cli",
3
- "version": "1.2.0-alpha.21",
3
+ "version": "1.2.0-alpha.23",
4
4
  "description": "Mushroom CLI",
5
5
  "main": "dist/mr.js",
6
6
  "type": "module",