@powerhousedao/academy 3.3.0-dev.7 → 3.3.0-dev.9

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 3.3.0-dev.9 (2025-07-10)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - force release ([8185a3b37](https://github.com/powerhouse-inc/powerhouse/commit/8185a3b37))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Guillermo Puente @gpuente
10
+
11
+ ## 3.3.0-dev.8 (2025-07-10)
12
+
13
+ This was a version bump only for @powerhousedao/academy to align it with other projects, there were no code changes.
14
+
1
15
  ## 3.3.0-dev.7 (2025-07-10)
2
16
 
3
17
  This was a version bump only for @powerhousedao/academy to align it with other projects, there were no code changes.
@@ -0,0 +1,338 @@
1
+ # PHDocument Migration Guide (v3.3.0)
2
+
3
+ :::tip
4
+ This guide covers the **breaking changes** introduced in Powerhouse v3.3.0 related to PHDocument structure changes. If you're upgrading from v3.2.0 or earlier, **this migration is required** and document models must be regenerated.
5
+ :::
6
+
7
+ ## Overview
8
+
9
+ Version 3.3.0 introduced a significant refactor of the `PHDocument` structure that consolidates document metadata into a `header` field. This change enables signed and unsigned documents with cryptographic verification capabilities, but requires updating all code that accesses document properties.
10
+
11
+ ## What Changed
12
+
13
+ ### Document Structure Refactor
14
+
15
+ The most significant change is the consolidation of document metadata into a `header` field. Previously, document properties were scattered at the root level of the document object.
16
+
17
+ **Before (v3.2.0 and earlier):**
18
+ ```javascript
19
+ const document = {
20
+ id: "doc-123",
21
+ created: "2023-01-01T00:00:00.000Z",
22
+ lastModified: "2023-01-01T12:00:00.000Z",
23
+ revision: 5,
24
+ documentType: "powerhouse/todolist",
25
+ name: "My Todo List",
26
+ slug: "my-todo-list",
27
+ // ... other properties
28
+ }
29
+ ```
30
+
31
+ **After (v3.3.0):**
32
+ ```javascript
33
+ const document = {
34
+ header: {
35
+ id: "doc-123",
36
+ createdAtUtcIso: "2023-01-01T00:00:00.000Z",
37
+ lastModifiedAtUtcIso: "2023-01-01T12:00:00.000Z",
38
+ revision: { global: 5, local: 0 },
39
+ documentType: "powerhouse/todolist",
40
+ name: "My Todo List",
41
+ slug: "my-todo-list",
42
+ branch: "main",
43
+ sig: { nonce: "", publicKey: {} },
44
+ meta: {}
45
+ },
46
+ // ... other properties
47
+ }
48
+ ```
49
+
50
+ ## Complete Property Migration Map
51
+
52
+ | **Old Property** | **New Property** | **Additional Changes** |
53
+ |------------------|------------------|------------------------|
54
+ | `document.id` | `document.header.id` | Now an Ed25519 signature for signed documents |
55
+ | `document.created` | `document.header.createdAtUtcIso` | **Renamed** to include UTC ISO specification |
56
+ | `document.lastModified` | `document.header.lastModifiedAtUtcIso` | **Renamed** to include UTC ISO specification |
57
+ | `document.revision` | `document.header.revision` | Now an **object** with scope keys (e.g., `{ global: 5, local: 0 }`) |
58
+ | `document.documentType` | `document.header.documentType` | No additional changes |
59
+ | `document.name` | `document.header.name` | No additional changes |
60
+ | `document.slug` | `document.header.slug` | No additional changes |
61
+ | `document.branch` | `document.header.branch` | Now explicitly included |
62
+ | `document.meta` | `document.header.meta` | Now explicitly included |
63
+ | N/A | `document.header.sig` | **New** - Signature information for document verification |
64
+
65
+ ## Step-by-Step Migration Guide
66
+
67
+ ### Step 1: Update Document Property Access
68
+
69
+ Replace all instances of direct property access with header-based access:
70
+
71
+ <details>
72
+ <summary>**Common Property Access Patterns**</summary>
73
+
74
+ **Document ID Access:**
75
+ ```javascript
76
+ // Before
77
+ const documentId = document.id;
78
+
79
+ // After
80
+ const documentId = document.header.id;
81
+ ```
82
+
83
+ **Document Name Access:**
84
+ ```javascript
85
+ // Before
86
+ const documentName = document.name;
87
+
88
+ // After
89
+ const documentName = document.header.name;
90
+ ```
91
+
92
+ **Document Type Access:**
93
+ ```javascript
94
+ // Before
95
+ const docType = document.documentType;
96
+
97
+ // After
98
+ const docType = document.header.documentType;
99
+ ```
100
+
101
+ **Timestamp Access:**
102
+ ```javascript
103
+ // Before
104
+ const created = document.created;
105
+ const lastModified = document.lastModified;
106
+
107
+ // After
108
+ const created = document.header.createdAtUtcIso;
109
+ const lastModified = document.header.lastModifiedAtUtcIso;
110
+ ```
111
+
112
+ **Revision Access:**
113
+ ```javascript
114
+ // Before
115
+ const revision = document.revision; // Was a number
116
+
117
+ // After
118
+ const globalRevision = document.header.revision.global; // Now an object
119
+ const localRevision = document.header.revision.local;
120
+ // Or get all revisions
121
+ const allRevisions = document.header.revision; // { global: 5, local: 0, ... }
122
+ ```
123
+
124
+ </details>
125
+
126
+ ### Step 2: Update Component Code
127
+
128
+ **React Components:**
129
+
130
+ <details>
131
+ <summary>**Example: Document List Component**</summary>
132
+
133
+ ```jsx
134
+ // Before
135
+ function DocumentList({ documents }) {
136
+ return (
137
+ <div>
138
+ {documents.map(doc => (
139
+ <div key={doc.id} className="document-item">
140
+ <h3>{doc.name}</h3>
141
+ <p>Type: {doc.documentType}</p>
142
+ <p>Last modified: {new Date(doc.lastModified).toLocaleDateString()}</p>
143
+ <p>Revision: {doc.revision}</p>
144
+ </div>
145
+ ))}
146
+ </div>
147
+ );
148
+ }
149
+
150
+ // After
151
+ function DocumentList({ documents }) {
152
+ return (
153
+ <div>
154
+ {documents.map(doc => (
155
+ <div key={doc.header.id} className="document-item">
156
+ <h3>{doc.header.name}</h3>
157
+ <p>Type: {doc.header.documentType}</p>
158
+ <p>Last modified: {new Date(doc.header.lastModifiedAtUtcIso).toLocaleDateString()}</p>
159
+ <p>Global Revision: {doc.header.revision.global}</p>
160
+ </div>
161
+ ))}
162
+ </div>
163
+ );
164
+ }
165
+ ```
166
+
167
+ </details>
168
+
169
+ ### Step 3: Update Type Definitions
170
+
171
+ If you're using TypeScript, update your type definitions:
172
+
173
+ <details>
174
+ <summary>**TypeScript Interface Updates**</summary>
175
+
176
+ ```typescript
177
+ // Before
178
+ interface MyDocument {
179
+ id: string;
180
+ name: string;
181
+ documentType: string;
182
+ created: string;
183
+ lastModified: string;
184
+ revision: number;
185
+ // ... other properties
186
+ }
187
+
188
+ // After
189
+ interface MyDocument {
190
+ header: {
191
+ id: string;
192
+ name: string;
193
+ documentType: string;
194
+ createdAtUtcIso: string;
195
+ lastModifiedAtUtcIso: string;
196
+ revision: {
197
+ [scope: string]: number;
198
+ };
199
+ slug: string;
200
+ branch: string;
201
+ sig: {
202
+ nonce: string;
203
+ publicKey: any;
204
+ };
205
+ meta?: {
206
+ preferredEditor?: string;
207
+ };
208
+ };
209
+ // ... other properties
210
+ }
211
+ ```
212
+
213
+ </details>
214
+
215
+ ### Step 4: Database Queries and APIs Compatibility
216
+
217
+ <details>
218
+ <summary>**GraphQL Query Compatibility**</summary>
219
+
220
+ **GraphQL Queries:**
221
+ ```graphql
222
+ # Your existing queries continue to work unchanged
223
+ query GetDocument($id: ID!) {
224
+ document(id: $id) {
225
+ id # Still works due to response transformation
226
+ name # Still works due to response transformation
227
+ documentType # Still works due to response transformation
228
+ created # Still works due to response transformation
229
+ lastModified # Still works due to response transformation
230
+ revision # Still works due to response transformation
231
+ }
232
+ }
233
+ ```
234
+
235
+ :::tip
236
+ **GraphQL Backward Compatibility:** The GraphQL API maintains backward compatibility through response transformation. Your existing queries will continue to work without changes. However, when working with the raw document objects in your application code, you'll need to use the new header structure.
237
+ :::
238
+
239
+ </details>
240
+
241
+
242
+
243
+
244
+
245
+ ## Common Migration Issues and Solutions
246
+
247
+ ### Issue 1: Undefined Property Errors
248
+
249
+ **Problem:** Getting `undefined` when accessing document properties.
250
+
251
+ **Solution:** Update property access to use the header structure:
252
+
253
+ ```javascript
254
+ // This will be undefined after migration
255
+ const name = document.name;
256
+
257
+ // Use this instead
258
+ const name = document.header.name;
259
+ ```
260
+
261
+ ### Issue 2: Revision Type Mismatch
262
+
263
+ **Problem:** Code expecting revision to be a number but getting an object.
264
+
265
+ **Solution:** Update revision access to specify the scope:
266
+
267
+ ```javascript
268
+ // Before - revision was a number
269
+ if (document.revision > 5) { ... }
270
+
271
+ // After - revision is an object with scope keys
272
+ if (document.header.revision.global > 5) { ... }
273
+ ```
274
+
275
+ ### Issue 3: Date Format Changes
276
+
277
+ **Problem:** Date parsing issues due to property name changes.
278
+
279
+ **Solution:** Update timestamp property names:
280
+
281
+ ```javascript
282
+ // Before
283
+ const createdDate = new Date(document.created);
284
+ const modifiedDate = new Date(document.lastModified);
285
+
286
+ // After
287
+ const createdDate = new Date(document.header.createdAtUtcIso);
288
+ const modifiedDate = new Date(document.header.lastModifiedAtUtcIso);
289
+ ```
290
+
291
+ ## Testing Your Migration
292
+
293
+ ### Automated Testing
294
+
295
+ Create tests to verify your migration:
296
+
297
+ <details>
298
+ <summary>**Migration Test Examples**</summary>
299
+
300
+ ```javascript
301
+ // Test document property access
302
+ describe('Document Migration', () => {
303
+ it('should access document properties correctly', () => {
304
+ const mockDocument = {
305
+ header: {
306
+ id: 'test-id',
307
+ name: 'Test Document',
308
+ documentType: 'powerhouse/test',
309
+ createdAtUtcIso: '2023-01-01T00:00:00.000Z',
310
+ lastModifiedAtUtcIso: '2023-01-01T12:00:00.000Z',
311
+ revision: { global: 5, local: 0 },
312
+ // ... other header properties
313
+ },
314
+ // ... other document properties
315
+ };
316
+
317
+ // Test property access
318
+ expect(mockDocument.header.id).toBe('test-id');
319
+ expect(mockDocument.header.name).toBe('Test Document');
320
+ expect(mockDocument.header.revision.global).toBe(5);
321
+ });
322
+ });
323
+ ```
324
+
325
+ </details>
326
+
327
+
328
+
329
+ ## Related Documentation
330
+
331
+ - [PHDocument Architecture](../05-Architecture/PHDocument.md)
332
+ - [Document Model Creation](../02-MasteryTrack/DocumentModelCreation/WhatIsADocumentModel.md)
333
+ - [GraphQL API Reference](./02-ReactorAPI.md)
334
+ - [React Hooks](./01-ReactHooks.md)
335
+
336
+ ---
337
+
338
+ *This migration guide covers the major changes in v3.3.0. For additional technical details, refer to the [RELEASE-NOTES.md](https://github.com/powerhouse-dao/powerhouse/blob/main/RELEASE-NOTES.md) in the main repository.*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/academy",
3
- "version": "3.3.0-dev.7",
3
+ "version": "3.3.0-dev.9",
4
4
  "homepage": "https://powerhouse.academy",
5
5
  "repository": {
6
6
  "type": "git",
package/sidebars.ts CHANGED
@@ -1,5 +1,3 @@
1
- import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
2
-
3
1
  /**
4
2
  * Creating a sidebar enables you to:
5
3
  - create an ordered group of docs
@@ -14,101 +12,121 @@ const sidebars = {
14
12
  // By default, Docusaurus generates a sidebar from the docs folder structure
15
13
  academySidebar: [
16
14
  {
17
- type: 'category',
18
- label: 'Get started',
15
+ type: "category",
16
+ label: "Get started",
19
17
  link: {
20
- type: 'doc',
21
- id: 'academy/GetStarted/home',
18
+ type: "doc",
19
+ id: "academy/GetStarted/home",
22
20
  },
23
21
  items: [
24
- 'academy/GetStarted/ExploreDemoPackage',
25
- 'academy/GetStarted/CreateNewPowerhouseProject',
26
- 'academy/GetStarted/DefineToDoListDocumentModel',
27
- 'academy/GetStarted/ImplementOperationReducers',
28
- 'academy/GetStarted/BuildToDoListEditor',
22
+ "academy/GetStarted/ExploreDemoPackage",
23
+ "academy/GetStarted/CreateNewPowerhouseProject",
24
+ "academy/GetStarted/DefineToDoListDocumentModel",
25
+ "academy/GetStarted/ImplementOperationReducers",
26
+ "academy/GetStarted/BuildToDoListEditor",
29
27
  ],
30
28
  },
31
29
  {
32
- type: 'category',
33
- label: 'Mastery track',
30
+ type: "category",
31
+ label: "Mastery track",
34
32
  items: [
35
33
  {
36
- type: 'category',
37
- label: 'Builder environment',
34
+ type: "category",
35
+ label: "Builder environment",
38
36
  link: {
39
- type: 'doc',
40
- id: 'academy/MasteryTrack/BuilderEnvironment/Prerequisites'
37
+ type: "doc",
38
+ id: "academy/MasteryTrack/BuilderEnvironment/Prerequisites",
41
39
  },
42
40
  items: [
43
- 'academy/MasteryTrack/BuilderEnvironment/Prerequisites',
44
- 'academy/MasteryTrack/BuilderEnvironment/StandardDocumentModelWorkflow',
45
- 'academy/MasteryTrack/BuilderEnvironment/BuilderTools',
46
- ]
41
+ "academy/MasteryTrack/BuilderEnvironment/Prerequisites",
42
+ "academy/MasteryTrack/BuilderEnvironment/StandardDocumentModelWorkflow",
43
+ "academy/MasteryTrack/BuilderEnvironment/BuilderTools",
44
+ ],
47
45
  },
48
46
  {
49
- type: 'category',
50
- label: 'Document model creation',
47
+ type: "category",
48
+ label: "Document model creation",
51
49
  link: {
52
- type: 'generated-index',
50
+ type: "generated-index",
53
51
  },
54
52
  items: [
55
- 'academy/MasteryTrack/DocumentModelCreation/WhatIsADocumentModel',
56
- 'academy/MasteryTrack/DocumentModelCreation/SpecifyTheStateSchema',
57
- 'academy/MasteryTrack/DocumentModelCreation/SpecifyDocumentOperations',
58
- 'academy/MasteryTrack/DocumentModelCreation/UseTheDocumentModelGenerator',
59
- 'academy/MasteryTrack/DocumentModelCreation/ImplementDocumentReducers',
60
- 'academy/MasteryTrack/DocumentModelCreation/ImplementDocumentModelTests',
61
- 'academy/MasteryTrack/DocumentModelCreation/ExampleToDoListRepository',
62
- ]
53
+ "academy/MasteryTrack/DocumentModelCreation/WhatIsADocumentModel",
54
+ "academy/MasteryTrack/DocumentModelCreation/SpecifyTheStateSchema",
55
+ "academy/MasteryTrack/DocumentModelCreation/SpecifyDocumentOperations",
56
+ "academy/MasteryTrack/DocumentModelCreation/UseTheDocumentModelGenerator",
57
+ "academy/MasteryTrack/DocumentModelCreation/ImplementDocumentReducers",
58
+ "academy/MasteryTrack/DocumentModelCreation/ImplementDocumentModelTests",
59
+ "academy/MasteryTrack/DocumentModelCreation/ExampleToDoListRepository",
60
+ ],
63
61
  },
64
62
  {
65
- type: 'category',
66
- label: 'Building user experiences',
63
+ type: "category",
64
+ label: "Building user experiences",
67
65
  link: {
68
- type: 'generated-index',
66
+ type: "generated-index",
69
67
  },
70
- items: [{ type: 'autogenerated', dirName: 'academy/02-MasteryTrack/03-BuildingUserExperiences' }]
68
+ items: [
69
+ {
70
+ type: "autogenerated",
71
+ dirName: "academy/02-MasteryTrack/03-BuildingUserExperiences",
72
+ },
73
+ ],
71
74
  },
72
75
  {
73
- type: 'category',
74
- label: 'Work with data',
76
+ type: "category",
77
+ label: "Work with data",
75
78
  link: {
76
- type: 'generated-index',
79
+ type: "generated-index",
77
80
  },
78
- items: [{type: 'autogenerated', dirName: 'academy/02-MasteryTrack/04-WorkWithData'}]
81
+ items: [
82
+ {
83
+ type: "autogenerated",
84
+ dirName: "academy/02-MasteryTrack/04-WorkWithData",
85
+ },
86
+ ],
79
87
  },
80
88
  {
81
- type: 'category',
82
- label: 'Launch',
89
+ type: "category",
90
+ label: "Launch",
83
91
  link: {
84
- type: 'generated-index',
92
+ type: "generated-index",
85
93
  },
86
- items: [{type: 'autogenerated', dirName: 'academy/02-MasteryTrack/05-Launch'}]
87
- }
94
+ items: [
95
+ {
96
+ type: "autogenerated",
97
+ dirName: "academy/02-MasteryTrack/05-Launch",
98
+ },
99
+ ],
100
+ },
88
101
  ],
89
102
  },
90
103
  {
91
- type: 'category',
92
- label: 'Example usecases',
93
- items: [{ type: 'autogenerated', dirName: 'academy/03-ExampleUsecases' }],
104
+ type: "category",
105
+ label: "Example usecases",
106
+ items: [{ type: "autogenerated", dirName: "academy/03-ExampleUsecases" }],
94
107
  },
95
108
  {
96
- type: 'category',
97
- label: 'API References',
98
- items: [{ type: 'autogenerated', dirName: 'academy/04-APIReferences' }],
109
+ type: "category",
110
+ label: "API References",
111
+ items: [
112
+ "academy/APIReferences/PowerhouseCLI",
113
+ "academy/APIReferences/ReactHooks",
114
+ "academy/APIReferences/OperationalDatabase",
115
+ "academy/APIReferences/PHDocumentMigrationGuide",
116
+ ],
99
117
  },
100
118
 
101
119
  // Manually define the Component Library category
102
120
  {
103
- type: 'category',
104
- label: 'Component library',
121
+ type: "category",
122
+ label: "Component library",
105
123
  items: [
106
124
  {
107
- type: 'doc',
108
- id: 'academy/ComponentLibrary/DocumentEngineering',
125
+ type: "doc",
126
+ id: "academy/ComponentLibrary/DocumentEngineering",
109
127
  },
110
128
  {
111
- type: 'html',
129
+ type: "html",
112
130
  value: `
113
131
  <a class="menu__link" href="https://storybook.powerhouse.academy/" target="_blank" rel="noopener" style="display: flex; align-items: center; justify-content: space-between; font-weight: 500; text-decoration: none;">
114
132
  <span style="display: flex; align-items: center; gap: 6px;">
@@ -119,21 +137,21 @@ const sidebars = {
119
137
  </a>
120
138
  `,
121
139
  },
122
- 'academy/ComponentLibrary/CreateCustomScalars',
123
- 'academy/ComponentLibrary/IntegrateIntoAReactComponent',
140
+ "academy/ComponentLibrary/CreateCustomScalars",
141
+ "academy/ComponentLibrary/IntegrateIntoAReactComponent",
124
142
  ],
125
143
  },
126
144
 
127
145
  // Everything after Component Library is still autogenerated
128
146
  {
129
- type: 'category',
130
- label: 'Architecture',
131
- items: [{ type: 'autogenerated', dirName: 'academy/05-Architecture' }],
147
+ type: "category",
148
+ label: "Architecture",
149
+ items: [{ type: "autogenerated", dirName: "academy/05-Architecture" }],
132
150
  },
133
- { type: 'doc', id: 'academy/Cookbook', label: 'Cookbook' },
134
- { type: 'doc', id: 'academy/Glossary', label: 'Glossary' },
151
+ { type: "doc", id: "academy/Cookbook", label: "Cookbook" },
152
+ { type: "doc", id: "academy/Glossary", label: "Glossary" },
135
153
  // ...add more as needed
136
154
  ],
137
155
  };
138
156
 
139
- export default sidebars;
157
+ export default sidebars;