@powerhousedao/codegen 4.1.0-staging.1 → 5.0.0-staging.10

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.
Files changed (62) hide show
  1. package/README.md +0 -1
  2. package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/resolvers.esm.t +1 -1
  3. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.esm.t +9 -1
  4. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/object.esm.t +6 -6
  5. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/ph-factories.esm.t +8 -8
  6. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +4 -3
  7. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +2 -4
  8. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +8 -6
  9. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +41 -35
  10. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.d.ts +2 -2
  11. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.d.ts.map +1 -1
  12. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js +7 -4
  13. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js.map +1 -1
  14. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/object.esm.t +2 -7
  15. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/resolvers.esm.t +9 -5
  16. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveExplorer.esm.t +3 -3
  17. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editor.esm.t +1 -1
  18. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.esm.t +1 -4
  19. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/factory.esm.t +2 -2
  20. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.esm.t +3 -8
  21. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_call.esm.t +1 -1
  22. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_import.esm.t +1 -1
  23. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/factory.esm.t +1 -1
  24. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.esm.t +3 -9
  25. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.esm.t +2 -4
  26. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_call.esm.t +2 -2
  27. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_import.esm.t +1 -1
  28. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/migrations.esm.t +1 -1
  29. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/schema.esm.t +10 -2
  30. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.esm.t +2 -1
  31. package/dist/src/codegen/graphql.d.ts +2 -2
  32. package/dist/src/codegen/graphql.d.ts.map +1 -1
  33. package/dist/src/codegen/graphql.js.map +1 -1
  34. package/dist/src/codegen/hygen.d.ts +2 -2
  35. package/dist/src/codegen/hygen.d.ts.map +1 -1
  36. package/dist/src/codegen/index.d.ts +2 -2
  37. package/dist/src/codegen/index.d.ts.map +1 -1
  38. package/dist/src/codegen/index.js +2 -2
  39. package/dist/src/codegen/index.js.map +1 -1
  40. package/dist/src/codegen/utils.d.ts +1 -1
  41. package/dist/src/codegen/utils.d.ts.map +1 -1
  42. package/dist/src/codegen/utils.js +1 -1
  43. package/dist/src/codegen/utils.js.map +1 -1
  44. package/dist/src/ts-morph-generator/core/FileGenerator.d.ts +3 -3
  45. package/dist/src/ts-morph-generator/core/FileGenerator.d.ts.map +1 -1
  46. package/dist/src/ts-morph-generator/core/GenerationContext.d.ts +2 -2
  47. package/dist/src/ts-morph-generator/core/GenerationContext.d.ts.map +1 -1
  48. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts +2 -2
  49. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts.map +1 -1
  50. package/dist/src/ts-morph-generator/file-generators/ReducerGenerator.d.ts +1 -1
  51. package/dist/src/ts-morph-generator/file-generators/ReducerGenerator.d.ts.map +1 -1
  52. package/dist/src/ts-morph-generator/file-generators/ReducerGenerator.js +1 -1
  53. package/dist/src/ts-morph-generator/file-generators/ReducerGenerator.js.map +1 -1
  54. package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts +2 -2
  55. package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts.map +1 -1
  56. package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts +1 -1
  57. package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts.map +1 -1
  58. package/dist/src/utils/validation.d.ts +1 -1
  59. package/dist/src/utils/validation.d.ts.map +1 -1
  60. package/dist/tsconfig.hygen.tsbuildinfo +1 -1
  61. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  62. package/package.json +7 -7
package/README.md CHANGED
@@ -16,7 +16,6 @@ A powerful code generation toolkit for the Powerhouse ecosystem, designed to aut
16
16
  pnpm add @powerhousedao/codegen
17
17
  ```
18
18
 
19
-
20
19
  ## Templates
21
20
 
22
21
  The package supports custom templates for different output formats:
@@ -4,7 +4,7 @@ force: true
4
4
  ---
5
5
  import { type Subgraph } from "@powerhousedao/reactor-api";
6
6
 
7
- export const getResolvers = (subgraph: Subgraph) => {
7
+ export const getResolvers = (subgraph: Subgraph): Record<string, unknown> => {
8
8
  const reactor = subgraph.reactor;
9
9
 
10
10
  return ({
@@ -6,4 +6,12 @@ export * from './actions.js';
6
6
  export * from './document-model.js';
7
7
  export * from './object.js';
8
8
  export * from './types.js';
9
- export * as actions from './creators.js';
9
+ export * as actions from './creators.js';
10
+ export type { <%= h.changeCase.pascal(documentType) %>PHState } from './ph-factories.js';
11
+ export {
12
+ create<%= h.changeCase.pascal(documentType) %>Document,
13
+ createState,
14
+ defaultPHState,
15
+ defaultGlobalState,
16
+ defaultLocalState,
17
+ } from './ph-factories.js';
@@ -2,11 +2,11 @@
2
2
  to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/object.ts"
3
3
  force: true
4
4
  ---
5
- import { BaseDocumentClass, type BaseStateFromDocument, type PartialState, applyMixins, type SignalDispatch } from 'document-model';
6
- import { <%= 'type ' + h.changeCase.pascal(documentType) %>State, <%= 'type ' + h.changeCase.pascal(documentType) %>LocalState, <%= 'type ' + h.changeCase.pascal(documentType) %>Document } from './types.js';
5
+ import { BaseDocumentClass, applyMixins, type SignalDispatch } from 'document-model';
6
+ import { <%= h.changeCase.pascal(documentType) %>PHState } from './ph-factories.js';
7
7
  import { <%= 'type ' + h.changeCase.pascal(documentType) %>Action } from './actions.js';
8
8
  import { reducer } from './reducer.js';
9
- import utils from './utils.js';
9
+ import { createDocument } from './utils.js';
10
10
  <% modules.forEach(module => { _%>
11
11
  import <%= h.changeCase.pascal(documentType) %>_<%= h.changeCase.pascal(module.name) %> from './<%= module.name %>/object.js';
12
12
  <% }); _%>
@@ -20,11 +20,11 @@ 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 BaseDocumentClass<<%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState, <%= h.changeCase.pascal(documentType) %>Action> {
23
+ class <%= h.changeCase.pascal(documentType) %> extends BaseDocumentClass<<%= h.changeCase.pascal(documentType) %>PHState> {
24
24
  static fileExtension = '<%= extension %>';
25
25
 
26
- constructor(initialState?: Partial<BaseStateFromDocument<<%= h.changeCase.pascal(documentType) %>Document>>, dispatch?: SignalDispatch) {
27
- super(reducer, utils.createDocument(initialState), dispatch);
26
+ constructor(initialState?: Partial<<%= h.changeCase.pascal(documentType) %>PHState>, dispatch?: SignalDispatch) {
27
+ super(reducer, createDocument(initialState), dispatch);
28
28
  }
29
29
 
30
30
  public saveToFile(path: string, name?: string) {
@@ -1,5 +1,5 @@
1
1
  ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/ph-factories.ts"
2
+ to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/ph-factories.ts"
3
3
  force: true
4
4
  ---
5
5
  /**
@@ -17,8 +17,13 @@ import type {
17
17
  <%= h.changeCase.pascal(documentType) %>Document,
18
18
  <%= h.changeCase.pascal(documentType) %>LocalState,
19
19
  <%= h.changeCase.pascal(documentType) %>State,
20
- } from "./gen/types.js";
21
- import { createDocument } from "./gen/utils.js";
20
+ } from "./types.js";
21
+ import { createDocument } from "./utils.js";
22
+
23
+ export type <%= h.changeCase.pascal(documentType) %>PHState = PHBaseState & {
24
+ global: <%= h.changeCase.pascal(documentType) %>State;
25
+ local: <%= h.changeCase.pascal(documentType) %>LocalState;
26
+ };
22
27
 
23
28
  export function defaultGlobalState(): <%= h.changeCase.pascal(documentType) %>State {
24
29
  return <%- initialGlobalState %>;
@@ -66,11 +71,6 @@ export function createState(
66
71
  };
67
72
  }
68
73
 
69
- export type <%= h.changeCase.pascal(documentType) %>PHState = PHBaseState & {
70
- global: <%= h.changeCase.pascal(documentType) %>State;
71
- local: <%= h.changeCase.pascal(documentType) %>LocalState;
72
- };
73
-
74
74
  /**
75
75
  * Creates a <%= h.changeCase.pascal(documentType) %>Document with custom global and local state
76
76
  * This properly handles the PHBaseState requirements while allowing
@@ -6,13 +6,14 @@ force: true
6
6
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
7
7
  /* eslint-disable @typescript-eslint/no-unsafe-argument */
8
8
  import { type StateReducer, isDocumentAction, createReducer } from "document-model";
9
- import { <%= 'type ' + h.changeCase.pascal(documentType) %>Document, z } from './types.js';
9
+ import { <%= h.changeCase.pascal(documentType) %>PHState } from './ph-factories.js';
10
+ import { z } from './types.js';
10
11
 
11
12
  <% modules.forEach(m => { _%>
12
13
  import { reducer as <%= h.changeCase.pascal(m.name) %>Reducer } from '../src/reducers/<%= h.changeCase.param(m.name) %>.js';
13
14
  <%_ }); %>
14
15
 
15
- const stateReducer: StateReducer<<%= h.changeCase.pascal(documentType) %>Document> =
16
+ export const stateReducer: StateReducer<<%= h.changeCase.pascal(documentType) %>PHState> =
16
17
  (state, action, dispatch) => {
17
18
  if (isDocumentAction(action)) {
18
19
  return state;
@@ -34,4 +35,4 @@ const stateReducer: StateReducer<<%= h.changeCase.pascal(documentType) %>Documen
34
35
  }
35
36
  }
36
37
 
37
- export const reducer = createReducer<<%= h.changeCase.pascal(documentType) %>Document>(stateReducer);
38
+ export const reducer = createReducer<<%= h.changeCase.pascal(documentType) %>PHState>(stateReducer);
@@ -13,15 +13,13 @@ import { reducer } from './gen/reducer.js';
13
13
  import { documentModel } from './gen/document-model.js';
14
14
  import genUtils from './gen/utils.js';
15
15
  import * as customUtils from './src/utils.js';
16
- import {
17
- <%= 'type ' + h.changeCase.pascal(documentType) %>Document,
18
- } from './gen/types.js';
16
+ import type { <%= h.changeCase.pascal(documentType) %>PHState } from './gen/ph-factories.js';
19
17
 
20
18
  const utils = { ...genUtils, ...customUtils };
21
19
  const actions = { ...BaseActions, ...<%= h.changeCase.pascal(documentType) %>Actions };
22
20
 
23
21
  export const module: DocumentModelModule<
24
- <%= h.changeCase.pascal(documentType) %>Document
22
+ <%= h.changeCase.pascal(documentType) %>PHState
25
23
  > = {
26
24
  reducer,
27
25
  actions,
@@ -2,18 +2,20 @@
2
2
  to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/types.ts"
3
3
  force: true
4
4
  ---
5
- import type { PHDocument, BaseStateFromDocument } from 'document-model';
6
- import type { <%= h.changeCase.pascal(documentType) %>State } from './schema/types.js';
5
+ import type { PHDocument } from 'document-model';
6
+ import type { <%= h.changeCase.pascal(documentType) %>Action } from './actions.js';
7
+ import type { <%= h.changeCase.pascal(documentType) %>PHState } from './ph-factories.js';
8
+ import type {
9
+ <%= h.changeCase.pascal(documentType) %>State,
7
10
  <% if(hasLocalSchema) { -%>
8
- import type { <%= h.changeCase.pascal(documentType) %>LocalState } from './schema/types.js';
11
+ <%= h.changeCase.pascal(documentType) %>LocalState,
9
12
  <%} -%>
10
- import type { <%= h.changeCase.pascal(documentType) %>Action } from './actions.js';
13
+ } from './schema/types.js';
11
14
 
12
15
  export { z } from './schema/index.js';
13
16
  export type * from './schema/types.js';
14
17
  <% if(!hasLocalSchema) { -%>
15
18
  <%= 'type ' + h.changeCase.pascal(documentType) %>LocalState = Record<PropertyKey, never>;
16
19
  <%} -%>
17
- export type Extended<%= h.changeCase.pascal(documentType) %>State = BaseStateFromDocument<<%= h.changeCase.pascal(documentType) %>Document>;
18
- export <%= 'type ' + h.changeCase.pascal(documentType) %>Document = PHDocument<<%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState>;
20
+ export type <%= h.changeCase.pascal(documentType) %>Document = PHDocument<<%= h.changeCase.pascal(documentType) %>PHState>;
19
21
  export type { <%= h.changeCase.pascal(documentType) %>State, <%= h.changeCase.pascal(documentType) %>LocalState, <%= h.changeCase.pascal(documentType) %>Action };
@@ -3,7 +3,10 @@ to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/utils.ts"
3
3
  force: true
4
4
  ---
5
5
  import {
6
- type DocumentModelUtils,
6
+ type CreateDocument,
7
+ type CreateState,
8
+ type LoadFromFile,
9
+ type LoadFromInput,
7
10
  baseCreateDocument,
8
11
  baseSaveToFile,
9
12
  baseSaveToFileHandle,
@@ -13,52 +16,55 @@ import {
13
16
  generateId,
14
17
  } from 'document-model';
15
18
  import {
16
- <%= 'type ' + h.changeCase.pascal(documentType) %>Document,
17
19
  <%= 'type ' + h.changeCase.pascal(documentType) %>State,
18
20
  <%= 'type ' + h.changeCase.pascal(documentType) %>LocalState
19
21
  } from './types.js';
22
+ import { <%= h.changeCase.pascal(documentType) %>PHState } from './ph-factories.js';
20
23
  import { reducer } from './reducer.js';
21
24
 
22
25
  export const initialGlobalState: <%= h.changeCase.pascal(documentType) %>State = <%- initialGlobalState %>;
23
26
  export const initialLocalState: <%= h.changeCase.pascal(documentType) %>LocalState = <%- initialLocalState %>;
24
27
 
25
- const utils: DocumentModelUtils<<%= h.changeCase.pascal(documentType) %>Document> = {
26
- fileExtension: '<%- fileExtension %>',
27
- createState(state) {
28
- return { ...defaultBaseState(), global: { ...initialGlobalState, ...state?.global }, local: { ...initialLocalState, ...state?.local } };
29
- },
30
- createDocument(state) {
31
- const document = baseCreateDocument(
32
- utils.createState,
33
- state
34
- );
28
+ export const createState: CreateState<<%= h.changeCase.pascal(documentType) %>PHState> = (state) => {
29
+ return {
30
+ ...defaultBaseState(),
31
+ global: { ...initialGlobalState, ...(state?.global ?? {}) },
32
+ local: { ...initialLocalState, ...(state?.local ?? {}) }
33
+ };
34
+ };
35
+
36
+ export const createDocument: CreateDocument<<%= h.changeCase.pascal(documentType) %>PHState> = (state) => {
37
+ const document = baseCreateDocument(createState, state);
38
+ document.header.documentType = '<%- documentTypeId %>';
39
+ // for backwards compatibility, but this is NOT a valid signed document id
40
+ document.header.id = generateId();
41
+ return document;
42
+ };
43
+
44
+ export const saveToFile = (document: any, path: string, name?: string) => {
45
+ return baseSaveToFile(document, path, '<%- fileExtension %>', name);
46
+ };
35
47
 
36
- document.header.documentType = '<%- documentTypeId %>';
48
+ export const saveToFileHandle = (document: any, input: any) => {
49
+ return baseSaveToFileHandle(document, input);
50
+ };
37
51
 
38
- // for backwards compatibility, but this is NOT a valid signed document id
39
- document.header.id = generateId();
52
+ export const loadFromFile: LoadFromFile<<%= h.changeCase.pascal(documentType) %>PHState> = (path) => {
53
+ return baseLoadFromFile(path, reducer);
54
+ };
40
55
 
41
- return document;
42
- },
43
- saveToFile(document, path, name) {
44
- return baseSaveToFile(document, path, '<%- fileExtension %>', name);
45
- },
46
- saveToFileHandle(document, input) {
47
- return baseSaveToFileHandle(document, input);
48
- },
49
- loadFromFile(path) {
50
- return baseLoadFromFile(path, reducer);
51
- },
52
- loadFromInput(input) {
53
- return baseLoadFromInput(input, reducer);
54
- },
56
+ export const loadFromInput: LoadFromInput<<%= h.changeCase.pascal(documentType) %>PHState> = (input) => {
57
+ return baseLoadFromInput(input, reducer);
55
58
  };
56
59
 
57
- export const createDocument = utils.createDocument;
58
- export const createState = utils.createState;
59
- export const saveToFile = utils.saveToFile;
60
- export const saveToFileHandle = utils.saveToFileHandle;
61
- export const loadFromFile = utils.loadFromFile;
62
- export const loadFromInput = utils.loadFromInput;
60
+ const utils = {
61
+ fileExtension: '<%- fileExtension %>',
62
+ createState,
63
+ createDocument,
64
+ saveToFile,
65
+ saveToFileHandle,
66
+ loadFromFile,
67
+ loadFromInput,
68
+ };
63
69
 
64
70
  export default utils;
@@ -1,5 +1,5 @@
1
- import { type DocumentModelState } from "document-model";
2
- import { type Args } from "../generate-document-model/index.js";
1
+ import type { DocumentModelState } from "document-model";
2
+ import type { Args } from "../generate-document-model/index.js";
3
3
  type ModuleArgs = Args & {
4
4
  module: string;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEhE,KAAK,UAAU,GAAG,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAC5C,KAAK,cAAc,GACjB,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1G,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B,CAAC;;uBAGmB;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE;;;;;;;;AADzC,wBA2CE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEhE,KAAK,UAAU,GAAG,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAC5C,KAAK,cAAc,GACjB,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1G,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B,CAAC;;uBAGmB;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE;;;;;;;;AADzC,wBAiDE"}
@@ -18,12 +18,15 @@ exports.default = {
18
18
  : [];
19
19
  const errors = actions.reduce((acc, action) => {
20
20
  action.errors.forEach((error) => {
21
- const existingError = acc.find((e) => e.code === error.code);
21
+ // Fallback: If error code is empty, generate it from the error name in PascalCase
22
+ const errorCode = error.code || (0, change_case_1.pascalCase)(error.name || "");
23
+ const normalizedError = { ...error, code: errorCode };
24
+ const existingError = acc.find((e) => e.code === errorCode);
22
25
  if (!existingError) {
23
- acc.push(error);
26
+ acc.push(normalizedError);
24
27
  }
25
- else if (JSON.stringify(existingError) !== JSON.stringify(error)) {
26
- console.warn(`Warning: Duplicate error code "${error.code}" with different fields found`);
28
+ else if (JSON.stringify(existingError) !== JSON.stringify(normalizedError)) {
29
+ console.warn(`Warning: Duplicate error code "${errorCode}" with different fields found`);
27
30
  }
28
31
  });
29
32
  return acc;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts"],"names":[],"mappings":";;AAAA,6CAAwC;AAgBxC,kBAAe;IACb,MAAM,EAAE,CAAC,EAAE,IAAI,EAAwB,EAAE,EAAE;QACzC,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAuB,CAAC;QAC3E,MAAM,UAAU,GACd,aAAa,CAAC,cAAc,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACxE,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAC/C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAC9B,CAAC;QAEF,MAAM,OAAO,GACX,eAAe,CAAC,MAAM,GAAG,CAAC;YACxB,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACxC,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,QAAQ,EAAE,CAAC,CAAC,MAAM,KAAK,IAAI;gBAC3B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC;gBACjD,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,QAAQ;gBAC1B,KAAK,EAAE,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,gCAAgC;gBAC5E,MAAM,EAAE,CAAC,CAAC,MAAM;aACjB,CAAC,CAAC;YACL,CAAC,CAAC,EAAE,CAAC;QAET,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YAC9D,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC9B,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC7D,IAAI,CAAC,aAAa,EAAE,CAAC;oBACnB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAClB,CAAC;qBAAM,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;oBACnE,OAAO,CAAC,IAAI,CACV,kCAAkC,KAAK,CAAC,IAAI,+BAA+B,CAC5E,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;YACH,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,YAAY,EAAE,aAAa,CAAC,IAAI;YAChC,MAAM,EAAE,IAAA,uBAAS,EAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,OAAO;YACP,MAAM;SACP,CAAC;IACJ,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.ts"],"names":[],"mappings":";;AAAA,6CAAoD;AAgBpD,kBAAe;IACb,MAAM,EAAE,CAAC,EAAE,IAAI,EAAwB,EAAE,EAAE;QACzC,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAuB,CAAC;QAC3E,MAAM,UAAU,GACd,aAAa,CAAC,cAAc,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACxE,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAC/C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAC9B,CAAC;QAEF,MAAM,OAAO,GACX,eAAe,CAAC,MAAM,GAAG,CAAC;YACxB,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACxC,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,QAAQ,EAAE,CAAC,CAAC,MAAM,KAAK,IAAI;gBAC3B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC;gBACjD,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,QAAQ;gBAC1B,KAAK,EAAE,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,gCAAgC;gBAC5E,MAAM,EAAE,CAAC,CAAC,MAAM;aACjB,CAAC,CAAC;YACL,CAAC,CAAC,EAAE,CAAC;QAET,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YAC9D,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC9B,kFAAkF;gBAClF,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,IAAI,IAAA,wBAAU,EAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;gBAC7D,MAAM,eAAe,GAAG,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;gBAEtD,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;gBAC5D,IAAI,CAAC,aAAa,EAAE,CAAC;oBACnB,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;gBAC5B,CAAC;qBAAM,IACL,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,EACjE,CAAC;oBACD,OAAO,CAAC,IAAI,CACV,kCAAkC,SAAS,+BAA+B,CAC3E,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;YACH,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,YAAY,EAAE,aAAa,CAAC,IAAI;YAChC,MAAM,EAAE,IAAA,uBAAS,EAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,OAAO;YACP,MAAM;SACP,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -3,12 +3,11 @@ to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/<%= module %>/ob
3
3
  force: true
4
4
  ---
5
5
  import { BaseDocumentClass<% if (actions.find(a => a.hasAttachment)) {%>, AttachmentInput<%}%> } from 'document-model';
6
+ import { <%= h.changeCase.pascal(documentType) %>PHState } from '../ph-factories.js';
6
7
  import {
7
8
  <% actions.filter(action => action.hasInput).forEach(action => { _%>
8
9
  <%= 'type ' + h.changeCase.pascal(action.name) %>Input,
9
10
  <% }); _%>
10
- <%= 'type ' + h.changeCase.pascal(documentType) %>State,
11
- <%= 'type ' + h.changeCase.pascal(documentType) %>LocalState
12
11
  } from '../types.js';
13
12
  import {
14
13
  <% actions.forEach(action => { _%>
@@ -17,11 +16,7 @@ import {
17
16
  } from './creators.js';
18
17
  import { <%= 'type ' + h.changeCase.pascal(documentType) %>Action } from '../actions.js';
19
18
 
20
- export default class <%= h.changeCase.pascal(documentType) %>_<%= h.changeCase.pascal(module) %> extends BaseDocumentClass<
21
- <%= h.changeCase.pascal(documentType) %>State,
22
- <%= h.changeCase.pascal(documentType) %>LocalState,
23
- <%= h.changeCase.pascal(documentType) %>Action
24
- > {
19
+ export default class <%= h.changeCase.pascal(documentType) %>_<%= h.changeCase.pascal(module) %> extends BaseDocumentClass<<%= h.changeCase.pascal(documentType) %>PHState> {
25
20
  <% actions.filter(action => action.hasInput).forEach(action => { _%>
26
21
  public <%= h.changeCase.camel(action.name) %>(input: <%= h.changeCase.pascal(action.name) %>Input<%if(action.hasAttachment){ %>, attachments: AttachmentInput[] <% } %>) {
27
22
  return this.dispatch(<%= h.changeCase.camel(action.name) %>(input<%if(action.hasAttachment){ %>, attachments<% } %>));
@@ -4,10 +4,10 @@ force: true
4
4
  ---
5
5
  import { type Subgraph } from "@powerhousedao/reactor-api";
6
6
  import { addFile } from "document-drive";
7
- import { actions <% modules.forEach(module => { %><% module.operations.forEach(op => { %>, type <%- h.changeCase.pascal(op.name) %>Input<%_ })}); %> } from "../../document-models/<%- h.changeCase.param(documentType) %>/index.js";
7
+ import { actions <% modules.forEach(module => { %><% module.operations.forEach(op => { %>, type <%- h.changeCase.pascal(op.name) %>Input<%_ })}); %>, type <%- h.changeCase.pascal(documentType) %>Document } from "../../document-models/<%- h.changeCase.param(documentType) %>/index.js";
8
8
  import { setName } from "document-model";
9
9
 
10
- export const getResolvers = (subgraph: Subgraph) => {
10
+ export const getResolvers = (subgraph: Subgraph): Record<string, unknown> => {
11
11
  const reactor = subgraph.reactor;
12
12
 
13
13
  return ({
@@ -28,11 +28,13 @@ export const getResolvers = (subgraph: Subgraph) => {
28
28
  }
29
29
  }
30
30
 
31
- const doc = await reactor.getDocument(docId);
31
+ const doc = await reactor.getDocument<<%- h.changeCase.pascal(documentType) %>Document>(docId);
32
32
  return {
33
33
  driveId: driveId,
34
34
  ...doc,
35
35
  ...doc.header,
36
+ created: doc.header.createdAtUtcIso,
37
+ lastModified: doc.header.lastModifiedAtUtcIso,
36
38
  state: doc.state.global,
37
39
  stateJSON: doc.state.global,
38
40
  revision: doc.header?.revision?.global ?? 0,
@@ -43,11 +45,13 @@ export const getResolvers = (subgraph: Subgraph) => {
43
45
  const docsIds = await reactor.getDocuments(driveId);
44
46
  const docs = await Promise.all(
45
47
  docsIds.map(async (docId) => {
46
- const doc = await reactor.getDocument(docId);
48
+ const doc = await reactor.getDocument<<%- h.changeCase.pascal(documentType) %>Document>(docId);
47
49
  return {
48
50
  driveId: driveId,
49
51
  ...doc,
50
52
  ...doc.header,
53
+ created: doc.header.createdAtUtcIso,
54
+ lastModified: doc.header.lastModifiedAtUtcIso,
51
55
  state: doc.state.global,
52
56
  stateJSON: doc.state.global,
53
57
  revision: doc.header?.revision?.global ?? 0,
@@ -92,7 +96,7 @@ export const getResolvers = (subgraph: Subgraph) => {
92
96
  <% module.operations.forEach(op => { _%>
93
97
  <%- h.changeCase.pascal(documentType) + '_' + h.changeCase.camel(op.name) %>: async (_: unknown, args: { docId: string, input: <%- h.changeCase.pascal(op.name) %>Input}) => {
94
98
  const { docId, input } = args;
95
- const doc = await reactor.getDocument(docId);
99
+ const doc = await reactor.getDocument<<%- h.changeCase.pascal(documentType) %>Document>(docId);
96
100
  if(!doc) {
97
101
  throw new Error("Document not found");
98
102
  }
@@ -28,9 +28,9 @@ import {
28
28
  } from "@powerhousedao/reactor-browser";
29
29
  import type { DocumentModelModule } from "document-model";
30
30
  import { useCallback, useRef, useState } from "react";
31
- import { CreateDocument } from "./CreateDocument.jsx";
32
- import { EditorContainer } from "./EditorContainer.jsx";
33
- import { FolderTree } from "./FolderTree.jsx";
31
+ import { CreateDocument } from "./CreateDocument.js";
32
+ import { EditorContainer } from "./EditorContainer.js";
33
+ import { FolderTree } from "./FolderTree.js";
34
34
 
35
35
  /**
36
36
  * Main drive explorer component with sidebar navigation and content area.
@@ -8,7 +8,7 @@ import { type <%= documentTypesMap[type].name %>Document, actions } from "<%= do
8
8
  %><% }); _%>
9
9
  import { Button } from '@powerhousedao/design-system';
10
10
 
11
- export type IProps = <% if(!documentTypes.length){ %>EditorProps<PHDocument><% } else { %><% documentTypes.forEach((type, index) => { _%>EditorProps<<%= documentTypesMap[type].name %>Document%>%>><% if(index < documentTypes.length - 1){ %> | <% }%><% }); _%> <% } %>;
11
+ export type IProps = EditorProps;
12
12
 
13
13
  export default function Editor(props: IProps) {
14
14
  return (
@@ -4,11 +4,8 @@ force: true
4
4
  ---
5
5
  import type { EditorModule } from 'document-model';
6
6
  import Editor from './editor.js';
7
- <% documentTypes.forEach(type => { _%>
8
- import type { <%= documentTypesMap[type].name %>Document } from "<%= documentTypesMap[type].importPath %>/index.js";
9
- %><% }); _%>
10
7
 
11
- export const module: <% if(!documentTypes.length){ %>EditorModule<% } else { %><% documentTypes.forEach((type, index) => { _%>EditorModule<<%= documentTypesMap[type].name %>Document%>%>> <% if(index < documentTypes.length - 1){ %>| <% }%><% }); _%> <% } %>= {
8
+ export const module: EditorModule = {
12
9
  Component: Editor,
13
10
  documentTypes: [<% if(!documentTypes.length){ %>'*'<% } else { %><% documentTypes.forEach(type => { _%>"<%= type %>", %><% }); _%> <% } %>],
14
11
  config: {
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/factory.ts"
3
- force: true
3
+ unless_exists: true
4
4
  ---
5
- import { type ProcessorRecord } from "document-drive/processors/types";
5
+ import { type ProcessorRecord } from "document-drive";
6
6
  import { type IProcessorHostModule } from "document-drive/processors/types";
7
7
  import { type PHDocumentHeader } from "document-model";
8
8
  import { <%= pascalName %>Processor } from "./index.js";
@@ -1,14 +1,9 @@
1
1
  ---
2
2
  to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/index.ts"
3
- force: true
3
+ unless_exists: true
4
4
  ---
5
- import type { PHDocument } from "document-model";
6
5
  import { AnalyticsPath, AnalyticsSeriesInput, IAnalyticsStore } from "@powerhousedao/reactor-api";
7
- import { InternalTransmitterUpdate, IProcessor } from "document-drive";
8
-
9
- <% documentTypes.forEach(type => { _%>
10
- import type { <%= documentTypesMap[type].name %>Document } from "<%= documentTypesMap[type].importPath %>/index.js";
11
- %><% }); _%>
6
+ import { type InternalTransmitterUpdate, type IProcessor } from "document-drive";
12
7
 
13
8
  export class <%= pascalName %>Processor implements IProcessor {
14
9
  private readonly NAMESPACE = "<%= pascalName %>";
@@ -19,7 +14,7 @@ export class <%= pascalName %>Processor implements IProcessor {
19
14
  //
20
15
  }
21
16
 
22
- async onStrands<TDocument extends PHDocument>(strands: InternalTransmitterUpdate<TDocument>[]): Promise<void> {
17
+ async onStrands(strands: InternalTransmitterUpdate[]): Promise<void> {
23
18
  if (strands.length === 0) {
24
19
  return;
25
20
  }
@@ -2,6 +2,6 @@
2
2
  inject: true
3
3
  to: "<%= rootDir %>/factory.ts"
4
4
  after: " // Add processors here as they are generated"
5
- skip_if: "<%=h.changeCase.pascal(name) %>ProcessorFactory(module)"
5
+ skip_if: "<%= h.changeCase.pascal(name) %>ProcessorFactory"
6
6
  ---
7
7
  factories.push(<%= h.changeCase.pascal(name) %>ProcessorFactory(module));
@@ -2,6 +2,6 @@
2
2
  inject: true
3
3
  to: "<%= rootDir %>/factory.ts"
4
4
  after: "// Import processor factories here as they are generated"
5
- skip_if: "{ <%= h.changeCase.camel(name) %>ProcessorFactory }"
5
+ skip_if: "{ <%= h.changeCase.pascal(name) %>ProcessorFactory }"
6
6
  ---
7
7
  import { <%= h.changeCase.pascal(name) %>ProcessorFactory } from "./<%= h.changeCase.param(name) %>/factory.js";
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/factory.ts"
3
- force: true
3
+ unless_exists: true
4
4
  ---
5
5
  import {
6
6
  type ProcessorRecord,
@@ -1,19 +1,13 @@
1
1
  ---
2
2
  to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/index.ts"
3
- force: true
3
+ unless_exists: true
4
4
  ---
5
5
  import { type IRelationalDb } from "document-drive/processors/types";
6
6
  import { RelationalDbProcessor } from "document-drive/processors/relational";
7
7
  import { type InternalTransmitterUpdate } from "document-drive/server/listener/transmitter/internal";
8
- <% documentTypes.forEach(type => { _%>
9
- import type { <%= documentTypesMap[type].name %>Document } from "<%= documentTypesMap[type].importPath %>/index.js";
10
- %><% }); _%>
11
- <% if(documentTypes.length === 0) { %>import { type PHDocument } from "document-model";<% } %>
12
8
  import { up } from "./migrations.js";
13
9
  import { type DB } from "./schema.js";
14
10
 
15
- type DocumentType = <% if(documentTypes.length) { %><%= documentTypes.map(type => `${documentTypesMap[type].name}Document`).join(" | ") %> <% } else { %>PHDocument<% } %>;
16
-
17
11
  export class <%= pascalName %>Processor extends RelationalDbProcessor<DB> {
18
12
  static override getNamespace(driveId: string): string {
19
13
  // Default namespace: `${this.name}_${driveId.replaceAll("-", "_")}`
@@ -25,7 +19,7 @@ export class <%= pascalName %>Processor extends RelationalDbProcessor<DB> {
25
19
  }
26
20
 
27
21
  override async onStrands(
28
- strands: InternalTransmitterUpdate<DocumentType>[],
22
+ strands: InternalTransmitterUpdate[],
29
23
  ): Promise<void> {
30
24
  if (strands.length === 0) {
31
25
  return;
@@ -40,7 +34,7 @@ export class <%= pascalName %>Processor extends RelationalDbProcessor<DB> {
40
34
  await this.relationalDb
41
35
  .insertInto("todo")
42
36
  .values({
43
- task: `${strand.documentId}-${operation.index}: ${operation.type}`,
37
+ task: `${strand.documentId}-${operation.index}: ${operation.action.type}`,
44
38
  status: true,
45
39
  })
46
40
  .onConflict((oc) => oc.column("task").doNothing())
@@ -10,15 +10,13 @@ unless_exists: true
10
10
  import { type ProcessorRecord, type IProcessorHostModule, type ProcessorFactory } from "document-drive/processors/types";
11
11
  import { type PHDocumentHeader } from "document-model";
12
12
 
13
- // Import other processor factories here as they are generated
13
+ // Import processor factories here as they are generated
14
14
 
15
15
  export const processorFactory = (module: IProcessorHostModule) => {
16
16
  // Initialize all processor factories once with the module
17
17
  const factories: Array<ProcessorFactory> = [];
18
18
 
19
- // Add all processor factories
20
-
21
- // Add other processors here as they are generated
19
+ // Add processors here as they are generated
22
20
 
23
21
  // Return the inner function that will be called for each drive
24
22
  return async (driveHeader: PHDocumentHeader): Promise<ProcessorRecord[]> => {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  inject: true
3
3
  to: "<%= rootDir %>/factory.ts"
4
- after: " // Add other processors here as they are generated"
5
- skip_if: "<%=h.changeCase.camel(name) %>ProcessorFactory(module)"
4
+ after: " // Add processors here as they are generated"
5
+ skip_if: "<%= h.changeCase.camel(name) %>ProcessorFactory"
6
6
  ---
7
7
  factories.push(<%= h.changeCase.camel(name) %>ProcessorFactory(module));
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  inject: true
3
3
  to: "<%= rootDir %>/factory.ts"
4
- after: "// Import other processor factories here as they are generated"
4
+ after: "// Import processor factories here as they are generated"
5
5
  skip_if: "{ <%= h.changeCase.camel(name) %>ProcessorFactory }"
6
6
  ---
7
7
  import { <%= h.changeCase.camel(name) %>ProcessorFactory } from "./<%= h.changeCase.param(name) %>/factory.js";
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/migrations.ts"
3
- force: true
3
+ unless_exists: true
4
4
  ---
5
5
  import { type IRelationalDb } from "document-drive/processors/types"
6
6
 
@@ -1,5 +1,13 @@
1
1
  ---
2
2
  to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/schema.ts"
3
- force: true
3
+ unless_exists: true
4
4
  ---
5
- export interface DB {}
5
+ export interface Todo {
6
+ status: boolean | null;
7
+ task: string;
8
+ }
9
+
10
+ export interface DB {
11
+ todo: Todo;
12
+ }
13
+