@powerhousedao/academy 5.0.0-staging.9 → 5.0.1-staging.2
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/.vscode/settings.json +1 -1
- package/CHANGELOG.md +400 -0
- package/README.md +3 -3
- package/babel.config.js +1 -1
- package/blog/BeyondCommunication-ABlueprintForDevelopment.md +25 -24
- package/blog/TheChallengeOfChange.md +21 -21
- package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +67 -30
- package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +38 -21
- package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +24 -19
- package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +44 -41
- package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +10 -10
- package/docs/academy/01-GetStarted/05-VetraStudio.md +164 -0
- package/docs/academy/01-GetStarted/06-ReactorMCP.md +58 -0
- package/docs/academy/01-GetStarted/home.mdx +185 -90
- package/docs/academy/01-GetStarted/images/Modules.png +0 -0
- package/docs/academy/01-GetStarted/images/VetraStudioDrive.png +0 -0
- package/docs/academy/01-GetStarted/styles.module.css +5 -5
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/01-Prerequisites.md +46 -18
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +118 -68
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +75 -33
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +30 -21
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +41 -37
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +29 -25
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +36 -37
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +128 -109
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +95 -86
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +7 -9
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +65 -47
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +77 -62
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +360 -349
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/00-DocumentToolbar.mdx +16 -10
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/01-OperationHistory.md +10 -7
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/02-RevisionHistoryTimeline.md +25 -17
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/01-RenownAuthenticationFlow.md +14 -7
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/02-Authorization.md +0 -1
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/_category_.json +5 -5
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/_category_.json +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/01-GraphQLAtPowerhouse.md +45 -33
- package/docs/academy/02-MasteryTrack/04-WorkWithData/02-UsingTheAPI.mdx +61 -18
- package/docs/academy/02-MasteryTrack/04-WorkWithData/03-UsingSubgraphs.md +50 -54
- package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +126 -110
- package/docs/academy/02-MasteryTrack/04-WorkWithData/05-RelationalDbProcessor.md +75 -45
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +23 -21
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +9 -9
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +11 -23
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +25 -9
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +10 -10
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/benchmarks.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +16 -11
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +6 -5
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +2 -2
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +7 -5
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +32 -58
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/processors.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/07-drive-analytics.md +105 -71
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_01-SetupBuilderEnvironment.md +22 -0
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_02-CreateNewPowerhouseProject.md +9 -8
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_03-GenerateAnAnalyticsProcessor.md +28 -32
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_04-UpdateAnalyticsProcessor.md +25 -26
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_category_.json +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_category_.json +7 -7
- package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +3 -4
- package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +69 -45
- package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +70 -40
- package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +1 -0
- package/docs/academy/02-MasteryTrack/05-Launch/_category_.json +7 -7
- package/docs/academy/02-MasteryTrack/_category_.json +6 -6
- package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +5 -3
- package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +38 -37
- package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +45 -41
- package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +14 -14
- package/docs/academy/03-ExampleUsecases/Chatroom/06-LaunchALocalReactor.md +6 -6
- package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
- package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +104 -43
- package/docs/academy/04-APIReferences/01-ReactHooks.md +177 -129
- package/docs/academy/04-APIReferences/04-RelationalDatabase.md +121 -113
- package/docs/academy/04-APIReferences/05-PHDocumentMigrationGuide.md +48 -41
- package/docs/academy/04-APIReferences/_category_.json +6 -6
- package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +1 -2
- package/docs/academy/05-Architecture/01-WorkingWithTheReactor.md +11 -8
- package/docs/academy/05-Architecture/05-DocumentModelTheory/_category_.json +1 -1
- package/docs/academy/05-Architecture/_category_.json +6 -6
- package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +25 -23
- package/docs/academy/06-ComponentLibrary/02-CreateCustomScalars.md +105 -93
- package/docs/academy/06-ComponentLibrary/03-IntegrateIntoAReactComponent.md +1 -0
- package/docs/academy/06-ComponentLibrary/_category_.json +7 -7
- package/docs/academy/07-Cookbook.md +268 -35
- package/docs/academy/08-Glossary.md +7 -1
- package/docs/bookofpowerhouse/01-Overview.md +2 -2
- package/docs/bookofpowerhouse/02-GeneralFrameworkAndPhilosophy.md +1 -7
- package/docs/bookofpowerhouse/03-PowerhouseSoftwareArchitecture.md +10 -7
- package/docs/bookofpowerhouse/04-DevelopmentApproaches.md +10 -4
- package/docs/bookofpowerhouse/05-SNOsandANewModelForOSSandPublicGoods.md +23 -30
- package/docs/bookofpowerhouse/06-SNOsInActionAndPlatformEconomies.md +0 -7
- package/docusaurus.config.ts +64 -66
- package/package.json +9 -7
- package/scripts/generate-combined-cli-docs.ts +43 -13
- package/sidebars.ts +2 -0
- package/src/components/HomepageFeatures/index.tsx +171 -78
- package/src/components/HomepageFeatures/styles.module.css +1 -2
- package/src/css/custom.css +89 -89
- package/src/pages/_archive-homepage.tsx +17 -16
- package/src/theme/DocCardList/index.tsx +9 -8
- package/static.json +6 -6
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
The Document Toolbar is a central component in Powerhouse Connect, appearing at the top of every document view. It provides quick access to a variety of tools and functions designed to streamline your workflow and enhance document management.
|
|
4
4
|
|
|
5
5
|
<figure className="image-container">
|
|
6
|
-
<img
|
|
7
|
-
|
|
6
|
+
<img
|
|
7
|
+
src={require("./images/DocumentToolbar.png").default}
|
|
8
|
+
alt="Document Toolbar"
|
|
9
|
+
/>
|
|
10
|
+
<figcaption>
|
|
11
|
+
The Document Toolbar can be found at the top of any generic document.
|
|
12
|
+
</figcaption>
|
|
8
13
|
</figure>
|
|
9
14
|
|
|
10
15
|
## Overview
|
|
@@ -12,14 +17,15 @@ The Document Toolbar is a central component in Powerhouse Connect, appearing at
|
|
|
12
17
|
The toolbar is designed to be intuitive and context-aware, offering relevant options based on the document type and your current task. Its capabilities range from basic actions to more advanced document control features.
|
|
13
18
|
|
|
14
19
|
### Key functionalities in the future will include:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
|
|
21
|
+
- **Switchboard API Access:** Access the Switchboard API via its logo in the toolbar. This opens the Apollo Studio Sandbox, pre-populating the DocumentID for your current document model. This feature is unavailable for locally stored documents.
|
|
22
|
+
- **Navigation and Versioning:** Tools for managing [document versions](/academy/MasteryTrack/BuildingUserExperiences/DocumentTools/OperationHistory), such as undo/redo, and accessing the [revision history timeline](/academy/MasteryTrack/BuildingUserExperiences/DocumentTools/RevisionHistoryTimeline).
|
|
23
|
+
- **Document Actions:** Buttons for common operations like exporting or deleting documents.
|
|
24
|
+
- **Information Display:** Shows the document title and may include indicators for status (e.g., connectivity, errors) or active modes.
|
|
25
|
+
- **Search and Filtering:** Integrated search capabilities to find assets or attachments within the document context.
|
|
26
|
+
- **View Customization:** Options to switch between different views or display modes.
|
|
27
|
+
- **Contextual Tools:** Depending on the document, you might find toggles, dropdowns for specific actions (e.g., "Sync Schema", "Fixed Income Purchase"), or buttons for settings and configurations.
|
|
22
28
|
|
|
23
29
|
The specific set of tools available on the toolbar can be configured and may evolve as new features are introduced. This section will detail the various components and options you may encounter.
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
_(Detailed information on each toolbar feature, such as "Export Button", "Title Display", "Search Functionality", "Toggle Switches", "Icon Buttons", etc., will follow here.)_
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# Operations history
|
|
2
2
|
|
|
3
3
|
## What is a document model?
|
|
4
|
+
|
|
4
5
|
A **document model** in Powerhouse is the core unit for managing business data. Each document (such as an invoice, contributor agreement, or scope of work) is created from a specific document model, which defines:
|
|
5
6
|
|
|
6
7
|
- **State schema:** What data the document contains
|
|
7
8
|
- **Operations:** What actions can modify that document
|
|
8
9
|
|
|
9
10
|
## What is an operations history?
|
|
11
|
+
|
|
10
12
|
Every time a user edits a document, they do so by submitting a document operation or a 'command' in CQRS (e.g., `ADD_LINE_ITEM`, `UPDATE_RECIPIENT`). These operations are:
|
|
11
13
|
|
|
12
14
|
- **Appended** to the document's history
|
|
@@ -16,13 +18,14 @@ Every time a user edits a document, they do so by submitting a document operatio
|
|
|
16
18
|
This design is based on **event sourcing** principles.
|
|
17
19
|
|
|
18
20
|
## Why use an operations history?
|
|
21
|
+
|
|
19
22
|
- **Auditability:** Inspect every change ever made to a document.
|
|
20
23
|
- **Transparency:** Contributors see what others have done.
|
|
21
24
|
- **Versioning:** Revert to any prior state or resolve conflicts using branching and merging.
|
|
22
25
|
- **Interoperability:** Operations are just data—they can be signed, stored on-chain, or synchronized across systems.
|
|
23
26
|
|
|
24
|
-
|
|
25
27
|
## Example: Invoice document
|
|
28
|
+
|
|
26
29
|
Suppose you're editing a `powerhouse/invoice` document. Its operations history might look like this:
|
|
27
30
|
|
|
28
31
|
```plaintext
|
|
@@ -36,32 +39,32 @@ The document's state at any time is the result of running those operations in or
|
|
|
36
39
|
## Visualizing the operations history
|
|
37
40
|
|
|
38
41
|
### Revision list and details
|
|
42
|
+
|
|
39
43
|
In Connect the Powerhouse UI displays a chronologic list of all applied modifications to the document, each with a unique event ID, state hash, and commit message. You can inspect each revision for signatures and errors.
|
|
40
44
|
|
|
41
45
|

|
|
42
46
|
|
|
43
|
-
|
|
44
47
|
### Viewing revision hashes and event IDs
|
|
48
|
+
|
|
45
49
|
Hovering over a revision reveals its event ID and state hash, providing traceability for every change.
|
|
46
50
|
|
|
47
51
|

|
|
48
52
|
|
|
49
|
-
|
|
50
53
|
### Signature verification
|
|
54
|
+
|
|
51
55
|
Clicking the signature badge shows signature details, including signer address, hash, and verification status. This ensures every operation is cryptographically auditable.
|
|
52
|
-
Read more about how we are using [Renown](/academy/MasteryTrack/BuildingUserExperiences/Authorization/RenownAuthenticationFlow) for authentication & verification of signer data.
|
|
56
|
+
Read more about how we are using [Renown](/academy/MasteryTrack/BuildingUserExperiences/Authorization/RenownAuthenticationFlow) for authentication & verification of signer data.
|
|
53
57
|
|
|
54
58
|

|
|
55
59
|
|
|
56
|
-
|
|
57
60
|
### Viewing committer addresses
|
|
61
|
+
|
|
58
62
|
You can also view the committer's address for each revision, supporting full transparency and accountability.
|
|
59
63
|
|
|
60
64
|

|
|
61
65
|
|
|
62
|
-
|
|
63
66
|
## Replay, branch, and merge (under development)
|
|
67
|
+
|
|
64
68
|
- **Replay:** When you load a document, the system replays all operations to build its state.
|
|
65
69
|
- **Branch:** Create a parallel version of the document to test changes or handle conflicts.
|
|
66
70
|
- **Merge:** Combine branches intelligently based on operations, not just raw field values.
|
|
67
|
-
|
|
@@ -9,23 +9,18 @@ To enable the timeline feature in your document editor, you need to set `timelin
|
|
|
9
9
|
```typescript
|
|
10
10
|
// editors/to-do-list/index.ts
|
|
11
11
|
export const module: EditorModule<ToDoDocument> = {
|
|
12
|
-
Component: Editor as unknown as FC<
|
|
12
|
+
Component: Editor as unknown as FC<
|
|
13
|
+
EditorProps<ToDoDocument> & Record<string, unknown>
|
|
14
|
+
>,
|
|
13
15
|
documentTypes: ["powerhouse/todo"],
|
|
14
|
-
config: {
|
|
15
|
-
id: "editor-id",
|
|
16
|
-
disableExternalControls: true,
|
|
17
|
-
documentToolbarEnabled: true,
|
|
18
|
-
showSwitchboardLink: true,
|
|
19
|
-
timelineEnabled: true, // Enable timeline feature
|
|
20
|
-
},
|
|
21
16
|
};
|
|
22
17
|
```
|
|
23
18
|
|
|
24
19
|
This setting enables the timeline button in the document toolbar.
|
|
25
20
|
|
|
26
|
-
:::warning Heads Up!
|
|
27
|
-
The revision history timeline will only become visible once your document model has some operations or 'history'.
|
|
28
|
-
Add a few to-do's or some data in the model you are working on and the revision history timeline button in the Document Toolbar will be activated.
|
|
21
|
+
:::warning Heads Up!
|
|
22
|
+
The revision history timeline will only become visible once your document model has some operations or 'history'.
|
|
23
|
+
Add a few to-do's or some data in the model you are working on and the revision history timeline button in the Document Toolbar will be activated.
|
|
29
24
|
Click the button to see the timeline expand and see the first history 'candle' appear.
|
|
30
25
|
:::
|
|
31
26
|
|
|
@@ -64,7 +59,8 @@ const timelineItems = useTimelineItems(documentId);
|
|
|
64
59
|
3. Track the selected timeline item in state:
|
|
65
60
|
|
|
66
61
|
```typescript
|
|
67
|
-
const [selectedTimelineItem, setSelectedTimelineItem] =
|
|
62
|
+
const [selectedTimelineItem, setSelectedTimelineItem] =
|
|
63
|
+
useState<TimelineItem | null>(null);
|
|
68
64
|
```
|
|
69
65
|
|
|
70
66
|
4. Pass the timeline items to the DocumentToolbar and handle item selection:
|
|
@@ -104,18 +100,30 @@ In your document editor (e.g., `editors/to-do-list/editor.tsx`), you need to han
|
|
|
104
100
|
1. Extract timeline-related properties from the context:
|
|
105
101
|
|
|
106
102
|
```typescript
|
|
107
|
-
const {
|
|
103
|
+
const {
|
|
104
|
+
readMode = false,
|
|
105
|
+
selectedTimelineRevision,
|
|
106
|
+
getDocumentRevision,
|
|
107
|
+
} = context;
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
2. Fetch the document at the selected revision when in read mode:
|
|
111
111
|
|
|
112
112
|
```typescript
|
|
113
|
-
const [readModeDocument, setReadModeDocument] = useState<ToDoDocument | null>(
|
|
113
|
+
const [readModeDocument, setReadModeDocument] = useState<ToDoDocument | null>(
|
|
114
|
+
null,
|
|
115
|
+
);
|
|
114
116
|
|
|
115
117
|
useEffect(() => {
|
|
116
118
|
const getReadModeDocument = async () => {
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
+
if (
|
|
120
|
+
getDocumentRevision &&
|
|
121
|
+
readMode &&
|
|
122
|
+
typeof selectedTimelineRevision === "number"
|
|
123
|
+
) {
|
|
124
|
+
const document = await getDocumentRevision({
|
|
125
|
+
revisions: { global: selectedTimelineRevision },
|
|
126
|
+
});
|
|
119
127
|
setReadModeDocument(document);
|
|
120
128
|
} else if (!readMode) {
|
|
121
129
|
setReadModeDocument(null);
|
|
@@ -140,4 +148,4 @@ const document = readModeDocument || writeModeDocument;
|
|
|
140
148
|
)}
|
|
141
149
|
```
|
|
142
150
|
|
|
143
|
-
This implementation allows users to navigate through document history while preventing edits to historical revisions.
|
|
151
|
+
This implementation allows users to navigate through document history while preventing edits to historical revisions.
|
package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/_category_.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"label": "Document Tools",
|
|
3
|
+
"link": {
|
|
4
|
+
"type": "generated-index",
|
|
5
|
+
"description": "All of the tools that you get for free with Powerhouse."
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -3,43 +3,48 @@
|
|
|
3
3
|
The Renown login flow leverages decentralized identity (DID) creation and the Ceramic network for credential storage and verification, ensuring secure and verifiable actions within decentralized organizations. Below is a detailed breakdown of the process, aimed at developers integrating the Renown, Connect, and Switchboard components.
|
|
4
4
|
|
|
5
5
|
### Renown in the decentralized workplace
|
|
6
|
+
|
|
6
7
|
Renown provides a decentralized identity and reputation hub, where users connect their Ethereum address, creating a **Decentralized Identifier (DID)** tied to their wallet.
|
|
7
8
|
|
|
8
9
|
#### Why an integrated identity solution?
|
|
10
|
+
|
|
9
11
|
Renown is designed to address the challenge of trust within DAOs, 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. Over time, contributors can share their pseudonymous profiles with other organizations as cryptographic resumes, helping to secure new opportunities while maintaining privacy.
|
|
10
12
|
|
|
11
13
|
### Detailed login flow
|
|
12
14
|
|
|
13
15
|
#### 1. User login via wallet connection
|
|
16
|
+
|
|
14
17
|
- The user starts by logging into Renown using their Ethereum address. This is done by signing a message with their wallet.
|
|
15
18
|
- The Ethereum key is used to create a DID (Decentralized Identifier), which uniquely represents the user without exposing their personal identity.
|
|
16
19
|
|
|
17
|
-
|
|
18
20
|
<figure className="image-container">
|
|
19
21
|
<img src={require("./images/ConnectAddress.png").default} alt="Connect Address" />
|
|
20
22
|
<figcaption>Connecting your Ethereum address to generate Decentralized Identifier with Renown.</figcaption>
|
|
21
23
|
</figure>
|
|
22
24
|
|
|
23
25
|
#### 2. DID creation
|
|
26
|
+
|
|
24
27
|
- A Decentralized Identifier (DID) is created based on the user's Ethereum key. The DID follows a specific format:
|
|
25
28
|
`did:example:123456789abcdefghijk`
|
|
26
29
|
- This DID acts as the user's digital identifier across decentralized systems.
|
|
27
30
|
|
|
28
31
|
#### 3. Credential generation
|
|
32
|
+
|
|
29
33
|
- A credential is generated, allowing the DID to sign operations on behalf of the user. This credential is stored on Ceramic, a decentralized data stream network.
|
|
30
34
|
- Ceramic ensures that the credentials are securely stored and verifiable across the network. Credentials include the user's signing permissions and are linked to the DID.
|
|
31
35
|
|
|
32
36
|
#### 4. Operation signing with Connect
|
|
37
|
+
|
|
33
38
|
- Connect uses the newly created DID to sign operations performed by the user. For example, when a document or transaction is edited in Connect, the operation is signed with the user's DID.
|
|
34
39
|
- This ensures that every action taken within the Connect system is linked to the user's decentralized identity, maintaining transparency and accountability.
|
|
35
40
|
|
|
36
|
-
|
|
37
41
|
<figure className="image-container">
|
|
38
42
|
<img src={require("./images/OperationsHistory.png").default} alt="Renown Login" />
|
|
39
43
|
<figcaption>Your DID is used to sign operations performed by the user.</figcaption>
|
|
40
44
|
</figure>
|
|
41
45
|
|
|
42
46
|
#### 5. Switchboard verification
|
|
47
|
+
|
|
43
48
|
- Once an operation is signed by the DID through Connect, it is sent to Switchboard for verification.
|
|
44
49
|
- Switchboard verifies whether the DID has a valid credential stored on Ceramic and if the DID was indeed the one that signed the operation.
|
|
45
50
|
- The request includes critical metadata such as the user's Ethereum address, the DID, the signed operation, and other parameters required for validation.
|
|
@@ -50,11 +55,12 @@ Renown is designed to address the challenge of trust within DAOs, where contribu
|
|
|
50
55
|
"hash": "did:key:2be4x...",
|
|
51
56
|
"signatureBytes": "Xmqy8FNz...",
|
|
52
57
|
"isVerified": true
|
|
53
|
-
}
|
|
58
|
+
}
|
|
54
59
|
```
|
|
55
60
|
|
|
56
61
|
#### 6. Operation validation and execution
|
|
57
|
-
|
|
62
|
+
|
|
63
|
+
- After Switchboard validates the operation, it ensures the operation context is accurate and the credentials match the signer.
|
|
58
64
|
- The operation is then either approved or rejected based on the verification results.
|
|
59
65
|
- Approved operations are processed, and changes made within the Connect system are synchronized across the relevant nodes.
|
|
60
66
|
|
|
@@ -63,10 +69,11 @@ Renown is designed to address the challenge of trust within DAOs, where contribu
|
|
|
63
69
|
|
|
64
70
|
:::info
|
|
65
71
|
**Key Components used during login-flow**
|
|
72
|
+
|
|
66
73
|
- **Renown**: Manages user identities via DID creation and Ethereum wallet integration.
|
|
67
|
-
- **Ceramic**: Decentralized data stream where user credentials are stored and verified.
|
|
74
|
+
- **Ceramic**: Decentralized data stream where user credentials are stored and verified.
|
|
68
75
|
- **Connect**: The interface for users to perform operations. It uses the DID for signing operations.
|
|
69
76
|
- **Switchboard**: Responsible for verifying credentials and operation signatures to ensure authenticity.
|
|
70
|
-
:::
|
|
77
|
+
:::
|
|
71
78
|
|
|
72
|
-
This flow ensures that all actions within the Powerhouse ecosystem are secure, transparent, and verifiable, promoting trust in a pseudonymous contributor environment.
|
|
79
|
+
This flow ensures that all actions within the Powerhouse ecosystem are secure, transparent, and verifiable, promoting trust in a pseudonymous contributor environment.
|
package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/_category_.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"label": "Authorization",
|
|
3
|
+
"link": {
|
|
4
|
+
"type": "generated-index"
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
In this section, we will cover **the core concepts of GraphQL with examples applied to the Powerhouse ecosystem**. GraphQL plays a fundamental role in defining document model data schemas, handling data access patterns, and enabling event-driven workflows within the Powerhouse ecosystem.
|
|
4
4
|
|
|
5
5
|
More specifically, GraphQL is used as:
|
|
6
|
+
|
|
6
7
|
- The **schema definition language (SDL)** for defining our document models and thereby self-documenting the API to the data model. It allows developers to define the structure and relationships of data in a strongly-typed format.
|
|
7
8
|
- As the **query language in subgraphs**, which allow different services to expose and query structured data dynamically.
|
|
8
9
|
|
|
@@ -15,21 +16,22 @@ More specifically, GraphQL is used as:
|
|
|
15
16
|
## GraphQL: Core concepts
|
|
16
17
|
|
|
17
18
|
### Schema
|
|
19
|
+
|
|
18
20
|
The schema defines the structure of a GraphQL API. It acts as a contract between the client and server, detailing:
|
|
19
21
|
|
|
20
|
-
- **Data Types**: The various types of data that can be queried.
|
|
21
|
-
For example the contributor type and the project type
|
|
22
|
-
- **Fields**: The available fields on each type.
|
|
23
|
-
For example the contributor type has a field 'name' and the project type has a field 'title'
|
|
24
|
-
- **Relationships**: How different types relate to each other.
|
|
25
|
-
For example the contributor type has a relationship with the project type
|
|
22
|
+
- **Data Types**: The various types of data that can be queried.
|
|
23
|
+
For example the contributor type and the project type
|
|
24
|
+
- **Fields**: The available fields on each type.
|
|
25
|
+
For example the contributor type has a field 'name' and the project type has a field 'title'
|
|
26
|
+
- **Relationships**: How different types relate to each other.
|
|
27
|
+
For example the contributor type has a relationship with the project type
|
|
26
28
|
|
|
27
29
|
```graphql title="Example of a Powerhouse Contributor schema in GraphQL"
|
|
28
30
|
type Contributor {
|
|
29
31
|
id: ID!
|
|
30
32
|
name: String!
|
|
31
33
|
reputationScore: Float
|
|
32
|
-
projects: [Project]
|
|
34
|
+
projects: [Project] # The Contributor type has a field 'projects' that returns an array of Project objects
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
type Project {
|
|
@@ -46,22 +48,23 @@ For example the contributor type has a relationship with the project type
|
|
|
46
48
|
|
|
47
49
|
With the following query someone can request the contributor with the id 123
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
```graphql title="Example of a query to get a contributor"
|
|
52
|
+
query {
|
|
53
|
+
getContributor(id: "123") {
|
|
54
|
+
name
|
|
55
|
+
reputationScore
|
|
56
|
+
projects { # Accessing the related projects
|
|
57
|
+
title
|
|
58
|
+
status
|
|
59
|
+
}
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
|
-
|
|
60
|
-
```
|
|
62
|
+
```
|
|
61
63
|
|
|
62
64
|
---
|
|
63
65
|
|
|
64
66
|
### Fields and arguments
|
|
67
|
+
|
|
65
68
|
- **Field**: A specific piece of data you can request from an object. When you build a query, you select the fields you want to retrieve.
|
|
66
69
|
- **Argument**: Key-value pairs that can be attached to fields to customize and refine the query. Some fields require arguments to work correctly, especially when dealing with mutations.
|
|
67
70
|
|
|
@@ -78,9 +81,11 @@ For example the contributor type has a relationship with the project type
|
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
```
|
|
81
|
-
|
|
84
|
+
|
|
85
|
+
---
|
|
82
86
|
|
|
83
87
|
### Introspection
|
|
88
|
+
|
|
84
89
|
GraphQL APIs are self-documenting. Through introspection, you can query the API to retrieve details about its schema, including:
|
|
85
90
|
|
|
86
91
|
- The list of **available types and fields**.
|
|
@@ -102,7 +107,9 @@ GraphQL APIs are self-documenting. Through introspection, you can query the API
|
|
|
102
107
|
```
|
|
103
108
|
|
|
104
109
|
---
|
|
110
|
+
|
|
105
111
|
### Connections, edges, and nodes
|
|
112
|
+
|
|
106
113
|
When dealing with lists of data, GraphQL employs a pattern that includes:
|
|
107
114
|
|
|
108
115
|
- **Connection**: A structure that represents a list of related objects.
|
|
@@ -136,21 +143,24 @@ When dealing with lists of data, GraphQL employs a pattern that includes:
|
|
|
136
143
|
---
|
|
137
144
|
|
|
138
145
|
### Mutations
|
|
146
|
+
|
|
139
147
|
- While queries retrieve data, **mutations modify data**. In Powerhouse, a contributor might need to submit an invoice after completing a task. A GraphQL mutation for this could be:
|
|
140
148
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
149
|
+
```graphql title="Submitting an Invoice"
|
|
150
|
+
mutation {
|
|
151
|
+
submitInvoice(
|
|
152
|
+
input: {
|
|
144
153
|
contributorId: "123"
|
|
145
154
|
amount: 500.00
|
|
146
155
|
currency: "USD"
|
|
147
156
|
dueDate: "2024-03-01"
|
|
148
|
-
}) {
|
|
149
|
-
id
|
|
150
|
-
status
|
|
151
157
|
}
|
|
158
|
+
) {
|
|
159
|
+
id
|
|
160
|
+
status
|
|
152
161
|
}
|
|
153
|
-
|
|
162
|
+
}
|
|
163
|
+
```
|
|
154
164
|
|
|
155
165
|
---
|
|
156
166
|
|
|
@@ -192,14 +202,15 @@ Powerhouse uses **CQRS (Command Query Responsibility Segregation)** to separate
|
|
|
192
202
|
|
|
193
203
|
Powerhouse's subgraphs act as the read layer, while processors handle write operations into operational data stores. This prevents conflicts between querying and modifying data.
|
|
194
204
|
|
|
195
|
-
| Layer
|
|
196
|
-
|
|
|
197
|
-
| Write Model (Commands) | Handles state changes (adding, modifying, deleting) | GraphQL Mutations | Processor
|
|
198
|
-
| Read Model (Queries)
|
|
205
|
+
| Layer | Role | GraphQL Usage | Implementation |
|
|
206
|
+
| ---------------------- | --------------------------------------------------- | ----------------- | -------------- |
|
|
207
|
+
| Write Model (Commands) | Handles state changes (adding, modifying, deleting) | GraphQL Mutations | Processor |
|
|
208
|
+
| Read Model (Queries) | Optimized for fetching/reading/retrieving data | GraphQL Queries | Subgraph |
|
|
199
209
|
|
|
200
|
-
### Read and write separation
|
|
210
|
+
### Read and write separation
|
|
211
|
+
|
|
212
|
+
**Read Model (Query)**
|
|
201
213
|
|
|
202
|
-
**Read Model (Query)**
|
|
203
214
|
- Optimized for data retrieval
|
|
204
215
|
- Structured using GraphQL Queries
|
|
205
216
|
- Aggregates and exposes data via a subgraph
|
|
@@ -216,7 +227,8 @@ query {
|
|
|
216
227
|
}
|
|
217
228
|
```
|
|
218
229
|
|
|
219
|
-
**Write Model (Mutation)**
|
|
230
|
+
**Write Model (Mutation)**
|
|
231
|
+
|
|
220
232
|
- Handles state changes (adding, modifying, deleting)
|
|
221
233
|
- Structured using GraphQL Mutations
|
|
222
234
|
- Writes data to Operational Data Stores
|
|
@@ -281,4 +293,4 @@ GraphQL offers a streamlined and efficient approach to data retrieval, particula
|
|
|
281
293
|
|
|
282
294
|
By defining robust schemas, using precise fields and arguments, leveraging introspection, and implementing subgraphs with CQRS principles, GraphQL minimizes unnecessary data transfers while maximizing flexibility and scalability in the Powerhouse platform.
|
|
283
295
|
|
|
284
|
-
For more information about GraphQL fundamentals, visit the [Introduction to GraphQL](https://graphql.org/learn/) documentation.
|
|
296
|
+
For more information about GraphQL fundamentals, visit the [Introduction to GraphQL](https://graphql.org/learn/) documentation.
|
|
@@ -18,7 +18,7 @@ In this tutorial, we'll show how to use a **GraphQL** query to query a document
|
|
|
18
18
|
To make our document model available in the Apollo Studio Sandbox, we'll need to store it on a remote [Reactor](/academy/Architecture/WorkingWithTheReactor).
|
|
19
19
|
|
|
20
20
|
:::info What are reactors?
|
|
21
|
-
**Powerhouse Reactors** are the nodes in the network that store documents, resolve conflicts, and rerun operations to verify document event histories.
|
|
21
|
+
**Powerhouse Reactors** are the nodes in the network that store documents, resolve conflicts, and rerun operations to verify document event histories.
|
|
22
22
|
Reactors can be configured for local storage, centralized cloud storage, or a decentralized storage network.
|
|
23
23
|
:::
|
|
24
24
|
|
|
@@ -29,11 +29,13 @@ ph reactor
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
To start both Connect and a Reactor locally at the same time in a Powerhouse project, you can use the following command:
|
|
32
|
+
|
|
32
33
|
```bash
|
|
33
34
|
ph dev
|
|
34
35
|
```
|
|
35
36
|
|
|
36
37
|
This will return a URL to access the Reactor.
|
|
38
|
+
|
|
37
39
|
```bash
|
|
38
40
|
[Reactor]: ➜ Reactor: http://localhost:4001/d/powerhouse
|
|
39
41
|
```
|
|
@@ -46,8 +48,13 @@ Get access to an **organization's drive** instances by adding their drive to you
|
|
|
46
48
|
Click the (+) 'Create New Drive' to add a public drive. To add a new drive, you'll have to know the correct public URL of the drive. Read more about [configuring drives](/academy/Architecture/WorkingWithTheReactor).
|
|
47
49
|
|
|
48
50
|
<figure className="image-container">
|
|
49
|
-
<img
|
|
50
|
-
|
|
51
|
+
<img
|
|
52
|
+
src={require("./images/AddNewDriveURL.png").default}
|
|
53
|
+
alt="Add a drive through an URL"
|
|
54
|
+
/>
|
|
55
|
+
<figcaption>
|
|
56
|
+
The 'Add Drive' button that allows you to enter a Drive URL.
|
|
57
|
+
</figcaption>
|
|
51
58
|
</figure>
|
|
52
59
|
|
|
53
60
|
## Query the state of a document
|
|
@@ -55,10 +62,10 @@ Click the (+) 'Create New Drive' to add a public drive. To add a new drive, you'
|
|
|
55
62
|
Now that we have our remote reactor and/or drive running, we can store our document model on it.
|
|
56
63
|
Let's quickly create a new to-do list document in Connect Studio to test the process. Let's call it **'Powerhouse-onboarding-tasks'**.
|
|
57
64
|
|
|
58
|
-
|
|
59
65
|
Add the following to-dos to your list:
|
|
66
|
+
|
|
60
67
|
- [ ] Sign up for Powerhouse
|
|
61
|
-
- [ ] Do the work
|
|
68
|
+
- [ ] Do the work
|
|
62
69
|
- [ ] Deliver the work
|
|
63
70
|
- [ ] Send the invoice
|
|
64
71
|
- [ ] Get paid
|
|
@@ -66,8 +73,13 @@ Add the following to-dos to your list:
|
|
|
66
73
|
Below is the operation history of the to-do list document. As you can see, the operations are logged in the order they were executed.
|
|
67
74
|
|
|
68
75
|
<figure className="image-container">
|
|
69
|
-
<img
|
|
70
|
-
|
|
76
|
+
<img
|
|
77
|
+
src={require("./images/OnboardingTasks.png").default}
|
|
78
|
+
alt="Operation history in Connect"
|
|
79
|
+
/>
|
|
80
|
+
<figcaption>
|
|
81
|
+
The operation history of the to-do list document, showing each change made.
|
|
82
|
+
</figcaption>
|
|
71
83
|
</figure>
|
|
72
84
|
|
|
73
85
|
Now that we have some data in our document model, we can query it through the GraphQL API.
|
|
@@ -79,8 +91,14 @@ The Switchboard API button at the top of your document model will get you the co
|
|
|
79
91
|
This will prepopulate the Apollo Studio Sandbox with the correct **DocumentID** for your document model.
|
|
80
92
|
|
|
81
93
|
<figure className="image-container">
|
|
82
|
-
<img
|
|
83
|
-
|
|
94
|
+
<img
|
|
95
|
+
src={require("./images/SwitchboardButton.png").default}
|
|
96
|
+
alt="Switchboard button in document editor"
|
|
97
|
+
/>
|
|
98
|
+
<figcaption>
|
|
99
|
+
The Switchboard button provides a direct link to the GraphQL API for the
|
|
100
|
+
document.
|
|
101
|
+
</figcaption>
|
|
84
102
|
</figure>
|
|
85
103
|
|
|
86
104
|
### Option 2: Query your document by document ID
|
|
@@ -89,16 +107,27 @@ In your Document Toolbar, you will find an icon to visit your operations history
|
|
|
89
107
|
Copy this ID to use it in the Switchboard API.
|
|
90
108
|
|
|
91
109
|
<figure className="image-container">
|
|
92
|
-
<img
|
|
93
|
-
|
|
110
|
+
<img
|
|
111
|
+
src={require("./images/DocumentID.png").default}
|
|
112
|
+
alt="Copy the DocumentID"
|
|
113
|
+
/>
|
|
114
|
+
<figcaption>
|
|
115
|
+
You can copy your Document ID from your operations history.
|
|
116
|
+
</figcaption>
|
|
94
117
|
</figure>
|
|
95
118
|
|
|
96
119
|
When you navigate to your Switchboard endpoint by adding **`/graphql/system`** to the end of your URL. (e.g., http://localhost:4001/graphql/system, https://switchboard.phd/graphql/system, or add it to a custom domain), you can use this document ID to query the state of your document.
|
|
97
120
|
The documentation on the left-hand side of the Apollo Sandbox will show you all the different fields that are available to query.
|
|
98
121
|
|
|
99
122
|
<figure className="image-container">
|
|
100
|
-
<img
|
|
101
|
-
|
|
123
|
+
<img
|
|
124
|
+
src={require("./images/QueryDocumentID.png").default}
|
|
125
|
+
alt="Apollo Studio with document query"
|
|
126
|
+
/>
|
|
127
|
+
<figcaption>
|
|
128
|
+
The Apollo Studio Sandbox showing the available fields for querying a
|
|
129
|
+
document.
|
|
130
|
+
</figcaption>
|
|
102
131
|
</figure>
|
|
103
132
|
|
|
104
133
|
### Option 3: Search for your document ID via GraphQL
|
|
@@ -143,7 +172,16 @@ query getDocument($documentId: PHID!, $driveId: String) {
|
|
|
143
172
|
name
|
|
144
173
|
revision
|
|
145
174
|
state {
|
|
146
|
-
items {
|
|
175
|
+
items {
|
|
176
|
+
id
|
|
177
|
+
text
|
|
178
|
+
checked
|
|
179
|
+
}
|
|
180
|
+
stats {
|
|
181
|
+
total
|
|
182
|
+
checked
|
|
183
|
+
unchecked
|
|
184
|
+
}
|
|
147
185
|
}
|
|
148
186
|
}
|
|
149
187
|
}
|
|
@@ -160,11 +198,16 @@ query getDocument($documentId: PHID!, $driveId: String) {
|
|
|
160
198
|
This query will return the current state of the document, including all to-do items and stats.
|
|
161
199
|
|
|
162
200
|
<figure className="image-container">
|
|
163
|
-
<img
|
|
164
|
-
|
|
201
|
+
<img
|
|
202
|
+
src={require("./images/OperationsQuery.png").default}
|
|
203
|
+
alt="Executing a mutation for a to-do item in Apollo Studio"
|
|
204
|
+
/>
|
|
205
|
+
<figcaption>
|
|
206
|
+
The Apollo Studio Sandbox showing the <code>addTodoItem</code> mutation. You
|
|
207
|
+
can see the variables passed in and the response from the server.
|
|
208
|
+
</figcaption>
|
|
165
209
|
</figure>
|
|
166
210
|
|
|
167
|
-
|
|
168
211
|
## Mutate the state of a document
|
|
169
212
|
|
|
170
213
|
Now that we know how to query the state of a document, we can start to write to it.
|
|
@@ -205,6 +248,7 @@ To delete an item, you'll need its unique identifier. When you query for the to-
|
|
|
205
248
|
The document model provides a `DELETE_TODO_ITEM` operation, which corresponds to a `deleteTodoItem` mutation.
|
|
206
249
|
|
|
207
250
|
Here's how you can use it:
|
|
251
|
+
|
|
208
252
|
```graphql title="example-delete-mutation"
|
|
209
253
|
mutation Mutation($docId: PHID, $input: ToDoList_DeleteTodoItemInput) {
|
|
210
254
|
ToDoList_deleteTodoItem(docId: $docId, input: $input)
|
|
@@ -231,7 +275,6 @@ After performing a write mutation, you can verify that the change was successful
|
|
|
231
275
|
1. **Query the document state again:** Rerun the `getDocument` query from earlier in this tutorial. You should see the new item in the list or the deleted item removed.
|
|
232
276
|
2. **Check the Operation History:** The operation history in Connect will show the new `ADD_TODO_ITEM` or `DELETE_TODO_ITEM` operation, along with who performed it and when. This provides a complete audit trail of all changes to the document.
|
|
233
277
|
|
|
234
|
-
|
|
235
278
|
### Summary
|
|
236
279
|
|
|
237
280
|
This ability to programmatically read from and write to documents via the GraphQL API is a powerful feature of Powerhouse. It unlocks countless possibilities for integrating your structured data into other applications, building automated workflows, and creating rich, data-driven user experiences.
|