Skip to content

Commit

Permalink
Merge pull request #24 from powerhouse-inc/ver-0.0.11
Browse files Browse the repository at this point in the history
v0.0.11
  • Loading branch information
gpuente authored Jan 24, 2024
2 parents 279d02b + 3c04ace commit 35da32d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@powerhousedao/codegen",
"version": "0.0.10",
"version": "0.0.11",
"license": "AGPL-3.0-only",
"private": false,
"main": "dist/index.js",
Expand Down Expand Up @@ -33,7 +33,7 @@
"@types/node": "^20.11.2",
"arg": "^5.0.2",
"change-case": "^4.1.2",
"document-model": "^1.0.20",
"document-model": "^1.0.25",
"enquirer": "^2.4.1",
"execa": "^8.0.1",
"hygen": "^6.2.11",
Expand Down
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,
};
},
};
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2183,10 +2183,10 @@ doctrine@^3.0.0:
dependencies:
esutils "^2.0.2"

document-model@^1.0.20:
version "1.0.20"
resolved "https://registry.yarnpkg.com/document-model/-/document-model-1.0.20.tgz#9a4ef989e5c9e53cbaa04719c8ffcdba3fffdd15"
integrity sha512-bRJswH99+KDqVusnd1paYLooWCcwGRbtF6TV0flVebmy/T/23uI7eo39KsolT3x6fmgJI5OIjmPEDwPu8+ntEQ==
document-model@^1.0.25:
version "1.0.25"
resolved "https://registry.yarnpkg.com/document-model/-/document-model-1.0.25.tgz#10d218ad54dd98e004a01c83e523e98de3389293"
integrity sha512-3N8jjYO2pCJ51uAPM1Gue9WqOOuwVfhLOG7ax30JYvRqFLKdKjSQs1v9UIY42STgyqeuKidJVKUE8Non1/e3Ag==
dependencies:
immer "^10.0.2"
json-stringify-deterministic "^1.0.10"
Expand Down

0 comments on commit 35da32d

Please sign in to comment.