implement prepare publish (create only) - #285
Merged
Merged
Conversation
nikgraf
force-pushed
the
ng/prepare-publish
branch
from
June 30, 2025 14:22
2b6a284 to
6fef6a8
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements the preparePublish function for creating publish operations, injects a __schema reference into every entity instance to support publishing, updates exports in hypergraph-react, refreshes tests to assert the new __schema field, and integrates publishing into the example app UI.
- Inject
__schemametadata onfindOne,findMany, andupdatesopreparePublishcan access schema definitions. - Add
prepare-publish.tswith create-only publishing logic and export it inhypergraph-react. - Update tests and example app code/routes to use
preparePublishand expect__schema.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/hypergraph/test/entity/entity.test.ts | Updated tests to include __schema on returned entities |
| packages/hypergraph/src/entity/update.ts | Inject __schema in updated entities |
| packages/hypergraph/src/entity/findOne.ts | Inject __schema in findOne results |
| packages/hypergraph/src/entity/findMany.ts | Inject __schema in findMany results |
| packages/hypergraph-react/src/prepare-publish.ts | New preparePublish implementation (create only) |
| packages/hypergraph-react/src/index.ts | Export preparePublish from package API |
| packages/hypergraph-react/src/internal/use-query-public.tsx | Inject __schema in public query parsing |
| packages/hypergraph-react/src/use-query.tsx | Clean up unused useGenerateCreateOps import |
| apps/events/src/routes/space/$spaceId/events.tsx | New Events route component integrating publish UI |
| apps/events/src/routes/space/$spaceId.tsx | Add link to Events page |
| apps/events/src/routeTree.gen.ts | Register /space/$spaceId/events in route tree |
| apps/events/src/components/user-entry.tsx | Add Publish button and call preparePublish |
| apps/events/src/components/events/events.tsx | Use preparePublish + publishOps in Events UI |
| apps/events/src/components/todo/todos-public.tsx | Remove deprecated create-op helpers |
Comments suppressed due to low confidence (2)
packages/hypergraph-react/src/prepare-publish.ts:1
- There are no unit tests covering the new
preparePublishlogic. Add tests to validate thatpreparePublishcorrectly serializes properties, relations, and returns expected ops for create-only scenarios.
import {
packages/hypergraph-react/src/prepare-publish.ts:1
- [nitpick] The new
preparePublishfunction lacks a doc comment or usage example. Consider adding JSDoc explaining parameters and the high-level create-only publishing flow.
import {
| const [editMode, setEditMode] = useState(false); | ||
|
|
||
| const handlePublish = async () => { | ||
| const result = await preparePublish({ entity: user, publicTargetSpace: 'abc' }); |
There was a problem hiding this comment.
The call to preparePublish uses publicTargetSpace instead of the expected publicSpace parameter name, causing a runtime or type error. Rename the property to publicSpace.
Suggested change
| const result = await preparePublish({ entity: user, publicTargetSpace: 'abc' }); | |
| const result = await preparePublish({ entity: user, publicSpace: 'abc' }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.