@plurid/opject-server
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-1 • Public • Published



License: DEL

opject

Object Passing Library

Contents

About

opject is a specification and implementation for passing objects through the network.

An object is a self-contained piece of code.

The passing of the object through the network is obtained in 2 steps:

  • a registered object is requested by the opject client from the opject server;
  • the opject client instantiates or runs in a virtual machine the received object.

opject has clients for

The opject server can serve any kind of object. However, depending on the preferred language, a specific opject server can be used for

The opject registry grants extended functionality through a web interface. The registry can be self-hosted or cloud-hosted.

Install

Install using

npm install @plurid/opject-server

or

yarn add @plurid/opject-server

Install the peer dependencies

@plurid/deon @plurid/plurid-functions express body-parser crypto

Usage

A simple opject server will only require passing a verifyToken function and starting the server.

import OpjectServer from '@plurid/opject-server';


const opjectServer = new OpjectServer({
    verifyToken: async (
        token,
    ) => {
        if (token === '__TESTS__') {
            return true;
        }

        return false;
    },
});

const PORT = 7766;


opjectServer.start(PORT);

The opject server will use the local filesystem for storing data.

Custom functions can be passed to the opject server to implement any kind of logic handling following the interfaces

export type VerifyToken = (
    token: string,
) => Promise<boolean>;

export type GetObject = (
    id: string,
) => Promise<string | undefined>;

export type GetMetadata = (
    id: string,
) => Promise<OpjectMetadata | undefined>;

export type RegisterObject = (
    id: string,
    data: string,
) => Promise<boolean>;

export type RegisterMetadata = (
    id: string,
    data: OpjectMetadata,
) => Promise<boolean>;

export type RemoveObject = (
    id: string,
) => Promise<boolean>;

export interface OpjectServerConfiguration {
    verifyToken: VerifyToken;
    getObject?: GetObject;
    getMetadata?: GetMetadata;
    registerObject?: RegisterObject;
    registerMetadata?: RegisterMetadata;
    removeObject?: RemoveObject;
    options?: OpjectServerPartialOptions;
}

Packages

Version

@plurid/opject-client-javascriptJavaScript opject client

Version

@plurid/opject-server-javascriptJavaScript opject server

Version

@plurid/opject-client-pythonPython opject client

Version

@plurid/opject-server-pythonPython opject server

Codeophon

Readme

Keywords

Package Sidebar

Install

npm i @plurid/opject-server

Weekly Downloads

4

Version

0.0.0-1

License

SEE LICENSE IN LICENSE

Unpacked Size

161 kB

Total Files

12

Last publish

Collaborators

  • ly3xqhl8g9