Skip to content

Instantly share code, notes, and snippets.

@ivansglazunov
Last active November 27, 2021 14:55
Show Gist options
  • Save ivansglazunov/34ad30ba22c07ebb09e8a83663f0749a to your computer and use it in GitHub Desktop.
Save ivansglazunov/34ad30ba22c07ebb09e8a83663f0749a to your computer and use it in GitHub Desktop.
Deep Documentation

Checkboxes - documentation sections.

Link

  • Link as links table row.
  • Link as gql relational schema.
  • Link as minilinks structure.

Typing and inheritance.

  • Link by relation type returns type link of current link. Current link is instance of type link.
  • Type link behaves like a typing rule. Instance links must has from/to equal by type to type from/to.
  • If a typing violation is found, link insert transaction will be rolled back with a verbose error.

Value and custom tables

  • Link may have value field with any custom structure.
  • How to custom tables.
  • If link type have attached table, then row with link_id can be getted with value relation from that link.
  • Tables awailable independently as table, or as link relation, if you know table id.
  • If Column link has value: { value: 'abc' }, then column in database will have name = abc.

Tree indexation

  • If your want search by tree ranges, you must define tree.
  • You can expand and decrease tree structure every time.
  • On client side, you can expand plain results into linked minilinks structure.
  • Relations up and down.

Selector model

  • Built-in model of selecting data.
  • Usage for trees.

Rules and permissions

  • Basical rule theory
  • Actions insert/update/delete/select for permissions.
  • Custom actions.
  • [ ]

Handlers

Packager

  • Package contain items list. Item is { id type from to value }.
  • Field id can be defined any unique for package string|number. Package id names/numbers - local id.
  • Field id in data base names global id.
  • After package import, local id of currentLink stored in package |= contain => currentLink in contain.value.value.
  • Fields from_id, to_id, type_id not used in packages.
  • Links in package connected by fields from, to, type.
  • If only id and value is defined, but type and others not defined, item exists for insert value in specific order after base link by id already inserted.
  • If package.strict is true, then items insert in strict order as in package.

Promises

  • If inserted link has subscribed by type or selector handlers, then creates links then and promise in transacition. current |-- then --> promise.
  • For answer - is link background handlers resolved? need to verify any one of this conditions:
    • if link not have outgoind |-- then --> links
    • else link has has, promise and resolved links as |-- then --> promise |-- resolved, but has not rejected links as |-- then --> promise |-- resolved.
    • else if link has rejected links (it doesn't matter if there is a resolved or not), it means a link was inserted with unsuccessful reactions and is considered damaged in a general sense, but you can check each rejected and resolved links from promise. This will allow you to understand which handlers are errored.
  • In js implementation you can use await awaitPromise({ id, client }) method returns native promise.

Reserved

  • Mutation reserve({ count: 15 }) { ids } reserve some count of link ids and return it as ids.
  • You can insert links with ids from reserve mutation.
  • One hour from reservation - imeout for cleaning reserved ids.

Auth

Here will be hybric passportjs and deep jwt standart.

  • Temporary guest gql query generate new link and jwt for it.
  • Temporary jwt generate new jwt from linkId.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment