@powerhousedao/codegen 0.37.4 → 0.39.0
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/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModel.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/object.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +5 -6
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +6 -12
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +16 -9
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/actions.esm.t +3 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t +1 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/object.esm.t +4 -4
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/operations.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-mutations/resolvers.esm.t +11 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-mutations/schema.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editor.esm.t +3 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.esm.t +3 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/story.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/utils.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-operational/index.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.esm.t +1 -1
- package/dist/src/codegen/graphql.d.ts.map +1 -1
- package/dist/src/create-lib/create-project.d.ts.map +1 -1
- package/dist/src/create-lib/create-project.js +6 -2
- package/dist/tsconfig.hygen.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -6
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/object.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import {
|
|
5
|
+
import { BaseDocumentClass, ExtendedState, PartialState, applyMixins, SignalDispatch } from 'document-model';
|
|
6
6
|
import { <%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState } from './types';
|
|
7
7
|
import { <%= h.changeCase.pascal(documentType) %>Action } from './actions';
|
|
8
8
|
import { reducer } from './reducer';
|
|
@@ -20,7 +20,7 @@ interface <%= h.changeCase.pascal(documentType) %> extends
|
|
|
20
20
|
<%= modules.map(m => ' ' + h.changeCase.pascal(documentType) + '_' + h.changeCase.pascal(m.name)).join(',\n') %> {}
|
|
21
21
|
|
|
22
22
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
23
|
-
class <%= h.changeCase.pascal(documentType) %> extends
|
|
23
|
+
class <%= h.changeCase.pascal(documentType) %> extends BaseDocumentClass<<%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState, <%= h.changeCase.pascal(documentType) %>Action> {
|
|
24
24
|
static fileExtension = '<%= extension %>';
|
|
25
25
|
|
|
26
26
|
constructor(initialState?: Partial<ExtendedState<PartialState<<%= h.changeCase.pascal(documentType) %>State>, PartialState<<%= h.changeCase.pascal(documentType) %>LocalState>>>, dispatch?: SignalDispatch) {
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/reducer.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import {
|
|
6
|
-
import { <%= h.changeCase.pascal(documentType) %>
|
|
7
|
-
import { <%= h.changeCase.pascal(documentType) %>Action } from './actions';
|
|
5
|
+
import { StateReducer, isDocumentAction, createReducer } from "document-model";
|
|
6
|
+
import { <%= h.changeCase.pascal(documentType) %>Document, z } from './types';
|
|
8
7
|
|
|
9
8
|
<% modules.forEach(m => { _%>
|
|
10
9
|
import { reducer as <%= h.changeCase.pascal(m.name) %>Reducer } from '../src/reducers/<%= h.changeCase.param(m.name) %>';
|
|
11
10
|
<%_ }); %>
|
|
12
11
|
|
|
13
|
-
const stateReducer:
|
|
12
|
+
const stateReducer: StateReducer<<%= h.changeCase.pascal(documentType) %>Document> =
|
|
14
13
|
(state, action, dispatch) => {
|
|
15
|
-
if (
|
|
14
|
+
if (isDocumentAction(action)) {
|
|
16
15
|
return state;
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -32,4 +31,4 @@ const stateReducer: ImmutableStateReducer<<%= h.changeCase.pascal(documentType)
|
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
export const reducer =
|
|
34
|
+
export const reducer = createReducer<<%= h.changeCase.pascal(documentType) %>Document>(stateReducer);
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t
CHANGED
|
@@ -7,35 +7,29 @@ force: true
|
|
|
7
7
|
* Delete the file and run the code generator again to have it reset
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { actions as BaseActions,
|
|
11
|
-
import { actions as <%= h.changeCase.pascal(documentType) %>Actions
|
|
10
|
+
import { actions as BaseActions, DocumentModelModule } from 'document-model';
|
|
11
|
+
import { actions as <%= h.changeCase.pascal(documentType) %>Actions } from './gen';
|
|
12
12
|
import { reducer } from './gen/reducer';
|
|
13
13
|
import { documentModel } from './gen/document-model';
|
|
14
14
|
import genUtils from './gen/utils';
|
|
15
15
|
import * as customUtils from './src/utils';
|
|
16
16
|
import {
|
|
17
|
-
<%= h.changeCase.pascal(documentType) %>
|
|
18
|
-
<%= h.changeCase.pascal(documentType) %>Action,
|
|
19
|
-
<%= h.changeCase.pascal(documentType) %>LocalState,
|
|
17
|
+
<%= h.changeCase.pascal(documentType) %>Document,
|
|
20
18
|
} from './gen/types';
|
|
21
19
|
|
|
22
|
-
const Document = <%= h.changeCase.pascal(documentType) %>;
|
|
23
20
|
const utils = { ...genUtils, ...customUtils };
|
|
24
21
|
const actions = { ...BaseActions, ...<%= h.changeCase.pascal(documentType) %>Actions };
|
|
25
22
|
|
|
26
|
-
export const module:
|
|
27
|
-
<%= h.changeCase.pascal(documentType) %>
|
|
28
|
-
<%= h.changeCase.pascal(documentType) %>Action,
|
|
29
|
-
<%= h.changeCase.pascal(documentType) %>LocalState
|
|
23
|
+
export const module: DocumentModelModule<
|
|
24
|
+
<%= h.changeCase.pascal(documentType) %>Document
|
|
30
25
|
> = {
|
|
31
|
-
Document,
|
|
32
26
|
reducer,
|
|
33
27
|
actions,
|
|
34
28
|
utils,
|
|
35
29
|
documentModel,
|
|
36
30
|
};
|
|
37
31
|
|
|
38
|
-
export {
|
|
32
|
+
export { reducer, actions, utils, documentModel };
|
|
39
33
|
|
|
40
34
|
export * from './gen/types';
|
|
41
35
|
export * from './src/utils';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/types.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import type {
|
|
5
|
+
import type { PHDocument, ExtendedState } from 'document-model';
|
|
6
6
|
import type { <%= h.changeCase.pascal(documentType) %>State } from './schema/types';
|
|
7
7
|
<% if(hasLocalSchema) { -%>
|
|
8
8
|
import type { <%= h.changeCase.pascal(documentType) %>LocalState } from './schema/types';
|
|
@@ -15,5 +15,5 @@ export type * from './schema/types';
|
|
|
15
15
|
type <%= h.changeCase.pascal(documentType) %>LocalState = Record<PropertyKey, never>;
|
|
16
16
|
<%} -%>
|
|
17
17
|
export type Extended<%= h.changeCase.pascal(documentType) %>State = ExtendedState<<%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState>;
|
|
18
|
-
export type <%= h.changeCase.pascal(documentType) %>Document =
|
|
18
|
+
export type <%= h.changeCase.pascal(documentType) %>Document = PHDocument<<%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState, <%= h.changeCase.pascal(documentType) %>Action>;
|
|
19
19
|
export { <%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState, <%= h.changeCase.pascal(documentType) %>Action };
|
|
@@ -2,41 +2,48 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/utils.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import { DocumentModelUtils,
|
|
6
|
-
|
|
5
|
+
import { DocumentModelUtils,
|
|
6
|
+
baseCreateDocument,
|
|
7
|
+
baseCreateExtendedState,
|
|
8
|
+
baseSaveToFile,
|
|
9
|
+
baseSaveToFileHandle,
|
|
10
|
+
baseLoadFromFile,
|
|
11
|
+
baseLoadFromInput
|
|
12
|
+
} from 'document-model';
|
|
13
|
+
import { <%= h.changeCase.pascal(documentType) %>Document, <%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState} from './types';
|
|
7
14
|
import { reducer } from './reducer';
|
|
8
15
|
|
|
9
16
|
export const initialGlobalState: <%= h.changeCase.pascal(documentType) %>State = <%- initialGlobalState %>;
|
|
10
17
|
export const initialLocalState: <%= h.changeCase.pascal(documentType) %>LocalState = <%- initialLocalState %>;
|
|
11
18
|
|
|
12
|
-
const utils: DocumentModelUtils<<%= h.changeCase.pascal(documentType) %>
|
|
19
|
+
const utils: DocumentModelUtils<<%= h.changeCase.pascal(documentType) %>Document> = {
|
|
13
20
|
fileExtension: '<%- fileExtension %>',
|
|
14
21
|
createState(state) {
|
|
15
22
|
return { global: { ...initialGlobalState, ...state?.global }, local: { ...initialLocalState, ...state?.local } };
|
|
16
23
|
},
|
|
17
24
|
createExtendedState(extendedState) {
|
|
18
|
-
return
|
|
25
|
+
return baseCreateExtendedState(
|
|
19
26
|
{ ...extendedState, documentType: '<%- documentTypeId %>' },
|
|
20
27
|
utils.createState
|
|
21
28
|
);
|
|
22
29
|
},
|
|
23
30
|
createDocument(state) {
|
|
24
|
-
return
|
|
31
|
+
return baseCreateDocument(
|
|
25
32
|
utils.createExtendedState(state),
|
|
26
33
|
utils.createState
|
|
27
34
|
);
|
|
28
35
|
},
|
|
29
36
|
saveToFile(document, path, name) {
|
|
30
|
-
return
|
|
37
|
+
return baseSaveToFile(document, path, '<%- fileExtension %>', name);
|
|
31
38
|
},
|
|
32
39
|
saveToFileHandle(document, input) {
|
|
33
|
-
return
|
|
40
|
+
return baseSaveToFileHandle(document, input);
|
|
34
41
|
},
|
|
35
42
|
loadFromFile(path) {
|
|
36
|
-
return
|
|
43
|
+
return baseLoadFromFile(path, reducer);
|
|
37
44
|
},
|
|
38
45
|
loadFromInput(input) {
|
|
39
|
-
return
|
|
46
|
+
return baseLoadFromInput(input, reducer);
|
|
40
47
|
},
|
|
41
48
|
};
|
|
42
49
|
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/actions.esm.t
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/<%= module %>/actions.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import {
|
|
5
|
+
import { BaseAction<% if (actions.find(a => a.hasAttachment)) {%>, BaseActionWithAttachment<%}%> } from 'document-model';
|
|
6
6
|
import {
|
|
7
7
|
<% actions.filter(a => a.hasInput).forEach(action => { _%>
|
|
8
8
|
<%= h.changeCase.pascal(action.name) %>Input,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
} from '../types';
|
|
11
11
|
|
|
12
12
|
<% actions.filter(a => a.hasInput).forEach(actionType => { _%>
|
|
13
|
-
export type <%= h.changeCase.pascal(actionType.name) %>Action =
|
|
13
|
+
export type <%= h.changeCase.pascal(actionType.name) %>Action = BaseAction<%if(actionType.hasAttachment){ %>WithAttachment<% } %><'<%= h.changeCase.constantCase(actionType.name) %>', <%= h.changeCase.pascal(actionType.name) %>Input, '<%= actionType.scope %>'>;
|
|
14
14
|
<% }); _%>
|
|
15
15
|
<% actions.filter(a => !a.hasInput).forEach(actionType => { _%>
|
|
16
|
-
export type <%= h.changeCase.pascal(actionType.name) %>Action =
|
|
16
|
+
export type <%= h.changeCase.pascal(actionType.name) %>Action = BaseAction<'<%= h.changeCase.constantCase(actionType.name) %>', never, '<%= actionType.scope %>'>;
|
|
17
17
|
<% }); _%>
|
|
18
18
|
|
|
19
19
|
export type <%= h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module) %>Action =
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/<%= module %>/creators.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import {
|
|
5
|
+
import { createAction<% if (actions.find(a => a.hasAttachment)) {%>, AttachmentInput<%}%> } from 'document-model';
|
|
6
6
|
import { z,
|
|
7
7
|
<% actions.filter(a => a.hasInput).forEach(action => { _%>
|
|
8
8
|
<%= h.changeCase.pascal(action.name) %>Input,
|
|
@@ -14,8 +14,6 @@ import {
|
|
|
14
14
|
<% }); _%>
|
|
15
15
|
} from './actions';
|
|
16
16
|
|
|
17
|
-
const { createAction } = utils;
|
|
18
|
-
|
|
19
17
|
<% actions.filter(a => a.hasInput).forEach(action => { _%>
|
|
20
18
|
export const <%= h.changeCase.camel(action.name) %> = (input: <%= h.changeCase.pascal(action.name) %>Input<%if(action.hasAttachment){ %>, attachments: AttachmentInput[] <% } %>) =>
|
|
21
19
|
createAction<<%= h.changeCase.pascal(action.name) %>Action>(
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t
CHANGED
|
@@ -8,7 +8,7 @@ unless_exists: true
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { generateMock } from '@powerhousedao/codegen';
|
|
11
|
-
import { utils as documentModelUtils } from 'document-model
|
|
11
|
+
import { utils as documentModelUtils } from 'document-model';
|
|
12
12
|
|
|
13
13
|
import utils from '../../gen/utils';
|
|
14
14
|
import {
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/object.esm.t
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/<%= module %>/object.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import {
|
|
5
|
+
import { BaseDocumentClass<% if (actions.find(a => a.hasAttachment)) {%>, AttachmentInput<%}%> } from 'document-model';
|
|
6
6
|
import {
|
|
7
7
|
<% actions.filter(action => action.hasInput).forEach(action => { _%>
|
|
8
8
|
<%= h.changeCase.pascal(action.name) %>Input,
|
|
@@ -17,10 +17,10 @@ import {
|
|
|
17
17
|
} from './creators';
|
|
18
18
|
import { <%= h.changeCase.pascal(documentType) %>Action } from '../actions';
|
|
19
19
|
|
|
20
|
-
export default class <%= h.changeCase.pascal(documentType) %>_<%= h.changeCase.pascal(module) %> extends
|
|
20
|
+
export default class <%= h.changeCase.pascal(documentType) %>_<%= h.changeCase.pascal(module) %> extends BaseDocumentClass<
|
|
21
21
|
<%= h.changeCase.pascal(documentType) %>State,
|
|
22
|
-
<%= h.changeCase.pascal(documentType) %>
|
|
23
|
-
<%= h.changeCase.pascal(documentType) %>
|
|
22
|
+
<%= h.changeCase.pascal(documentType) %>LocalState,
|
|
23
|
+
<%= h.changeCase.pascal(documentType) %>Action
|
|
24
24
|
> {
|
|
25
25
|
<% actions.filter(action => action.hasInput).forEach(action => { _%>
|
|
26
26
|
public <%= h.changeCase.camel(action.name) %>(input: <%= h.changeCase.pascal(action.name) %>Input<%if(action.hasAttachment){ %>, attachments: AttachmentInput[] <% } %>) {
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/operations.esm.t
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/<%= module %>/operations.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import { SignalDispatch } from 'document-model
|
|
5
|
+
import { SignalDispatch } from 'document-model';
|
|
6
6
|
import {
|
|
7
7
|
<% actions.forEach(action => { _%>
|
|
8
8
|
<%= h.changeCase.pascal(action.name) %>Action,
|
|
@@ -6,20 +6,23 @@ force: true
|
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
7
7
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
8
8
|
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
9
|
+
import { addFile } from "document-drive";
|
|
9
10
|
import { actions } from "../../document-models/<%- h.changeCase.param(documentType) %>";
|
|
10
|
-
import {
|
|
11
|
-
import { utils as docUtils } from "document-model/document";
|
|
11
|
+
import { generateId, hashKey } from "document-model";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const DEFAULT_DRIVE_ID = "powerhouse";
|
|
14
|
+
|
|
15
|
+
export const getResolvers = (subgraph: Subgraph) => {
|
|
14
16
|
const reactor = subgraph.reactor;
|
|
15
17
|
|
|
16
18
|
return ({
|
|
17
19
|
Mutation: {
|
|
18
20
|
|
|
19
21
|
<%- h.changeCase.pascal(documentType) %>_createDocument: async (_: any, args: any) => {
|
|
20
|
-
const
|
|
22
|
+
const driveId: string = args.driveId || DEFAULT_DRIVE_ID;
|
|
23
|
+
const docId = generateId();
|
|
21
24
|
|
|
22
|
-
await reactor.addDriveAction(driveId,
|
|
25
|
+
await reactor.addDriveAction(driveId, addFile({
|
|
23
26
|
id: docId,
|
|
24
27
|
name: args.name,
|
|
25
28
|
documentType: "<%- documentTypeId %>",
|
|
@@ -27,12 +30,12 @@ export const getResolvers = (subgraph: Subgraph, driveId: string) => {
|
|
|
27
30
|
{
|
|
28
31
|
branch: "main",
|
|
29
32
|
scope: "global",
|
|
30
|
-
syncId:
|
|
33
|
+
syncId: hashKey(),
|
|
31
34
|
},
|
|
32
35
|
{
|
|
33
36
|
branch: "main",
|
|
34
37
|
scope: "local",
|
|
35
|
-
syncId:
|
|
38
|
+
syncId: hashKey(),
|
|
36
39
|
}
|
|
37
40
|
],
|
|
38
41
|
}));
|
|
@@ -44,6 +47,7 @@ export const getResolvers = (subgraph: Subgraph, driveId: string) => {
|
|
|
44
47
|
<% module.operations.forEach(op => { _%>
|
|
45
48
|
<%- h.changeCase.pascal(documentType) + '_' + h.changeCase.camel(op.name)
|
|
46
49
|
%>: async (_: any, args: any) => {
|
|
50
|
+
const driveId: string = args.driveId || DEFAULT_DRIVE_ID;
|
|
47
51
|
const docId: string = args.docId || "";
|
|
48
52
|
const doc = await reactor.getDocument(driveId, docId);
|
|
49
53
|
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-mutations/schema.esm.t
CHANGED
|
@@ -13,12 +13,12 @@ Mutations: <%= h.changeCase.pascal(documentType) %>
|
|
|
13
13
|
"""
|
|
14
14
|
type Mutation {
|
|
15
15
|
|
|
16
|
-
<%- h.changeCase.pascal(documentType) %>_createDocument(name:String): String
|
|
16
|
+
<%- h.changeCase.pascal(documentType) %>_createDocument(driveId:String, name:String): String
|
|
17
17
|
|
|
18
18
|
<% modules.forEach(module => { _%>
|
|
19
19
|
<% module.operations.forEach(op => { _%>
|
|
20
20
|
<%- h.changeCase.pascal(documentType) + '_' + h.changeCase.camel(op.name)
|
|
21
|
-
%>(docId:
|
|
21
|
+
%>(driveId:String, docId:PHID, input:<%-
|
|
22
22
|
h.changeCase.pascal(documentType) + '_' + h.changeCase.pascal(op.name) %>Input): Int
|
|
23
23
|
<%_ })}); %>}
|
|
24
24
|
<% modules.forEach(module => { _%>
|
|
@@ -2,19 +2,15 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/editor.tsx"
|
|
3
3
|
unless_exists: true
|
|
4
4
|
---
|
|
5
|
-
<% if(!documentTypes.length){ %>import { Action, EditorProps } from 'document-model
|
|
5
|
+
<% if(!documentTypes.length){ %>import { Action, EditorProps } from 'document-model';<% } else { %>import { EditorProps } from 'document-model';<% } %>
|
|
6
6
|
<% documentTypes.forEach(type => { _%>
|
|
7
|
-
import { <%= documentTypesMap[type].name %>
|
|
7
|
+
import { <%= documentTypesMap[type].name %>Document, actions } from "<%= documentTypesMap[type].importPath %>";
|
|
8
8
|
%><% }); _%>
|
|
9
|
-
import { utils as documentModelUtils } from 'document-model/document';
|
|
10
9
|
import { Button } from '@powerhousedao/design-system';
|
|
11
10
|
|
|
12
|
-
export type IProps = <% if(!documentTypes.length){ %>EditorProps<unknown, Action><% } else { %><% documentTypes.forEach((type, index) => { _%>EditorProps<<%= documentTypesMap[type].name %>
|
|
11
|
+
export type IProps = <% if(!documentTypes.length){ %>EditorProps<unknown, Action><% } else { %><% documentTypes.forEach((type, index) => { _%>EditorProps<<%= documentTypesMap[type].name %>Document%>%>><% if(index < documentTypes.length - 1){ %> | <% }%><% }); _%> <% } %>;
|
|
13
12
|
|
|
14
13
|
export default function Editor(props: IProps) {
|
|
15
|
-
// generate a random id
|
|
16
|
-
// const id = documentModelUtils.hashKey();
|
|
17
|
-
|
|
18
14
|
return (
|
|
19
15
|
<div>
|
|
20
16
|
<Button onClick={() => console.log('Hello world!')}>My Button</Button>
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/index.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import {
|
|
5
|
+
import { EditorModule } from 'document-model';
|
|
6
6
|
import Editor from './editor';
|
|
7
7
|
<% documentTypes.forEach(type => { _%>
|
|
8
|
-
import { <%= documentTypesMap[type].name %>
|
|
8
|
+
import { <%= documentTypesMap[type].name %>Document } from "<%= documentTypesMap[type].importPath %>";
|
|
9
9
|
%><% }); _%>
|
|
10
10
|
|
|
11
|
-
export const module: <% if(!documentTypes.length){ %>
|
|
11
|
+
export const module: <% if(!documentTypes.length){ %>EditorModule<% } else { %><% documentTypes.forEach((type, index) => { _%>EditorModule<<%= documentTypesMap[type].name %>Document%>%>> <% if(index < documentTypes.length - 1){ %>| <% }%><% }); _%> <% } %>= {
|
|
12
12
|
Component: Editor,
|
|
13
13
|
documentTypes: [<% if(!documentTypes.length){ %>'*'<% } else { %><% documentTypes.forEach(type => { _%>"<%= type %>", %><% }); _%> <% } %>],
|
|
14
14
|
config: {
|
|
@@ -4,7 +4,7 @@ unless_exists: true
|
|
|
4
4
|
---
|
|
5
5
|
import Editor from './editor';
|
|
6
6
|
import { createDocumentStory } from 'document-model-libs/utils';
|
|
7
|
-
<% if(!documentTypes.length){ %>import { baseReducer, utils } from 'document-model
|
|
7
|
+
<% if(!documentTypes.length){ %>import { baseReducer, utils } from 'document-model';<% } %>
|
|
8
8
|
<% documentTypes.forEach(type => { _%>
|
|
9
9
|
import * as <%= documentTypesMap[type].name %>Module from "<%= documentTypesMap[type].importPath %>";
|
|
10
10
|
%><% }); _%>
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
generateSynchronizationUnits
|
|
10
10
|
} from "document-model-libs/document-drive";
|
|
11
11
|
import * as DocumentModelsLibs from "document-model-libs/document-models";
|
|
12
|
-
import { DocumentModel } from "document-model
|
|
12
|
+
import { DocumentModel } from "document-model";
|
|
13
13
|
import { module as DocumentModelLib } from "document-model";
|
|
14
14
|
import * as LocalDocumentModels from "../../document-models";
|
|
15
15
|
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.esm.t
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
<% documentTypes.forEach(type => { _%>
|
|
13
13
|
import { <%= documentTypesMap[type].name %>Document } from "<%= documentTypesMap[type].importPath %>";
|
|
14
14
|
%><% }); _%>
|
|
15
|
-
<% if(documentTypes.length === 0) { %>import { Document } from "document-model
|
|
15
|
+
<% if(documentTypes.length === 0) { %>import { Document } from "document-model";<% } %>
|
|
16
16
|
type DocumentType = <% if(documentTypes.length) { %><%= documentTypes.map(type => `${documentTypesMap[type].name}Document`).join(" | ") %> <% } else { %>Document<% } %>;
|
|
17
17
|
|
|
18
18
|
export class <%= pascalName %>Processor extends AnalyticsProcessor<% if(documentTypes.length) { %><DocumentType><% } %> {
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-operational/index.esm.t
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
<% documentTypes.forEach(type => { _%>
|
|
13
13
|
import { <%= documentTypesMap[type].name %>Document } from "<%= documentTypesMap[type].importPath %>";
|
|
14
14
|
%><% }); _%>
|
|
15
|
-
<% if(documentTypes.length === 0) { %>import { Document } from "document-model
|
|
15
|
+
<% if(documentTypes.length === 0) { %>import { Document } from "document-model";<% } %>
|
|
16
16
|
type DocumentType = <% if(documentTypes.length) { %><%= documentTypes.map(type => `${documentTypesMap[type].name}Document`).join(" | ") %> <% } else { %>Document<% } %>;
|
|
17
17
|
|
|
18
18
|
export class <%= pascalName %>Processor extends OperationalProcessor<% if(documentTypes.length) { %><DocumentType><% } %> {
|
|
@@ -19,7 +19,7 @@ export class <%= pascalName %>Subgraph extends Subgraph {
|
|
|
19
19
|
<% if (loadFromFile) { %>
|
|
20
20
|
typeDefs = gql`${gqlCode}`;
|
|
21
21
|
|
|
22
|
-
resolvers = getResolvers(this
|
|
22
|
+
resolvers = getResolvers(this);
|
|
23
23
|
additionalContextFields = {};
|
|
24
24
|
async onSetup() {}
|
|
25
25
|
async onDisconnect() {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/codegen/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uDAAuD,CAAC;AAC/E,OAAO,EAAE,KAAK,aAAa,EAAY,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAUrE,eAAO,MAAM,QAAQ,EAAE,sBAiBtB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAEtE,eAAO,MAAM,gBAAgB,EAAE,0BAkB9B,CAAC;AAEF,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,aAAa,CAAC,WAAW,CAAC,CAmB5B;AAED,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/codegen/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uDAAuD,CAAC;AAC/E,OAAO,EAAE,KAAK,aAAa,EAAY,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAUrE,eAAO,MAAM,QAAQ,EAAE,sBAiBtB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAEtE,eAAO,MAAM,gBAAgB,EAAE,0BAkB9B,CAAC;AAEF,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,aAAa,CAAC,WAAW,CAAC,CAmB5B;AAED,eAAO,MAAM,cAAc,GACzB,OAAO,MAAM,EACb,KAAK,MAAM,EACX;;;CAA0C,iBAa3C,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,KAAK,MAAM,EACX;;;CAA0C,iBAoB3C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../../../src/create-lib/create-project.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,iBAAiB;;;;;;;;;;CAUpB,CAAC;AAEX,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;
|
|
1
|
+
{"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../../../src/create-lib/create-project.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,iBAAiB;;;;;;;;;;CAUpB,CAAC;AAEX,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAqED,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,UAWA;AAUD,wBAAgB,OAAO,kBAQtB;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,qBAAqB,iBAmDjE"}
|
|
@@ -43,11 +43,15 @@ function buildPowerhouseConfig(appPath, documentModelsDir, editorsDir) {
|
|
|
43
43
|
fs.writeFileSync(filePath, JSON.stringify(newPackage, null, 2), "utf8");
|
|
44
44
|
}
|
|
45
45
|
function buildIndex(appPath, documentModelsDir, editorsDir) {
|
|
46
|
-
fs.writeFileSync(path.join(appPath, "index.ts"), `import
|
|
46
|
+
fs.writeFileSync(path.join(appPath, "index.ts"), `import { Manifest } from "document-model";
|
|
47
|
+
import manifestJson from "./powerhouse.manifest.json" assert { type: "json" };
|
|
48
|
+
import * as documentModelsExports from '${documentModelsDir}';
|
|
47
49
|
import * as editorsExports from '${editorsDir}';
|
|
48
50
|
|
|
51
|
+
export const manifest: Manifest = manifestJson;
|
|
49
52
|
export const documentModels = Object.values(documentModelsExports);
|
|
50
|
-
export const editors = Object.values(editorsExports)
|
|
53
|
+
export const editors = Object.values(editorsExports);
|
|
54
|
+
`, "utf8");
|
|
51
55
|
}
|
|
52
56
|
function runCmd(command) {
|
|
53
57
|
try {
|