Code Monkey home page Code Monkey logo

xml-to-ipld's Introduction

XML-to-IPLD

Ceramic is undergoing significant refactoring as it nears mainnet release, and the Ceramic examples are broken for the time being.

A simple React app to take a DOM tree and serialize it to IPFS's IPLD data structure or the Ceramic Network's "tile" documents.

Each level in the tree be a separate document with references to its children.

In this situation, updates will only replace those levels that changed, making for for efficient storage and cache invalidation.

Generating Ceramic Document IDs

A copy of the document definition IDs is checked into the repo, but should you need to generate a new set, the method is:

  • RANDBYTES=$(node -e "console.log(require('crypto').randomBytes(32).toString('hex'))")
  • SEED=$RANDBYTES yarn bootstrap

xml-to-ipld's People

Contributors

dysbulic avatar

Stargazers

 avatar

Watchers

 avatar

xml-to-ipld's Issues

Enable zooming and panning of the force graph w/ the mouse wheel

The node circles enclose title elements, and, if hovered, will display the node name and the nested set left and right.

The problem is that everytime the graph is regenerated the viewBox is set to the bounding box of the image, so, theoretically, everything should be in frame. It causes the graph to wiggle some; enough that you can't hover to see the title.

I added the ability to pause updates while the mouse button is down, but the titles won't appear until the button is released.

So this request is to enable navigation with a combination of the alternate, control, and shift keys combined with the mouse wheel.

  • Wheel: Directionally the same as this window. Up/Down the page.
  • Wheel + Shift: Directionally the same Inkscape. Left/Right the page.
  • Wheel + Control: Perspectively the same as Inkscape. Zoom in/out.
  • Wheel + Alt + (Control ∨ Shift): The speed of change is reduced by 90%.

Ceramic initialization failing in production with "Cannot call a class as a function"

Bug Description

When the button is clicked on https://dysbulic.github.io/xml-to-ipld/#/ceramic the application crashes with the following error:

Uncaught (in promise) Error: Failed to resolve did:3:kjzl6cwe1jw14936apxr6lxhewn3srcpxjwjtu777mkfio7718ue8alc7pfr717?version-id=0#pn1iiYhhzD3kUev: invalidDid, TypeError: Cannot call a class as a function
    at A.<anonymous> (index.ts:303)
    at c (runtime.js:63)

The value of DID before the error is:

Screenshot from 2021-04-14 01-49-05

This issue does not occur in development. In development, the value of DID at the same location is:

Screenshot from 2021-04-14 01-49-41

The code being run is:

  const connect = async () => {
    
    const ceramic = (
      new Ceramic('https://ceramic-clay.3boxlabs.com')
    )
    await ceramic.setDIDProvider(didProvider)
    setCeramic(ceramic)
  }

Then in @ceramicnetwork/http-client:

  async setDIDProvider(provider: DIDProvider): Promise<void> {
    this.context.provider = provider;
    this.context.did = new DID({ provider, resolver: this.context.resolver })
    if (!this.context.did.authenticated) {
      await this.context.did.authenticate()
    }
  }

It dies calling new DID().

To Reproduce

  1. Go to https://dysbulic.github.io/xml-to-ipld/#/ceramic.
  2. Click on the "Connect Your Wallet" button.
  3. View the error in the console.
  4. git clone https://github.com/dysbulic/xml-to-ipld.git
  5. cd xml-to-ipld && yarn && yarn start
  6. No error and the program completes satisfactorily.

Expected Behavior

I would like the behavior in production to be the same as development.

Ceramic Versions

  • @ceramicnetwork/3id-did-resolver@^1.1.1
  • @ceramicnetwork/common@^0.17.0
  • @ceramicnetwork/docid@^0.5.1
  • @ceramicnetwork/doctype-caip10-link@^0.13.4
  • @ceramicnetwork/doctype-tile@^0.14.1
  • @ceramicnetwork/http-client@^0.10.1
  • @ceramicstudio/idx@^0.7.0
  • @ceramicstudio/[email protected]

Machine, OS, Browser Information

  • Linux fenrir 5.8.0-48-generic #54~20.04.1-Ubuntu SMP Sat Mar 20 13:40:25 UTC 2021 x86_64 GNU/Linux
  • Browsers:
    • Chrome 89.0: Works in development, not in production.
    • Firefox 87.0: Works in development, not in production.
    • Opera: Crashes b/c accounts[0] is not defined.
    • Brave: Crashes b/c window.ethereum is not defined.

Additional Information

It looks to me like the minimizer made a mistake, but that just seems so unlikely.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.