@powerhousedao/academy 3.2.0-dev.2 → 3.2.0-dev.4

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 (67) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +188 -0
  3. package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +10 -12
  4. package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +8 -8
  5. package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +11 -11
  6. package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +13 -13
  7. package/docs/academy/01-GetStarted/_04-BuildToDoListEditor +12 -12
  8. package/docs/academy/01-GetStarted/home.mdx +50 -51
  9. package/docs/academy/01-GetStarted/images/Connect.png +0 -0
  10. package/docs/academy/01-GetStarted/images/Packagemanager.png +0 -0
  11. package/docs/academy/01-GetStarted/images/TodoDriveApp.png +0 -0
  12. package/docs/academy/01-GetStarted/styles.module.css +7 -14
  13. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +25 -24
  14. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +17 -17
  15. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +1 -1
  16. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +15 -15
  17. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +11 -9
  18. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +15 -15
  19. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +9 -9
  20. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +15 -15
  21. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +14 -14
  22. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +6 -6
  23. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +31 -32
  24. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +7 -9
  25. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +485 -92
  26. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/{00-DocumentToolbar.md → 00-DocumentToolbar.mdx} +7 -2
  27. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/01-OperationHistory.md +12 -12
  28. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/02-RevisionHistoryTimeline.md +18 -7
  29. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/images/DocumentToolbar.png +0 -0
  30. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/images/revision-history-timeline.png +0 -0
  31. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/08-Authorization/01-RenownAuthenticationFlow.md +22 -11
  32. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/08-Authorization/02-Authorization.md +8 -8
  33. package/docs/academy/02-MasteryTrack/04-WorkWithData/01-ReadingAndWritingThroughTheAPI.mdx +13 -19
  34. package/docs/academy/02-MasteryTrack/04-WorkWithData/02-GraphQLAtPowerhouse.md +3 -3
  35. package/docs/academy/02-MasteryTrack/04-WorkWithData/03-WorkingWithSubgraphs/02-GraphQLAndSubgraphs.mdx +8 -8
  36. package/docs/academy/02-MasteryTrack/04-WorkWithData/03-WorkingWithSubgraphs/03-WorkingWithSubgraphs.md +28 -28
  37. package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +4 -4
  38. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/01-SetupBuilderEnvironment.md +14 -14
  39. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/02-CreateNewPowerhouseProject.md +2 -2
  40. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/03-GenerateAnAnalyticsProcessor.md +6 -6
  41. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/04-UpdateAnalyticsProcessor.md +1 -1
  42. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +2 -2
  43. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +4 -4
  44. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +7 -7
  45. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +1 -1
  46. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +6 -6
  47. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/browser.md +1 -1
  48. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +5 -5
  49. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +1 -1
  50. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/pg.md +2 -2
  51. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +1 -1
  52. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +1 -1
  53. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/index.md +1 -1
  54. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +12 -12
  55. package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +9 -9
  56. package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +8 -8
  57. package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +35 -35
  58. package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +8 -8
  59. package/docs/academy/02-MasteryTrack/_category_.json +1 -1
  60. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +5 -5
  61. package/docs/academy/04-APIReferences/01-ReactHooks.md +209 -0
  62. package/docs/academy/07-Cookbook.md +105 -105
  63. package/package.json +1 -1
  64. package/sidebars.ts +9 -10
  65. package/src/css/custom.css +18 -0
  66. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.md +0 -88
  67. package/docs/academy/04-APIReferences/01-ReactHooks +0 -98
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/academy",
3
- "version": "3.2.0-dev.2",
3
+ "version": "3.2.0-dev.4",
4
4
  "homepage": "https://powerhouse.academy",
5
5
  "repository": {
6
6
  "type": "git",
package/sidebars.ts CHANGED
@@ -15,7 +15,7 @@ const sidebars = {
15
15
  academySidebar: [
16
16
  {
17
17
  type: 'category',
18
- label: 'Get Started',
18
+ label: 'Get started',
19
19
  link: {
20
20
  type: 'doc',
21
21
  id: 'academy/GetStarted/home',
@@ -30,11 +30,11 @@ const sidebars = {
30
30
  },
31
31
  {
32
32
  type: 'category',
33
- label: 'Mastery Track',
33
+ label: 'Mastery track',
34
34
  items: [
35
35
  {
36
36
  type: 'category',
37
- label: 'Builder Environment',
37
+ label: 'Builder environment',
38
38
  link: {
39
39
  type: 'doc',
40
40
  id: 'academy/MasteryTrack/BuilderEnvironment/Prerequisites'
@@ -47,10 +47,9 @@ const sidebars = {
47
47
  },
48
48
  {
49
49
  type: 'category',
50
- label: 'Document Model Creation',
50
+ label: 'Document model creation',
51
51
  link: {
52
- type: 'doc',
53
- id: "academy/MasteryTrack/DocumentModelCreation/WhatIsADocumentModel"
52
+ type: 'generated-index',
54
53
  },
55
54
  items: [
56
55
  'academy/MasteryTrack/DocumentModelCreation/WhatIsADocumentModel',
@@ -64,7 +63,7 @@ const sidebars = {
64
63
  },
65
64
  {
66
65
  type: 'category',
67
- label: 'Building User Experiences',
66
+ label: 'Building user experiences',
68
67
  link: {
69
68
  type: 'generated-index',
70
69
  },
@@ -72,7 +71,7 @@ const sidebars = {
72
71
  },
73
72
  {
74
73
  type: 'category',
75
- label: 'Work With Data',
74
+ label: 'Work with data',
76
75
  link: {
77
76
  type: 'generated-index',
78
77
  },
@@ -90,7 +89,7 @@ const sidebars = {
90
89
  },
91
90
  {
92
91
  type: 'category',
93
- label: 'Example Usecases',
92
+ label: 'Example usecases',
94
93
  items: [{ type: 'autogenerated', dirName: 'academy/03-ExampleUsecases' }],
95
94
  },
96
95
  {
@@ -102,7 +101,7 @@ const sidebars = {
102
101
  // Manually define the Component Library category
103
102
  {
104
103
  type: 'category',
105
- label: 'Component Library',
104
+ label: 'Component library',
106
105
  items: [
107
106
  {
108
107
  type: 'doc',
@@ -486,3 +486,21 @@ html[data-theme='dark'] .DocSearch-Hits > *:empty {
486
486
  font-weight: bold;
487
487
  text-decoration: none;
488
488
  }
489
+
490
+ .image-container {
491
+ border: 1px solid var(--ifm-color-emphasis-300);
492
+ border-radius: var(--ifm-card-border-radius);
493
+ padding: 1rem;
494
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
495
+ margin-bottom: 1.5rem;
496
+ }
497
+
498
+ .image-container img {
499
+ border-radius: var(--ifm-card-border-radius);
500
+ }
501
+
502
+ .image-container figcaption {
503
+ text-align: center;
504
+ margin-top: 0.5rem;
505
+ font-style: italic;
506
+ }
@@ -1,88 +0,0 @@
1
- # Explore the Demo Package
2
-
3
- :::info How Long Will This Tutorial Take?
4
- We've designed this "Get Started" track to be as smooth as possible. The time it takes will vary based on your familiarity with modern web development tools.
5
-
6
- - **For Experienced Developers** (familiar with TypeScript, React, and CLIs), you can expect to complete the entire four-part tutorial in approximately **1 to 1.5 hours**.
7
- - **For Developers New to This Stack**, we recommend setting aside **3.5 to 4.5 hours**. This allows for time to understand not just the steps, but the core concepts behind them.
8
-
9
- This is just a guideline. The goal is to learn comfortably and build a solid foundation with Powerhouse!
10
-
11
- A more in theoretic and advanced version of this tutorial can also be found in [Mastery Track - Document Model Creation](../MasteryTrack/DocumentModelCreation/WhatIsADocumentModel).
12
- :::
13
-
14
-
15
- To give you a quick idea of how the Powerhouse ecosystem operates on document models and packages, why don\'t you try installing a package?
16
-
17
- Install the Powerhouse command-line tool `ph-cmd` and then use it to install a pre-built demo package with document models & editors.
18
-
19
- ## Step 1: Install the Powerhouse CLI
20
-
21
- You will use the Powerhouse CLI to launch a local environment with a "**ToDoList Demo Package**".
22
- This is also the package that you'll recreate during the tutorials and get's you familiar with Powerhouse.
23
-
24
- ```bash
25
- pnpm install -g ph-cmd
26
- ```
27
-
28
- Verify the installation:
29
-
30
- ```bash
31
- ph-cmd --version
32
- ```
33
-
34
- ## Step 2: Install the Contributor Billing Package
35
-
36
- Now, use the `ph` command to install the demo package into a global project.
37
-
38
- ```bash
39
- # Install the package
40
- ph install @powerhousedao/todo-demo-package.
41
- ```
42
-
43
- This command downloads and sets up the todo-demo-package, making its features available in your Powerhouse environment.
44
-
45
- You have now successfully installed `ph-cmd` and added your first package!
46
-
47
- ## Step 3: Run the Connect App in Studio mode
48
- To run the package locally in Connect Studio (our collaboration and contributor app), run the `ph connect` command.
49
-
50
- ## Step 4: Log in with Renown
51
-
52
- Renown is Powerhouse's decentralized identity and reputation system designed to address the challenge of trust within open organization's, where contributors often operate under pseudonyms. In traditional organizations, personal identity and reputation are key to establishing trust and accountability. Renown replicates this dynamic in the digital space, allowing contributors to earn experience and build reputation without revealing their real-world identities.
53
-
54
- :::tip
55
- When signing in with Renown, use an Ethereum or blockchain address that can function as your \'identity\', as this address will accrue more experience and history over time.
56
- :::
57
-
58
- ### Login Flow
59
- "**Log in with Renown**" is a decentralized authentication flow that enables you to log into applications by signing a credential with your Ethereum wallet. Upon signing in, a Decentralized Identifier (DID) is created based on your Ethereum key.
60
-
61
- ![Renown Login](./images/RenownLogin.png)
62
-
63
- ### Generate a DID to sign operations in Connect
64
- This DID is then associated with a credential that authorizes a specific Connect instance to act on your behalf. That credential is stored securely on Ceramic, a decentralized data network. When you perform actions through the Powerhouse Connect interface, those operations are signed with the DID and transmitted to Switchboard, which serves as the verifier.
65
-
66
- ![Renown Login](./images/ConnectAddress.png)
67
-
68
- ![Renown Login](./images/LoginComplete.png)
69
-
70
- ### Modify a document
71
- Switchboard checks the validity of the DID and credential, ensuring the operation request is legitimate. This flow is designed to offer a verifiable, cryptographically secure login system that replaces traditional password-based authentication with decentralized identity and signature-based trust.
72
-
73
- ## Step 5: Create an invoice & Explore the Document Operations History
74
-
75
- ![Renown Login](./images/OperationsHistory.png)
76
-
77
- By leveraging this system, every operation or modification made to a document is cryptographically signed by the contributor\'s Renown identity. This ensures that each change is verifiable, traceable, and attributable to a specific pseudonymous user, providing a robust audit trail for all document activity.
78
-
79
- A key feature you get with Connect is the **Operations History**. Every change to a document is stored as an individual operation, creating an immutable and replayable history. This provides complete auditability and transparency, as you can inspect each revision, its details, and any associated signatures. For example, you can see a chronological list of all modifications, along with who made them and when. This ensures every action is traceable and verifiable.
80
- Learn more about the [Operations History and other document tools you get for free](../MasteryTrack/BuildingUserExperiences/DocumentTools/OperationHistory).
81
-
82
- ## Step 6: Export a Document
83
-
84
- Export the invoice document as a `.phd` (Powerhouse Document) file using the export button in the document toolbar at the top. In this toolbar, you will find all available functionality for your documents. The `.phd` file can be sent through any of your preferred channels to other users on your Powergrid network.
85
-
86
- Now that you have explored a Powerhouse package and discovered its basic functionalities, it is time to start building your own.
87
- Our next tutorial focuses on creating a simple To-Do list document and will introduce you to the world of Document Models.
88
-
@@ -1,98 +0,0 @@
1
- # React Hooks (WIP)
2
-
3
- The idea is to make this feel as simple and familiar as using useState.
4
- Happy Path would look something like this:
5
-
6
- ```js
7
- // in a component that only needs to read a value, you can use
8
- const invoiceName = useReadDocumentField('myInvoiceDocumentId', 'name') // returns a string which is the `name`
9
- // and for documents that need to update data as well, you would have
10
- const updateInvoiceName = useUpdateDocumentField('myInvoiceDocumentId', 'name') // returns a function that takes a new string for the new name and dispatches the update
11
- // finally, we can combine these into a single hook which works like react's useState hook returning both the value and updater function
12
- const [invoiceName, updateInvoiceName] = useDocumentField('myInvoiceDocumentId', 'name')
13
-
14
-
15
- // Read-only value
16
- const invoiceName = useReadDocumentField('docId', 'name')
17
-
18
- // Write-only updater
19
- const updateInvoiceName = useUpdateDocumentField('docId', 'name')
20
-
21
- // Combined read + write (like useState)
22
- const [invoiceName, updateInvoiceName] = useDocumentField('docId', 'name')
23
- ```
24
-
25
- Request Translation
26
- Global access to drive state: A top-level, possibly context-based, way to introspect and interact with any document and its state tree without manually passing things around.
27
- Global dispatcher access: A utility or API (probably a hook or service function) where they give a document ID and get back all the relevant dispatch functions — kind of like a command palette for document ops.
28
- Time spent wiring > time spent building Frustration with current DX (developer experience) — they want abstractions and helpers to just do the thing.
29
-
30
- Core Hooks & Patterns
31
- - useDocumentField
32
- - useReadDocumentField
33
- - useUpdateDocumentField
34
- - useDocumentDispatch(docId): updateX, delete, ...
35
-
36
- Global Drive Access
37
- - How to access and manipulate the global document tree
38
- - How to inspect children from parent context
39
- - Tree traversal utilities (if any)
40
-
41
- Convenience APIs
42
- - Utility functions like getDispatchFunctions(docId)
43
- - “Quick Start” to manipulate any document like a pro
44
-
45
- Working with Context
46
- - DriveContext: what lives there, how to use it
47
- - Example: using context to get current doc, sibling docs
48
-
49
- Best Practices & Patterns
50
- - When to use useDocumentField vs getDispatch
51
- - Composing document fields into custom logic
52
-
53
- <details>
54
- <summary>Refresher on React Hooks</summary>
55
-
56
- React Hooks allow you to use various React features directly within your functional components. You can use built-in Hooks or combine them to create your own custom Hooks.
57
-
58
- **What are Custom Hooks?**
59
- A custom hook is a JavaScript function whose name starts with "use" and that calls other Hooks. They are used to:
60
- - Reuse stateful logic between components.
61
- - Abstract complex logic into a simpler interface.
62
- - Isolate side effects, particularly those managed by `useEffect`.
63
-
64
- **Key Built-in Hooks Examples:**
65
- - `useState`: Lets a component "remember" information (state).
66
- - `useEffect`: Lets a component perform side effects (e.g., data fetching, subscriptions, manually changing the DOM).
67
- - `useContext`: Lets a component receive information from distant parent components without explicitly passing props through every level of the component tree.
68
-
69
- **Naming Convention:**
70
- Hook names must always start with `use` followed by a capital letter (e.g., `useState`, `useOnlineStatus`).
71
-
72
- **Rules of Hooks:**
73
- 1. **Only Call Hooks at the Top Level**: Don't call Hooks inside loops, conditions, or nested functions.
74
- 2. **Only Call Hooks from React Functions**: Call Hooks from React functional components or from custom Hooks.
75
-
76
- It's important to note that a function should only be named and treated as a hook if it actually utilizes one or more built-in React hooks. If a function (even if named `useSomething`) doesn't call any built-in hooks, it behaves like a regular JavaScript function, and making it a "hook" offers no specific React advantages.
77
-
78
- For more details, see the official documentation and our API reference:
79
- - [Reusing Logic with Custom Hooks (react.dev)](https://react.dev/learn/reusing-logic-with-custom-hooks)
80
- - [Rules of Hooks (react.dev)](https://react.dev/reference/rules/rules-of-hooks)
81
- - [Powerhouse React Hooks API Reference](docs/academy/APIReferences/ReactHooks)
82
-
83
- </details>
84
-
85
- ### Hook Name and Signature
86
- The name of the hook and its TypeScript (or JavaScript) signature.
87
- ### Description
88
- A brief explanation of what the hook does and when to use it.
89
- ### Usage Example
90
- A code snippet showing how to use the hook in a real-world scenario.
91
- ### Parameters
92
- A table or list describing each parameter, its type, and its purpose.
93
- ### Return Value
94
- A description (and sometimes a table) of what the hook returns.
95
- ### Notes / Caveats
96
- Any important details, gotchas, or best practices.
97
- ### Related Hooks
98
- Links to other relevant hooks or documentation.