Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(editor): schema extension #10447

Merged
merged 1 commit into from
Feb 26, 2025
Merged

Conversation

Saul-Mirone
Copy link
Contributor

@Saul-Mirone Saul-Mirone commented Feb 26, 2025

  1. Major Architectural Change: Schema Management

    • Moved from workspace.schema to store.schema throughout the codebase
    • Removed schema property from Workspace and Doc interfaces
    • Added BlockSchemaExtension pattern across multiple block types
  2. Block Schema Extensions Added

    • Added new BlockSchemaExtension to numerous block types including:
      • DataView, Surface, Attachment, Bookmark, Code
      • Database, Divider, EdgelessText, Embed blocks (Figma, Github, HTML, etc.)
      • Frame, Image, Latex, List, Note, Paragraph
      • Root, Surface Reference, Table blocks
  3. Import/Export System Updates

    • Updated import functions to accept schema parameter:
      • importHTMLToDoc
      • importHTMLZip
      • importMarkdownToDoc
      • importMarkdownZip
      • importNotionZip
    • Modified export functions to use new schema pattern
  4. Test Infrastructure Updates

    • Updated test files to use new schema extensions
    • Modified test document creation to include schema extensions
    • Removed direct schema registration in favor of extensions
  5. Service Layer Changes

    • Updated various services to use getAFFiNEWorkspaceSchema()
    • Modified transformer initialization to use document schema
    • Updated collection initialization patterns
  6. Version Management

    • Removed version-related properties and methods from:
      • WorkspaceMetaImpl
      • TestMeta
      • DocImpl
    • Removed blockVersions and workspaceVersion/pageVersion
  7. Store and Extension Updates

    • Added new store extensions and adapters
    • Updated store initialization patterns
    • Added new schema-related functionality in store extension

This PR represents a significant architectural shift in how schemas are managed, moving from a workspace-centric to a store-centric approach, while introducing a more extensible block schema system through BlockSchemaExtension. The changes touch multiple layers of the application including core functionality, services, testing infrastructure, and import/export capabilities.

Copy link
Contributor Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added test Related to test cases app:core labels Feb 26, 2025
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 54.27%. Comparing base (2732b96) to head (ce87dcf).
Report is 1 commits behind head on canary.

Files with missing lines Patch % Lines
...ffine/block-root/src/edgeless/services/template.ts 0.00% 1 Missing ⚠️
...ot/src/widgets/linked-doc/import-doc/import-doc.ts 0.00% 1 Missing ⚠️
...core/src/blocksuite/ai/components/text-renderer.ts 0.00% 1 Missing ⚠️
...ontend/core/src/blocksuite/utils/markdown-utils.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #10447      +/-   ##
==========================================
+ Coverage   54.22%   54.27%   +0.05%     
==========================================
  Files        2340     2342       +2     
  Lines      108221   108199      -22     
  Branches    17894    17882      -12     
==========================================
+ Hits        58678    58725      +47     
+ Misses      48217    48143      -74     
- Partials     1326     1331       +5     
Flag Coverage Δ
server-test 78.95% <ø> (+<0.01%) ⬆️
unittest 31.22% <90.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Saul-Mirone Saul-Mirone marked this pull request as ready for review February 26, 2025 10:58
@Saul-Mirone Saul-Mirone requested a review from a team as a code owner February 26, 2025 10:58
@graphite-app graphite-app bot requested review from a team February 26, 2025 10:58
@Saul-Mirone Saul-Mirone force-pushed the 02-26-feat_editor_schema_extension branch from 655444e to febae52 Compare February 26, 2025 11:06
Copy link

graphite-app bot commented Feb 26, 2025

Merge activity

1. **Major Architectural Change: Schema Management**
   - Moved from `workspace.schema` to `store.schema` throughout the codebase
   - Removed schema property from Workspace and Doc interfaces
   - Added `BlockSchemaExtension` pattern across multiple block types

2. **Block Schema Extensions Added**
   - Added new `BlockSchemaExtension` to numerous block types including:
     - DataView, Surface, Attachment, Bookmark, Code
     - Database, Divider, EdgelessText, Embed blocks (Figma, Github, HTML, etc.)
     - Frame, Image, Latex, List, Note, Paragraph
     - Root, Surface Reference, Table blocks

3. **Import/Export System Updates**
   - Updated import functions to accept `schema` parameter:
     - `importHTMLToDoc`
     - `importHTMLZip`
     - `importMarkdownToDoc`
     - `importMarkdownZip`
     - `importNotionZip`
   - Modified export functions to use new schema pattern

4. **Test Infrastructure Updates**
   - Updated test files to use new schema extensions
   - Modified test document creation to include schema extensions
   - Removed direct schema registration in favor of extensions

5. **Service Layer Changes**
   - Updated various services to use `getAFFiNEWorkspaceSchema()`
   - Modified transformer initialization to use document schema
   - Updated collection initialization patterns

6. **Version Management**
   - Removed version-related properties and methods from:
     - `WorkspaceMetaImpl`
     - `TestMeta`
     - `DocImpl`
   - Removed `blockVersions` and `workspaceVersion/pageVersion`

7. **Store and Extension Updates**
   - Added new store extensions and adapters
   - Updated store initialization patterns
   - Added new schema-related functionality in store extension

This PR represents a significant architectural shift in how schemas are managed, moving from a workspace-centric to a store-centric approach, while introducing a more extensible block schema system through `BlockSchemaExtension`. The changes touch multiple layers of the application including core functionality, services, testing infrastructure, and import/export capabilities.
@graphite-app graphite-app bot force-pushed the 02-26-feat_editor_schema_extension branch from febae52 to ce87dcf Compare February 26, 2025 11:31
@graphite-app graphite-app bot merged commit ce87dcf into canary Feb 26, 2025
66 checks passed
@graphite-app graphite-app bot deleted the 02-26-feat_editor_schema_extension branch February 26, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:core test Related to test cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants