1.2.4 • Published 6 months ago

pathos-proto-infra v1.2.4

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

pathos-proto-infra

  • NPM Module Version - npm version

Pathos Protocol Buffer Infrastructure

Encoding and decoding standard for Pathos Protocol Buffer based data architecture

Encoders

Recieve data to encode it within pathos file structure and returns the Protocol Buffer hash name

FunctionParameters
makeMomentdatetime, format, lat, lon, x, y, z
makePioneerbirthday, format
makeSecretauthor, format
makeEntitybirthday, secret, format
makeNodeauthor, file, str, format
makePathauthor, name, head, parent, format
makeTagauthor, name, parent, format

Decoders

Recieve hashes and returns useful data objects

FunctionParameters
getMomentObjxmoment (moment hash)
getPioneerObjxpioneer (pioneer hash)
getSecretObjxsecret (secret hash)
getEntityObjxuser (user hash)
getNodeObjxnode (node hash)
getPathObjxpath (path hash)
getTagObjxtag (tag hash)
getTagObjFromKeyxkey (key on the dictionary)

Modifiers

Modify objects

FunctionParametersDescription
useSecretxsecret (secret hash)Sets 'used' secret property to true if it is false.

Dictionary

The dictionary is the human layer naming tags in order to get them by setting up a unique key

FunctionParameters
makeTagKeyauthor, key, xtag, format

Publishing

When author is specified, the nodes, paths, keys and tags are stored in private directions.

FunctionParameters
makePublicdir

Usage

You can make (encode) and get (decode) protocol buffers easily with pathos's data structure in order to use them.

Importing pathos-proto-infra:

const pathos = require("pathos-proto-infra");

makeMoment(datetime, format, lat, lon, x, y, z)

Making a moment involves space and time parameters, but they are all optional because the default moment data is the current time information. If datetime is specified, format must be specified accordingly with date-and-time npm dependency standards.

Calling makeMoment():

const moment = pathos.makeMoment();
console.log("MOMENT BUFFER: ", moment)

Console log:

MOMENT BUFFER:  9e68a6f5c74b4f25a863117f95caadde1b2bde3fad550b0e616ee21ce2ba8d0a

getMomentObj(xmoment)

Getting a moment object by it's hashname

Calling getMomentObj():

// Creating a moment
const moment = pathos.makeMoment();

const moment_obj = pathos.getMomentObj(moment);
console.log("MOMENT OBJECT: ", moment_obj)

Console log:

MOMENT OBJECT:  {
  coordinates: { lat: 0, lon: 0, xyz: { x: 0, y: 0, z: 0 } },
  datetime: {
    Y: 2023,
    M: 8,
    D: 5,
    H: 15,
    A: 0,
    h: 0,
    m: 22,
    s: 37,
    S: 0,
    Z: 360,
    _index: 29,
    _length: 29,
    _match: 7
  }
}

getPioneerObj(xpioneer)

Getting a pioneer object by it's hashname

Calling getPioneerObj():

const pioneer_obj = pathos.getPioneerObj(pioneer);
console.log("PIONEER OBJECT: ", pioneer_obj);

Console log:

PIONEER OBJECT:  {
  birthday: 'moments/1ac234c81ee269e408d7a9e5a7a95492b60883ac53d24d9f11e0903c6ba5f7c6',
  register: 'moments/140ccd369a9d916fb339b09f5b98f84831412a3f520a71002bcb3a66678882a4',
  invite: 'entities/ffe125f1827ca16374ac5ea8d69defeee4b2ff8a9f8d640fa27c495881fe93b4',
  tag: 'entities/ffe125f1827ca16374ac5ea8d69defeee4b2ff8a9f8d640fa27c495881fe93b4'
}

makeSecret(author, format)

Making a secret involves tracking the secret's author. Pioneer user is set by default if author is not provided. Pioneer is created automatically if it does not exist.

Calling makeSecret():

const secret = pathos.makeSecret();
console.log("SECRET BUFFER: ", secret)

Console log:

SECRET BUFFER:  574e8fee76ba4dc93c2f4cd79399aa01e6cfb19257e4eb305dcfaeb16649b7bf

getSecretObj(xsecret)

Getting a secret object by it's hashname

Calling getSecretObj():

const secret_obj = pathos.getSecretObj(secret);
console.log("SECRET OBJECT: ", secret_obj);

Console log:

SECRET OBJECT:  {
  register: 'moments/638976edf4684e746f9bd013bd2e9145b1316ee42b40b0877185f6aeda960b8d',
  author: 'pioneer/ebd4ff7e4f69d1c4c2b529eb60a7ca72bb459c1458e1a011b26b6ea84901d143',
  used: false,
  tag: 'secrets/574e8fee76ba4dc93c2f4cd79399aa01e6cfb19257e4eb305dcfaeb16649b7bf'
}

useSecret(xsecret)

Using a secret by setting its 'used' property to true if it is set to false.

Creating a secret, calling useSecret(xsecret) and printing used secret object:

// Creating secret
const secret = pathos.makeSecret();
console.log("SECRET BUFFER: ", secret)

// Getting secret object and printing it
const secret_obj = pathos.getSecretObj(secret);
console.log("SECRET OBJECT: ", secret_obj)

// Using secret!
const used_secret = pathos.useSecret(secret)

// Getting secret object and printing it
const usecret_obj = pathos.getSecretObj(used_secret);
console.log("USED SECRET OBJECT: ", usecret_obj)

Console log:

SECRET BUFFER:  574e8fee76ba4dc93c2f4cd79399aa01e6cfb19257e4eb305dcfaeb16649b7bf
SECRET OBJECT:  {
  register: 'moments/638976edf4684e746f9bd013bd2e9145b1316ee42b40b0877185f6aeda960b8d',
  author: 'pioneer/ebd4ff7e4f69d1c4c2b529eb60a7ca72bb459c1458e1a011b26b6ea84901d143',
  used: false,
  tag: 'secrets/574e8fee76ba4dc93c2f4cd79399aa01e6cfb19257e4eb305dcfaeb16649b7bf'
}
USED SECRET OBJECT:  {
  register: 'moments/638976edf4684e746f9bd013bd2e9145b1316ee42b40b0877185f6aeda960b8d',
  author: 'pioneer/ebd4ff7e4f69d1c4c2b529eb60a7ca72bb459c1458e1a011b26b6ea84901d143',
  used: true,
  tag: 'secrets/574e8fee76ba4dc93c2f4cd79399aa01e6cfb19257e4eb305dcfaeb16649b7bf'
}

makeEntity(secret, format)

Making an entity involves tracking the entities author by tracking the secret author. Pioneer user is created automatically if it does not exist. We use the entities given birthday as a bigbang moment.

Calling makeEntity():

const entity = pathos.makeEntity(secret);
console.log("ENTITY BUFFER: ", entity)

Console log:

ENTITY BUFFER:  bd97daa5b9d4490156bfa169c3b15a08b5d43bad0b2206575e4f6330fd5aca6f

getEntityObj(xentity)

Getting an entity object by it's hashname

Calling getEntityObj():

const entity_obj = pathos.getEntityObj(entity);
console.log("ENTITY OBJECT: ", entity_obj);

Console log:

ENTITY OBJECT:  {
  birthday: 'moments/0d6c319d7c11b457b0163d84d7643352f855e1a34b7f4c24118a4e0178fc7431',
  register: 'moments/4063001a28bedc82e006585add2f88059c5daa1ef252177a6381e69ed1806108',
  invite: 'pioneer/ebd4ff7e4f69d1c4c2b529eb60a7ca72bb459c1458e1a011b26b6ea84901d143',
  tag: 'entitys/bd97daa5b9d4490156bfa169c3b15a08b5d43bad0b2206575e4f6330fd5aca6f'
}

makeNode(author, file, str, format)

Making a node takes an author and content, that can be a file address or a string.

Calling makeNode():

const node = pathos.makeNode("pioneer/ebd4ff7e4f69d1c4c2b529eb60a7ca72bb459c1458e1a011b26b6ea84901d143", "izipizilemonsquizi");
console.log("NODE BUFFER: ", node)

Console log:

NODE BUFFER:  bd97daa5b9d4490156bfa169c3b15a08b5d43bad0b2206575e4f6330fd5aca6f

If the author is specified, the buffer includes the private direction Console log of private node:

NODE BUFFER:  ebd4ff7e4f69d1c4c2b529eb60a7ca72bb459c1458e1a011b26b6ea84901d143/nodes/2359990a0e4b3a69c057aecefc7a2b288dd80752e635b1afbb83d4f4c1e6d686

getNodeObj(xnode)

Getting a node object by it's hashname

Calling getNodeObj():

const node_obj = pathos.getNodeObj(node);
console.log("NODE OBJECT: ", node_obj)

Console log:

NODE OBJECT:  {
  register: 'moments/90e7b7a8fe8ff1d198ea2df3a05088550d19104af888073aa35237fb82e98163',
  author: 'pioneer/ebd4ff7e4f69d1c4c2b529eb60a7ca72bb459c1458e1a011b26b6ea84901d143',
  file: '',
  str: 'izipizilemonsquizi',
  tag: 'secrets/ab99e5cb55a5e32dd2d5385d6cddfb5e6a40845b29e3897a2b93db8d4ee730a9'
}

makePath(author, name, head, parent, format)

To create a path, it is necessary to specify the author and the head of the node of the path. The name can be set, but if not, the hash is set as default name. If the path is a branch from another path, the parent path can be specified.

Calling makePath():

const path = pathos.makePath(entity, "elPath", node);
console.log("PATH BUFFER: ", path)

Console log:

PATH BUFFER:  paths/ad6ee3e45a3bfa450d7de201cd354f90a17651e06c1d4b8e9b2b76ae1330c735

If the author is specified, the buffer includes the private direction Console log of private path:

PATH BUFFER:  ebd4ff7e4f69d1c4c2b529eb60a7ca72bb459c1458e1a011b26b6ea84901d143/paths/2359990a0e4b3a69c057aecefc7a2b288dd80752e635b1afbb83d4f4c1e6d686

getPathObj(xpath)

Getting a path object by it's hashname

Calling getPathObj():

const path_obj = pathos.getPathObj(path);
console.log("PATH OBJECT: ", path_obj)

Console log:

PATH OBJECT:  {
  register: 'moments/091da3164800c5d08c2efc21abe948c14185d8841a1c82cf6f683dd7c2b5cd02',
  author: 'entities/1249bf6b7d2c33722325b4ec7213577b9d51338f8cbb0c3757583bf2254961d4',
  name: 'elPath',
  head: 'nodes/d7a45fa71467185773e687e279f8dc763748571a5ed0bd6abf08d0895a805a14',
  parent: 'paths/ad6ee3e45a3bfa450d7de201cd354f90a17651e06c1d4b8e9b2b76ae1330c735',
  tag: 'paths/ad6ee3e45a3bfa450d7de201cd354f90a17651e06c1d4b8e9b2b76ae1330c735'
}

makeTag(author, name, head, parent, format)

To create a tag, it is necessary to specify the author and the name of the tag. If the tag is under another tag, the parent tag can be specified.

Calling makeTag():

const tag = pathos.makeTag(user, "word");
console.log("TAG BUFFER: ", tag)

Console log:

TAG BUFFER:  tags/86af49e57a415f956d3a9c99708848d0ea575864e790ed8e5e71bfc0e0fb5cd9

makeTagKey(author, key, xtag, format)

Tag key are the dictionary keys that allow acessing tags from natural language ids. It puts a tag buffer in the dictionary inside a folder with the name of the specified key.

Calling makeTagKey():

const tag_key = pathos.makeTagKey(user, "word");
console.log("TAG KEY DIR: ", tag_key)

Console log:

TAG KEY DIR:  dictionary/word/86af49e57a415f956d3a9c99708848d0ea575864e790ed8e5e71bfc0e0fb5cd9

getTagObj(xtag)

Getting a tag object by it's hashname

Calling getTagObj():

const tag_obj = tagos.getTagObj(tag);
console.log("PATH OBJECT: ", tag_obj)

Console log:

TAG OBJECT:  {
  register: 'moments/9858bb87923ae3e0eaab4479b47cbbf305ad70a8ce3afcd8465c28a7ef9f9e8f',
  author: 'entities/8799224e7192b3c0bf3b75ed211a50e90a23438eec8f718ae197c81a8f4fe001',
  name: 'word',
  parent: 'tags/86af49e57a415f956d3a9c99708848d0ea575864e790ed8e5e71bfc0e0fb5cd9',
  tag: 'tags/86af49e57a415f956d3a9c99708848d0ea575864e790ed8e5e71bfc0e0fb5cd9'
}

getTagObjFromKey(xkey)

Getting a tag object by it's key name on the dictionary

Calling getTagObjFromKey():

const tag_obj = pathos.getTagObjFromKey(xey);
console.log("TAG OBJECT: ", tag_obj)

Console log:

TAG OBJECT:  {
  register: 'moments/9858bb87923ae3e0eaab4479b47cbbf305ad70a8ce3afcd8465c28a7ef9f9e8f',
  author: 'entities/8799224e7192b3c0bf3b75ed211a50e90a23438eec8f718ae197c81a8f4fe001',
  name: 'word',
  parent: 'tags/86af49e57a415f956d3a9c99708848d0ea575864e790ed8e5e71bfc0e0fb5cd9',
  tag: 'tags/86af49e57a415f956d3a9c99708848d0ea575864e790ed8e5e71bfc0e0fb5cd9'
}

makePublic(dir)

The buffer on the specified directory is made public (it gets to live on the root directory)

Calling makePublic():

const dir = "46af49e57a415f956d3a9c99708848d0ea575864e790ed8e5e71bfc0e0fb5cd9/paths/ad6ee3e45a3bfa450d7de201cd354f90a17651e06c1d4b8e9b2b76ae1330c735";

const public_buffer = pathos.makePublic(dir);
console.log("PUBLIC ADDRESS: ", public_buffer)

Console log:

PUBLIC ADDRESS:  paths/ad6ee3e45a3bfa450d7de201cd354f90a17651e06c1d4b8e9b2b76ae1330c735
1.2.4

6 months ago

1.2.3

6 months ago

1.2.2

7 months ago

1.2.1

7 months ago

1.0.69

7 months ago

1.0.73

7 months ago

1.0.72

7 months ago

1.0.71

7 months ago

1.0.70

7 months ago

1.0.77

7 months ago

1.0.76

7 months ago

1.0.75

7 months ago

1.0.74

7 months ago

1.0.79

7 months ago

1.0.78

7 months ago

1.0.80

7 months ago

1.0.83

7 months ago

1.0.82

7 months ago

1.0.81

7 months ago

1.0.68

9 months ago

1.0.67

9 months ago

1.0.66

9 months ago

1.0.65

9 months ago

1.0.64

9 months ago

1.0.63

9 months ago

1.0.62

9 months ago

1.0.61

9 months ago

1.0.60

9 months ago

1.0.59

9 months ago

1.0.58

9 months ago

1.0.57

9 months ago

1.0.56

9 months ago

1.0.55

9 months ago

1.0.54

9 months ago

1.0.53

9 months ago

1.0.52

9 months ago

1.0.51

9 months ago

1.0.50

9 months ago

1.0.49

9 months ago

1.0.48

9 months ago

1.0.47

9 months ago

1.0.46

9 months ago

1.0.45

9 months ago

1.0.44

9 months ago

1.0.43

9 months ago

1.0.42

9 months ago

1.0.41

9 months ago

1.0.40

9 months ago

1.0.39

9 months ago

1.0.38

9 months ago

1.0.37

9 months ago

1.0.36

9 months ago

1.0.35

9 months ago

1.0.34

9 months ago

1.0.33

9 months ago

1.0.32

9 months ago

1.0.31

9 months ago

1.0.30

9 months ago

1.0.29

9 months ago

1.0.28

9 months ago

1.0.27

9 months ago

1.0.26

9 months ago

1.0.25

9 months ago

1.0.24

9 months ago

1.0.23

9 months ago

1.0.22

9 months ago

1.0.21

9 months ago

1.0.20

9 months ago

1.0.19

9 months ago

1.0.18

9 months ago

1.0.17

9 months ago

1.0.16

9 months ago

1.0.15

9 months ago

1.0.14

9 months ago

1.0.13

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago