@powerhousedao/codegen 0.43.1 → 0.45.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/actions.esm.t +3 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/creators.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModelTest.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.esm.t +5 -5
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/lib.inject_export.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/object.esm.t +7 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +3 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +10 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/schema.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +8 -8
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +8 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/actions.esm.t +6 -6
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t +4 -4
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customReducers.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t +6 -6
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/object.esm.t +6 -6
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/operations.esm.t +4 -4
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-mutations/resolvers.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-mutations/schema.esm.t +6 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/lib.inject_export.esm.t +1 -1
- package/dist/src/codegen/graphql.d.ts +0 -3
- package/dist/src/codegen/graphql.d.ts.map +1 -1
- package/dist/src/codegen/graphql.js +19 -19
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -3,14 +3,14 @@ to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/actions.ts"
|
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
5
|
<% modules.forEach(module => { _%>
|
|
6
|
-
import { <%= h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module.name) %>Action } from './<%= module.name %>/actions';
|
|
6
|
+
import type { <%= h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module.name) %>Action } from './<%= module.name %>/actions.js';
|
|
7
7
|
<% }); _%>
|
|
8
8
|
|
|
9
9
|
<% modules.forEach(module => { _%>
|
|
10
|
-
export * from './<%= module.name %>/actions';
|
|
10
|
+
export * from './<%= module.name %>/actions.js';
|
|
11
11
|
<% }); _%>
|
|
12
12
|
|
|
13
|
-
export type
|
|
13
|
+
export <%= 'type ' + h.changeCase.pascal(documentType) %>Action =
|
|
14
14
|
<% modules.forEach(module => { _%>
|
|
15
15
|
| <%= h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module.name) %>Action
|
|
16
16
|
<% }); _%>;
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModelTest.esm.t
CHANGED
|
@@ -7,7 +7,7 @@ unless_exists: true
|
|
|
7
7
|
* - change it by adding new tests or modifying the existing ones
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import utils, { initialGlobalState, initialLocalState } from '../../gen/utils';
|
|
10
|
+
import utils, { initialGlobalState, initialLocalState } from '../../gen/utils.js';
|
|
11
11
|
|
|
12
12
|
describe('<%= h.changeCase.title(documentType) %> Document Model', () => {
|
|
13
13
|
it('should create a new <%= h.changeCase.title(documentType) %> document', () => {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/index.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
export * from './actions';
|
|
6
|
-
export * from './document-model';
|
|
7
|
-
export * from './object';
|
|
8
|
-
export * from './types';
|
|
9
|
-
export * as actions from './creators';
|
|
5
|
+
export * from './actions.js';
|
|
6
|
+
export * from './document-model.js';
|
|
7
|
+
export * from './object.js';
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
export * as actions from './creators.js';
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/lib.inject_export.esm.t
CHANGED
|
@@ -4,4 +4,4 @@ append: true
|
|
|
4
4
|
to: "<%= rootDir %>/index.ts"
|
|
5
5
|
skip_if: "<%= h.changeCase.pascal(documentType) %>"
|
|
6
6
|
---
|
|
7
|
-
export { module as <%= h.changeCase.pascal(documentType) %> } from './<%= h.changeCase.param(documentType)
|
|
7
|
+
export { module as <%= h.changeCase.pascal(documentType) %> } from './<%= h.changeCase.param(documentType) %>.js';
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/object.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import { BaseDocumentClass, ExtendedState, PartialState, applyMixins, SignalDispatch } from 'document-model';
|
|
6
|
-
import { <%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState } from './types';
|
|
7
|
-
import { <%= h.changeCase.pascal(documentType) %>Action } from './actions';
|
|
8
|
-
import { reducer } from './reducer';
|
|
9
|
-
import utils from './utils';
|
|
5
|
+
import { BaseDocumentClass, type ExtendedState, type PartialState, applyMixins, type SignalDispatch } from 'document-model';
|
|
6
|
+
import { <%= 'type ' + h.changeCase.pascal(documentType) %>State, <%= 'type ' + h.changeCase.pascal(documentType) %>LocalState } from './types.js';
|
|
7
|
+
import { <%= 'type ' + h.changeCase.pascal(documentType) %>Action } from './actions.js';
|
|
8
|
+
import { reducer } from './reducer.js';
|
|
9
|
+
import utils from './utils.js';
|
|
10
10
|
<% modules.forEach(module => { _%>
|
|
11
|
-
import <%= h.changeCase.pascal(documentType) %>_<%= h.changeCase.pascal(module.name) %> from './<%= module.name %>/object';
|
|
11
|
+
import <%= h.changeCase.pascal(documentType) %>_<%= h.changeCase.pascal(module.name) %> from './<%= module.name %>/object.js';
|
|
12
12
|
<% }); _%>
|
|
13
13
|
|
|
14
14
|
<% modules.forEach(module => { _%>
|
|
15
|
-
export * from './<%= module.name %>/object';
|
|
15
|
+
export * from './<%= module.name %>/object.js';
|
|
16
16
|
<% }); _%>
|
|
17
17
|
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/reducer.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import { StateReducer, isDocumentAction, createReducer } from "document-model";
|
|
6
|
-
import { <%= h.changeCase.pascal(documentType) %>Document, z } from './types';
|
|
5
|
+
import { type StateReducer, isDocumentAction, createReducer } from "document-model";
|
|
6
|
+
import { <%= 'type ' + h.changeCase.pascal(documentType) %>Document, z } from './types.js';
|
|
7
7
|
|
|
8
8
|
<% modules.forEach(m => { _%>
|
|
9
|
-
import { reducer as <%= h.changeCase.pascal(m.name) %>Reducer } from '../src/reducers/<%= h.changeCase.param(m.name)
|
|
9
|
+
import { reducer as <%= h.changeCase.pascal(m.name) %>Reducer } from '../src/reducers/<%= h.changeCase.param(m.name) %>.js';
|
|
10
10
|
<%_ }); %>
|
|
11
11
|
|
|
12
12
|
const stateReducer: StateReducer<<%= h.changeCase.pascal(documentType) %>Document> =
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t
CHANGED
|
@@ -7,15 +7,15 @@ 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, DocumentModelModule } from 'document-model';
|
|
11
|
-
import { actions as <%= h.changeCase.pascal(documentType) %>Actions } from './gen';
|
|
12
|
-
import { reducer } from './gen/reducer';
|
|
13
|
-
import { documentModel } from './gen/document-model';
|
|
14
|
-
import genUtils from './gen/utils';
|
|
15
|
-
import * as customUtils from './src/utils';
|
|
10
|
+
import { actions as BaseActions, type DocumentModelModule } from 'document-model';
|
|
11
|
+
import { actions as <%= h.changeCase.pascal(documentType) %>Actions } from './gen/index.js';
|
|
12
|
+
import { reducer } from './gen/reducer.js';
|
|
13
|
+
import { documentModel } from './gen/document-model.js';
|
|
14
|
+
import genUtils from './gen/utils.js';
|
|
15
|
+
import * as customUtils from './src/utils.js';
|
|
16
16
|
import {
|
|
17
|
-
<%= h.changeCase.pascal(documentType) %>Document,
|
|
18
|
-
} from './gen/types';
|
|
17
|
+
<%= 'type ' + h.changeCase.pascal(documentType) %>Document,
|
|
18
|
+
} from './gen/types.js';
|
|
19
19
|
|
|
20
20
|
const utils = { ...genUtils, ...customUtils };
|
|
21
21
|
const actions = { ...BaseActions, ...<%= h.changeCase.pascal(documentType) %>Actions };
|
|
@@ -31,5 +31,5 @@ export const module: DocumentModelModule<
|
|
|
31
31
|
|
|
32
32
|
export { reducer, actions, utils, documentModel };
|
|
33
33
|
|
|
34
|
-
export * from './gen/types';
|
|
35
|
-
export * from './src/utils';
|
|
34
|
+
export * from './gen/types.js';
|
|
35
|
+
export * from './src/utils.js';
|
|
@@ -3,17 +3,17 @@ to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/types.ts"
|
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
5
|
import type { PHDocument, ExtendedState } from 'document-model';
|
|
6
|
-
import type { <%= h.changeCase.pascal(documentType) %>State } from './schema/types';
|
|
6
|
+
import type { <%= h.changeCase.pascal(documentType) %>State } from './schema/types.js';
|
|
7
7
|
<% if(hasLocalSchema) { -%>
|
|
8
|
-
import type { <%= h.changeCase.pascal(documentType) %>LocalState } from './schema/types';
|
|
8
|
+
import type { <%= h.changeCase.pascal(documentType) %>LocalState } from './schema/types.js';
|
|
9
9
|
<%} -%>
|
|
10
|
-
import type { <%= h.changeCase.pascal(documentType) %>Action } from './actions';
|
|
10
|
+
import type { <%= h.changeCase.pascal(documentType) %>Action } from './actions.js';
|
|
11
11
|
|
|
12
|
-
export { z } from './schema';
|
|
13
|
-
export type * from './schema/types';
|
|
12
|
+
export { z } from './schema/index.js';
|
|
13
|
+
export type * from './schema/types.js';
|
|
14
14
|
<% if(!hasLocalSchema) { -%>
|
|
15
|
-
type
|
|
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
|
|
19
|
-
export { <%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState, <%= h.changeCase.pascal(documentType) %>Action };
|
|
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
|
+
export type { <%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState, <%= h.changeCase.pascal(documentType) %>Action };
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/utils.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
type DocumentModelUtils,
|
|
6
7
|
baseCreateDocument,
|
|
7
8
|
baseCreateExtendedState,
|
|
8
9
|
baseSaveToFile,
|
|
@@ -10,8 +11,12 @@ import { DocumentModelUtils,
|
|
|
10
11
|
baseLoadFromFile,
|
|
11
12
|
baseLoadFromInput
|
|
12
13
|
} from 'document-model';
|
|
13
|
-
import {
|
|
14
|
-
|
|
14
|
+
import {
|
|
15
|
+
<%= 'type ' + h.changeCase.pascal(documentType) %>Document,
|
|
16
|
+
<%= 'type ' + h.changeCase.pascal(documentType) %>State,
|
|
17
|
+
<%= 'type ' + h.changeCase.pascal(documentType) %>LocalState
|
|
18
|
+
} from './types.js';
|
|
19
|
+
import { reducer } from './reducer.js';
|
|
15
20
|
|
|
16
21
|
export const initialGlobalState: <%= h.changeCase.pascal(documentType) %>State = <%- initialGlobalState %>;
|
|
17
22
|
export const initialLocalState: <%= h.changeCase.pascal(documentType) %>LocalState = <%- initialLocalState %>;
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/actions.esm.t
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/<%= module %>/actions.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
-
import { BaseAction<% if (actions.find(a => a.hasAttachment)) {%>, BaseActionWithAttachment<%}%> } from 'document-model';
|
|
6
|
-
import {
|
|
5
|
+
import { type BaseAction<% if (actions.find(a => a.hasAttachment)) {%>, BaseActionWithAttachment<%}%> } from 'document-model';
|
|
6
|
+
import type {
|
|
7
7
|
<% actions.filter(a => a.hasInput).forEach(action => { _%>
|
|
8
8
|
<%= h.changeCase.pascal(action.name) %>Input,
|
|
9
9
|
<% }); _%>
|
|
10
|
-
} from '../types';
|
|
10
|
+
} from '../types.js';
|
|
11
11
|
|
|
12
12
|
<% actions.filter(a => a.hasInput).forEach(actionType => { _%>
|
|
13
|
-
export type
|
|
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
|
|
16
|
+
export <%= 'type ' + h.changeCase.pascal(actionType.name) %>Action = BaseAction<'<%= h.changeCase.constantCase(actionType.name) %>', never, '<%= actionType.scope %>'>;
|
|
17
17
|
<% }); _%>
|
|
18
18
|
|
|
19
|
-
export type
|
|
19
|
+
export <%= 'type ' + h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module) %>Action =
|
|
20
20
|
<% actions.forEach(actionType => { _%>
|
|
21
21
|
| <%= h.changeCase.pascal(actionType.name) %>Action
|
|
22
22
|
<% }); _%>;
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t
CHANGED
|
@@ -5,14 +5,14 @@ force: true
|
|
|
5
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
|
-
<%= h.changeCase.pascal(action.name) %>Input,
|
|
8
|
+
<%= 'type ' + h.changeCase.pascal(action.name) %>Input,
|
|
9
9
|
<% }); _%>
|
|
10
|
-
} from '../types';
|
|
10
|
+
} from '../types.js';
|
|
11
11
|
import {
|
|
12
12
|
<% actions.forEach(action => { _%>
|
|
13
|
-
<%= h.changeCase.pascal(action.name) %>Action,
|
|
13
|
+
<%= 'type ' + h.changeCase.pascal(action.name) %>Action,
|
|
14
14
|
<% }); _%>
|
|
15
|
-
} from './actions';
|
|
15
|
+
} from './actions.js';
|
|
16
16
|
|
|
17
17
|
<% actions.filter(a => a.hasInput).forEach(action => { _%>
|
|
18
18
|
export const <%= h.changeCase.camel(action.name) %> = (input: <%= h.changeCase.pascal(action.name) %>Input<%if(action.hasAttachment){ %>, attachments: AttachmentInput[] <% } %>) =>
|
|
@@ -8,7 +8,7 @@ unless_exists: true
|
|
|
8
8
|
* - delete the file and run the code generator again to have it reset
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { <%= h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module) %>Operations } from '../../gen/<%= module %>/operations';
|
|
11
|
+
import { <%= h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module) %>Operations } from '../../gen/<%= module %>/operations.js';
|
|
12
12
|
|
|
13
13
|
export const reducer: <%= h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module) %>Operations = {
|
|
14
14
|
<% actions.forEach(action => { _%>
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t
CHANGED
|
@@ -10,16 +10,16 @@ unless_exists: true
|
|
|
10
10
|
import { generateMock } from '@powerhousedao/codegen';
|
|
11
11
|
import { utils as documentModelUtils } from 'document-model';
|
|
12
12
|
|
|
13
|
-
import utils from '../../gen/utils';
|
|
13
|
+
import utils from '../../gen/utils.js';
|
|
14
14
|
import {
|
|
15
15
|
z,
|
|
16
16
|
<% actions.forEach(action => { _%>
|
|
17
|
-
<%= h.changeCase.pascal(action.name) %>Input,
|
|
17
|
+
<%= 'type ' + h.changeCase.pascal(action.name) %>Input,
|
|
18
18
|
<% }); _%>
|
|
19
|
-
} from '../../gen/schema';
|
|
20
|
-
import { reducer } from '../../gen/reducer';
|
|
21
|
-
import * as creators from '../../gen/<%= module %>/creators';
|
|
22
|
-
import { <%= h.changeCase.pascal(documentType) %>Document } from '../../gen/types';
|
|
19
|
+
} from '../../gen/schema/index.js';
|
|
20
|
+
import { reducer } from '../../gen/reducer.js';
|
|
21
|
+
import * as creators from '../../gen/<%= module %>/creators.js';
|
|
22
|
+
import { <%= h.changeCase.pascal(documentType) %>Document } from '../../gen/types.js';
|
|
23
23
|
|
|
24
24
|
describe('<%= h.changeCase.pascal(module) %> Operations', () => {
|
|
25
25
|
let document: <%= h.changeCase.pascal(documentType) %>Document;
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/object.esm.t
CHANGED
|
@@ -5,17 +5,17 @@ force: true
|
|
|
5
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
|
-
<%= h.changeCase.pascal(action.name) %>Input,
|
|
8
|
+
<%= 'type ' + h.changeCase.pascal(action.name) %>Input,
|
|
9
9
|
<% }); _%>
|
|
10
|
-
<%= h.changeCase.pascal(documentType) %>State,
|
|
11
|
-
<%= h.changeCase.pascal(documentType) %>LocalState
|
|
12
|
-
} from '../types';
|
|
10
|
+
<%= 'type ' + h.changeCase.pascal(documentType) %>State,
|
|
11
|
+
<%= 'type ' + h.changeCase.pascal(documentType) %>LocalState
|
|
12
|
+
} from '../types.js';
|
|
13
13
|
import {
|
|
14
14
|
<% actions.forEach(action => { _%>
|
|
15
15
|
<%= h.changeCase.camel(action.name) %>,
|
|
16
16
|
<% }); _%>
|
|
17
|
-
} from './creators';
|
|
18
|
-
import { <%= h.changeCase.pascal(documentType) %>Action } from '../actions';
|
|
17
|
+
} from './creators.js';
|
|
18
|
+
import { <%= 'type ' + h.changeCase.pascal(documentType) %>Action } from '../actions.js';
|
|
19
19
|
|
|
20
20
|
export default class <%= h.changeCase.pascal(documentType) %>_<%= h.changeCase.pascal(module) %> extends BaseDocumentClass<
|
|
21
21
|
<%= h.changeCase.pascal(documentType) %>State,
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/operations.esm.t
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
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 { type SignalDispatch } from 'document-model';
|
|
6
6
|
import {
|
|
7
7
|
<% actions.forEach(action => { _%>
|
|
8
|
-
<%= h.changeCase.pascal(action.name) %>Action,
|
|
8
|
+
<%= 'type ' + h.changeCase.pascal(action.name) %>Action,
|
|
9
9
|
<% }); _%>
|
|
10
|
-
} from './actions';
|
|
11
|
-
import { <%= actions.map(action => h.changeCase.pascal(h.changeCase.pascal(documentType + '_' + action.state + '_State'))).filter((value, index, self) => self.indexOf(value) === index).join(', ') %> } from '../types';
|
|
10
|
+
} from './actions.js';
|
|
11
|
+
import { <%= actions.map(action => 'type ' + h.changeCase.pascal(h.changeCase.pascal(documentType + '_' + action.state + '_State'))).filter((value, index, self) => self.indexOf(value) === index).join(', ') %> } from '../types.js';
|
|
12
12
|
|
|
13
13
|
export interface <%= h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module) %>Operations {
|
|
14
14
|
<% actions.forEach(action => { _%>
|
|
@@ -5,9 +5,9 @@ force: true
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
7
7
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
8
|
-
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
8
|
+
import { type Subgraph } from "@powerhousedao/reactor-api";
|
|
9
9
|
import { addFile } from "document-drive";
|
|
10
|
-
import { actions } from "../../document-models/<%- h.changeCase.param(documentType)
|
|
10
|
+
import { actions } from "../../document-models/<%- h.changeCase.param(documentType) %>/index.js";
|
|
11
11
|
import { generateId, hashKey } from "document-model";
|
|
12
12
|
|
|
13
13
|
const DEFAULT_DRIVE_ID = "powerhouse";
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-mutations/schema.esm.t
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
to: "<%= rootDir %>/<%= h.changeCase.param(subgraph) %>/schema.
|
|
2
|
+
to: "<%= rootDir %>/<%= h.changeCase.param(subgraph) %>/schema.ts"
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
|
+
import { gql } from "graphql-tag";
|
|
6
|
+
|
|
7
|
+
export const schema = gql`
|
|
5
8
|
"""
|
|
6
9
|
Subgraph definition for <%= h.changeCase.pascal(documentType) %> (<%- documentTypeId %>)
|
|
7
10
|
|
|
@@ -28,4 +31,5 @@ Module: <%= h.changeCase.pascal(module.name) %>
|
|
|
28
31
|
"""
|
|
29
32
|
<% module.operations.forEach(op => { _%>
|
|
30
33
|
<%- op.schema.replace('input ', 'input ' + h.changeCase.pascal(documentType) + '_') %>
|
|
31
|
-
<%_ })}); %>
|
|
34
|
+
<%_ })}); %>
|
|
35
|
+
`;
|
|
@@ -4,8 +4,8 @@ force: true
|
|
|
4
4
|
---
|
|
5
5
|
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
6
6
|
<% if (loadFromFile) { %>
|
|
7
|
-
import schema from "./schema.
|
|
8
|
-
import { getResolvers } from "./resolvers";
|
|
7
|
+
import { schema } from "./schema.js";
|
|
8
|
+
import { getResolvers } from "./resolvers.js";
|
|
9
9
|
<% } else { %>
|
|
10
10
|
import { gql } from "graphql-tag";
|
|
11
11
|
<% } %>
|
package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/lib.inject_export.esm.t
CHANGED
|
@@ -4,4 +4,4 @@ append: true
|
|
|
4
4
|
to: "<%= rootDir %>/index.ts"
|
|
5
5
|
skip_if: "<%= h.changeCase.pascal(name) %>"
|
|
6
6
|
---
|
|
7
|
-
export * as <%= h.changeCase.pascal(name) %>Subgraph from "./<%= h.changeCase.param(name)
|
|
7
|
+
export * as <%= h.changeCase.pascal(name) %>Subgraph from "./<%= h.changeCase.param(name) %>.js";
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { type plugin } from "@acaldas/graphql-codegen-typescript-validation-schema";
|
|
2
1
|
import { type CodegenConfig } from "@graphql-codegen/cli";
|
|
3
2
|
import { type TypeScriptPluginConfig } from "@graphql-codegen/typescript";
|
|
4
3
|
export declare const tsConfig: TypeScriptPluginConfig;
|
|
5
|
-
export type ValidationSchemaConfigType = Parameters<typeof plugin>[2];
|
|
6
|
-
export declare const validationConfig: ValidationSchemaConfigType;
|
|
7
4
|
export declare function schemaConfig(name: string, dir: string): CodegenConfig["generates"];
|
|
8
5
|
export declare const generateSchema: (model: string, dir: string, { watch, skipFormat }?: {
|
|
9
6
|
watch?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/codegen/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/codegen/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAY,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAU1E,eAAO,MAAM,QAAQ,EAAE,sBAiBtB,CAAC;AAEF,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,aAAa,CAAC,WAAW,CAAC,CAsC5B;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"}
|
|
@@ -23,24 +23,6 @@ export const tsConfig = {
|
|
|
23
23
|
// maybeValue: "T | null | undefined",
|
|
24
24
|
inputMaybeValue: "T | null | undefined",
|
|
25
25
|
};
|
|
26
|
-
export const validationConfig = {
|
|
27
|
-
importFrom: `./types.js`,
|
|
28
|
-
schema: "zod",
|
|
29
|
-
...tsConfig,
|
|
30
|
-
scalarSchemas: {
|
|
31
|
-
Unknown: "z.unknown()",
|
|
32
|
-
DateTime: "z.string().datetime()",
|
|
33
|
-
Attachment: "z.string()",
|
|
34
|
-
Address: "z.custom<`${string}:0x${string}`>((val) => /^[a-zA-Z0-9]+:0x[a-fA-F0-9]{40}$/.test(val as string))",
|
|
35
|
-
...validationSchema,
|
|
36
|
-
},
|
|
37
|
-
directives: {
|
|
38
|
-
equals: {
|
|
39
|
-
value: ["regex", "/^$1$/"],
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
withObjectType: true,
|
|
43
|
-
};
|
|
44
26
|
export function schemaConfig(name, dir) {
|
|
45
27
|
return {
|
|
46
28
|
[`${dir}/${name}/gen/schema/types.ts`]: {
|
|
@@ -57,7 +39,25 @@ export function schemaConfig(name, dir) {
|
|
|
57
39
|
[`${dir}/${name}/gen/schema/zod.ts`]: {
|
|
58
40
|
schema: `${dir}/${name}/schema.graphql`,
|
|
59
41
|
plugins: ["@acaldas/graphql-codegen-typescript-validation-schema"],
|
|
60
|
-
config:
|
|
42
|
+
config: {
|
|
43
|
+
...tsConfig,
|
|
44
|
+
importFrom: `./types.js`,
|
|
45
|
+
schema: "zod",
|
|
46
|
+
useTypeImports: true,
|
|
47
|
+
scalarSchemas: {
|
|
48
|
+
Unknown: "z.unknown()",
|
|
49
|
+
DateTime: "z.string().datetime()",
|
|
50
|
+
Attachment: "z.string()",
|
|
51
|
+
Address: "z.custom<`${string}:0x${string}`>((val) => /^[a-zA-Z0-9]+:0x[a-fA-F0-9]{40}$/.test(val as string))",
|
|
52
|
+
...validationSchema,
|
|
53
|
+
},
|
|
54
|
+
directives: {
|
|
55
|
+
equals: {
|
|
56
|
+
value: ["regex", "/^$1$/"],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
withObjectType: true,
|
|
60
|
+
},
|
|
61
61
|
},
|
|
62
62
|
};
|
|
63
63
|
}
|