@powerhousedao/academy 5.0.0-staging.8 → 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.
Files changed (108) hide show
  1. package/.vscode/settings.json +1 -1
  2. package/CHANGELOG.md +404 -0
  3. package/README.md +3 -3
  4. package/babel.config.js +1 -1
  5. package/blog/BeyondCommunication-ABlueprintForDevelopment.md +25 -24
  6. package/blog/TheChallengeOfChange.md +21 -21
  7. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +67 -30
  8. package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +38 -21
  9. package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +24 -19
  10. package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +44 -41
  11. package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +10 -10
  12. package/docs/academy/01-GetStarted/05-VetraStudio.md +164 -0
  13. package/docs/academy/01-GetStarted/06-ReactorMCP.md +58 -0
  14. package/docs/academy/01-GetStarted/home.mdx +185 -90
  15. package/docs/academy/01-GetStarted/images/Modules.png +0 -0
  16. package/docs/academy/01-GetStarted/images/VetraStudioDrive.png +0 -0
  17. package/docs/academy/01-GetStarted/styles.module.css +5 -5
  18. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/01-Prerequisites.md +46 -18
  19. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +118 -68
  20. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +75 -33
  21. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +6 -6
  22. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +30 -21
  23. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +41 -37
  24. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +29 -25
  25. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +36 -37
  26. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +128 -109
  27. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +95 -86
  28. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +7 -9
  29. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/_category_.json +6 -6
  30. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +65 -47
  31. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +77 -62
  32. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +360 -349
  33. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/00-DocumentToolbar.mdx +16 -10
  34. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/01-OperationHistory.md +10 -7
  35. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/02-RevisionHistoryTimeline.md +25 -17
  36. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/_category_.json +6 -6
  37. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/01-RenownAuthenticationFlow.md +14 -7
  38. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/02-Authorization.md +0 -1
  39. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/_category_.json +5 -5
  40. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/_category_.json +1 -1
  41. package/docs/academy/02-MasteryTrack/04-WorkWithData/01-GraphQLAtPowerhouse.md +45 -33
  42. package/docs/academy/02-MasteryTrack/04-WorkWithData/02-UsingTheAPI.mdx +61 -18
  43. package/docs/academy/02-MasteryTrack/04-WorkWithData/03-UsingSubgraphs.md +50 -54
  44. package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +126 -110
  45. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-RelationalDbProcessor.md +75 -45
  46. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +23 -21
  47. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +9 -9
  48. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +11 -23
  49. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +25 -9
  50. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +10 -10
  51. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/benchmarks.md +1 -1
  52. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +16 -11
  53. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +6 -5
  54. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +2 -2
  55. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +7 -5
  56. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +32 -58
  57. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/processors.md +1 -1
  58. package/docs/academy/02-MasteryTrack/04-WorkWithData/07-drive-analytics.md +105 -71
  59. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_01-SetupBuilderEnvironment.md +22 -0
  60. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_02-CreateNewPowerhouseProject.md +9 -8
  61. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_03-GenerateAnAnalyticsProcessor.md +28 -32
  62. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_04-UpdateAnalyticsProcessor.md +25 -26
  63. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_category_.json +1 -1
  64. package/docs/academy/02-MasteryTrack/04-WorkWithData/_category_.json +7 -7
  65. package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +3 -4
  66. package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +69 -45
  67. package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +70 -40
  68. package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +1 -0
  69. package/docs/academy/02-MasteryTrack/05-Launch/_category_.json +7 -7
  70. package/docs/academy/02-MasteryTrack/_category_.json +6 -6
  71. package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +5 -3
  72. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +38 -37
  73. package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +45 -41
  74. package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +14 -14
  75. package/docs/academy/03-ExampleUsecases/Chatroom/06-LaunchALocalReactor.md +6 -6
  76. package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
  77. package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +104 -43
  78. package/docs/academy/04-APIReferences/01-ReactHooks.md +177 -129
  79. package/docs/academy/04-APIReferences/04-RelationalDatabase.md +121 -113
  80. package/docs/academy/04-APIReferences/05-PHDocumentMigrationGuide.md +48 -41
  81. package/docs/academy/04-APIReferences/_category_.json +6 -6
  82. package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +1 -2
  83. package/docs/academy/05-Architecture/01-WorkingWithTheReactor.md +11 -8
  84. package/docs/academy/05-Architecture/05-DocumentModelTheory/_category_.json +1 -1
  85. package/docs/academy/05-Architecture/_category_.json +6 -6
  86. package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +25 -23
  87. package/docs/academy/06-ComponentLibrary/02-CreateCustomScalars.md +105 -93
  88. package/docs/academy/06-ComponentLibrary/03-IntegrateIntoAReactComponent.md +1 -0
  89. package/docs/academy/06-ComponentLibrary/_category_.json +7 -7
  90. package/docs/academy/07-Cookbook.md +268 -35
  91. package/docs/academy/08-Glossary.md +7 -1
  92. package/docs/bookofpowerhouse/01-Overview.md +2 -2
  93. package/docs/bookofpowerhouse/02-GeneralFrameworkAndPhilosophy.md +1 -7
  94. package/docs/bookofpowerhouse/03-PowerhouseSoftwareArchitecture.md +10 -7
  95. package/docs/bookofpowerhouse/04-DevelopmentApproaches.md +10 -4
  96. package/docs/bookofpowerhouse/05-SNOsandANewModelForOSSandPublicGoods.md +23 -30
  97. package/docs/bookofpowerhouse/06-SNOsInActionAndPlatformEconomies.md +0 -7
  98. package/docusaurus.config.ts +64 -66
  99. package/package.json +9 -7
  100. package/scripts/generate-combined-cli-docs.ts +43 -13
  101. package/sidebars.ts +2 -0
  102. package/src/components/HomepageFeatures/index.tsx +171 -78
  103. package/src/components/HomepageFeatures/styles.module.css +1 -2
  104. package/src/css/custom.css +89 -89
  105. package/src/pages/_archive-homepage.tsx +17 -16
  106. package/src/theme/DocCardList/index.tsx +9 -8
  107. package/static.json +6 -6
  108. package/tsconfig.tsbuildinfo +1 -0
@@ -14,48 +14,60 @@ Create a new TypeScript file in `src/scalars/graphql/` for your scalar. Use `Ema
14
14
  **Example: Creating a `PhoneNumber.ts` scalar**
15
15
 
16
16
  ```typescript
17
- import { GraphQLError, GraphQLScalarType, type GraphQLScalarTypeConfig, Kind } from 'graphql'
18
- import { z } from 'zod'
17
+ import {
18
+ GraphQLError,
19
+ GraphQLScalarType,
20
+ type GraphQLScalarTypeConfig,
21
+ Kind,
22
+ } from "graphql";
23
+ import { z } from "zod";
19
24
 
20
25
  export interface ScalarType {
21
- input: string
22
- output: string
26
+ input: string;
27
+ output: string;
23
28
  }
24
29
 
25
- export const type = 'string' // TS type in string form
30
+ export const type = "string"; // TS type in string form
26
31
 
27
- export const typedef = 'scalar PhoneNumber'
32
+ export const typedef = "scalar PhoneNumber";
28
33
 
29
- export const schema = z.string().regex(/^\+?[1-9]\d{1,14}$/, 'Invalid phone number format')
34
+ export const schema = z
35
+ .string()
36
+ .regex(/^\+?[1-9]\d{1,14}$/, "Invalid phone number format");
30
37
 
31
- export const stringSchema = 'z.string().regex(/^\\+?[1-9]\\d{1,14}$/, "Invalid phone number format")'
38
+ export const stringSchema =
39
+ 'z.string().regex(/^\\+?[1-9]\\d{1,14}$/, "Invalid phone number format")';
32
40
 
33
41
  const phoneValidation = (value: unknown): string => {
34
- if (typeof value !== 'string') {
35
- throw new GraphQLError(`Value is not string: ${JSON.stringify(value)}`)
42
+ if (typeof value !== "string") {
43
+ throw new GraphQLError(`Value is not string: ${JSON.stringify(value)}`);
36
44
  }
37
45
 
38
- const result = schema.safeParse(value)
46
+ const result = schema.safeParse(value);
39
47
 
40
- if (result.success) return result.data
41
- throw new GraphQLError(result.error.message)
42
- }
48
+ if (result.success) return result.data;
49
+ throw new GraphQLError(result.error.message);
50
+ };
43
51
 
44
52
  export const config: GraphQLScalarTypeConfig<string, string> = {
45
- name: 'PhoneNumber',
46
- description: 'A field whose value conforms to international phone number format.',
53
+ name: "PhoneNumber",
54
+ description:
55
+ "A field whose value conforms to international phone number format.",
47
56
  serialize: phoneValidation,
48
57
  parseValue: phoneValidation,
49
58
  parseLiteral: (value) => {
50
59
  if (value.kind !== Kind.STRING) {
51
- throw new GraphQLError(`Can only validate strings as phone numbers but got a: ${value.kind}`, { nodes: value })
60
+ throw new GraphQLError(
61
+ `Can only validate strings as phone numbers but got a: ${value.kind}`,
62
+ { nodes: value },
63
+ );
52
64
  }
53
65
 
54
- return phoneValidation(value.value)
66
+ return phoneValidation(value.value);
55
67
  },
56
- }
68
+ };
57
69
 
58
- export const scalar = new GraphQLScalarType(config)
70
+ export const scalar = new GraphQLScalarType(config);
59
71
  ```
60
72
 
61
73
  ### Key Components to Update:
@@ -79,11 +91,11 @@ Add your scalar to the namespace imports section (around line 2):
79
91
 
80
92
  ```typescript
81
93
  // namespace imports -- DO NOT REMOVE OR EDIT THIS COMMENT
82
- import * as Amount from './Amount.js'
83
- import * as AmountCrypto from './AmountCrypto.js'
94
+ import * as Amount from "./Amount.js";
95
+ import * as AmountCrypto from "./AmountCrypto.js";
84
96
  // ... other imports ...
85
- import * as PhoneNumber from './PhoneNumber.js' // ADD THIS LINE
86
- import * as URLScalar from './URL.js'
97
+ import * as PhoneNumber from "./PhoneNumber.js"; // ADD THIS LINE
98
+ import * as URLScalar from "./URL.js";
87
99
  ```
88
100
 
89
101
  ### 2.2 Add Type Export
@@ -92,10 +104,10 @@ Add the type export (around line 22):
92
104
 
93
105
  ```typescript
94
106
  // export types -- DO NOT REMOVE OR EDIT THIS COMMENT
95
- export type { ScalarType as AmountScalarType } from './Amount.js'
107
+ export type { ScalarType as AmountScalarType } from "./Amount.js";
96
108
  // ... other type exports ...
97
- export type { ScalarType as PhoneNumberScalarType } from './PhoneNumber.js' // ADD THIS LINE
98
- export type { ScalarType as URLScalarType } from './URL.js'
109
+ export type { ScalarType as PhoneNumberScalarType } from "./PhoneNumber.js"; // ADD THIS LINE
110
+ export type { ScalarType as URLScalarType } from "./URL.js";
99
111
  ```
100
112
 
101
113
  ### 2.3 Add to Export Object
@@ -109,7 +121,7 @@ export {
109
121
  // ... other exports ...
110
122
  PhoneNumber, // ADD THIS LINE
111
123
  URLScalar,
112
- }
124
+ };
113
125
  ```
114
126
 
115
127
  ### 2.4 Add to Custom Scalars
@@ -121,7 +133,7 @@ export const customScalars: Record<string, BasePHScalar<any>> = {
121
133
  // ... other scalars ...
122
134
  PhoneNumber, // ADD THIS LINE
123
135
  URLScalar,
124
- } as const
136
+ } as const;
125
137
  ```
126
138
 
127
139
  #### 2.5 Add to Resolvers
@@ -135,7 +147,7 @@ export const resolvers = {
135
147
  // ... other resolvers ...
136
148
  PhoneNumber: PhoneNumber.scalar, // ADD THIS LINE
137
149
  Amount: Amount.scalar,
138
- }
150
+ };
139
151
  ```
140
152
 
141
153
  ### 2.6 Add to Type Definitions
@@ -149,7 +161,7 @@ export const typeDefs = [
149
161
  // ... other typedefs ...
150
162
  PhoneNumber.typedef, // ADD THIS LINE
151
163
  Amount.typedef,
152
- ]
164
+ ];
153
165
  ```
154
166
 
155
167
  ### 2.7 Add to Generator Type Definitions
@@ -163,7 +175,7 @@ export const generatorTypeDefs = {
163
175
  // ... other entries ...
164
176
  [PhoneNumber.config.name]: PhoneNumber.type, // ADD THIS LINE
165
177
  [Amount.config.name]: Amount.type,
166
- }
178
+ };
167
179
  ```
168
180
 
169
181
  ### 2.8 Add to Validation Schema
@@ -177,7 +189,7 @@ export const validationSchema = {
177
189
  // ... other entries ...
178
190
  [PhoneNumber.config.name]: PhoneNumber.stringSchema, // ADD THIS LINE
179
191
  [Amount.config.name]: Amount.stringSchema,
180
- }
192
+ };
181
193
  ```
182
194
 
183
195
  ## Step 3: Create Tests for Your Scalar
@@ -187,79 +199,79 @@ Every scalar must have comprehensive tests to ensure it works correctly. Create
187
199
  **Example: Creating `PhoneNumber.test.ts`**
188
200
 
189
201
  ```typescript
190
- import { Kind } from 'graphql'
191
- import { scalar } from '../PhoneNumber.js'
202
+ import { Kind } from "graphql";
203
+ import { scalar } from "../PhoneNumber.js";
192
204
 
193
- describe('PhoneNumber Scalar', () => {
194
- it('should serialize a phone number', () => {
195
- const phoneNumber = '+1234567890'
205
+ describe("PhoneNumber Scalar", () => {
206
+ it("should serialize a phone number", () => {
207
+ const phoneNumber = "+1234567890";
196
208
 
197
- expect(scalar.serialize(phoneNumber)).toBe(phoneNumber)
198
- })
209
+ expect(scalar.serialize(phoneNumber)).toBe(phoneNumber);
210
+ });
199
211
 
200
- it('should throw an error if the value is not a string', () => {
201
- const phoneNumber = 123
212
+ it("should throw an error if the value is not a string", () => {
213
+ const phoneNumber = 123;
202
214
 
203
- expect(() => scalar.serialize(phoneNumber)).toThrow()
204
- })
215
+ expect(() => scalar.serialize(phoneNumber)).toThrow();
216
+ });
205
217
 
206
- it('should throw an error if the value is not a valid phone number', () => {
207
- const phoneNumber = 'invalid-phone'
218
+ it("should throw an error if the value is not a valid phone number", () => {
219
+ const phoneNumber = "invalid-phone";
208
220
 
209
- expect(() => scalar.serialize(phoneNumber)).toThrow()
210
- })
221
+ expect(() => scalar.serialize(phoneNumber)).toThrow();
222
+ });
211
223
 
212
- it('should parse a valid phone number', () => {
213
- const phoneNumber = '+1234567890'
224
+ it("should parse a valid phone number", () => {
225
+ const phoneNumber = "+1234567890";
214
226
 
215
- expect(scalar.parseValue(phoneNumber)).toBe(phoneNumber)
216
- })
227
+ expect(scalar.parseValue(phoneNumber)).toBe(phoneNumber);
228
+ });
217
229
 
218
- it('should throw an error if parse a value that is not a valid phone number', () => {
219
- const phoneNumber = 'invalid-phone'
230
+ it("should throw an error if parse a value that is not a valid phone number", () => {
231
+ const phoneNumber = "invalid-phone";
220
232
 
221
- expect(() => scalar.parseValue(phoneNumber)).toThrow()
222
- })
233
+ expect(() => scalar.parseValue(phoneNumber)).toThrow();
234
+ });
223
235
 
224
- it('should throw an error if parse a value that is not a string', () => {
225
- const phoneNumber = 123
236
+ it("should throw an error if parse a value that is not a string", () => {
237
+ const phoneNumber = 123;
226
238
 
227
- expect(() => scalar.parseValue(phoneNumber)).toThrow()
228
- })
239
+ expect(() => scalar.parseValue(phoneNumber)).toThrow();
240
+ });
229
241
 
230
- it('should parse a valid phone number from a literal', () => {
231
- const phoneNumber = '+1234567890'
242
+ it("should parse a valid phone number from a literal", () => {
243
+ const phoneNumber = "+1234567890";
232
244
 
233
245
  expect(
234
246
  scalar.parseLiteral({
235
247
  kind: Kind.STRING,
236
248
  value: phoneNumber,
237
- })
238
- ).toBe(phoneNumber)
239
- })
249
+ }),
250
+ ).toBe(phoneNumber);
251
+ });
240
252
 
241
- it('should throw an error if parse a literal that is not a valid phone number', () => {
242
- const phoneNumber = 'invalid-phone'
253
+ it("should throw an error if parse a literal that is not a valid phone number", () => {
254
+ const phoneNumber = "invalid-phone";
243
255
 
244
256
  expect(() =>
245
257
  scalar.parseLiteral({
246
258
  kind: Kind.STRING,
247
259
  value: phoneNumber,
248
- })
249
- ).toThrow()
250
- })
260
+ }),
261
+ ).toThrow();
262
+ });
251
263
 
252
- it('should throw an error if parse a literal that is not a string', () => {
253
- const phoneNumber = '+1234567890'
264
+ it("should throw an error if parse a literal that is not a string", () => {
265
+ const phoneNumber = "+1234567890";
254
266
 
255
267
  expect(() =>
256
268
  scalar.parseLiteral({
257
269
  kind: Kind.INT,
258
270
  value: phoneNumber,
259
- })
260
- ).toThrow()
261
- })
262
- })
271
+ }),
272
+ ).toThrow();
273
+ });
274
+ });
263
275
  ```
264
276
 
265
277
  #### Required Test Cases
@@ -297,37 +309,37 @@ Your scalar tests should cover these essential scenarios:
297
309
 
298
310
  ```typescript
299
311
  // Test empty string
300
- expect(() => scalar.parseValue('')).toThrow()
312
+ expect(() => scalar.parseValue("")).toThrow();
301
313
 
302
314
  // Test too long/short values
303
- expect(() => scalar.parseValue('123')).toThrow()
304
- expect(() => scalar.parseValue('+' + '1'.repeat(20))).toThrow()
315
+ expect(() => scalar.parseValue("123")).toThrow();
316
+ expect(() => scalar.parseValue("+" + "1".repeat(20))).toThrow();
305
317
 
306
318
  // Test special characters
307
- expect(() => scalar.parseValue('+1-234-567-890')).not.toThrow()
319
+ expect(() => scalar.parseValue("+1-234-567-890")).not.toThrow();
308
320
  ```
309
321
 
310
322
  **Number-based scalars:**
311
323
 
312
324
  ```typescript
313
325
  // Test zero
314
- expect(scalar.parseValue(0)).toBe(0)
326
+ expect(scalar.parseValue(0)).toBe(0);
315
327
 
316
328
  // Test negative numbers
317
- expect(() => scalar.parseValue(-1)).toThrow()
329
+ expect(() => scalar.parseValue(-1)).toThrow();
318
330
 
319
331
  // Test decimal numbers
320
- expect(scalar.parseValue(123.45)).toBe(123.45)
332
+ expect(scalar.parseValue(123.45)).toBe(123.45);
321
333
  ```
322
334
 
323
335
  **Date-based scalars:**
324
336
 
325
337
  ```typescript
326
338
  // Test valid ISO date
327
- expect(scalar.parseValue('2023-12-25T00:00:00Z')).toBe('2023-12-25T00:00:00Z')
339
+ expect(scalar.parseValue("2023-12-25T00:00:00Z")).toBe("2023-12-25T00:00:00Z");
328
340
 
329
341
  // Test invalid date format
330
- expect(() => scalar.parseValue('25/12/2023')).toThrow()
342
+ expect(() => scalar.parseValue("25/12/2023")).toThrow();
331
343
  ```
332
344
 
333
345
  ## Step 4: Validate Your Implementation
@@ -346,22 +358,22 @@ Here are some common patterns for different types of scalars:
346
358
  #### String-based Scalars
347
359
 
348
360
  ```typescript
349
- export const type = 'string'
350
- export const schema = z.string().min(1).max(100)
361
+ export const type = "string";
362
+ export const schema = z.string().min(1).max(100);
351
363
  ```
352
364
 
353
365
  #### Number-based Scalars
354
366
 
355
367
  ```typescript
356
- export const type = 'number'
357
- export const schema = z.number().positive()
368
+ export const type = "number";
369
+ export const schema = z.number().positive();
358
370
  ```
359
371
 
360
372
  #### Date-based Scalars
361
373
 
362
374
  ```typescript
363
- export const type = 'string'
364
- export const schema = z.string().datetime()
375
+ export const type = "string";
376
+ export const schema = z.string().datetime();
365
377
  ```
366
378
 
367
379
  :::info
@@ -370,7 +382,7 @@ export const schema = z.string().datetime()
370
382
  - **Open Source**: Please submit contributions as a pull request to the Powerhouse team.
371
383
  - **UI is Optional but Helpful**: A design or UI for your scalar isn't required, but it helps reviewers understand its purpose.
372
384
  - **Semantic Scalars**: Some scalars don't need a unique UI. For instance, `Title` and `Description` might both use a simple text input but serve a semantic role by adding specific meaning and validation to the schema.
373
- :::
385
+ :::
374
386
 
375
387
  ### Tips
376
388
 
@@ -379,4 +391,4 @@ export const schema = z.string().datetime()
379
391
  - Write clear, descriptive error messages
380
392
  - Keep the `stringSchema` in sync with your `schema` definition
381
393
  - Test edge cases in your validation function
382
- - Update all required sections in `scalars.ts`
394
+ - Update all required sections in `scalars.ts`
@@ -80,6 +80,7 @@ export const EthereumAddress: React.FC<EthereumAddressProps> = ({ onChange }) =>
80
80
  ```
81
81
 
82
82
  **Key Points:**
83
+
83
84
  - Use the scalar's `.schema.safeParse(value)` for validation.
84
85
  - Display error messages if validation fails.
85
86
  - Call `onChange` with both the value and its validity.
@@ -1,8 +1,8 @@
1
1
  {
2
- "label": "Component Library",
3
- "position": 4,
4
- "link": {
5
- "type": "generated-index",
6
- "description": "An overview of the components in the Powerhouse Component Library."
7
- }
8
- }
2
+ "label": "Component Library",
3
+ "position": 4,
4
+ "link": {
5
+ "type": "generated-index",
6
+ "description": "An overview of the components in the Powerhouse Component Library."
7
+ }
8
+ }