From 25a58a1eab8edd3591f2a82e56995b72c305c594 Mon Sep 17 00:00:00 2001 From: Guillermo Puente Date: Tue, 23 Jan 2024 08:41:18 -0300 Subject: [PATCH 1/3] chore: updated document-model lib ver + type fix --- package.json | 2 +- .../powerhouse/generate-document-model-module/index.ts | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 7062ceb..9ff9ca6 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts b/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts index 6dc5662..a4f9e22 100644 --- a/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts +++ b/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts @@ -32,4 +32,4 @@ export default { : [], }; }, -}; +} as any; diff --git a/yarn.lock b/yarn.lock index 529d1e2..e57c06e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" From e2993e09a59cb6148bf739d7151f9b9e07e307dc Mon Sep 17 00:00:00 2001 From: Guillermo Puente Date: Tue, 23 Jan 2024 08:41:23 -0300 Subject: [PATCH 2/3] 0.0.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9ff9ca6..cd2e967 100644 --- a/package.json +++ b/package.json @@ -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", From 3c04aceb1d1b9cad15cb4c5921d1d749212c0ae3 Mon Sep 17 00:00:00 2001 From: Guillermo Puente Date: Wed, 24 Jan 2024 10:26:14 -0300 Subject: [PATCH 3/3] fix: PR comments --- .../generate-document-model-module/index.ts | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts b/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts index a4f9e22..eb5cefd 100644 --- a/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts +++ b/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts @@ -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; + hasInput: boolean; + hasAttachment: boolean | undefined; + scope: OperationScope; + state: string; +}; + export default { params: ({ args }: { args: ModuleArgs }) => { const documentModel = JSON.parse( @@ -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; +};