@powerhousedao/academy 5.0.0-staging.1 → 5.0.0-staging.11
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 +64 -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 +61 -24
- package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +21 -12
- 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-SpecDrivenAI.md +143 -0
- package/docs/academy/01-GetStarted/home.mdx +185 -90
- 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 +26 -11
- 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 +9 -7
- 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 +267 -34
- 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 +1 -1
- package/scripts/generate-combined-cli-docs.ts +43 -13
- package/sidebars.ts +1 -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
|
@@ -16,8 +16,9 @@ These processors run in the background, converting operations into structured ti
|
|
|
16
16
|
Connect applications have Drive Analytics enabled by default through the `ReactorAnalyticsProvider`. When enabled, the system automatically tracks:
|
|
17
17
|
|
|
18
18
|
### Drive Operations Metrics
|
|
19
|
+
|
|
19
20
|
- **File Creation**: New documents added to drives
|
|
20
|
-
- **Folder Creation**: New directories created
|
|
21
|
+
- **Folder Creation**: New directories created
|
|
21
22
|
- **File Updates**: Document content modifications
|
|
22
23
|
- **Node Updates**: Metadata changes
|
|
23
24
|
- **File Moves**: Documents relocated between folders
|
|
@@ -25,6 +26,7 @@ Connect applications have Drive Analytics enabled by default through the `Reacto
|
|
|
25
26
|
- **File Deletions**: Documents removed from drives
|
|
26
27
|
|
|
27
28
|
### Document Operations Metrics
|
|
29
|
+
|
|
28
30
|
- **State Changes**: Document model state modifications
|
|
29
31
|
|
|
30
32
|
## Data Sources and Structure
|
|
@@ -32,15 +34,19 @@ Connect applications have Drive Analytics enabled by default through the `Reacto
|
|
|
32
34
|
Drive Analytics organizes data using hierarchical source paths that allow precise querying of different analytics contexts:
|
|
33
35
|
|
|
34
36
|
### Drive Analytics Sources
|
|
37
|
+
|
|
35
38
|
Pattern: `ph/drive/{driveId}/{branch}/{scope}`
|
|
39
|
+
|
|
36
40
|
- **driveId**: Unique identifier for the document drive
|
|
37
|
-
- **branch**: Branch name (e.g., "main", "dev")
|
|
41
|
+
- **branch**: Branch name (e.g., "main", "dev")
|
|
38
42
|
- **scope**: Operation scope ("global" for shared operations, "local" for device-specific)
|
|
39
43
|
|
|
40
44
|
Example: `ph/drive/abc123/main/global`
|
|
41
45
|
|
|
42
|
-
### Document Analytics Sources
|
|
46
|
+
### Document Analytics Sources
|
|
47
|
+
|
|
43
48
|
Pattern: `ph/doc/{driveId}/{documentId}/{branch}/{scope}`
|
|
49
|
+
|
|
44
50
|
- **driveId**: Drive containing the document
|
|
45
51
|
- **documentId**: Specific document identifier
|
|
46
52
|
- **branch**: Branch name
|
|
@@ -51,13 +57,17 @@ Example: `ph/doc/abc123/doc456/main/global`
|
|
|
51
57
|
## Available Metrics
|
|
52
58
|
|
|
53
59
|
### DriveOperations
|
|
60
|
+
|
|
54
61
|
Tracks file system operations within drives:
|
|
62
|
+
|
|
55
63
|
- **Value**: Always 1 (counter metric)
|
|
56
64
|
- **Purpose**: Count drive-level operations like file creation, deletion, moves
|
|
57
65
|
- **Source Pattern**: `ph/drive/*`
|
|
58
66
|
|
|
59
|
-
### DocumentOperations
|
|
67
|
+
### DocumentOperations
|
|
68
|
+
|
|
60
69
|
Tracks document content and state changes:
|
|
70
|
+
|
|
61
71
|
- **Value**: Always 1 (counter metric)
|
|
62
72
|
- **Purpose**: Count document-specific operations like state changes
|
|
63
73
|
- **Source Pattern**: `ph/doc/*`
|
|
@@ -67,21 +77,25 @@ Tracks document content and state changes:
|
|
|
67
77
|
### Drive Analytics Dimensions
|
|
68
78
|
|
|
69
79
|
#### 1. Drive Dimension
|
|
80
|
+
|
|
70
81
|
**Pattern**: `ph/drive/{driveId}/{branch}/{scope}/{revision}`
|
|
71
82
|
**Purpose**: Identifies the drive context with revision information
|
|
83
|
+
|
|
72
84
|
```tsx
|
|
73
85
|
// Examples
|
|
74
|
-
"ph/drive/abc123/main/global/42"
|
|
75
|
-
"ph/drive/my-drive/feature-branch/local/15"
|
|
86
|
+
"ph/drive/abc123/main/global/42";
|
|
87
|
+
"ph/drive/my-drive/feature-branch/local/15";
|
|
76
88
|
```
|
|
77
89
|
|
|
78
90
|
#### 2. Operation Dimension
|
|
91
|
+
|
|
79
92
|
**Pattern**: `ph/drive/operation/{operationType}/{operationIndex}`
|
|
80
93
|
**Purpose**: Identifies specific operation types and their sequence
|
|
81
94
|
|
|
82
95
|
**Available Operation Types**:
|
|
96
|
+
|
|
83
97
|
- **ADD_FILE**: Create new file
|
|
84
|
-
- **ADD_FOLDER**: Create new folder
|
|
98
|
+
- **ADD_FOLDER**: Create new folder
|
|
85
99
|
- **UPDATE_FILE**: Modify file content
|
|
86
100
|
- **UPDATE_NODE**: Modify node metadata
|
|
87
101
|
- **MOVE_NODE**: Move file/folder to different location
|
|
@@ -90,31 +104,35 @@ Tracks document content and state changes:
|
|
|
90
104
|
|
|
91
105
|
```tsx
|
|
92
106
|
// Examples
|
|
93
|
-
"ph/drive/operation/ADD_FILE/5"
|
|
94
|
-
"ph/drive/operation/DELETE_NODE/23"
|
|
95
|
-
"ph/drive/operation/MOVE_NODE/12"
|
|
107
|
+
"ph/drive/operation/ADD_FILE/5";
|
|
108
|
+
"ph/drive/operation/DELETE_NODE/23";
|
|
109
|
+
"ph/drive/operation/MOVE_NODE/12";
|
|
96
110
|
```
|
|
97
111
|
|
|
98
112
|
#### 3. Target Dimension
|
|
113
|
+
|
|
99
114
|
**Pattern**: `ph/drive/target/{targetType}/{targetId}`
|
|
100
115
|
**Purpose**: Identifies what was targeted by the operation
|
|
101
116
|
|
|
102
117
|
**Target Types**:
|
|
118
|
+
|
|
103
119
|
- **DRIVE**: Operation affects the drive itself
|
|
104
120
|
- **NODE**: Operation affects a specific file/folder
|
|
105
121
|
|
|
106
122
|
```tsx
|
|
107
123
|
// Examples
|
|
108
|
-
"ph/drive/target/DRIVE/abc123"
|
|
109
|
-
"ph/drive/target/NODE/file456"
|
|
110
|
-
"ph/drive/target/NODE/folder789"
|
|
124
|
+
"ph/drive/target/DRIVE/abc123";
|
|
125
|
+
"ph/drive/target/NODE/file456";
|
|
126
|
+
"ph/drive/target/NODE/folder789";
|
|
111
127
|
```
|
|
112
128
|
|
|
113
129
|
#### 4. Action Type Dimension
|
|
130
|
+
|
|
114
131
|
**Pattern**: `ph/drive/actionType/{actionType}/{targetId}`
|
|
115
132
|
**Purpose**: Categorizes operations by their effect
|
|
116
133
|
|
|
117
134
|
**Action Types**:
|
|
135
|
+
|
|
118
136
|
- **CREATED**: New items added (ADD_FILE, ADD_FOLDER)
|
|
119
137
|
- **DUPLICATED**: Items copied (COPY_NODE)
|
|
120
138
|
- **UPDATED**: Existing items modified (UPDATE_FILE, UPDATE_NODE)
|
|
@@ -123,48 +141,55 @@ Tracks document content and state changes:
|
|
|
123
141
|
|
|
124
142
|
```tsx
|
|
125
143
|
// Examples
|
|
126
|
-
"ph/drive/actionType/CREATED/file123"
|
|
127
|
-
"ph/drive/actionType/MOVED/folder456"
|
|
128
|
-
"ph/drive/actionType/REMOVED/doc789"
|
|
144
|
+
"ph/drive/actionType/CREATED/file123";
|
|
145
|
+
"ph/drive/actionType/MOVED/folder456";
|
|
146
|
+
"ph/drive/actionType/REMOVED/doc789";
|
|
129
147
|
```
|
|
130
148
|
|
|
131
149
|
### Document Analytics Dimensions
|
|
132
150
|
|
|
133
151
|
#### 1. Drive Dimension
|
|
152
|
+
|
|
134
153
|
**Pattern**: `ph/doc/drive/{driveId}/{branch}/{scope}/{revision}`
|
|
135
154
|
**Purpose**: Drive context for document operations
|
|
155
|
+
|
|
136
156
|
```tsx
|
|
137
157
|
// Examples
|
|
138
|
-
"ph/doc/drive/abc123/main/global/42"
|
|
158
|
+
"ph/doc/drive/abc123/main/global/42";
|
|
139
159
|
```
|
|
140
160
|
|
|
141
|
-
#### 2. Operation Dimension
|
|
161
|
+
#### 2. Operation Dimension
|
|
162
|
+
|
|
142
163
|
**Pattern**: `ph/doc/operation/{operationType}/{operationIndex}`
|
|
143
164
|
**Purpose**: Document-specific operation identification
|
|
165
|
+
|
|
144
166
|
```tsx
|
|
145
167
|
// Examples (document model operations vary by document type)
|
|
146
|
-
"ph/doc/operation/SET_STATE/15"
|
|
147
|
-
"ph/doc/operation/ADD_ITEM/8"
|
|
148
|
-
"ph/doc/operation/UPDATE_PROPERTY/22"
|
|
168
|
+
"ph/doc/operation/SET_STATE/15";
|
|
169
|
+
"ph/doc/operation/ADD_ITEM/8";
|
|
170
|
+
"ph/doc/operation/UPDATE_PROPERTY/22";
|
|
149
171
|
```
|
|
150
172
|
|
|
151
173
|
#### 3. Target Dimension
|
|
174
|
+
|
|
152
175
|
**Pattern**: `ph/doc/target/{driveId}/{targetType}/{documentId}`
|
|
153
176
|
**Purpose**: Document target identification
|
|
154
177
|
|
|
155
178
|
**Target Types**:
|
|
179
|
+
|
|
156
180
|
- **DRIVE**: Document is the drive document itself (driveId === documentId)
|
|
157
181
|
- **NODE**: Document is a regular document within the drive
|
|
158
182
|
|
|
159
183
|
```tsx
|
|
160
184
|
// Examples
|
|
161
|
-
"ph/doc/target/abc123/DRIVE/abc123"
|
|
162
|
-
"ph/doc/target/abc123/NODE/doc456"
|
|
185
|
+
"ph/doc/target/abc123/DRIVE/abc123"; // Drive document
|
|
186
|
+
"ph/doc/target/abc123/NODE/doc456"; // Regular document
|
|
163
187
|
```
|
|
164
188
|
|
|
165
189
|
## Query Parameters
|
|
166
190
|
|
|
167
191
|
### Time Range
|
|
192
|
+
|
|
168
193
|
- **start**: DateTime object for query start time
|
|
169
194
|
- **end**: DateTime object for query end time
|
|
170
195
|
- **granularity**: Time bucketing (Total, Hourly, Daily, Weekly, Monthly)
|
|
@@ -180,19 +205,19 @@ select: {
|
|
|
180
205
|
AnalyticsPath.fromString("ph/drive/abc123"),
|
|
181
206
|
AnalyticsPath.fromString("ph/drive/xyz789")
|
|
182
207
|
],
|
|
183
|
-
|
|
208
|
+
|
|
184
209
|
// Filter by operation types
|
|
185
210
|
operation: [
|
|
186
211
|
AnalyticsPath.fromString("ph/drive/operation/ADD_FILE"),
|
|
187
212
|
AnalyticsPath.fromString("ph/drive/operation/UPDATE_FILE")
|
|
188
213
|
],
|
|
189
|
-
|
|
190
|
-
// Filter by action types
|
|
214
|
+
|
|
215
|
+
// Filter by action types
|
|
191
216
|
actionType: [
|
|
192
217
|
AnalyticsPath.fromString("ph/drive/actionType/CREATED"),
|
|
193
218
|
AnalyticsPath.fromString("ph/drive/actionType/UPDATED")
|
|
194
219
|
],
|
|
195
|
-
|
|
220
|
+
|
|
196
221
|
// Filter by targets
|
|
197
222
|
target: [
|
|
198
223
|
AnalyticsPath.fromString("ph/drive/target/NODE")
|
|
@@ -220,7 +245,12 @@ lod: {
|
|
|
220
245
|
The primary way to access drive analytics is through the `useAnalyticsQuery` hook:
|
|
221
246
|
|
|
222
247
|
```tsx
|
|
223
|
-
import {
|
|
248
|
+
import {
|
|
249
|
+
useAnalyticsQuery,
|
|
250
|
+
AnalyticsGranularity,
|
|
251
|
+
AnalyticsPath,
|
|
252
|
+
DateTime,
|
|
253
|
+
} from "@powerhousedao/reactor-browser/analytics";
|
|
224
254
|
|
|
225
255
|
function DriveUsageChart({ driveId }: { driveId: string }) {
|
|
226
256
|
const { data, isLoading } = useAnalyticsQuery({
|
|
@@ -233,13 +263,13 @@ function DriveUsageChart({ driveId }: { driveId: string }) {
|
|
|
233
263
|
actionType: [
|
|
234
264
|
AnalyticsPath.fromString("ph/drive/actionType/CREATED"),
|
|
235
265
|
AnalyticsPath.fromString("ph/drive/actionType/UPDATED"),
|
|
236
|
-
AnalyticsPath.fromString("ph/drive/actionType/REMOVED")
|
|
237
|
-
]
|
|
266
|
+
AnalyticsPath.fromString("ph/drive/actionType/REMOVED"),
|
|
267
|
+
],
|
|
238
268
|
},
|
|
239
269
|
lod: {
|
|
240
270
|
drive: 1,
|
|
241
|
-
actionType: 1
|
|
242
|
-
}
|
|
271
|
+
actionType: 1,
|
|
272
|
+
},
|
|
243
273
|
});
|
|
244
274
|
|
|
245
275
|
if (isLoading) return <div>Loading analytics...</div>;
|
|
@@ -247,7 +277,7 @@ function DriveUsageChart({ driveId }: { driveId: string }) {
|
|
|
247
277
|
return (
|
|
248
278
|
<div>
|
|
249
279
|
{/* Render your chart using the analytics data */}
|
|
250
|
-
{data?.rows.map(row => (
|
|
280
|
+
{data?.rows.map((row) => (
|
|
251
281
|
<div key={row.metric}>
|
|
252
282
|
{row.metric}: {row.value}
|
|
253
283
|
</div>
|
|
@@ -262,20 +292,20 @@ function DriveUsageChart({ driveId }: { driveId: string }) {
|
|
|
262
292
|
For common drive analytics queries, use the specialized `useDriveAnalytics` hook:
|
|
263
293
|
|
|
264
294
|
```tsx
|
|
265
|
-
import { useDriveAnalytics } from
|
|
266
|
-
import { AnalyticsGranularity } from
|
|
295
|
+
import { useDriveAnalytics } from "@powerhousedao/common/drive-analytics";
|
|
296
|
+
import { AnalyticsGranularity } from "@powerhousedao/reactor-browser/analytics";
|
|
267
297
|
|
|
268
298
|
function DriveInsights({ driveIds }: { driveIds: string[] }) {
|
|
269
299
|
const analytics = useDriveAnalytics({
|
|
270
300
|
filters: {
|
|
271
301
|
driveId: driveIds,
|
|
272
302
|
operation: ["ADD_FILE", "UPDATE_FILE", "DELETE_NODE"],
|
|
273
|
-
actionType: ["CREATED", "UPDATED", "REMOVED"]
|
|
303
|
+
actionType: ["CREATED", "UPDATED", "REMOVED"],
|
|
274
304
|
},
|
|
275
305
|
from: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString(), // 7 days ago
|
|
276
306
|
to: new Date().toISOString(),
|
|
277
307
|
granularity: AnalyticsGranularity.Daily,
|
|
278
|
-
levelOfDetail: { drive: 1, operation: 1 }
|
|
308
|
+
levelOfDetail: { drive: 1, operation: 1 },
|
|
279
309
|
});
|
|
280
310
|
|
|
281
311
|
if (analytics.isLoading) return <div>Loading...</div>;
|
|
@@ -285,7 +315,10 @@ function DriveInsights({ driveIds }: { driveIds: string[] }) {
|
|
|
285
315
|
<h3>Drive Activity Summary</h3>
|
|
286
316
|
{analytics.data?.rows.map((row, index) => (
|
|
287
317
|
<div key={index}>
|
|
288
|
-
<strong>
|
|
318
|
+
<strong>
|
|
319
|
+
{row.dimensions.find((d) => d.name === "actionType")?.path}
|
|
320
|
+
</strong>
|
|
321
|
+
: {row.value}
|
|
289
322
|
</div>
|
|
290
323
|
))}
|
|
291
324
|
</div>
|
|
@@ -298,26 +331,32 @@ function DriveInsights({ driveIds }: { driveIds: string[] }) {
|
|
|
298
331
|
For document-specific analytics queries, use the `useDocumentAnalytics` hook:
|
|
299
332
|
|
|
300
333
|
```tsx
|
|
301
|
-
import { useDocumentAnalytics } from
|
|
302
|
-
import { AnalyticsGranularity } from
|
|
303
|
-
|
|
304
|
-
function DocumentInsights({
|
|
334
|
+
import { useDocumentAnalytics } from "@powerhousedao/common/drive-analytics";
|
|
335
|
+
import { AnalyticsGranularity } from "@powerhousedao/reactor-browser/analytics";
|
|
336
|
+
|
|
337
|
+
function DocumentInsights({
|
|
338
|
+
driveId,
|
|
339
|
+
documentIds,
|
|
340
|
+
}: {
|
|
341
|
+
driveId: string;
|
|
342
|
+
documentIds: string[];
|
|
343
|
+
}) {
|
|
305
344
|
const analytics = useDocumentAnalytics({
|
|
306
345
|
filters: {
|
|
307
346
|
driveId: [driveId],
|
|
308
347
|
documentId: documentIds,
|
|
309
348
|
target: ["NODE"], // Focus on document nodes vs drive documents
|
|
310
349
|
branch: ["main"],
|
|
311
|
-
scope: ["global"]
|
|
350
|
+
scope: ["global"],
|
|
312
351
|
},
|
|
313
352
|
from: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(), // 24 hours ago
|
|
314
353
|
to: new Date().toISOString(),
|
|
315
354
|
granularity: AnalyticsGranularity.Hourly,
|
|
316
|
-
levelOfDetail: {
|
|
317
|
-
drive: 1,
|
|
355
|
+
levelOfDetail: {
|
|
356
|
+
drive: 1,
|
|
318
357
|
operation: 1,
|
|
319
|
-
target: 1
|
|
320
|
-
}
|
|
358
|
+
target: 1,
|
|
359
|
+
},
|
|
321
360
|
});
|
|
322
361
|
|
|
323
362
|
if (analytics.isLoading) return <div>Loading...</div>;
|
|
@@ -326,9 +365,7 @@ function DocumentInsights({ driveId, documentIds }: { driveId: string, documentI
|
|
|
326
365
|
<div>
|
|
327
366
|
<h3>Document Activity Summary</h3>
|
|
328
367
|
{analytics.data?.rows.map((row, index) => (
|
|
329
|
-
<div key={index}>
|
|
330
|
-
Document Operations: {row.value}
|
|
331
|
-
</div>
|
|
368
|
+
<div key={index}>Document Operations: {row.value}</div>
|
|
332
369
|
))}
|
|
333
370
|
</div>
|
|
334
371
|
);
|
|
@@ -349,20 +386,18 @@ const { data } = useAnalyticsQuery({
|
|
|
349
386
|
select: {
|
|
350
387
|
drive: [
|
|
351
388
|
AnalyticsPath.fromString("ph/drive/project-a"),
|
|
352
|
-
AnalyticsPath.fromString("ph/drive/project-b")
|
|
389
|
+
AnalyticsPath.fromString("ph/drive/project-b"),
|
|
353
390
|
],
|
|
354
391
|
operation: [
|
|
355
392
|
AnalyticsPath.fromString("ph/drive/operation/ADD_FILE"),
|
|
356
|
-
AnalyticsPath.fromString("ph/drive/operation/UPDATE_FILE")
|
|
393
|
+
AnalyticsPath.fromString("ph/drive/operation/UPDATE_FILE"),
|
|
357
394
|
],
|
|
358
|
-
target: [
|
|
359
|
-
AnalyticsPath.fromString("ph/drive/target/NODE")
|
|
360
|
-
]
|
|
395
|
+
target: [AnalyticsPath.fromString("ph/drive/target/NODE")],
|
|
361
396
|
},
|
|
362
397
|
lod: {
|
|
363
398
|
drive: 1,
|
|
364
|
-
operation: 1
|
|
365
|
-
}
|
|
399
|
+
operation: 1,
|
|
400
|
+
},
|
|
366
401
|
});
|
|
367
402
|
```
|
|
368
403
|
|
|
@@ -374,14 +409,14 @@ const driveOps = useDriveAnalytics({
|
|
|
374
409
|
filters: { driveId: [driveId] },
|
|
375
410
|
from: DateTime.now().minus({ days: 1 }).toISO(),
|
|
376
411
|
to: DateTime.now().toISO(),
|
|
377
|
-
granularity: AnalyticsGranularity.Total
|
|
412
|
+
granularity: AnalyticsGranularity.Total,
|
|
378
413
|
});
|
|
379
414
|
|
|
380
415
|
const docOps = useDocumentAnalytics({
|
|
381
416
|
filters: { driveId: [driveId] },
|
|
382
417
|
from: DateTime.now().minus({ days: 1 }).toISO(),
|
|
383
418
|
to: DateTime.now().toISO(),
|
|
384
|
-
granularity: AnalyticsGranularity.Total
|
|
419
|
+
granularity: AnalyticsGranularity.Total,
|
|
385
420
|
});
|
|
386
421
|
|
|
387
422
|
// Or using useAnalyticsQuery directly
|
|
@@ -391,8 +426,8 @@ const driveOpsQuery = useAnalyticsQuery({
|
|
|
391
426
|
granularity: AnalyticsGranularity.Total,
|
|
392
427
|
metrics: ["DriveOperations"],
|
|
393
428
|
select: {
|
|
394
|
-
drive: [AnalyticsPath.fromString(`ph/drive/${driveId}`)]
|
|
395
|
-
}
|
|
429
|
+
drive: [AnalyticsPath.fromString(`ph/drive/${driveId}`)],
|
|
430
|
+
},
|
|
396
431
|
});
|
|
397
432
|
|
|
398
433
|
const docOpsQuery = useAnalyticsQuery({
|
|
@@ -401,8 +436,8 @@ const docOpsQuery = useAnalyticsQuery({
|
|
|
401
436
|
granularity: AnalyticsGranularity.Total,
|
|
402
437
|
metrics: ["DocumentOperations"],
|
|
403
438
|
select: {
|
|
404
|
-
drive: [AnalyticsPath.fromString(`ph/doc/drive/${driveId}`)]
|
|
405
|
-
}
|
|
439
|
+
drive: [AnalyticsPath.fromString(`ph/doc/drive/${driveId}`)],
|
|
440
|
+
},
|
|
406
441
|
});
|
|
407
442
|
```
|
|
408
443
|
|
|
@@ -417,13 +452,13 @@ const { data } = useAnalyticsQuery(
|
|
|
417
452
|
granularity: AnalyticsGranularity.Total,
|
|
418
453
|
metrics: ["DriveOperations"],
|
|
419
454
|
select: {
|
|
420
|
-
drive: [AnalyticsPath.fromString(`ph/drive/${driveId}`)]
|
|
421
|
-
}
|
|
455
|
+
drive: [AnalyticsPath.fromString(`ph/drive/${driveId}`)],
|
|
456
|
+
},
|
|
422
457
|
},
|
|
423
458
|
{
|
|
424
459
|
sources: [AnalyticsPath.fromString(`ph/drive/${driveId}`)],
|
|
425
|
-
refetchInterval: 5000 // Poll every 5 seconds
|
|
426
|
-
}
|
|
460
|
+
refetchInterval: 5000, // Poll every 5 seconds
|
|
461
|
+
},
|
|
427
462
|
);
|
|
428
463
|
```
|
|
429
464
|
|
|
@@ -437,17 +472,16 @@ const { data } = useAnalyticsQuery(
|
|
|
437
472
|
start: DateTime.now().minus({ hours: 1 }),
|
|
438
473
|
end: DateTime.now(),
|
|
439
474
|
granularity: AnalyticsGranularity.Total,
|
|
440
|
-
metrics: ["DriveOperations"]
|
|
475
|
+
metrics: ["DriveOperations"],
|
|
441
476
|
},
|
|
442
477
|
{
|
|
443
|
-
sources: [AnalyticsPath.fromString(`ph/drive/${driveId}`)]
|
|
444
|
-
}
|
|
478
|
+
sources: [AnalyticsPath.fromString(`ph/drive/${driveId}`)],
|
|
479
|
+
},
|
|
445
480
|
);
|
|
446
481
|
|
|
447
482
|
// This query will automatically refetch when new operations occur in the specified drive
|
|
448
483
|
```
|
|
449
484
|
|
|
450
|
-
|
|
451
485
|
## Configuration in Connect
|
|
452
486
|
|
|
453
487
|
Drive Analytics is automatically enabled in Connect applications through feature flags:
|
|
@@ -7,6 +7,7 @@ If you've already setup git, node, and npm, your most important step is to insta
|
|
|
7
7
|
:::
|
|
8
8
|
|
|
9
9
|
## Table of contents
|
|
10
|
+
|
|
10
11
|
- [Prerequisites](#prerequisites)
|
|
11
12
|
- [Installing node.js 22](#installing-nodejs)
|
|
12
13
|
- [For Windows](#for-windows)
|
|
@@ -32,14 +33,17 @@ Before we begin with any of the Powerhouse Connect tutorials, we need to install
|
|
|
32
33
|
node.js 22 is a tool that lets us run our application. Let's install it step by step.
|
|
33
34
|
|
|
34
35
|
#### For Windows
|
|
36
|
+
|
|
35
37
|
1. **Set up PowerShell for running commands:**
|
|
36
38
|
- Press the Windows key
|
|
37
39
|
- Type "PowerShell"
|
|
38
40
|
- Right-click on "Windows PowerShell" and select "Run as administrator"
|
|
39
41
|
- In the PowerShell window, type this command and press Enter:
|
|
42
|
+
|
|
40
43
|
```powershell
|
|
41
44
|
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
42
45
|
```
|
|
46
|
+
|
|
43
47
|
- Type 'A' when prompted to confirm
|
|
44
48
|
- You can now close this window and open PowerShell normally for the remaining steps
|
|
45
49
|
|
|
@@ -56,21 +60,26 @@ node.js 22 is a tool that lets us run our application. Let's install it step by
|
|
|
56
60
|
node --version
|
|
57
61
|
pnpm --version
|
|
58
62
|
```
|
|
63
|
+
|
|
59
64
|
- You should see version numbers appear after each command (e.g., v18.17.0). If you do, congratulations - node.js 22 is installed!
|
|
60
65
|
|
|
61
66
|
> **Note**: If node.js 22 commands don't work in VS Code, restart VS Code to refresh environment variables.
|
|
62
67
|
|
|
63
68
|
#### For macOS
|
|
69
|
+
|
|
64
70
|
1. **Install Homebrew:**
|
|
65
71
|
- Open Terminal (press Command + Space and type "Terminal")
|
|
66
72
|
- Copy and paste this command into Terminal and press Enter:
|
|
73
|
+
|
|
67
74
|
```bash
|
|
68
75
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
69
76
|
```
|
|
77
|
+
|
|
70
78
|
- Follow any additional instructions that appear
|
|
71
79
|
|
|
72
80
|
2. **Install node.js 22:**
|
|
73
81
|
- In the same Terminal window, type this command and press Enter:
|
|
82
|
+
|
|
74
83
|
```bash
|
|
75
84
|
brew install node
|
|
76
85
|
```
|
|
@@ -81,19 +90,23 @@ node.js 22 is a tool that lets us run our application. Let's install it step by
|
|
|
81
90
|
node --version
|
|
82
91
|
pnpm --version
|
|
83
92
|
```
|
|
93
|
+
|
|
84
94
|
- If you see version numbers, you've successfully installed node.js 22!
|
|
85
95
|
|
|
86
96
|
#### For Linux (Ubuntu/Debian)
|
|
97
|
+
|
|
87
98
|
1. **Open Terminal:**
|
|
88
99
|
- Press Ctrl + Alt + T on your keyboard, or
|
|
89
100
|
- Click the Activities button and type "Terminal"
|
|
90
101
|
|
|
91
102
|
2. **Update Package List:**
|
|
103
|
+
|
|
92
104
|
```bash
|
|
93
105
|
sudo apt update
|
|
94
106
|
```
|
|
95
107
|
|
|
96
108
|
3. **Install node.js 22 and npm:**
|
|
109
|
+
|
|
97
110
|
```bash
|
|
98
111
|
sudo apt install nodejs npm
|
|
99
112
|
```
|
|
@@ -104,6 +117,7 @@ node.js 22 is a tool that lets us run our application. Let's install it step by
|
|
|
104
117
|
node --version
|
|
105
118
|
pnpm --version
|
|
106
119
|
```
|
|
120
|
+
|
|
107
121
|
- If you see version numbers, you're all set!
|
|
108
122
|
|
|
109
123
|
### Installing Visual Studio Code
|
|
@@ -111,6 +125,7 @@ node.js 22 is a tool that lets us run our application. Let's install it step by
|
|
|
111
125
|
VS Code is the editor we'll use to write our code. Here's how to install it:
|
|
112
126
|
|
|
113
127
|
#### For Windows
|
|
128
|
+
|
|
114
129
|
1. Visit the [Visual Studio Code website](https://code.visualstudio.com/)
|
|
115
130
|
2. Click the blue "Download for Windows" button
|
|
116
131
|
3. Once the installer downloads, double-click it
|
|
@@ -121,6 +136,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
|
|
|
121
136
|
8. When installation is complete, click "Finish"
|
|
122
137
|
|
|
123
138
|
#### For macOS
|
|
139
|
+
|
|
124
140
|
1. Visit the [Visual Studio Code website](https://code.visualstudio.com/)
|
|
125
141
|
2. Click the blue "Download for Mac" button
|
|
126
142
|
3. Once the .zip file downloads, double-click it to extract
|
|
@@ -132,6 +148,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
|
|
|
132
148
|
- Type "shell command" and select "Install 'code' command in PATH"
|
|
133
149
|
|
|
134
150
|
#### For Linux (Ubuntu/Debian)
|
|
151
|
+
|
|
135
152
|
1. Open Terminal (Ctrl + Alt + T)
|
|
136
153
|
2. First, update the packages list:
|
|
137
154
|
```bash
|
|
@@ -160,6 +177,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
|
|
|
160
177
|
### Install Git
|
|
161
178
|
|
|
162
179
|
#### For Windows
|
|
180
|
+
|
|
163
181
|
1. Open PowerShell (press Windows key, type "PowerShell", and press Enter)
|
|
164
182
|
2. Visit the [Git website](https://git-scm.com/)
|
|
165
183
|
3. Download the latest version for Windows
|
|
@@ -170,6 +188,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
|
|
|
170
188
|
```
|
|
171
189
|
|
|
172
190
|
#### For macOS
|
|
191
|
+
|
|
173
192
|
1. Install using Homebrew:
|
|
174
193
|
```bash
|
|
175
194
|
brew install git
|
|
@@ -180,6 +199,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
|
|
|
180
199
|
```
|
|
181
200
|
|
|
182
201
|
#### For Linux (Ubuntu/Debian)
|
|
202
|
+
|
|
183
203
|
1. Update package list:
|
|
184
204
|
```bash
|
|
185
205
|
sudo apt update
|
|
@@ -198,6 +218,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
|
|
|
198
218
|
Open your terminal (command prompt) and run the following commands to set up Git:
|
|
199
219
|
|
|
200
220
|
After installation, set up your identity:
|
|
221
|
+
|
|
201
222
|
```bash
|
|
202
223
|
git config --global user.name "Your Name"
|
|
203
224
|
git config --global user.email "your.email@example.com"
|
|
@@ -206,6 +227,7 @@ git config --global user.email "your.email@example.com"
|
|
|
206
227
|
### Verify installation
|
|
207
228
|
|
|
208
229
|
Open your terminal (command prompt) and run the following commands to verify your setup:
|
|
230
|
+
|
|
209
231
|
```bash
|
|
210
232
|
node --version
|
|
211
233
|
pnpm --version
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Create new Powerhouse project
|
|
2
2
|
|
|
3
|
-
Before we start diving into the tutorial, lets have a quick look at all the steps we'll go through.
|
|
3
|
+
Before we start diving into the tutorial, lets have a quick look at all the steps we'll go through.
|
|
4
4
|
|
|
5
|
-
1. We'll set up a powerhouse project and navigate to the newly created project directory to launch an analytics processor.
|
|
5
|
+
1. We'll set up a powerhouse project and navigate to the newly created project directory to launch an analytics processor.
|
|
6
6
|
2. Afterwards we'll run a new Reactor instance. A Reactor instance is a local (or remote) node in the Powerhouse network.
|
|
7
|
-
3. We'll create a new Real World Asset (RWA) Portfolio document model on the reactor node and add multiple purchase transactions to it.
|
|
8
|
-
4. We'll observe how the analytics processor receives the operations we've added to the document in the previous step.
|
|
7
|
+
3. We'll create a new Real World Asset (RWA) Portfolio document model on the reactor node and add multiple purchase transactions to it.
|
|
8
|
+
4. We'll observe how the analytics processor receives the operations we've added to the document in the previous step.
|
|
9
9
|
5. We'll stop the reactor & replace our default code with the analytics processor code so it can calculate the different metrics & dimensions we want to see.
|
|
10
|
-
|
|
10
|
+
6. Finally we'll run the analytics processor engine on the document model and look at the total value of specific asset classses on a monthly basis, add more data and adjust the granularity of the data we want to see.
|
|
11
11
|
|
|
12
12
|
This tuturial should give you a good understanding of how the analytics processor works and how you can use it to listen, query and combine data from multiple document models or dimensions.
|
|
13
13
|
Offering you the option to cut and slice your data in any way you want.
|
|
@@ -23,12 +23,13 @@ This command will create a new project in the current directory.
|
|
|
23
23
|
You can run the command in the terminal window of your OS or you open the newly installed VSCode and run the command in the terminal window of VSCode.
|
|
24
24
|
You will need VSCode later in the tutorial once you have generated the document model.
|
|
25
25
|
Make sure the terminal reflects the directory where you want to create the new project.
|
|
26
|
-
To open a directory in a terminal, you use the cd command to change your current directory. The cd command takes an argument, usually the name of the folder you want to move to, so the full command is
|
|
26
|
+
To open a directory in a terminal, you use the cd command to change your current directory. The cd command takes an argument, usually the name of the folder you want to move to, so the full command is
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
29
|
mkdir ph-projects
|
|
30
30
|
cd ph-projects
|
|
31
31
|
```
|
|
32
|
+
|
|
32
33
|
This essentially opens that folder and places you in it.
|
|
33
34
|
:::
|
|
34
35
|
|
|
@@ -43,7 +44,7 @@ Since we'll be using the Analytics Processor on a Real World Asset report (RWA),
|
|
|
43
44
|
|
|
44
45
|
```bash
|
|
45
46
|
? What is the project name? ‣ rwa-analytics
|
|
46
|
-
```
|
|
47
|
+
```
|
|
47
48
|
|
|
48
49
|
Once the project is created and the dependencies are installed (which can take a few minutes), you will see the following output:
|
|
49
50
|
|
|
@@ -54,4 +55,4 @@ Once the project is created and the dependencies are installed (which can take a
|
|
|
54
55
|
cd rwa-analytics-demo
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
Great! You've created a new powerhouse project, let's move on to the next step.
|
|
58
|
+
Great! You've created a new powerhouse project, let's move on to the next step.
|