3.12.0 • Published 1 year ago

@totemorg/debe v3.12.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

DEBE

DEBE is a TOTEM plugin that provides notebook agents at

/NOTEBOOK.TYPE ? QUERY

where the notebook TYPE:

view | run | brief | browse
exe | tou | md | status | suitors | usage | EVENTS
import | export | publish | mod
js | py | m | jx | jade | R

renders, runs, probes, manages or licenses a notebook.

DEBE also provides the following info agents at:

search | searches | words
wms | wfs | tips | DG | HYDRA | NCL | ISPY | ESS | MIDB
uploads | stores | ingest
follow | proctor | likeus
notebooks
decode | config | info
ESC
matlab

Instal

npm install @totemorg/debe		# install extended service
npm update

Manage

npm run start [ ? | $ | ...]	# Unit test
npm run verminor				# Roll minor version
npm run vermajor				# Roll major version
npm run redoc					# Regen documentation
npm run pubminor				# republish as minor version
npm run pubmajor				# republish as major version

npm run	startdbs				# Start required database servers
npm run setprot					# Configure for protected mode
npm run setdebug				# Configure for debugging mode
npm run setoper					# Configure for operational mode
npm run setprod					# Configure for production mode

npm run genio						# Generate totem-man.github.io from jades/totemblog
npm run raster --in=src --out=tar	# Rasterize source url into a target file 

Usage

Acquire, optionally configure and start a DEBE server:

import * as DEBE from "@totemorg/debe";

DEBE.config({
	key: value, 						// set key
	"key.key": value, 					// indexed set
	"key.key.": value					// indexed append
}, sql => {
	console.log( sql ? "look mom - Im running!" : "something evil is lurking" );
});

where configuration keys follow ENUMS deep copy conventions.

Program Reference

DEBE

Provides notebook interface to the barebone TOTEM web service. This module documented in accordance with jsdoc.

Requires: module:totem, module:atomic, module:man, module:enums, module:reader, module:skin, module:crypto, module:child_process, module:fs, module:stream, module:cluster, module:repl, module:i18n-abide, module:optimist, module:tokml, module:officegen
Author: ACMESDS
Example

// npm test D2
// Start challenge-protected server with additional node Routers.

config({
	riddles: 10,
	"nodeRouters.": {
		wfs: function (req,res) {
			res("here i go again");

			Fetch(WFS_TEST, data => {
				_Trace(data);
			});
		}
	}
}, sql => {
	_Trace( "This bad boy in an encrypted service with a database and has an /wfs endpoint" );
});	

Example

// npm test D3
// Start server using default config

config({
}, sql => {
	_Trace( "Stateful network flow manger started" );
});

Example

// npm test D4
// Start server and prep file system

function readFile(sql, path, cb) {
	sql.beginBulk();
	readers.xls( "./config.stores/test.xls", rec => { 
		if (rec) 
			cb(rec,sql);

		else 
			sql.endBulk();
	});
}

config({
}, sql => {
	var recs = 0, now = new Date();
	readFile( sql, "./config.stores/test.xls", (rec,sql) => {
		if ( ++recs<5 ) {
			var 
				doc = (rec.doc || rec.Doc || rec.report || rec.Report || "")
						.replace( /\n/g, " ")
						.replace( /\&\#10;/g, " "),

				docs = doc				
						.match( /(.*)TEXT:(.*)COMMENTS:(.*)/ ) || [ "", "", doc, ""],

				text = "";

			docs[2].replace( /\.  /g, "\n").replace( /^[0-9 ]*\. \(.*\) (.*)/gm, (str,txt) => text += txt + ".  " );

			sql.query("INSERT INTO openv.docs SET ?", {
				Reported: rec.reported || rec.Reported || now,
				Name: rec.reportID || ("tbd-"+recs),
				Pipe: JSON.stringify( text )
			}, err => _Trace("add", err) );
		}
	});
});

String

String~align()

Kind: inner method of String

String~trimGoogle()

Kind: inner method of String

Array

Array~merge(Recs, idx)

Merge changes when doing table deltas from their baseline versions.

Kind: inner method of Array

ParamTypeDescription
RecsArraySource records to merge into this records
idxStringKey name to use for detecting record changes

Array~schemaify(src)

Returns a schema of the array using the specified src path.

Kind: inner method of Array

ParamTypeDescription
srcStringpath to source

Array~treeify(idx, kids, level, keys, wt)

Returns a tree = {name,weight,nodes} from records having been sorted on keys=key,...

Kind: inner method of Array

ParamTypeDescription
idxNumberstarting index (0 on first call)
kidsNumbernumber of leafs following starting index (this.length on first call)
levelNumbercurrent depth (0 on first call)
keysArraypivot keys
wtStringkey name that contains leaf weight (defaults to "size")

Data

Data.watchDogs

Watchdogs {name: dog(sql, lims), ... } run at intervals dog.cycle seconds usings its dog.trace, dog.parms, sql connector and threshold parameters.

Kind: static constant of Data
Cfg: Object

Data.siteContext

Site skinning context

Kind: static constant of Data

Data.filters

Data filters:

(recs,req,res) => { ... }

convert the recs list provided on the current req request and uses the res responder to supply the filtered results.

Kind: static constant of Data

ParamTypeDescription
recsArrayRecords to filter
reqObjectTotem session request
resfunctionTotem session response

Data~defaultDocs

Default doc for reserved notebook keys

Kind: inner property of Data

Data~licenseOnDownload

Kind: inner property of Data

Data~probono : boolean

Enable to give-away plugin services

Kind: inner property of Data

Data~isSpawned : Boolean

Enabled when this is child server spawned by a master server

Kind: inner property of Data

Data~soapRouters : Object

Reserved for soap interfaces

Kind: inner property of Data

Data~_Notebooks

Kind: inner constant of Data

Data~_Errors

Client error messages

Kind: inner constant of Data

_Errors.noMarkdown

Kind: static property of _Errors

_Errors.noRecord

Kind: static property of _Errors

_Errors.pubRejected

Kind: static property of _Errors

_Errors.noPartner

Kind: static property of _Errors

_Errors.noLicense

Kind: static property of _Errors

_Errors.badAgent

Kind: static property of _Errors

_Errors.noOffice

Kind: static property of _Errors

_Errors.noContext

Kind: static property of _Errors

_Errors.cantRun

Kind: static property of _Errors

_Errors.noName

Kind: static property of _Errors

_Errors.noNotebook

Kind: static property of _Errors

_Errors.certFailed

Kind: static property of _Errors

_Errors.bookExists

Kind: static property of _Errors

_Errors.pubFailed

Kind: static property of _Errors

Data~_SQLs

Kind: inner constant of Data

Data~_$lib

Kind: inner constant of Data

_$lib.$log

See debe

Kind: static property of _$lib

_$lib.$copy

See debe

Kind: static property of _$lib

_$lib.$each

See debe

Kind: static property of _$lib

_$lib.$sql

See jsdb

Kind: static property of _$lib

_$lib.$neo

See jsdb

Kind: static property of _$lib

_$lib.$help()

Kind: static method of _$lib

_$lib.$fetch()

Kind: static method of _$lib

_$lib.$get()

Kind: static method of _$lib

Data~_Paths

Kind: inner constant of Data

Data~config(sql, init)

Configure DEBE on startup.

Kind: inner method of Data

ParamTypeDescription
sqlObjectMySQL connector
initfunctioncallback(sql) when service init completed

Data~SOAPsession(req, res, proxy)

Process a SOAP session peer-to-peer request. Currently customized for Hydra-peer and could/should be revised to support more generic peer-to-peer soapRouters interfaces.

Kind: inner method of Data

ParamTypeDescription
reqObjectHTTP request
resObjectHTTP response
proxyfunctionName of APP proxy function to handle this session.

Data~linkInspect()

Inspect doc - kludge i/f to support nlp project

Kind: inner method of Data

Data~publishNotebooks()

Kind: inner method of Data

Data~licenseCode()

License notebook engine code.

Kind: inner method of Data

Data~sendMail()

Kind: inner method of Data

Data~genDoc(recs, req, res)

Convert records to requested req.type office file.

Kind: inner method of Data

ParamTypeDescription
recsArraylist of records to be converted
reqObjectTotem session request
resfunctionTotem session response

Data~getEngine()

Kind: inner method of Data

Data~fileUpload()

Kind: inner method of Data

Data~savePage()

Kind: inner method of Data

Data~statusNotebook()

Kind: inner method of Data

Data~matchNotebook()

Kind: inner method of Data

Data~docNotebook()

Kind: inner method of Data

Data~trackNotebook()

Kind: inner method of Data

Data~getNotebook()

Return a watermarked engine to a registered notebook.

Kind: inner method of Data

Data~usersNotebook(req, res)

Endpoint to return users of a requested notebook.

Kind: inner method of Data

ParamTypeDescription
reqObjecthttp request
resfunctionTotem session response callback

Data~exportNotebook()

Kind: inner method of Data

Data~importNotebook()

Kind: inner method of Data

Data~wikiNotebook()

Kind: inner method of Data

Data~publishNotebook()

Kind: inner method of Data

Data~extendNotebook()

Kind: inner method of Data

Data~retractNotebook()

Kind: inner method of Data

Data~helpNotebook()

Kind: inner method of Data

Data~getCert(req, res)

Create/return public-private cert.

Kind: inner method of Data

ParamTypeDescription
reqObjectTotem session request
resfunctionTotem session response

Contacting, Contributing, Following

Feel free to

License

MIT


© 2012 ACMESDS