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

Add fork API #410

Merged
merged 5 commits into from
Nov 29, 2024
Merged

Add fork API #410

merged 5 commits into from
Nov 29, 2024

Conversation

trungleduc
Copy link
Member

@trungleduc trungleduc commented Nov 29, 2024

Code Changes:

  • New token IForkManagerToken in @jupyter/docprovider-extension.
  • This token implements the following interface:
    /**
     * Creates a new fork for a given document.
     *
     * @param options.rootId - The ID of the root document to fork.
     * @param options.synchronize - A flag indicating whether the fork should be kept
     * synchronized with the root document.
     * @param options.title - An optional label for the fork.
     * @param options.description - An optional description for the fork.
     *
     * @returns A promise that resolves to an `IForkCreationResponse` if the fork
     * is created successfully, or `undefined` if the creation fails.
     */
    createFork(options: {
        rootId: string;
        synchronize: boolean;
        title?: string;
        description?: string;
    }): Promise<IForkCreationResponse | undefined>;
    /**
     * Retrieves all forks associated with a specific document.
     *
     * @param documentId - The ID of the document for which forks are to be retrieved.
     *
     * @returns A promise that resolves to an `IAllForksResponse` containing information about all forks.
     */
    getAllForks(documentId: string): Promise<IAllForksResponse>;
    /**
     * Deletes a specified fork and optionally merges its changes.
     *
     * @param options - Options for deleting the fork.
     * @param options.forkId - The ID of the fork to be deleted.
     * @param options.merge - A flag indicating whether changes from the fork should be merged back into the root document.
     *
     * @returns A promise that resolves when the fork is successfully deleted.
     */
    deleteFork(options: {
        forkId: string;
        merge: boolean;
    }): Promise<void>;
    /**
     * Signal emitted when a new fork is added.
     *
     * @event forkAdded
     * @type ISignal<IForkManager, IForkChangedEvent>
     */
    forkAdded: ISignal<IForkManager, IForkChangedEvent>;
    /**
     * Signal emitted when a fork is deleted.
     *
     * @event forkDeleted
     * @type ISignal<IForkManager, IForkChangedEvent>
     */
    forkDeleted: ISignal<IForkManager, IForkChangedEvent>;

* Add forking API

* Add GET forks of root

* Add fork Jupyter events

* Replace query parameter merge=1 with merge=true

* Add fork title and description
Copy link
Contributor

Binder 👈 Launch a Binder on branch jupyterlab/jupyter-collaboration/suggestions

@trungleduc trungleduc added the enhancement New feature or request label Nov 29, 2024
* Add forking API (#394)

* Add forking API

* Add GET forks of root

* Add fork Jupyter events

* Replace query parameter merge=1 with merge=true

* Add fork title and description

* Add JS APIs

---------

Co-authored-by: David Brochart <[email protected]>
@davidbrochart davidbrochart marked this pull request as ready for review November 29, 2024 12:17
@davidbrochart davidbrochart merged commit 9363e5a into main Nov 29, 2024
27 checks passed
@davidbrochart davidbrochart deleted the suggestions branch November 29, 2024 12:30
@martinRenou
Copy link
Member

🚀

andrii-i pushed a commit to andrii-i/jupyter-collaboration that referenced this pull request Feb 11, 2025
* Add forking API (jupyterlab#394)

* Add forking API

* Add GET forks of root

* Add fork Jupyter events

* Replace query parameter merge=1 with merge=true

* Add fork title and description

* Add js api (jupyterlab#395)

* Add forking API (jupyterlab#394)

* Add forking API

* Add GET forks of root

* Add fork Jupyter events

* Replace query parameter merge=1 with merge=true

* Add fork title and description

* Add JS APIs

---------

Co-authored-by: David Brochart <[email protected]>

* Fix test_fork_handler

* again

* Allow time for update to propagate

---------

Co-authored-by: David Brochart <[email protected]>
andrii-i pushed a commit to andrii-i/jupyter-collaboration that referenced this pull request Feb 11, 2025
* Add forking API (jupyterlab#394)

* Add forking API

* Add GET forks of root

* Add fork Jupyter events

* Replace query parameter merge=1 with merge=true

* Add fork title and description

* Add js api (jupyterlab#395)

* Add forking API (jupyterlab#394)

* Add forking API

* Add GET forks of root

* Add fork Jupyter events

* Replace query parameter merge=1 with merge=true

* Add fork title and description

* Add JS APIs

---------

Co-authored-by: David Brochart <[email protected]>

* Fix test_fork_handler

* again

* Allow time for update to propagate

---------

Co-authored-by: David Brochart <[email protected]>
andrii-i pushed a commit to andrii-i/jupyter-collaboration that referenced this pull request Feb 11, 2025
* Add forking API (jupyterlab#394)

* Add forking API

* Add GET forks of root

* Add fork Jupyter events

* Replace query parameter merge=1 with merge=true

* Add fork title and description

* Add js api (jupyterlab#395)

* Add forking API (jupyterlab#394)

* Add forking API

* Add GET forks of root

* Add fork Jupyter events

* Replace query parameter merge=1 with merge=true

* Add fork title and description

* Add JS APIs

---------

Co-authored-by: David Brochart <[email protected]>

* Fix test_fork_handler

* again

* Allow time for update to propagate

---------

Co-authored-by: David Brochart <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants