Skip to content

Conversation

nikgraf
Copy link
Collaborator

@nikgraf nikgraf commented Jun 30, 2025

No description provided.

@nikgraf nikgraf changed the title implement prepare publish implement prepare publish (create only) Jun 30, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 __schema metadata on findOne, findMany, and update so preparePublish can access schema definitions.
  • Add prepare-publish.ts with create-only publishing logic and export it in hypergraph-react.
  • Update tests and example app code/routes to use preparePublish and 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 preparePublish logic. Add tests to validate that preparePublish correctly serializes properties, relations, and returns expected ops for create-only scenarios.
import {

packages/hypergraph-react/src/prepare-publish.ts:1

  • [nitpick] The new preparePublish function 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' });
Copy link

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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' });

Copilot uses AI. Check for mistakes.

@nikgraf nikgraf merged commit 57bc847 into main Jun 30, 2025
6 checks passed
@nikgraf nikgraf deleted the ng/prepare-publish branch June 30, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant