Skip to content

Commit

Permalink
fix: PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gpuente committed Jan 24, 2024
1 parent e2993e0 commit 3c04ace
Showing 1 changed file with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { DocumentModelState } from 'document-model/document-model';
import { paramCase } from 'change-case';
import { Maybe, OperationScope } from 'document-model/document';
import { Args } from '../generate-document-model';

type ModuleArgs = Args & { module: string };
type Actions = {
name: Maybe<string>;
hasInput: boolean;
hasAttachment: boolean | undefined;
scope: OperationScope;
state: string;
};

export default {
params: ({ args }: { args: ModuleArgs }) => {
const documentModel = JSON.parse(
Expand All @@ -16,20 +25,22 @@ export default {
m => m.name === args.module,
);

const actions: Actions[] =
filteredModules.length > 0
? filteredModules[0].operations.map(a => ({
name: a.name,
hasInput: a.schema !== null,
hasAttachment: a.schema?.includes(': Attachment'),
scope: a.scope || 'global',
state: a.scope === 'global' ? '' : a.scope, // the state this action affects
}))
: [];

return {
rootDir: args.rootDir,
documentType: documentModel.name,
module: paramCase(args.module),
actions:
filteredModules.length > 0
? filteredModules[0].operations.map(a => ({
name: a.name,
hasInput: a.schema !== null,
hasAttachment: a.schema?.includes(': Attachment'),
scope: a.scope || 'global',
state: a.scope === 'global' ? '' : a.scope, // the state this action affects
}))
: [],
actions,
};
},
} as any;
};

0 comments on commit 3c04ace

Please sign in to comment.