Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

pando.js #50

Open
osarrouy opened this issue Apr 7, 2019 · 1 comment
Open

pando.js #50

osarrouy opened this issue Apr 7, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@osarrouy
Copy link
Member

osarrouy commented Apr 7, 2019

Hey,

Here is a summary of the discussion we've had yesterday with Cory regarding the implementation of a small pando.js library.

What

The goal of this library would be to:

  • provide a more generic and efficient way to handle repositories frontend state
  • offer in-browser markdown edition,

How

To do so, we need to implement a small library providing the following features:

  • take a head commit IPLD CID and reduce it into an historically ordered commit array [the commit history of the given branch] as done in the current background script here
  • turn an IPLD linked-data commit object into an easier to manipulate Javascript / Typescript object
  • extract each file last update date and message for these commits
  • take a Javascript / Typescript object and turn it back into an IPLD / linked data commit object [to easily create a new commit to push from the browser]

Details

js-git-ipld commit objects look like that:

{
  "author": {
    "date": "1503667703 +0200",
    "email": "author@mail",
    "name": "Author Name"
  },
  "committer": {
    "date": "1503667703 +0200",
    "email": "author@mail",
    "name": "Author Name"
  },
  "message": "Commit Message\n",
  "parents": [
    { "/": cid }, { "/": cid }, ...
  ],
  "tree": { "/", cid }
}

The idea would be for this library to take the CID of such a given commit [the HEAD cid of a branch] and turn it into the following ordered array:

[
  commitN,
  commitN-1,
  commitN-2,
  ...
]

Where each commit would look like that:

{
  "cid": zw9X ..., // CID of the commit
  "sha": 9c4v ..., // git sha1 of the commit
  " "author": {
    "date": "1503667703 +0200",
    "email": "author@mail",
    "name": "Author Name"
  },
  "committer": {
    "date": "1503667703 +0200",
    "email": "author@mail",
    "name": "Author Name"
  },
  "message": "Commit Message\n",
  "tree": {
    "README.md": { "lastEdit": { "date": xxx, "message": xxx }, mode: "12600", "blob":  zw9x ... // CID of the file },
    "app/index.js": { "lastEdit": { "date": xxx, "message": xxx }, mode: "12600", "blob":  zw9x ... // CID of the file  },
    "app/util/index.js": { "lastEdit": { "date": xxx, "message": xxx }, mode: "12600", "blob":  zw9x ... // CID of the file },
     ...
  },
  parents: [
    zw9x ..., // CID of parent commit
    zw9x ... // CID of the
    ...
  ]
}

Conversely, this library should be able to take the object described below as an input an turn it back into an IPLD commit.

@osarrouy osarrouy added enhancement New feature or request pando-repository Related to pando-repository package labels Apr 7, 2019
@osarrouy osarrouy changed the title js-git-ipld <-> pando library pando.js May 13, 2019
@osarrouy osarrouy removed the pando-repository Related to pando-repository package label May 13, 2019
@osarrouy
Copy link
Member Author

IPLD folks have updated their specs and all their related js implementations. This is a mess now because if we wanna make pando compatible with their new release [and the upcoming ones] we have to update this library, but also the pando-repository frontend and the git-remote-pando CLI.

This makes me think that we clearly have a design issue since all this packages should rely on the same library the we could just update once to update all the packages.

I'm gonna try to figure out a possible interface / architecture for this library in the coming days ...

@osarrouy osarrouy self-assigned this May 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants