@powerhousedao/notes-demo-package 1.0.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/LICENSE +661 -0
- package/README.md +179 -0
- package/dist/document-models/index.d.ts +3 -0
- package/dist/document-models/index.d.ts.map +1 -0
- package/dist/document-models/index.js +2 -0
- package/dist/document-models/notes/gen/actions.d.ts +4 -0
- package/dist/document-models/notes/gen/actions.d.ts.map +1 -0
- package/dist/document-models/notes/gen/actions.js +1 -0
- package/dist/document-models/notes/gen/creators.d.ts +2 -0
- package/dist/document-models/notes/gen/creators.d.ts.map +1 -0
- package/dist/document-models/notes/gen/creators.js +1 -0
- package/dist/document-models/notes/gen/document-model.d.ts +3 -0
- package/dist/document-models/notes/gen/document-model.d.ts.map +1 -0
- package/dist/document-models/notes/gen/document-model.js +103 -0
- package/dist/document-models/notes/gen/index.d.ts +6 -0
- package/dist/document-models/notes/gen/index.d.ts.map +1 -0
- package/dist/document-models/notes/gen/index.js +5 -0
- package/dist/document-models/notes/gen/notes/actions.d.ts +28 -0
- package/dist/document-models/notes/gen/notes/actions.d.ts.map +1 -0
- package/dist/document-models/notes/gen/notes/actions.js +1 -0
- package/dist/document-models/notes/gen/notes/creators.d.ts +9 -0
- package/dist/document-models/notes/gen/notes/creators.d.ts.map +1 -0
- package/dist/document-models/notes/gen/notes/creators.js +9 -0
- package/dist/document-models/notes/gen/notes/error.d.ts +2 -0
- package/dist/document-models/notes/gen/notes/error.d.ts.map +1 -0
- package/dist/document-models/notes/gen/notes/error.js +1 -0
- package/dist/document-models/notes/gen/notes/operations.d.ts +12 -0
- package/dist/document-models/notes/gen/notes/operations.d.ts.map +1 -0
- package/dist/document-models/notes/gen/notes/operations.js +3 -0
- package/dist/document-models/notes/gen/ph-factories.d.ts +23 -0
- package/dist/document-models/notes/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/notes/gen/ph-factories.js +47 -0
- package/dist/document-models/notes/gen/reducer.d.ts +5 -0
- package/dist/document-models/notes/gen/reducer.d.ts.map +1 -0
- package/dist/document-models/notes/gen/reducer.js +37 -0
- package/dist/document-models/notes/gen/schema/index.d.ts +3 -0
- package/dist/document-models/notes/gen/schema/index.d.ts.map +1 -0
- package/dist/document-models/notes/gen/schema/index.js +2 -0
- package/dist/document-models/notes/gen/schema/types.d.ts +190 -0
- package/dist/document-models/notes/gen/schema/types.d.ts.map +1 -0
- package/dist/document-models/notes/gen/schema/types.js +1 -0
- package/dist/document-models/notes/gen/schema/zod.d.ts +50 -0
- package/dist/document-models/notes/gen/schema/zod.d.ts.map +1 -0
- package/dist/document-models/notes/gen/schema/zod.js +76 -0
- package/dist/document-models/notes/gen/types.d.ts +13 -0
- package/dist/document-models/notes/gen/types.d.ts.map +1 -0
- package/dist/document-models/notes/gen/types.js +2 -0
- package/dist/document-models/notes/gen/utils.d.ts +12 -0
- package/dist/document-models/notes/gen/utils.d.ts.map +1 -0
- package/dist/document-models/notes/gen/utils.js +34 -0
- package/dist/document-models/notes/index.d.ts +36 -0
- package/dist/document-models/notes/index.d.ts.map +1 -0
- package/dist/document-models/notes/index.js +22 -0
- package/dist/document-models/notes/src/reducers/notes.d.ts +3 -0
- package/dist/document-models/notes/src/reducers/notes.d.ts.map +1 -0
- package/dist/document-models/notes/src/reducers/notes.js +69 -0
- package/dist/document-models/notes/src/tests/document-model.test.d.ts +6 -0
- package/dist/document-models/notes/src/tests/document-model.test.d.ts.map +1 -0
- package/dist/document-models/notes/src/tests/document-model.test.js +18 -0
- package/dist/document-models/notes/src/tests/notes.test.d.ts +6 -0
- package/dist/document-models/notes/src/tests/notes.test.d.ts.map +1 -0
- package/dist/document-models/notes/src/tests/notes.test.js +32 -0
- package/dist/document-models/notes/src/utils.d.ts +2 -0
- package/dist/document-models/notes/src/utils.d.ts.map +1 -0
- package/dist/document-models/notes/src/utils.js +1 -0
- package/dist/editors/hooks/useNotesDocument.d.ts +4 -0
- package/dist/editors/hooks/useNotesDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useNotesDocument.js +7 -0
- package/dist/editors/index.d.ts +3 -0
- package/dist/editors/index.d.ts.map +1 -0
- package/dist/editors/index.js +2 -0
- package/dist/editors/notes-editor/components/NoteList.d.ts +11 -0
- package/dist/editors/notes-editor/components/NoteList.d.ts.map +1 -0
- package/dist/editors/notes-editor/components/NoteList.js +5 -0
- package/dist/editors/notes-editor/components/NoteListItem.d.ts +9 -0
- package/dist/editors/notes-editor/components/NoteListItem.d.ts.map +1 -0
- package/dist/editors/notes-editor/components/NoteListItem.js +5 -0
- package/dist/editors/notes-editor/components/TextNoteEditor.d.ts +13 -0
- package/dist/editors/notes-editor/components/TextNoteEditor.d.ts.map +1 -0
- package/dist/editors/notes-editor/components/TextNoteEditor.js +29 -0
- package/dist/editors/notes-editor/components/TodoNoteEditor.d.ts +13 -0
- package/dist/editors/notes-editor/components/TodoNoteEditor.d.ts.map +1 -0
- package/dist/editors/notes-editor/components/TodoNoteEditor.js +34 -0
- package/dist/editors/notes-editor/editor.d.ts +2 -0
- package/dist/editors/notes-editor/editor.d.ts.map +1 -0
- package/dist/editors/notes-editor/editor.js +61 -0
- package/dist/editors/notes-editor/index.d.ts +3 -0
- package/dist/editors/notes-editor/index.d.ts.map +1 -0
- package/dist/editors/notes-editor/index.js +9 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/powerhouse.manifest.json +27 -0
- package/dist/processors/index.d.ts +2 -0
- package/dist/processors/index.d.ts.map +1 -0
- package/dist/processors/index.js +1 -0
- package/dist/style.css +656 -0
- package/dist/subgraphs/index.d.ts +3 -0
- package/dist/subgraphs/index.d.ts.map +1 -0
- package/dist/subgraphs/index.js +2 -0
- package/dist/subgraphs/notes/index.d.ts +11 -0
- package/dist/subgraphs/notes/index.d.ts.map +1 -0
- package/dist/subgraphs/notes/index.js +11 -0
- package/dist/subgraphs/notes/resolvers.d.ts +3 -0
- package/dist/subgraphs/notes/resolvers.d.ts.map +1 -0
- package/dist/subgraphs/notes/resolvers.js +144 -0
- package/dist/subgraphs/notes/schema.d.ts +3 -0
- package/dist/subgraphs/notes/schema.d.ts.map +1 -0
- package/dist/subgraphs/notes/schema.js +80 -0
- package/dist/subgraphs/notes copy/index.d.ts +11 -0
- package/dist/subgraphs/notes copy/index.d.ts.map +1 -0
- package/dist/subgraphs/notes copy/index.js +11 -0
- package/dist/subgraphs/notes copy/resolvers.d.ts +3 -0
- package/dist/subgraphs/notes copy/resolvers.d.ts.map +1 -0
- package/dist/subgraphs/notes copy/resolvers.js +156 -0
- package/dist/subgraphs/notes copy/schema.d.ts +3 -0
- package/dist/subgraphs/notes copy/schema.d.ts.map +1 -0
- package/dist/subgraphs/notes copy/schema.js +80 -0
- package/dist/vite.config.d.ts +3 -0
- package/dist/vite.config.d.ts.map +1 -0
- package/dist/vite.config.js +13 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +8 -0
- package/package.json +118 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
export type Maybe<T> = T | null;
|
|
2
|
+
export type InputMaybe<T> = T | null | undefined;
|
|
3
|
+
export type Exact<T extends {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}> = {
|
|
6
|
+
[K in keyof T]: T[K];
|
|
7
|
+
};
|
|
8
|
+
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
9
|
+
[SubKey in K]?: Maybe<T[SubKey]>;
|
|
10
|
+
};
|
|
11
|
+
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
12
|
+
[SubKey in K]: Maybe<T[SubKey]>;
|
|
13
|
+
};
|
|
14
|
+
export type MakeEmpty<T extends {
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}, K extends keyof T> = {
|
|
17
|
+
[_ in K]?: never;
|
|
18
|
+
};
|
|
19
|
+
export type Incremental<T> = T | {
|
|
20
|
+
[P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never;
|
|
21
|
+
};
|
|
22
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
23
|
+
export type Scalars = {
|
|
24
|
+
ID: {
|
|
25
|
+
input: string;
|
|
26
|
+
output: string;
|
|
27
|
+
};
|
|
28
|
+
String: {
|
|
29
|
+
input: string;
|
|
30
|
+
output: string;
|
|
31
|
+
};
|
|
32
|
+
Boolean: {
|
|
33
|
+
input: boolean;
|
|
34
|
+
output: boolean;
|
|
35
|
+
};
|
|
36
|
+
Int: {
|
|
37
|
+
input: number;
|
|
38
|
+
output: number;
|
|
39
|
+
};
|
|
40
|
+
Float: {
|
|
41
|
+
input: number;
|
|
42
|
+
output: number;
|
|
43
|
+
};
|
|
44
|
+
Amount: {
|
|
45
|
+
input: {
|
|
46
|
+
unit?: string;
|
|
47
|
+
value?: number;
|
|
48
|
+
};
|
|
49
|
+
output: {
|
|
50
|
+
unit?: string;
|
|
51
|
+
value?: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
Amount_Crypto: {
|
|
55
|
+
input: {
|
|
56
|
+
unit: string;
|
|
57
|
+
value: string;
|
|
58
|
+
};
|
|
59
|
+
output: {
|
|
60
|
+
unit: string;
|
|
61
|
+
value: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
Amount_Currency: {
|
|
65
|
+
input: {
|
|
66
|
+
unit: string;
|
|
67
|
+
value: string;
|
|
68
|
+
};
|
|
69
|
+
output: {
|
|
70
|
+
unit: string;
|
|
71
|
+
value: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
Amount_Fiat: {
|
|
75
|
+
input: {
|
|
76
|
+
unit: string;
|
|
77
|
+
value: number;
|
|
78
|
+
};
|
|
79
|
+
output: {
|
|
80
|
+
unit: string;
|
|
81
|
+
value: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
Amount_Money: {
|
|
85
|
+
input: number;
|
|
86
|
+
output: number;
|
|
87
|
+
};
|
|
88
|
+
Amount_Percentage: {
|
|
89
|
+
input: number;
|
|
90
|
+
output: number;
|
|
91
|
+
};
|
|
92
|
+
Amount_Tokens: {
|
|
93
|
+
input: number;
|
|
94
|
+
output: number;
|
|
95
|
+
};
|
|
96
|
+
Currency: {
|
|
97
|
+
input: string;
|
|
98
|
+
output: string;
|
|
99
|
+
};
|
|
100
|
+
Date: {
|
|
101
|
+
input: string;
|
|
102
|
+
output: string;
|
|
103
|
+
};
|
|
104
|
+
DateTime: {
|
|
105
|
+
input: string;
|
|
106
|
+
output: string;
|
|
107
|
+
};
|
|
108
|
+
EmailAddress: {
|
|
109
|
+
input: string;
|
|
110
|
+
output: string;
|
|
111
|
+
};
|
|
112
|
+
EthereumAddress: {
|
|
113
|
+
input: string;
|
|
114
|
+
output: string;
|
|
115
|
+
};
|
|
116
|
+
OID: {
|
|
117
|
+
input: string;
|
|
118
|
+
output: string;
|
|
119
|
+
};
|
|
120
|
+
OLabel: {
|
|
121
|
+
input: string;
|
|
122
|
+
output: string;
|
|
123
|
+
};
|
|
124
|
+
PHID: {
|
|
125
|
+
input: string;
|
|
126
|
+
output: string;
|
|
127
|
+
};
|
|
128
|
+
URL: {
|
|
129
|
+
input: string;
|
|
130
|
+
output: string;
|
|
131
|
+
};
|
|
132
|
+
Upload: {
|
|
133
|
+
input: File;
|
|
134
|
+
output: File;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export type AddTextInput = {
|
|
138
|
+
content: Scalars["String"]["input"];
|
|
139
|
+
date: Scalars["Date"]["input"];
|
|
140
|
+
id: Scalars["OID"]["input"];
|
|
141
|
+
title: Scalars["String"]["input"];
|
|
142
|
+
};
|
|
143
|
+
export type AddTodoInput = {
|
|
144
|
+
date: Scalars["Date"]["input"];
|
|
145
|
+
done: Scalars["Boolean"]["input"];
|
|
146
|
+
id: Scalars["OID"]["input"];
|
|
147
|
+
title: Scalars["String"]["input"];
|
|
148
|
+
};
|
|
149
|
+
export type DeleteNoteInput = {
|
|
150
|
+
id: Scalars["OID"]["input"];
|
|
151
|
+
};
|
|
152
|
+
export type EditNoteInput = {
|
|
153
|
+
date?: InputMaybe<Scalars["Date"]["input"]>;
|
|
154
|
+
id: Scalars["OID"]["input"];
|
|
155
|
+
title?: InputMaybe<Scalars["String"]["input"]>;
|
|
156
|
+
};
|
|
157
|
+
export type EditTextInput = {
|
|
158
|
+
content?: InputMaybe<Scalars["String"]["input"]>;
|
|
159
|
+
date?: InputMaybe<Scalars["Date"]["input"]>;
|
|
160
|
+
id: Scalars["OID"]["input"];
|
|
161
|
+
title?: InputMaybe<Scalars["String"]["input"]>;
|
|
162
|
+
};
|
|
163
|
+
export type EditTodoInput = {
|
|
164
|
+
date?: InputMaybe<Scalars["Date"]["input"]>;
|
|
165
|
+
done?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
166
|
+
id: Scalars["OID"]["input"];
|
|
167
|
+
title?: InputMaybe<Scalars["String"]["input"]>;
|
|
168
|
+
};
|
|
169
|
+
export type INote = {
|
|
170
|
+
date: Scalars["Date"]["output"];
|
|
171
|
+
id: Scalars["OID"]["output"];
|
|
172
|
+
title: Scalars["String"]["output"];
|
|
173
|
+
};
|
|
174
|
+
export type Note = Text | Todo;
|
|
175
|
+
export type NotesState = {
|
|
176
|
+
notes: Array<Note>;
|
|
177
|
+
};
|
|
178
|
+
export type Text = INote & {
|
|
179
|
+
content: Scalars["String"]["output"];
|
|
180
|
+
date: Scalars["Date"]["output"];
|
|
181
|
+
id: Scalars["OID"]["output"];
|
|
182
|
+
title: Scalars["String"]["output"];
|
|
183
|
+
};
|
|
184
|
+
export type Todo = INote & {
|
|
185
|
+
date: Scalars["Date"]["output"];
|
|
186
|
+
done: Scalars["Boolean"]["output"];
|
|
187
|
+
id: Scalars["OID"]["output"];
|
|
188
|
+
title: Scalars["String"]["output"];
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;IAChC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;IACnC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;CACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AddTextInput, AddTodoInput, DeleteNoteInput, EditNoteInput, EditTextInput, EditTodoInput, NotesState, Text, Todo } from "./types.js";
|
|
3
|
+
type Properties<T> = Required<{
|
|
4
|
+
[K in keyof T]: z.ZodType<T[K], any, T[K]>;
|
|
5
|
+
}>;
|
|
6
|
+
type definedNonNullAny = {};
|
|
7
|
+
export declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
|
|
8
|
+
export declare const definedNonNullAnySchema: z.ZodEffects<z.ZodAny, definedNonNullAny, any>;
|
|
9
|
+
export declare function AddTextInputSchema(): z.ZodObject<Properties<AddTextInput>>;
|
|
10
|
+
export declare function AddTodoInputSchema(): z.ZodObject<Properties<AddTodoInput>>;
|
|
11
|
+
export declare function DeleteNoteInputSchema(): z.ZodObject<Properties<DeleteNoteInput>>;
|
|
12
|
+
export declare function EditNoteInputSchema(): z.ZodObject<Properties<EditNoteInput>>;
|
|
13
|
+
export declare function EditTextInputSchema(): z.ZodObject<Properties<EditTextInput>>;
|
|
14
|
+
export declare function EditTodoInputSchema(): z.ZodObject<Properties<EditTodoInput>>;
|
|
15
|
+
export declare function NoteSchema(): z.ZodUnion<[z.ZodObject<Required<{
|
|
16
|
+
date: z.ZodType<string, any, string>;
|
|
17
|
+
id: z.ZodType<string, any, string>;
|
|
18
|
+
title: z.ZodType<string, any, string>;
|
|
19
|
+
content: z.ZodType<string, any, string>;
|
|
20
|
+
}>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
21
|
+
content: import("./types.js").Scalars["String"]["output"];
|
|
22
|
+
date: import("./types.js").Scalars["Date"]["output"];
|
|
23
|
+
id: import("./types.js").Scalars["OID"]["output"];
|
|
24
|
+
title: import("./types.js").Scalars["String"]["output"];
|
|
25
|
+
}, {
|
|
26
|
+
content: import("./types.js").Scalars["String"]["output"];
|
|
27
|
+
date: import("./types.js").Scalars["Date"]["output"];
|
|
28
|
+
id: import("./types.js").Scalars["OID"]["output"];
|
|
29
|
+
title: import("./types.js").Scalars["String"]["output"];
|
|
30
|
+
}>, z.ZodObject<Required<{
|
|
31
|
+
date: z.ZodType<string, any, string>;
|
|
32
|
+
id: z.ZodType<string, any, string>;
|
|
33
|
+
title: z.ZodType<string, any, string>;
|
|
34
|
+
done: z.ZodType<boolean, any, boolean>;
|
|
35
|
+
}>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
36
|
+
date: import("./types.js").Scalars["Date"]["output"];
|
|
37
|
+
id: import("./types.js").Scalars["OID"]["output"];
|
|
38
|
+
title: import("./types.js").Scalars["String"]["output"];
|
|
39
|
+
done: import("./types.js").Scalars["Boolean"]["output"];
|
|
40
|
+
}, {
|
|
41
|
+
date: import("./types.js").Scalars["Date"]["output"];
|
|
42
|
+
id: import("./types.js").Scalars["OID"]["output"];
|
|
43
|
+
title: import("./types.js").Scalars["String"]["output"];
|
|
44
|
+
done: import("./types.js").Scalars["Boolean"]["output"];
|
|
45
|
+
}>]>;
|
|
46
|
+
export declare function NotesStateSchema(): z.ZodObject<Properties<NotesState>>;
|
|
47
|
+
export declare function TextSchema(): z.ZodObject<Properties<Text>>;
|
|
48
|
+
export declare function TodoSchema(): z.ZodObject<Properties<Todo>>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/notes/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,IAAI,EACJ,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,gDAEI,CAAC;AAEzC,wBAAgB,kBAAkB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAO1E;AAED,wBAAgB,kBAAkB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAO1E;AAED,wBAAgB,qBAAqB,IAAI,CAAC,CAAC,SAAS,CAClD,UAAU,CAAC,eAAe,CAAC,CAC5B,CAIA;AAED,wBAAgB,mBAAmB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAM5E;AAED,wBAAgB,mBAAmB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAO5E;AAED,wBAAgB,mBAAmB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAO5E;AAED,wBAAgB,UAAU;;;;;;aA8BquB,sCAAkB;UAArP,oCAAgB;QAAiB,mCAAe;WAAoB,sCAAkB;;aAA6I,sCAAkB;UAArP,oCAAgB;QAAiB,mCAAe;WAAoB,sCAAkB;;;;;;;UAAtF,oCAAgB;QAAiB,mCAAe;WAAoB,sCAAkB;UAA+V,uCAAmB;;UAAxc,oCAAgB;QAAiB,mCAAe;WAAoB,sCAAkB;UAA+V,uCAAmB;KA5Bn+B;AAED,wBAAgB,gBAAgB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAKtE;AAED,wBAAgB,UAAU,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAQ1D;AAED,wBAAgB,UAAU,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAQ1D"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const isDefinedNonNullAny = (v) => v !== undefined && v !== null;
|
|
3
|
+
export const definedNonNullAnySchema = z
|
|
4
|
+
.any()
|
|
5
|
+
.refine((v) => isDefinedNonNullAny(v));
|
|
6
|
+
export function AddTextInputSchema() {
|
|
7
|
+
return z.object({
|
|
8
|
+
content: z.string(),
|
|
9
|
+
date: z.string().datetime(),
|
|
10
|
+
id: z.string(),
|
|
11
|
+
title: z.string(),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function AddTodoInputSchema() {
|
|
15
|
+
return z.object({
|
|
16
|
+
date: z.string().datetime(),
|
|
17
|
+
done: z.boolean(),
|
|
18
|
+
id: z.string(),
|
|
19
|
+
title: z.string(),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function DeleteNoteInputSchema() {
|
|
23
|
+
return z.object({
|
|
24
|
+
id: z.string(),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export function EditNoteInputSchema() {
|
|
28
|
+
return z.object({
|
|
29
|
+
date: z.string().datetime().nullish(),
|
|
30
|
+
id: z.string(),
|
|
31
|
+
title: z.string().nullish(),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export function EditTextInputSchema() {
|
|
35
|
+
return z.object({
|
|
36
|
+
content: z.string().nullish(),
|
|
37
|
+
date: z.string().datetime().nullish(),
|
|
38
|
+
id: z.string(),
|
|
39
|
+
title: z.string().nullish(),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function EditTodoInputSchema() {
|
|
43
|
+
return z.object({
|
|
44
|
+
date: z.string().datetime().nullish(),
|
|
45
|
+
done: z.boolean().nullish(),
|
|
46
|
+
id: z.string(),
|
|
47
|
+
title: z.string().nullish(),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export function NoteSchema() {
|
|
51
|
+
return z.union([TextSchema(), TodoSchema()]);
|
|
52
|
+
}
|
|
53
|
+
export function NotesStateSchema() {
|
|
54
|
+
return z.object({
|
|
55
|
+
__typename: z.literal("NotesState").optional(),
|
|
56
|
+
notes: z.array(NoteSchema()),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export function TextSchema() {
|
|
60
|
+
return z.object({
|
|
61
|
+
__typename: z.literal("Text").optional(),
|
|
62
|
+
content: z.string(),
|
|
63
|
+
date: z.string().datetime(),
|
|
64
|
+
id: z.string(),
|
|
65
|
+
title: z.string(),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export function TodoSchema() {
|
|
69
|
+
return z.object({
|
|
70
|
+
__typename: z.literal("Todo").optional(),
|
|
71
|
+
date: z.string().datetime(),
|
|
72
|
+
done: z.boolean(),
|
|
73
|
+
id: z.string(),
|
|
74
|
+
title: z.string(),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PHDocument, PHBaseState } from "document-model";
|
|
2
|
+
import type { NotesAction } from "./actions.js";
|
|
3
|
+
import type { NotesState as NotesGlobalState } from "./schema/types.js";
|
|
4
|
+
export { z } from "./schema/index.js";
|
|
5
|
+
export * from "./schema/types.js";
|
|
6
|
+
type NotesLocalState = Record<PropertyKey, never>;
|
|
7
|
+
type NotesPHState = PHBaseState & {
|
|
8
|
+
global: NotesGlobalState;
|
|
9
|
+
local: NotesLocalState;
|
|
10
|
+
};
|
|
11
|
+
type NotesDocument = PHDocument<NotesPHState>;
|
|
12
|
+
export type { NotesGlobalState, NotesLocalState, NotesPHState, NotesAction, NotesDocument, };
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,KAAK,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAClD,KAAK,YAAY,GAAG,WAAW,GAAG;IAChC,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AACF,KAAK,aAAa,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;AAE9C,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DocumentModelUtils } from "document-model";
|
|
2
|
+
import type { NotesGlobalState, NotesLocalState } from "./types.js";
|
|
3
|
+
import type { NotesPHState } from "./types.js";
|
|
4
|
+
export declare const initialGlobalState: NotesGlobalState;
|
|
5
|
+
export declare const initialLocalState: NotesLocalState;
|
|
6
|
+
declare const utils: DocumentModelUtils<NotesPHState>;
|
|
7
|
+
export declare const createDocument: import("document-model").CreateDocument<NotesPHState>;
|
|
8
|
+
export declare const createState: import("document-model").CreateState<NotesPHState>;
|
|
9
|
+
export declare const saveToFileHandle: import("document-model").SaveToFileHandle;
|
|
10
|
+
export declare const loadFromInput: import("document-model").LoadFromInput<NotesPHState>;
|
|
11
|
+
export default utils;
|
|
12
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAQzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,eAAO,MAAM,kBAAkB,EAAE,gBAEhC,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,eAAoB,CAAC;AAErD,QAAA,MAAM,KAAK,EAAE,kBAAkB,CAAC,YAAY,CAyB3C,CAAC;AAEF,eAAO,MAAM,cAAc,uDAAuB,CAAC;AACnD,eAAO,MAAM,WAAW,oDAAoB,CAAC;AAC7C,eAAO,MAAM,gBAAgB,2CAAyB,CAAC;AACvD,eAAO,MAAM,aAAa,sDAAsB,CAAC;AAEjD,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { baseCreateDocument, baseSaveToFileHandle, baseLoadFromInput, defaultBaseState, generateId, } from "document-model/core";
|
|
2
|
+
import { reducer } from "./reducer.js";
|
|
3
|
+
export const initialGlobalState = {
|
|
4
|
+
notes: [],
|
|
5
|
+
};
|
|
6
|
+
export const initialLocalState = {};
|
|
7
|
+
const utils = {
|
|
8
|
+
fileExtension: ".note",
|
|
9
|
+
createState(state) {
|
|
10
|
+
return {
|
|
11
|
+
...defaultBaseState(),
|
|
12
|
+
global: { ...initialGlobalState, ...state?.global },
|
|
13
|
+
local: { ...initialLocalState, ...state?.local },
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
createDocument(state) {
|
|
17
|
+
const document = baseCreateDocument(utils.createState, state);
|
|
18
|
+
document.header.documentType = "powerhouse/notes";
|
|
19
|
+
// for backwards compatibility, but this is NOT a valid signed document id
|
|
20
|
+
document.header.id = generateId();
|
|
21
|
+
return document;
|
|
22
|
+
},
|
|
23
|
+
saveToFileHandle(document, input) {
|
|
24
|
+
return baseSaveToFileHandle(document, input);
|
|
25
|
+
},
|
|
26
|
+
loadFromInput(input) {
|
|
27
|
+
return baseLoadFromInput(input, reducer);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export const createDocument = utils.createDocument;
|
|
31
|
+
export const createState = utils.createState;
|
|
32
|
+
export const saveToFileHandle = utils.saveToFileHandle;
|
|
33
|
+
export const loadFromInput = utils.loadFromInput;
|
|
34
|
+
export default utils;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization.
|
|
3
|
+
* Delete the file and run the code generator again to have it reset
|
|
4
|
+
*/
|
|
5
|
+
import { type DocumentModelModule } from "document-model";
|
|
6
|
+
import { reducer } from "./gen/reducer.js";
|
|
7
|
+
import { documentModel } from "./gen/document-model.js";
|
|
8
|
+
import type { NotesPHState } from "./gen/types.js";
|
|
9
|
+
declare const utils: {
|
|
10
|
+
fileExtension: string;
|
|
11
|
+
createState: import("document-model").CreateState<NotesPHState>;
|
|
12
|
+
createDocument: import("document-model").CreateDocument<NotesPHState>;
|
|
13
|
+
loadFromInput: import("document-model").LoadFromInput<NotesPHState>;
|
|
14
|
+
saveToFileHandle: import("document-model").SaveToFileHandle;
|
|
15
|
+
};
|
|
16
|
+
declare const actions: {
|
|
17
|
+
addText: (input: import("./gen/index.js").AddTextInput) => import("./gen/index.js").AddTextAction;
|
|
18
|
+
addTodo: (input: import("./gen/index.js").AddTodoInput) => import("./gen/index.js").AddTodoAction;
|
|
19
|
+
editNote: (input: import("./gen/index.js").EditNoteInput) => import("./gen/index.js").EditNoteAction;
|
|
20
|
+
editText: (input: import("./gen/index.js").EditTextInput) => import("./gen/index.js").EditTextAction;
|
|
21
|
+
editTodo: (input: import("./gen/index.js").EditTodoInput) => import("./gen/index.js").EditTodoAction;
|
|
22
|
+
deleteNote: (input: import("./gen/index.js").DeleteNoteInput) => import("./gen/index.js").DeleteNoteAction;
|
|
23
|
+
setName: (name: string) => import("document-model").SetNameAction;
|
|
24
|
+
undo: (skip?: number, scope?: string) => import("document-model").UndoAction;
|
|
25
|
+
redo: (count?: number, scope?: string) => import("document-model").RedoAction;
|
|
26
|
+
prune: (start?: number, end?: number, scope?: string) => import("document-model").SchemaPruneAction;
|
|
27
|
+
loadState: <TState extends import("document-model").PHBaseState = import("document-model").PHBaseState>(state: TState & {
|
|
28
|
+
name: string;
|
|
29
|
+
}, operations: number) => import("document-model").LoadStateAction;
|
|
30
|
+
noop: (scope?: string) => import("document-model").NOOPAction;
|
|
31
|
+
};
|
|
32
|
+
export declare const module: DocumentModelModule<NotesPHState>;
|
|
33
|
+
export { reducer, actions, utils, documentModel };
|
|
34
|
+
export * from "./gen/types.js";
|
|
35
|
+
export * from "./src/utils.js";
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/notes/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,QAAA,MAAM,KAAK;;;;;;CAAkC,CAAC;AAC9C,QAAA,MAAM,OAAO;cANsB,4CAAmB;cAKxC,4CAAkB;eAM1B,6CACW;eAMM,6CACZ;eAA+J,6CAAoB;iBAAiK,+CAAsB;;eAAk1L,CAAC,eAAe,CAAC;gBAAkE,CAAC,eAAe,CAAC;iBAAmE,CAAC,aAAa,CAAC,eAAe,CAAC;;;;gBAAqS,CAAC;CAbhoN,CAAC;AAEpD,eAAO,MAAM,MAAM,EAAE,mBAAmB,CAAC,YAAY,CAKpD,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAElD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization.
|
|
3
|
+
* Delete the file and run the code generator again to have it reset
|
|
4
|
+
*/
|
|
5
|
+
import { createState, baseActions, } from "document-model";
|
|
6
|
+
import { defaultBaseState } from "document-model/core";
|
|
7
|
+
import { actions as NotesActions } from "./gen/index.js";
|
|
8
|
+
import { reducer } from "./gen/reducer.js";
|
|
9
|
+
import { documentModel } from "./gen/document-model.js";
|
|
10
|
+
import genUtils from "./gen/utils.js";
|
|
11
|
+
import * as customUtils from "./src/utils.js";
|
|
12
|
+
const utils = { ...genUtils, ...customUtils };
|
|
13
|
+
const actions = { ...baseActions, ...NotesActions };
|
|
14
|
+
export const module = {
|
|
15
|
+
reducer,
|
|
16
|
+
actions,
|
|
17
|
+
utils,
|
|
18
|
+
documentModel: createState(defaultBaseState(), documentModel),
|
|
19
|
+
};
|
|
20
|
+
export { reducer, actions, utils, documentModel };
|
|
21
|
+
export * from "./gen/types.js";
|
|
22
|
+
export * from "./src/utils.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes.d.ts","sourceRoot":"","sources":["../../../../../document-models/notes/src/reducers/notes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,eAAO,MAAM,OAAO,EAAE,oBA2ErB,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export const reducer = {
|
|
2
|
+
addTextOperation(state, action) {
|
|
3
|
+
state.notes.push({
|
|
4
|
+
id: action.input.id,
|
|
5
|
+
title: action.input.title,
|
|
6
|
+
date: action.input.date,
|
|
7
|
+
content: action.input.content,
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
addTodoOperation(state, action) {
|
|
11
|
+
state.notes.push({
|
|
12
|
+
id: action.input.id,
|
|
13
|
+
title: action.input.title,
|
|
14
|
+
date: action.input.date,
|
|
15
|
+
done: action.input.done,
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
editNoteOperation(state, action) {
|
|
19
|
+
const note = state.notes.find((note) => note.id === action.input.id);
|
|
20
|
+
if (!note) {
|
|
21
|
+
throw new Error(`Note with id ${action.input.id} not found`);
|
|
22
|
+
}
|
|
23
|
+
if (typeof action.input.title === "string") {
|
|
24
|
+
note.title = action.input.title;
|
|
25
|
+
}
|
|
26
|
+
if (typeof action.input.date === "string") {
|
|
27
|
+
note.date = action.input.date;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
editTextOperation(state, action) {
|
|
31
|
+
const note = state.notes.find((note) => note.id === action.input.id);
|
|
32
|
+
if (!note) {
|
|
33
|
+
throw new Error(`Note with id ${action.input.id} not found`);
|
|
34
|
+
}
|
|
35
|
+
if (!("content" in note)) {
|
|
36
|
+
throw new Error(`Note with id ${action.input.id} is not a Text note`);
|
|
37
|
+
}
|
|
38
|
+
if (typeof action.input.title === "string") {
|
|
39
|
+
note.title = action.input.title;
|
|
40
|
+
}
|
|
41
|
+
if (typeof action.input.date === "string") {
|
|
42
|
+
note.date = action.input.date;
|
|
43
|
+
}
|
|
44
|
+
if (typeof action.input.content === "string") {
|
|
45
|
+
note.content = action.input.content;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
editTodoOperation(state, action) {
|
|
49
|
+
const note = state.notes.find((note) => note.id === action.input.id);
|
|
50
|
+
if (!note) {
|
|
51
|
+
throw new Error(`Note with id ${action.input.id} not found`);
|
|
52
|
+
}
|
|
53
|
+
if (!("done" in note)) {
|
|
54
|
+
throw new Error(`Note with id ${action.input.id} is not a Todo note`);
|
|
55
|
+
}
|
|
56
|
+
if (typeof action.input.title === "string") {
|
|
57
|
+
note.title = action.input.title;
|
|
58
|
+
}
|
|
59
|
+
if (typeof action.input.date === "string") {
|
|
60
|
+
note.date = action.input.date;
|
|
61
|
+
}
|
|
62
|
+
if (typeof action.input.done === "boolean") {
|
|
63
|
+
note.done = action.input.done;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
deleteNoteOperation(state, action) {
|
|
67
|
+
state.notes.splice(state.notes.findIndex((note) => note.id === action.input.id), 1);
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-model.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/notes/src/tests/document-model.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - change it by adding new tests or modifying the existing ones
|
|
4
|
+
*/
|
|
5
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
6
|
+
import utils, { initialGlobalState, initialLocalState, } from "../../gen/utils.js";
|
|
7
|
+
describe("Notes Document Model", () => {
|
|
8
|
+
it("should create a new Notes document", () => {
|
|
9
|
+
const document = utils.createDocument();
|
|
10
|
+
expect(document).toBeDefined();
|
|
11
|
+
expect(document.header.documentType).toBe("powerhouse/notes");
|
|
12
|
+
});
|
|
13
|
+
it("should create a new Notes document with a valid initial state", () => {
|
|
14
|
+
const document = utils.createDocument();
|
|
15
|
+
expect(document.state.global).toStrictEqual(initialGlobalState);
|
|
16
|
+
expect(document.state.local).toStrictEqual(initialLocalState);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/notes/src/tests/notes.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - change it by adding new tests or modifying the existing ones
|
|
4
|
+
*/
|
|
5
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
6
|
+
import { generateMock } from "@powerhousedao/codegen";
|
|
7
|
+
import utils from "../../gen/utils.js";
|
|
8
|
+
import { z } from "../../gen/schema/index.js";
|
|
9
|
+
import { reducer } from "../../gen/reducer.js";
|
|
10
|
+
import * as creators from "../../gen/notes/creators.js";
|
|
11
|
+
describe("Notes Operations", () => {
|
|
12
|
+
let document;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
document = utils.createDocument();
|
|
15
|
+
});
|
|
16
|
+
it("should handle addText operation", () => {
|
|
17
|
+
const input = generateMock(z.AddTextInputSchema());
|
|
18
|
+
const updatedDocument = reducer(document, creators.addText(input));
|
|
19
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
20
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_TEXT");
|
|
21
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
22
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
23
|
+
});
|
|
24
|
+
it("should handle addTodo operation", () => {
|
|
25
|
+
const input = generateMock(z.AddTodoInputSchema());
|
|
26
|
+
const updatedDocument = reducer(document, creators.addTodo(input));
|
|
27
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
28
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_TODO");
|
|
29
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
30
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NotesDocument } from "../../document-models/notes/index.js";
|
|
2
|
+
export declare function useNotesDocument(documentId: string | null | undefined): never[] | [NotesDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<import("../../document-models/notes/gen/actions.js").NotesNotesAction>];
|
|
3
|
+
export declare function useSelectedNotesDocument(): [NotesDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<import("../../document-models/notes/gen/actions.js").NotesNotesAction>];
|
|
4
|
+
//# sourceMappingURL=useNotesDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotesDocument.d.ts","sourceRoot":"","sources":["../../../editors/hooks/useNotesDocument.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,aAAa,EACd,MAAM,sCAAsC,CAAC;AAE9C,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,+JAKrE;AAED,wBAAgB,wBAAwB,sJAIvC"}
|