@jkcfg/std
Advanced tools
Comparing version 0.3.0 to 0.3.2
@@ -24,1 +24,8 @@ /** | ||
export declare function dir(path: string, options?: DirOptions): Directory; | ||
export declare function join(base: string, name: string): string; | ||
interface WalkOpts { | ||
pre?: (f: FileInfo) => boolean; | ||
post?: () => void; | ||
} | ||
export declare function walk(path: string, opts?: WalkOpts): IterableIterator<FileInfo>; | ||
export {}; |
124
fs.js
/** | ||
* @module std/fs | ||
*/ | ||
import { flatbuffers } from './internal/flatbuffers'; | ||
import { __std } from './internal/__std_generated'; | ||
import { RPCSync } from './internal/rpc'; | ||
import { valueFromUTF8Bytes } from './internal/data'; | ||
export class FileInfo { | ||
@@ -21,79 +21,57 @@ constructor(n, p, d) { | ||
export function info(path, options = {}) { | ||
const { module } = options; | ||
const builder = new flatbuffers.Builder(512); | ||
const pathOffset = builder.createString(path); | ||
let moduleOffset = 0; | ||
if (module !== undefined) { | ||
moduleOffset = builder.createString(module); | ||
} | ||
__std.FileInfoArgs.startFileInfoArgs(builder); | ||
__std.FileInfoArgs.addPath(builder, pathOffset); | ||
if (module !== undefined) { | ||
__std.FileInfoArgs.addModule(builder, moduleOffset); | ||
} | ||
const argsOffset = __std.FileInfoArgs.endFileInfoArgs(builder); | ||
__std.Message.startMessage(builder); | ||
__std.Message.addArgsType(builder, __std.Args.FileInfoArgs); | ||
__std.Message.addArgs(builder, argsOffset); | ||
const messageOffset = __std.Message.endMessage(builder); | ||
builder.finish(messageOffset); | ||
const bytes = V8Worker2.send(builder.asArrayBuffer()); | ||
const buf = new flatbuffers.ByteBuffer(new Uint8Array(bytes)); | ||
const resp = __std.FileSystemResponse.getRootAsFileSystemResponse(buf); | ||
switch (resp.retvalType()) { | ||
case __std.FileSystemRetval.FileInfo: { | ||
const f = new __std.FileInfo(); | ||
resp.retval(f); | ||
return new FileInfo(f.name(), f.path(), f.isdir()); | ||
} | ||
case __std.FileSystemRetval.Error: { | ||
const err = new __std.Error(); | ||
resp.retval(err); | ||
throw new Error(err.message()); | ||
} | ||
default: | ||
throw new Error('Unexpected response to fileinfo'); | ||
} | ||
const { module = '' } = options; | ||
const response = RPCSync('std.fileinfo', path, module); | ||
const { name: n, path: p, isdir: d } = valueFromUTF8Bytes(response); | ||
return new FileInfo(n, p, d); | ||
} | ||
export function dir(path, options = {}) { | ||
const { module } = options; | ||
const builder = new flatbuffers.Builder(512); | ||
const pathOffset = builder.createString(path); | ||
let moduleOffset = 0; | ||
if (module !== undefined) { | ||
moduleOffset = builder.createString(module); | ||
const { module = '' } = options; | ||
const response = RPCSync('std.dir', path, module); | ||
const { name: n, path: p, files: fs } = valueFromUTF8Bytes(response); | ||
const infos = []; | ||
for (const f of fs) { | ||
const { name: infoname, path: infopath, isdir: infoisdir } = f; | ||
infos.push(new FileInfo(infoname, infopath, infoisdir)); | ||
} | ||
__std.ListArgs.startListArgs(builder); | ||
__std.ListArgs.addPath(builder, pathOffset); | ||
if (module !== undefined) { | ||
__std.ListArgs.addModule(builder, moduleOffset); | ||
} | ||
const argsOffset = __std.ListArgs.endListArgs(builder); | ||
__std.Message.startMessage(builder); | ||
__std.Message.addArgsType(builder, __std.Args.ListArgs); | ||
__std.Message.addArgs(builder, argsOffset); | ||
const messageOffset = __std.Message.endMessage(builder); | ||
builder.finish(messageOffset); | ||
const bytes = V8Worker2.send(builder.asArrayBuffer()); | ||
const buf = new flatbuffers.ByteBuffer(new Uint8Array(bytes)); | ||
const resp = __std.FileSystemResponse.getRootAsFileSystemResponse(buf); | ||
switch (resp.retvalType()) { | ||
case __std.FileSystemRetval.Directory: { | ||
const d = new __std.Directory(); | ||
resp.retval(d); | ||
const files = new Array(d.filesLength()); | ||
for (let i = 0; i < files.length; i += 1) { | ||
const f = d.files(i); | ||
files[i] = new FileInfo(f.name(), f.path(), f.isdir()); | ||
return new Directory(n, p, infos); | ||
} | ||
export function join(base, name) { | ||
return `${base}/${name}`; | ||
} | ||
const always = () => true; | ||
const noop = () => { }; | ||
export function* walk(path, opts = {}) { | ||
const { pre = always, post = noop } = opts; | ||
const top = dir(path); | ||
// the stack is going to keep lists of files to examine | ||
const stack = []; | ||
let next = top.files; | ||
while (next !== undefined) { | ||
let i = 0; | ||
for (; i < next.length; i += 1) { | ||
const f = next[i]; | ||
if (f.isdir && pre(f)) { | ||
const d = dir(f.path); | ||
// If we need to recurse into the subdirectory, push the work | ||
// yet to do here, then the subdirectory's files. If not, we | ||
// can just continue as before. | ||
if (d.files.length > 0) { | ||
stack.push(next.slice(i + 1)); | ||
stack.push(d.files); | ||
yield f; | ||
break; | ||
} | ||
else { | ||
yield f; | ||
post(); | ||
continue; | ||
} | ||
} | ||
return new Directory(d.name(), d.path(), files); | ||
yield f; | ||
} | ||
case __std.FileSystemRetval.Error: { | ||
const err = new __std.Error(); | ||
resp.retval(err); | ||
throw new Error(err.message()); | ||
} | ||
default: | ||
throw new Error('Unexpected response to fileinfo'); | ||
// If we've exhausted the slice, we're popping a directory | ||
if (i === next.length) | ||
post(); | ||
next = stack.pop(); | ||
} | ||
} |
export { log } from './log'; | ||
export { Format, write } from './write'; | ||
export { Format, Overwrite, write, print, } from './write'; | ||
export { Encoding, read } from './read'; | ||
export { parse, stringify } from './parse'; |
export { log } from './log'; | ||
export { Format, write } from './write'; | ||
export { Format, Overwrite, write, print, } from './write'; | ||
export { Encoding, read } from './read'; | ||
export { parse, stringify } from './parse'; |
@@ -27,13 +27,2 @@ import { flatbuffers } from "./flatbuffers"; | ||
export declare namespace __std { | ||
enum FileSystemRetval { | ||
NONE = 0, | ||
FileInfo = 1, | ||
Directory = 2, | ||
Error = 3 | ||
} | ||
} | ||
/** | ||
* @enum | ||
*/ | ||
export declare namespace __std { | ||
enum Format { | ||
@@ -50,2 +39,12 @@ FromExtension = 0, | ||
/** | ||
* @enum | ||
*/ | ||
export declare namespace __std { | ||
enum Overwrite { | ||
Skip = 0, | ||
Write = 1, | ||
Err = 2 | ||
} | ||
} | ||
/** | ||
* Encoding specifies the requested form of the contents to read; | ||
@@ -100,5 +99,27 @@ * either just the raw bytes, or as a UTF-16 string. Distinguishing | ||
/** | ||
* RPCValue is a union of the types that can be sent as arguments. | ||
* | ||
* @enum | ||
*/ | ||
export declare namespace __std { | ||
enum RPCValue { | ||
NONE = 0, | ||
RPCSerialised = 1, | ||
Data = 2 | ||
} | ||
} | ||
/** | ||
* @enum | ||
*/ | ||
export declare namespace __std { | ||
enum RPCSyncRetval { | ||
NONE = 0, | ||
Data = 1, | ||
Error = 2 | ||
} | ||
} | ||
/** | ||
* @enum | ||
*/ | ||
export declare namespace __std { | ||
enum Args { | ||
@@ -111,5 +132,4 @@ NONE = 0, | ||
CancelArgs = 5, | ||
FileInfoArgs = 6, | ||
ListArgs = 7, | ||
ParamArgs = 8 | ||
ParamArgs = 6, | ||
RPCArgs = 7 | ||
} | ||
@@ -450,294 +470,2 @@ } | ||
export declare namespace __std { | ||
class FileInfo { | ||
bb: flatbuffers.ByteBuffer | null; | ||
bb_pos: number; | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns FileInfo | ||
*/ | ||
__init(i: number, bb: flatbuffers.ByteBuffer): FileInfo; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param FileInfo= obj | ||
* @returns FileInfo | ||
*/ | ||
static getRootAsFileInfo(bb: flatbuffers.ByteBuffer, obj?: FileInfo): FileInfo; | ||
/** | ||
* @param flatbuffers.Encoding= optionalEncoding | ||
* @returns string|Uint8Array|null | ||
*/ | ||
name(): string | null; | ||
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; | ||
/** | ||
* @param flatbuffers.Encoding= optionalEncoding | ||
* @returns string|Uint8Array|null | ||
*/ | ||
path(): string | null; | ||
path(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; | ||
/** | ||
* @returns boolean | ||
*/ | ||
isdir(): boolean; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startFileInfo(builder: flatbuffers.Builder): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset nameOffset | ||
*/ | ||
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset pathOffset | ||
*/ | ||
static addPath(builder: flatbuffers.Builder, pathOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param boolean isdir | ||
*/ | ||
static addIsdir(builder: flatbuffers.Builder, isdir: boolean): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endFileInfo(builder: flatbuffers.Builder): flatbuffers.Offset; | ||
} | ||
} | ||
/** | ||
* @constructor | ||
*/ | ||
export declare namespace __std { | ||
class Directory { | ||
bb: flatbuffers.ByteBuffer | null; | ||
bb_pos: number; | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns Directory | ||
*/ | ||
__init(i: number, bb: flatbuffers.ByteBuffer): Directory; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param Directory= obj | ||
* @returns Directory | ||
*/ | ||
static getRootAsDirectory(bb: flatbuffers.ByteBuffer, obj?: Directory): Directory; | ||
/** | ||
* @param flatbuffers.Encoding= optionalEncoding | ||
* @returns string|Uint8Array|null | ||
*/ | ||
name(): string | null; | ||
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; | ||
/** | ||
* @param flatbuffers.Encoding= optionalEncoding | ||
* @returns string|Uint8Array|null | ||
*/ | ||
path(): string | null; | ||
path(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; | ||
/** | ||
* @param number index | ||
* @param __std.FileInfo= obj | ||
* @returns __std.FileInfo | ||
*/ | ||
files(index: number, obj?: __std.FileInfo): __std.FileInfo | null; | ||
/** | ||
* @returns number | ||
*/ | ||
filesLength(): number; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startDirectory(builder: flatbuffers.Builder): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset nameOffset | ||
*/ | ||
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset pathOffset | ||
*/ | ||
static addPath(builder: flatbuffers.Builder, pathOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset filesOffset | ||
*/ | ||
static addFiles(builder: flatbuffers.Builder, filesOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param Array.<flatbuffers.Offset> data | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static createFilesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param number numElems | ||
*/ | ||
static startFilesVector(builder: flatbuffers.Builder, numElems: number): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endDirectory(builder: flatbuffers.Builder): flatbuffers.Offset; | ||
} | ||
} | ||
/** | ||
* @constructor | ||
*/ | ||
export declare namespace __std { | ||
class FileInfoArgs { | ||
bb: flatbuffers.ByteBuffer | null; | ||
bb_pos: number; | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns FileInfoArgs | ||
*/ | ||
__init(i: number, bb: flatbuffers.ByteBuffer): FileInfoArgs; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param FileInfoArgs= obj | ||
* @returns FileInfoArgs | ||
*/ | ||
static getRootAsFileInfoArgs(bb: flatbuffers.ByteBuffer, obj?: FileInfoArgs): FileInfoArgs; | ||
/** | ||
* @param flatbuffers.Encoding= optionalEncoding | ||
* @returns string|Uint8Array|null | ||
*/ | ||
path(): string | null; | ||
path(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; | ||
/** | ||
* @param flatbuffers.Encoding= optionalEncoding | ||
* @returns string|Uint8Array|null | ||
*/ | ||
module(): string | null; | ||
module(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startFileInfoArgs(builder: flatbuffers.Builder): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset pathOffset | ||
*/ | ||
static addPath(builder: flatbuffers.Builder, pathOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset moduleOffset | ||
*/ | ||
static addModule(builder: flatbuffers.Builder, moduleOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endFileInfoArgs(builder: flatbuffers.Builder): flatbuffers.Offset; | ||
} | ||
} | ||
/** | ||
* @constructor | ||
*/ | ||
export declare namespace __std { | ||
class ListArgs { | ||
bb: flatbuffers.ByteBuffer | null; | ||
bb_pos: number; | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns ListArgs | ||
*/ | ||
__init(i: number, bb: flatbuffers.ByteBuffer): ListArgs; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param ListArgs= obj | ||
* @returns ListArgs | ||
*/ | ||
static getRootAsListArgs(bb: flatbuffers.ByteBuffer, obj?: ListArgs): ListArgs; | ||
/** | ||
* @param flatbuffers.Encoding= optionalEncoding | ||
* @returns string|Uint8Array|null | ||
*/ | ||
path(): string | null; | ||
path(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; | ||
/** | ||
* @param flatbuffers.Encoding= optionalEncoding | ||
* @returns string|Uint8Array|null | ||
*/ | ||
module(): string | null; | ||
module(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startListArgs(builder: flatbuffers.Builder): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset pathOffset | ||
*/ | ||
static addPath(builder: flatbuffers.Builder, pathOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset moduleOffset | ||
*/ | ||
static addModule(builder: flatbuffers.Builder, moduleOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endListArgs(builder: flatbuffers.Builder): flatbuffers.Offset; | ||
} | ||
} | ||
/** | ||
* @constructor | ||
*/ | ||
export declare namespace __std { | ||
class FileSystemResponse { | ||
bb: flatbuffers.ByteBuffer | null; | ||
bb_pos: number; | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns FileSystemResponse | ||
*/ | ||
__init(i: number, bb: flatbuffers.ByteBuffer): FileSystemResponse; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param FileSystemResponse= obj | ||
* @returns FileSystemResponse | ||
*/ | ||
static getRootAsFileSystemResponse(bb: flatbuffers.ByteBuffer, obj?: FileSystemResponse): FileSystemResponse; | ||
/** | ||
* @returns __std.FileSystemRetval | ||
*/ | ||
retvalType(): __std.FileSystemRetval; | ||
/** | ||
* @param flatbuffers.Table obj | ||
* @returns ?flatbuffers.Table | ||
*/ | ||
retval<T extends flatbuffers.Table>(obj: T): T | null; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startFileSystemResponse(builder: flatbuffers.Builder): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param __std.FileSystemRetval retvalType | ||
*/ | ||
static addRetvalType(builder: flatbuffers.Builder, retvalType: __std.FileSystemRetval): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset retvalOffset | ||
*/ | ||
static addRetval(builder: flatbuffers.Builder, retvalOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endFileSystemResponse(builder: flatbuffers.Builder): flatbuffers.Offset; | ||
} | ||
} | ||
/** | ||
* @constructor | ||
*/ | ||
export declare namespace __std { | ||
class WriteArgs { | ||
@@ -779,5 +507,5 @@ bb: flatbuffers.ByteBuffer | null; | ||
/** | ||
* @returns boolean | ||
* @returns __std.Overwrite | ||
*/ | ||
overwrite(): boolean; | ||
overwrite(): __std.Overwrite; | ||
/** | ||
@@ -809,5 +537,5 @@ * @param flatbuffers.Builder builder | ||
* @param flatbuffers.Builder builder | ||
* @param boolean overwrite | ||
* @param __std.Overwrite overwrite | ||
*/ | ||
static addOverwrite(builder: flatbuffers.Builder, overwrite: boolean): void; | ||
static addOverwrite(builder: flatbuffers.Builder, overwrite: __std.Overwrite): void; | ||
/** | ||
@@ -1241,5 +969,222 @@ * @param flatbuffers.Builder builder | ||
/** | ||
* RPCSerialised is a `JSON.stringify`d value, used for everything but byte | ||
* | ||
* @constructor | ||
*/ | ||
export declare namespace __std { | ||
class RPCSerialised { | ||
bb: flatbuffers.ByteBuffer | null; | ||
bb_pos: number; | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns RPCSerialised | ||
*/ | ||
__init(i: number, bb: flatbuffers.ByteBuffer): RPCSerialised; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param RPCSerialised= obj | ||
* @returns RPCSerialised | ||
*/ | ||
static getRootAsRPCSerialised(bb: flatbuffers.ByteBuffer, obj?: RPCSerialised): RPCSerialised; | ||
/** | ||
* @param flatbuffers.Encoding= optionalEncoding | ||
* @returns string|Uint8Array|null | ||
*/ | ||
value(): string | null; | ||
value(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startRPCSerialised(builder: flatbuffers.Builder): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset valueOffset | ||
*/ | ||
static addValue(builder: flatbuffers.Builder, valueOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endRPCSerialised(builder: flatbuffers.Builder): flatbuffers.Offset; | ||
} | ||
} | ||
/** | ||
* @constructor | ||
*/ | ||
export declare namespace __std { | ||
class RPCArg { | ||
bb: flatbuffers.ByteBuffer | null; | ||
bb_pos: number; | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns RPCArg | ||
*/ | ||
__init(i: number, bb: flatbuffers.ByteBuffer): RPCArg; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param RPCArg= obj | ||
* @returns RPCArg | ||
*/ | ||
static getRootAsRPCArg(bb: flatbuffers.ByteBuffer, obj?: RPCArg): RPCArg; | ||
/** | ||
* @returns __std.RPCValue | ||
*/ | ||
argType(): __std.RPCValue; | ||
/** | ||
* @param flatbuffers.Table obj | ||
* @returns ?flatbuffers.Table | ||
*/ | ||
arg<T extends flatbuffers.Table>(obj: T): T | null; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startRPCArg(builder: flatbuffers.Builder): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param __std.RPCValue argType | ||
*/ | ||
static addArgType(builder: flatbuffers.Builder, argType: __std.RPCValue): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset argOffset | ||
*/ | ||
static addArg(builder: flatbuffers.Builder, argOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endRPCArg(builder: flatbuffers.Builder): flatbuffers.Offset; | ||
} | ||
} | ||
/** | ||
* @constructor | ||
*/ | ||
export declare namespace __std { | ||
class RPCArgs { | ||
bb: flatbuffers.ByteBuffer | null; | ||
bb_pos: number; | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns RPCArgs | ||
*/ | ||
__init(i: number, bb: flatbuffers.ByteBuffer): RPCArgs; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param RPCArgs= obj | ||
* @returns RPCArgs | ||
*/ | ||
static getRootAsRPCArgs(bb: flatbuffers.ByteBuffer, obj?: RPCArgs): RPCArgs; | ||
/** | ||
* @param flatbuffers.Encoding= optionalEncoding | ||
* @returns string|Uint8Array|null | ||
*/ | ||
method(): string | null; | ||
method(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null; | ||
/** | ||
* @param number index | ||
* @param __std.RPCArg= obj | ||
* @returns __std.RPCArg | ||
*/ | ||
args(index: number, obj?: __std.RPCArg): __std.RPCArg | null; | ||
/** | ||
* @returns number | ||
*/ | ||
argsLength(): number; | ||
/** | ||
* @returns boolean | ||
*/ | ||
sync(): boolean; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startRPCArgs(builder: flatbuffers.Builder): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset methodOffset | ||
*/ | ||
static addMethod(builder: flatbuffers.Builder, methodOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset argsOffset | ||
*/ | ||
static addArgs(builder: flatbuffers.Builder, argsOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param Array.<flatbuffers.Offset> data | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static createArgsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param number numElems | ||
*/ | ||
static startArgsVector(builder: flatbuffers.Builder, numElems: number): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param boolean sync | ||
*/ | ||
static addSync(builder: flatbuffers.Builder, sync: boolean): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endRPCArgs(builder: flatbuffers.Builder): flatbuffers.Offset; | ||
} | ||
} | ||
/** | ||
* @constructor | ||
*/ | ||
export declare namespace __std { | ||
class RPCSyncResponse { | ||
bb: flatbuffers.ByteBuffer | null; | ||
bb_pos: number; | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns RPCSyncResponse | ||
*/ | ||
__init(i: number, bb: flatbuffers.ByteBuffer): RPCSyncResponse; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param RPCSyncResponse= obj | ||
* @returns RPCSyncResponse | ||
*/ | ||
static getRootAsRPCSyncResponse(bb: flatbuffers.ByteBuffer, obj?: RPCSyncResponse): RPCSyncResponse; | ||
/** | ||
* @returns __std.RPCSyncRetval | ||
*/ | ||
retvalType(): __std.RPCSyncRetval; | ||
/** | ||
* @param flatbuffers.Table obj | ||
* @returns ?flatbuffers.Table | ||
*/ | ||
retval<T extends flatbuffers.Table>(obj: T): T | null; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startRPCSyncResponse(builder: flatbuffers.Builder): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param __std.RPCSyncRetval retvalType | ||
*/ | ||
static addRetvalType(builder: flatbuffers.Builder, retvalType: __std.RPCSyncRetval): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset retvalOffset | ||
*/ | ||
static addRetval(builder: flatbuffers.Builder, retvalOffset: flatbuffers.Offset): void; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endRPCSyncResponse(builder: flatbuffers.Builder): flatbuffers.Offset; | ||
} | ||
} | ||
/** | ||
* @constructor | ||
*/ | ||
export declare namespace __std { | ||
class Message { | ||
@@ -1246,0 +1191,0 @@ bb: flatbuffers.ByteBuffer | null; |
@@ -32,15 +32,2 @@ // automatically generated by the FlatBuffers compiler, do not modify | ||
(function (__std) { | ||
let FileSystemRetval; | ||
(function (FileSystemRetval) { | ||
FileSystemRetval[FileSystemRetval["NONE"] = 0] = "NONE"; | ||
FileSystemRetval[FileSystemRetval["FileInfo"] = 1] = "FileInfo"; | ||
FileSystemRetval[FileSystemRetval["Directory"] = 2] = "Directory"; | ||
FileSystemRetval[FileSystemRetval["Error"] = 3] = "Error"; | ||
})(FileSystemRetval = __std.FileSystemRetval || (__std.FileSystemRetval = {})); | ||
})(__std || (__std = {})); | ||
; | ||
/** | ||
* @enum | ||
*/ | ||
(function (__std) { | ||
let Format; | ||
@@ -59,2 +46,14 @@ (function (Format) { | ||
/** | ||
* @enum | ||
*/ | ||
(function (__std) { | ||
let Overwrite; | ||
(function (Overwrite) { | ||
Overwrite[Overwrite["Skip"] = 0] = "Skip"; | ||
Overwrite[Overwrite["Write"] = 1] = "Write"; | ||
Overwrite[Overwrite["Err"] = 2] = "Err"; | ||
})(Overwrite = __std.Overwrite || (__std.Overwrite = {})); | ||
})(__std || (__std = {})); | ||
; | ||
/** | ||
* Encoding specifies the requested form of the contents to read; | ||
@@ -117,5 +116,31 @@ * either just the raw bytes, or as a UTF-16 string. Distinguishing | ||
/** | ||
* RPCValue is a union of the types that can be sent as arguments. | ||
* | ||
* @enum | ||
*/ | ||
(function (__std) { | ||
let RPCValue; | ||
(function (RPCValue) { | ||
RPCValue[RPCValue["NONE"] = 0] = "NONE"; | ||
RPCValue[RPCValue["RPCSerialised"] = 1] = "RPCSerialised"; | ||
RPCValue[RPCValue["Data"] = 2] = "Data"; | ||
})(RPCValue = __std.RPCValue || (__std.RPCValue = {})); | ||
})(__std || (__std = {})); | ||
; | ||
/** | ||
* @enum | ||
*/ | ||
(function (__std) { | ||
let RPCSyncRetval; | ||
(function (RPCSyncRetval) { | ||
RPCSyncRetval[RPCSyncRetval["NONE"] = 0] = "NONE"; | ||
RPCSyncRetval[RPCSyncRetval["Data"] = 1] = "Data"; | ||
RPCSyncRetval[RPCSyncRetval["Error"] = 2] = "Error"; | ||
})(RPCSyncRetval = __std.RPCSyncRetval || (__std.RPCSyncRetval = {})); | ||
})(__std || (__std = {})); | ||
; | ||
/** | ||
* @enum | ||
*/ | ||
(function (__std) { | ||
let Args; | ||
@@ -129,5 +154,4 @@ (function (Args) { | ||
Args[Args["CancelArgs"] = 5] = "CancelArgs"; | ||
Args[Args["FileInfoArgs"] = 6] = "FileInfoArgs"; | ||
Args[Args["ListArgs"] = 7] = "ListArgs"; | ||
Args[Args["ParamArgs"] = 8] = "ParamArgs"; | ||
Args[Args["ParamArgs"] = 6] = "ParamArgs"; | ||
Args[Args["RPCArgs"] = 7] = "RPCArgs"; | ||
})(Args = __std.Args || (__std.Args = {})); | ||
@@ -671,3 +695,3 @@ })(__std || (__std = {})); | ||
(function (__std) { | ||
class FileInfo { | ||
class WriteArgs { | ||
constructor() { | ||
@@ -680,3 +704,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns FileInfo | ||
* @returns WriteArgs | ||
*/ | ||
@@ -691,10 +715,10 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param FileInfo= obj | ||
* @returns FileInfo | ||
* @param WriteArgs= obj | ||
* @returns WriteArgs | ||
*/ | ||
static getRootAsFileInfo(bb, obj) { | ||
return (obj || new FileInfo).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsWriteArgs(bb, obj) { | ||
return (obj || new WriteArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
name(optionalEncoding) { | ||
path(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
@@ -704,3 +728,3 @@ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
; | ||
path(optionalEncoding) { | ||
value(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
@@ -711,22 +735,30 @@ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
/** | ||
* @returns boolean | ||
* @returns __std.Format | ||
*/ | ||
isdir() { | ||
format() { | ||
var offset = this.bb.__offset(this.bb_pos, 8); | ||
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.Format.FromExtension; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns number | ||
*/ | ||
static startFileInfo(builder) { | ||
builder.startObject(3); | ||
indent() { | ||
var offset = this.bb.__offset(this.bb_pos, 10); | ||
return offset ? this.bb.readInt8(this.bb_pos + offset) : 0; | ||
} | ||
; | ||
/** | ||
* @returns __std.Overwrite | ||
*/ | ||
overwrite() { | ||
var offset = this.bb.__offset(this.bb_pos, 12); | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.Overwrite.Skip; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset nameOffset | ||
*/ | ||
static addName(builder, nameOffset) { | ||
builder.addFieldOffset(0, nameOffset, 0); | ||
static startWriteArgs(builder) { | ||
builder.startObject(5); | ||
} | ||
@@ -739,3 +771,3 @@ ; | ||
static addPath(builder, pathOffset) { | ||
builder.addFieldOffset(1, pathOffset, 0); | ||
builder.addFieldOffset(0, pathOffset, 0); | ||
} | ||
@@ -745,6 +777,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param boolean isdir | ||
* @param flatbuffers.Offset valueOffset | ||
*/ | ||
static addIsdir(builder, isdir) { | ||
builder.addFieldInt8(2, +isdir, +false); | ||
static addValue(builder, valueOffset) { | ||
builder.addFieldOffset(1, valueOffset, 0); | ||
} | ||
@@ -754,5 +786,29 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param __std.Format format | ||
*/ | ||
static addFormat(builder, format) { | ||
builder.addFieldInt8(2, format, __std.Format.FromExtension); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param number indent | ||
*/ | ||
static addIndent(builder, indent) { | ||
builder.addFieldInt8(3, indent, 0); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param __std.Overwrite overwrite | ||
*/ | ||
static addOverwrite(builder, overwrite) { | ||
builder.addFieldInt8(4, overwrite, __std.Overwrite.Skip); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endFileInfo(builder) { | ||
static endWriteArgs(builder) { | ||
var offset = builder.endObject(); | ||
@@ -763,3 +819,3 @@ return offset; | ||
} | ||
__std.FileInfo = FileInfo; | ||
__std.WriteArgs = WriteArgs; | ||
})(__std || (__std = {})); | ||
@@ -770,3 +826,3 @@ /** | ||
(function (__std) { | ||
class Directory { | ||
class ReadArgs { | ||
constructor() { | ||
@@ -779,3 +835,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns Directory | ||
* @returns ReadArgs | ||
*/ | ||
@@ -790,10 +846,10 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param Directory= obj | ||
* @returns Directory | ||
* @param ReadArgs= obj | ||
* @returns ReadArgs | ||
*/ | ||
static getRootAsDirectory(bb, obj) { | ||
return (obj || new Directory).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsReadArgs(bb, obj) { | ||
return (obj || new ReadArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
name(optionalEncoding) { | ||
path(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
@@ -803,30 +859,36 @@ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
; | ||
path(optionalEncoding) { | ||
/** | ||
* @returns number | ||
*/ | ||
timeout() { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0; | ||
} | ||
; | ||
/** | ||
* @param number index | ||
* @param __std.FileInfo= obj | ||
* @returns __std.FileInfo | ||
* @returns __std.Encoding | ||
*/ | ||
files(index, obj) { | ||
encoding() { | ||
var offset = this.bb.__offset(this.bb_pos, 8); | ||
return offset ? (obj || new __std.FileInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.Encoding.Bytes; | ||
} | ||
; | ||
/** | ||
* @returns number | ||
* @returns __std.Format | ||
*/ | ||
filesLength() { | ||
var offset = this.bb.__offset(this.bb_pos, 8); | ||
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; | ||
format() { | ||
var offset = this.bb.__offset(this.bb_pos, 10); | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.Format.FromExtension; | ||
} | ||
; | ||
module(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 12); | ||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startDirectory(builder) { | ||
builder.startObject(3); | ||
static startReadArgs(builder) { | ||
builder.startObject(5); | ||
} | ||
@@ -836,6 +898,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset nameOffset | ||
* @param flatbuffers.Offset pathOffset | ||
*/ | ||
static addName(builder, nameOffset) { | ||
builder.addFieldOffset(0, nameOffset, 0); | ||
static addPath(builder, pathOffset) { | ||
builder.addFieldOffset(0, pathOffset, 0); | ||
} | ||
@@ -845,6 +907,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset pathOffset | ||
* @param number timeout | ||
*/ | ||
static addPath(builder, pathOffset) { | ||
builder.addFieldOffset(1, pathOffset, 0); | ||
static addTimeout(builder, timeout) { | ||
builder.addFieldInt32(1, timeout, 0); | ||
} | ||
@@ -854,6 +916,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset filesOffset | ||
* @param __std.Encoding encoding | ||
*/ | ||
static addFiles(builder, filesOffset) { | ||
builder.addFieldOffset(2, filesOffset, 0); | ||
static addEncoding(builder, encoding) { | ||
builder.addFieldInt8(2, encoding, __std.Encoding.Bytes); | ||
} | ||
@@ -863,11 +925,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param Array.<flatbuffers.Offset> data | ||
* @returns flatbuffers.Offset | ||
* @param __std.Format format | ||
*/ | ||
static createFilesVector(builder, data) { | ||
builder.startVector(4, data.length, 4); | ||
for (var i = data.length - 1; i >= 0; i--) { | ||
builder.addOffset(data[i]); | ||
} | ||
return builder.endVector(); | ||
static addFormat(builder, format) { | ||
builder.addFieldInt8(3, format, __std.Format.FromExtension); | ||
} | ||
@@ -877,6 +934,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param number numElems | ||
* @param flatbuffers.Offset moduleOffset | ||
*/ | ||
static startFilesVector(builder, numElems) { | ||
builder.startVector(4, numElems, 4); | ||
static addModule(builder, moduleOffset) { | ||
builder.addFieldOffset(4, moduleOffset, 0); | ||
} | ||
@@ -888,3 +945,3 @@ ; | ||
*/ | ||
static endDirectory(builder) { | ||
static endReadArgs(builder) { | ||
var offset = builder.endObject(); | ||
@@ -895,3 +952,3 @@ return offset; | ||
} | ||
__std.Directory = Directory; | ||
__std.ReadArgs = ReadArgs; | ||
})(__std || (__std = {})); | ||
@@ -902,3 +959,3 @@ /** | ||
(function (__std) { | ||
class FileInfoArgs { | ||
class ParamArgs { | ||
constructor() { | ||
@@ -911,3 +968,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns FileInfoArgs | ||
* @returns ParamArgs | ||
*/ | ||
@@ -922,7 +979,7 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param FileInfoArgs= obj | ||
* @returns FileInfoArgs | ||
* @param ParamArgs= obj | ||
* @returns ParamArgs | ||
*/ | ||
static getRootAsFileInfoArgs(bb, obj) { | ||
return (obj || new FileInfoArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsParamArgs(bb, obj) { | ||
return (obj || new ParamArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
@@ -935,4 +992,12 @@ ; | ||
; | ||
module(optionalEncoding) { | ||
/** | ||
* @returns __std.ParamType | ||
*/ | ||
type() { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.ParamType.Boolean; | ||
} | ||
; | ||
defaultValue(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 8); | ||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
@@ -944,4 +1009,4 @@ } | ||
*/ | ||
static startFileInfoArgs(builder) { | ||
builder.startObject(2); | ||
static startParamArgs(builder) { | ||
builder.startObject(3); | ||
} | ||
@@ -959,6 +1024,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset moduleOffset | ||
* @param __std.ParamType type | ||
*/ | ||
static addModule(builder, moduleOffset) { | ||
builder.addFieldOffset(1, moduleOffset, 0); | ||
static addType(builder, type) { | ||
builder.addFieldInt8(1, type, __std.ParamType.Boolean); | ||
} | ||
@@ -968,5 +1033,13 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset defaultValueOffset | ||
*/ | ||
static addDefaultValue(builder, defaultValueOffset) { | ||
builder.addFieldOffset(2, defaultValueOffset, 0); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endFileInfoArgs(builder) { | ||
static endParamArgs(builder) { | ||
var offset = builder.endObject(); | ||
@@ -977,3 +1050,3 @@ return offset; | ||
} | ||
__std.FileInfoArgs = FileInfoArgs; | ||
__std.ParamArgs = ParamArgs; | ||
})(__std || (__std = {})); | ||
@@ -984,3 +1057,3 @@ /** | ||
(function (__std) { | ||
class ListArgs { | ||
class ParamValue { | ||
constructor() { | ||
@@ -993,3 +1066,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns ListArgs | ||
* @returns ParamValue | ||
*/ | ||
@@ -1004,10 +1077,10 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param ListArgs= obj | ||
* @returns ListArgs | ||
* @param ParamValue= obj | ||
* @returns ParamValue | ||
*/ | ||
static getRootAsListArgs(bb, obj) { | ||
return (obj || new ListArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsParamValue(bb, obj) { | ||
return (obj || new ParamValue).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
path(optionalEncoding) { | ||
json(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
@@ -1017,12 +1090,7 @@ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
; | ||
module(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startListArgs(builder) { | ||
builder.startObject(2); | ||
static startParamValue(builder) { | ||
builder.startObject(1); | ||
} | ||
@@ -1032,6 +1100,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset pathOffset | ||
* @param flatbuffers.Offset jsonOffset | ||
*/ | ||
static addPath(builder, pathOffset) { | ||
builder.addFieldOffset(0, pathOffset, 0); | ||
static addJson(builder, jsonOffset) { | ||
builder.addFieldOffset(0, jsonOffset, 0); | ||
} | ||
@@ -1041,13 +1109,5 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset moduleOffset | ||
*/ | ||
static addModule(builder, moduleOffset) { | ||
builder.addFieldOffset(1, moduleOffset, 0); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endListArgs(builder) { | ||
static endParamValue(builder) { | ||
var offset = builder.endObject(); | ||
@@ -1058,3 +1118,3 @@ return offset; | ||
} | ||
__std.ListArgs = ListArgs; | ||
__std.ParamValue = ParamValue; | ||
})(__std || (__std = {})); | ||
@@ -1065,3 +1125,3 @@ /** | ||
(function (__std) { | ||
class FileSystemResponse { | ||
class ParamResponse { | ||
constructor() { | ||
@@ -1074,3 +1134,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns FileSystemResponse | ||
* @returns ParamResponse | ||
*/ | ||
@@ -1085,15 +1145,15 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param FileSystemResponse= obj | ||
* @returns FileSystemResponse | ||
* @param ParamResponse= obj | ||
* @returns ParamResponse | ||
*/ | ||
static getRootAsFileSystemResponse(bb, obj) { | ||
return (obj || new FileSystemResponse).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsParamResponse(bb, obj) { | ||
return (obj || new ParamResponse).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
/** | ||
* @returns __std.FileSystemRetval | ||
* @returns __std.ParamRetval | ||
*/ | ||
retvalType() { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
return offset ? /** */ (this.bb.readUint8(this.bb_pos + offset)) : __std.FileSystemRetval.NONE; | ||
return offset ? /** */ (this.bb.readUint8(this.bb_pos + offset)) : __std.ParamRetval.NONE; | ||
} | ||
@@ -1113,3 +1173,3 @@ ; | ||
*/ | ||
static startFileSystemResponse(builder) { | ||
static startParamResponse(builder) { | ||
builder.startObject(2); | ||
@@ -1120,6 +1180,6 @@ } | ||
* @param flatbuffers.Builder builder | ||
* @param __std.FileSystemRetval retvalType | ||
* @param __std.ParamRetval retvalType | ||
*/ | ||
static addRetvalType(builder, retvalType) { | ||
builder.addFieldInt8(0, retvalType, __std.FileSystemRetval.NONE); | ||
builder.addFieldInt8(0, retvalType, __std.ParamRetval.NONE); | ||
} | ||
@@ -1139,3 +1199,3 @@ ; | ||
*/ | ||
static endFileSystemResponse(builder) { | ||
static endParamResponse(builder) { | ||
var offset = builder.endObject(); | ||
@@ -1146,3 +1206,3 @@ return offset; | ||
} | ||
__std.FileSystemResponse = FileSystemResponse; | ||
__std.ParamResponse = ParamResponse; | ||
})(__std || (__std = {})); | ||
@@ -1153,3 +1213,3 @@ /** | ||
(function (__std) { | ||
class WriteArgs { | ||
class ParseArgs { | ||
constructor() { | ||
@@ -1162,3 +1222,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns WriteArgs | ||
* @returns ParseArgs | ||
*/ | ||
@@ -1173,10 +1233,10 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param WriteArgs= obj | ||
* @returns WriteArgs | ||
* @param ParseArgs= obj | ||
* @returns ParseArgs | ||
*/ | ||
static getRootAsWriteArgs(bb, obj) { | ||
return (obj || new WriteArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsParseArgs(bb, obj) { | ||
return (obj || new ParseArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
path(optionalEncoding) { | ||
chars(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
@@ -1186,7 +1246,2 @@ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
; | ||
value(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
} | ||
; | ||
/** | ||
@@ -1196,3 +1251,3 @@ * @returns __std.Format | ||
format() { | ||
var offset = this.bb.__offset(this.bb_pos, 8); | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.Format.FromExtension; | ||
@@ -1202,22 +1257,6 @@ } | ||
/** | ||
* @returns number | ||
*/ | ||
indent() { | ||
var offset = this.bb.__offset(this.bb_pos, 10); | ||
return offset ? this.bb.readInt8(this.bb_pos + offset) : 0; | ||
} | ||
; | ||
/** | ||
* @returns boolean | ||
*/ | ||
overwrite() { | ||
var offset = this.bb.__offset(this.bb_pos, 12); | ||
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startWriteArgs(builder) { | ||
builder.startObject(5); | ||
static startParseArgs(builder) { | ||
builder.startObject(2); | ||
} | ||
@@ -1227,6 +1266,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset pathOffset | ||
* @param flatbuffers.Offset charsOffset | ||
*/ | ||
static addPath(builder, pathOffset) { | ||
builder.addFieldOffset(0, pathOffset, 0); | ||
static addChars(builder, charsOffset) { | ||
builder.addFieldOffset(0, charsOffset, 0); | ||
} | ||
@@ -1236,14 +1275,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset valueOffset | ||
*/ | ||
static addValue(builder, valueOffset) { | ||
builder.addFieldOffset(1, valueOffset, 0); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param __std.Format format | ||
*/ | ||
static addFormat(builder, format) { | ||
builder.addFieldInt8(2, format, __std.Format.FromExtension); | ||
builder.addFieldInt8(1, format, __std.Format.FromExtension); | ||
} | ||
@@ -1253,21 +1284,5 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param number indent | ||
*/ | ||
static addIndent(builder, indent) { | ||
builder.addFieldInt8(3, indent, 0); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param boolean overwrite | ||
*/ | ||
static addOverwrite(builder, overwrite) { | ||
builder.addFieldInt8(4, +overwrite, +false); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endWriteArgs(builder) { | ||
static endParseArgs(builder) { | ||
var offset = builder.endObject(); | ||
@@ -1278,3 +1293,3 @@ return offset; | ||
} | ||
__std.WriteArgs = WriteArgs; | ||
__std.ParseArgs = ParseArgs; | ||
})(__std || (__std = {})); | ||
@@ -1285,3 +1300,3 @@ /** | ||
(function (__std) { | ||
class ReadArgs { | ||
class ParseUnparseData { | ||
constructor() { | ||
@@ -1294,3 +1309,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns ReadArgs | ||
* @returns ParseUnparseData | ||
*/ | ||
@@ -1305,10 +1320,10 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param ReadArgs= obj | ||
* @returns ReadArgs | ||
* @param ParseUnparseData= obj | ||
* @returns ParseUnparseData | ||
*/ | ||
static getRootAsReadArgs(bb, obj) { | ||
return (obj || new ReadArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsParseUnparseData(bb, obj) { | ||
return (obj || new ParseUnparseData).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
path(optionalEncoding) { | ||
data(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
@@ -1319,51 +1334,72 @@ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
/** | ||
* @returns number | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
timeout() { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0; | ||
static startParseUnparseData(builder) { | ||
builder.startObject(1); | ||
} | ||
; | ||
/** | ||
* @returns __std.Encoding | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset dataOffset | ||
*/ | ||
encoding() { | ||
var offset = this.bb.__offset(this.bb_pos, 8); | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.Encoding.Bytes; | ||
static addData(builder, dataOffset) { | ||
builder.addFieldOffset(0, dataOffset, 0); | ||
} | ||
; | ||
/** | ||
* @returns __std.Format | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
format() { | ||
var offset = this.bb.__offset(this.bb_pos, 10); | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.Format.FromExtension; | ||
static endParseUnparseData(builder) { | ||
var offset = builder.endObject(); | ||
return offset; | ||
} | ||
; | ||
module(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 12); | ||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
} | ||
__std.ParseUnparseData = ParseUnparseData; | ||
})(__std || (__std = {})); | ||
/** | ||
* @constructor | ||
*/ | ||
(function (__std) { | ||
class ParseUnparseResponse { | ||
constructor() { | ||
this.bb = null; | ||
this.bb_pos = 0; | ||
} | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns ParseUnparseResponse | ||
*/ | ||
__init(i, bb) { | ||
this.bb_pos = i; | ||
this.bb = bb; | ||
return this; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param ParseUnparseResponse= obj | ||
* @returns ParseUnparseResponse | ||
*/ | ||
static startReadArgs(builder) { | ||
builder.startObject(5); | ||
static getRootAsParseUnparseResponse(bb, obj) { | ||
return (obj || new ParseUnparseResponse).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset pathOffset | ||
* @returns __std.ParseUnparseRetval | ||
*/ | ||
static addPath(builder, pathOffset) { | ||
builder.addFieldOffset(0, pathOffset, 0); | ||
retvalType() { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
return offset ? /** */ (this.bb.readUint8(this.bb_pos + offset)) : __std.ParseUnparseRetval.NONE; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param number timeout | ||
* @param flatbuffers.Table obj | ||
* @returns ?flatbuffers.Table | ||
*/ | ||
static addTimeout(builder, timeout) { | ||
builder.addFieldInt32(1, timeout, 0); | ||
retval(obj) { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? this.bb.__union(obj, this.bb_pos + offset) : null; | ||
} | ||
@@ -1373,6 +1409,5 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param __std.Encoding encoding | ||
*/ | ||
static addEncoding(builder, encoding) { | ||
builder.addFieldInt8(2, encoding, __std.Encoding.Bytes); | ||
static startParseUnparseResponse(builder) { | ||
builder.startObject(2); | ||
} | ||
@@ -1382,6 +1417,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param __std.Format format | ||
* @param __std.ParseUnparseRetval retvalType | ||
*/ | ||
static addFormat(builder, format) { | ||
builder.addFieldInt8(3, format, __std.Format.FromExtension); | ||
static addRetvalType(builder, retvalType) { | ||
builder.addFieldInt8(0, retvalType, __std.ParseUnparseRetval.NONE); | ||
} | ||
@@ -1391,6 +1426,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset moduleOffset | ||
* @param flatbuffers.Offset retvalOffset | ||
*/ | ||
static addModule(builder, moduleOffset) { | ||
builder.addFieldOffset(4, moduleOffset, 0); | ||
static addRetval(builder, retvalOffset) { | ||
builder.addFieldOffset(1, retvalOffset, 0); | ||
} | ||
@@ -1402,3 +1437,3 @@ ; | ||
*/ | ||
static endReadArgs(builder) { | ||
static endParseUnparseResponse(builder) { | ||
var offset = builder.endObject(); | ||
@@ -1409,3 +1444,3 @@ return offset; | ||
} | ||
__std.ReadArgs = ReadArgs; | ||
__std.ParseUnparseResponse = ParseUnparseResponse; | ||
})(__std || (__std = {})); | ||
@@ -1416,3 +1451,3 @@ /** | ||
(function (__std) { | ||
class ParamArgs { | ||
class UnparseArgs { | ||
constructor() { | ||
@@ -1425,3 +1460,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns ParamArgs | ||
* @returns UnparseArgs | ||
*/ | ||
@@ -1436,10 +1471,10 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param ParamArgs= obj | ||
* @returns ParamArgs | ||
* @param UnparseArgs= obj | ||
* @returns UnparseArgs | ||
*/ | ||
static getRootAsParamArgs(bb, obj) { | ||
return (obj || new ParamArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsUnparseArgs(bb, obj) { | ||
return (obj || new UnparseArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
path(optionalEncoding) { | ||
object(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
@@ -1450,19 +1485,14 @@ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
/** | ||
* @returns __std.ParamType | ||
* @returns __std.Format | ||
*/ | ||
type() { | ||
format() { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.ParamType.Boolean; | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.Format.FromExtension; | ||
} | ||
; | ||
defaultValue(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 8); | ||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startParamArgs(builder) { | ||
builder.startObject(3); | ||
static startUnparseArgs(builder) { | ||
builder.startObject(2); | ||
} | ||
@@ -1472,6 +1502,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset pathOffset | ||
* @param flatbuffers.Offset objectOffset | ||
*/ | ||
static addPath(builder, pathOffset) { | ||
builder.addFieldOffset(0, pathOffset, 0); | ||
static addObject(builder, objectOffset) { | ||
builder.addFieldOffset(0, objectOffset, 0); | ||
} | ||
@@ -1481,6 +1511,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param __std.ParamType type | ||
* @param __std.Format format | ||
*/ | ||
static addType(builder, type) { | ||
builder.addFieldInt8(1, type, __std.ParamType.Boolean); | ||
static addFormat(builder, format) { | ||
builder.addFieldInt8(1, format, __std.Format.FromExtension); | ||
} | ||
@@ -1490,13 +1520,5 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset defaultValueOffset | ||
*/ | ||
static addDefaultValue(builder, defaultValueOffset) { | ||
builder.addFieldOffset(2, defaultValueOffset, 0); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endParamArgs(builder) { | ||
static endUnparseArgs(builder) { | ||
var offset = builder.endObject(); | ||
@@ -1507,9 +1529,11 @@ return offset; | ||
} | ||
__std.ParamArgs = ParamArgs; | ||
__std.UnparseArgs = UnparseArgs; | ||
})(__std || (__std = {})); | ||
/** | ||
* RPCSerialised is a `JSON.stringify`d value, used for everything but byte | ||
* | ||
* @constructor | ||
*/ | ||
(function (__std) { | ||
class ParamValue { | ||
class RPCSerialised { | ||
constructor() { | ||
@@ -1522,3 +1546,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns ParamValue | ||
* @returns RPCSerialised | ||
*/ | ||
@@ -1533,10 +1557,10 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param ParamValue= obj | ||
* @returns ParamValue | ||
* @param RPCSerialised= obj | ||
* @returns RPCSerialised | ||
*/ | ||
static getRootAsParamValue(bb, obj) { | ||
return (obj || new ParamValue).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsRPCSerialised(bb, obj) { | ||
return (obj || new RPCSerialised).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
json(optionalEncoding) { | ||
value(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
@@ -1549,3 +1573,3 @@ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
*/ | ||
static startParamValue(builder) { | ||
static startRPCSerialised(builder) { | ||
builder.startObject(1); | ||
@@ -1556,6 +1580,6 @@ } | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset jsonOffset | ||
* @param flatbuffers.Offset valueOffset | ||
*/ | ||
static addJson(builder, jsonOffset) { | ||
builder.addFieldOffset(0, jsonOffset, 0); | ||
static addValue(builder, valueOffset) { | ||
builder.addFieldOffset(0, valueOffset, 0); | ||
} | ||
@@ -1567,3 +1591,3 @@ ; | ||
*/ | ||
static endParamValue(builder) { | ||
static endRPCSerialised(builder) { | ||
var offset = builder.endObject(); | ||
@@ -1574,3 +1598,3 @@ return offset; | ||
} | ||
__std.ParamValue = ParamValue; | ||
__std.RPCSerialised = RPCSerialised; | ||
})(__std || (__std = {})); | ||
@@ -1581,3 +1605,3 @@ /** | ||
(function (__std) { | ||
class ParamResponse { | ||
class RPCArg { | ||
constructor() { | ||
@@ -1590,3 +1614,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns ParamResponse | ||
* @returns RPCArg | ||
*/ | ||
@@ -1601,15 +1625,15 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param ParamResponse= obj | ||
* @returns ParamResponse | ||
* @param RPCArg= obj | ||
* @returns RPCArg | ||
*/ | ||
static getRootAsParamResponse(bb, obj) { | ||
return (obj || new ParamResponse).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsRPCArg(bb, obj) { | ||
return (obj || new RPCArg).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
/** | ||
* @returns __std.ParamRetval | ||
* @returns __std.RPCValue | ||
*/ | ||
retvalType() { | ||
argType() { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
return offset ? /** */ (this.bb.readUint8(this.bb_pos + offset)) : __std.ParamRetval.NONE; | ||
return offset ? /** */ (this.bb.readUint8(this.bb_pos + offset)) : __std.RPCValue.NONE; | ||
} | ||
@@ -1621,3 +1645,3 @@ ; | ||
*/ | ||
retval(obj) { | ||
arg(obj) { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
@@ -1630,3 +1654,3 @@ return offset ? this.bb.__union(obj, this.bb_pos + offset) : null; | ||
*/ | ||
static startParamResponse(builder) { | ||
static startRPCArg(builder) { | ||
builder.startObject(2); | ||
@@ -1637,6 +1661,6 @@ } | ||
* @param flatbuffers.Builder builder | ||
* @param __std.ParamRetval retvalType | ||
* @param __std.RPCValue argType | ||
*/ | ||
static addRetvalType(builder, retvalType) { | ||
builder.addFieldInt8(0, retvalType, __std.ParamRetval.NONE); | ||
static addArgType(builder, argType) { | ||
builder.addFieldInt8(0, argType, __std.RPCValue.NONE); | ||
} | ||
@@ -1646,6 +1670,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset retvalOffset | ||
* @param flatbuffers.Offset argOffset | ||
*/ | ||
static addRetval(builder, retvalOffset) { | ||
builder.addFieldOffset(1, retvalOffset, 0); | ||
static addArg(builder, argOffset) { | ||
builder.addFieldOffset(1, argOffset, 0); | ||
} | ||
@@ -1657,3 +1681,3 @@ ; | ||
*/ | ||
static endParamResponse(builder) { | ||
static endRPCArg(builder) { | ||
var offset = builder.endObject(); | ||
@@ -1664,3 +1688,3 @@ return offset; | ||
} | ||
__std.ParamResponse = ParamResponse; | ||
__std.RPCArg = RPCArg; | ||
})(__std || (__std = {})); | ||
@@ -1671,3 +1695,3 @@ /** | ||
(function (__std) { | ||
class ParseArgs { | ||
class RPCArgs { | ||
constructor() { | ||
@@ -1680,3 +1704,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns ParseArgs | ||
* @returns RPCArgs | ||
*/ | ||
@@ -1691,10 +1715,10 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param ParseArgs= obj | ||
* @returns ParseArgs | ||
* @param RPCArgs= obj | ||
* @returns RPCArgs | ||
*/ | ||
static getRootAsParseArgs(bb, obj) { | ||
return (obj || new ParseArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsRPCArgs(bb, obj) { | ||
return (obj || new RPCArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
chars(optionalEncoding) { | ||
method(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
@@ -1705,22 +1729,25 @@ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
/** | ||
* @returns __std.Format | ||
* @param number index | ||
* @param __std.RPCArg= obj | ||
* @returns __std.RPCArg | ||
*/ | ||
format() { | ||
args(index, obj) { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.Format.FromExtension; | ||
return offset ? (obj || new __std.RPCArg).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns number | ||
*/ | ||
static startParseArgs(builder) { | ||
builder.startObject(2); | ||
argsLength() { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset charsOffset | ||
* @returns boolean | ||
*/ | ||
static addChars(builder, charsOffset) { | ||
builder.addFieldOffset(0, charsOffset, 0); | ||
sync() { | ||
var offset = this.bb.__offset(this.bb_pos, 8); | ||
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; | ||
} | ||
@@ -1730,6 +1757,5 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param __std.Format format | ||
*/ | ||
static addFormat(builder, format) { | ||
builder.addFieldInt8(1, format, __std.Format.FromExtension); | ||
static startRPCArgs(builder) { | ||
builder.startObject(3); | ||
} | ||
@@ -1739,51 +1765,35 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
* @param flatbuffers.Offset methodOffset | ||
*/ | ||
static endParseArgs(builder) { | ||
var offset = builder.endObject(); | ||
return offset; | ||
static addMethod(builder, methodOffset) { | ||
builder.addFieldOffset(0, methodOffset, 0); | ||
} | ||
; | ||
} | ||
__std.ParseArgs = ParseArgs; | ||
})(__std || (__std = {})); | ||
/** | ||
* @constructor | ||
*/ | ||
(function (__std) { | ||
class ParseUnparseData { | ||
constructor() { | ||
this.bb = null; | ||
this.bb_pos = 0; | ||
} | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns ParseUnparseData | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset argsOffset | ||
*/ | ||
__init(i, bb) { | ||
this.bb_pos = i; | ||
this.bb = bb; | ||
return this; | ||
static addArgs(builder, argsOffset) { | ||
builder.addFieldOffset(1, argsOffset, 0); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param ParseUnparseData= obj | ||
* @returns ParseUnparseData | ||
* @param flatbuffers.Builder builder | ||
* @param Array.<flatbuffers.Offset> data | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static getRootAsParseUnparseData(bb, obj) { | ||
return (obj || new ParseUnparseData).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static createArgsVector(builder, data) { | ||
builder.startVector(4, data.length, 4); | ||
for (var i = data.length - 1; i >= 0; i--) { | ||
builder.addOffset(data[i]); | ||
} | ||
return builder.endVector(); | ||
} | ||
; | ||
data(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param number numElems | ||
*/ | ||
static startParseUnparseData(builder) { | ||
builder.startObject(1); | ||
static startArgsVector(builder, numElems) { | ||
builder.startVector(4, numElems, 4); | ||
} | ||
@@ -1793,6 +1803,6 @@ ; | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset dataOffset | ||
* @param boolean sync | ||
*/ | ||
static addData(builder, dataOffset) { | ||
builder.addFieldOffset(0, dataOffset, 0); | ||
static addSync(builder, sync) { | ||
builder.addFieldInt8(2, +sync, +false); | ||
} | ||
@@ -1804,3 +1814,3 @@ ; | ||
*/ | ||
static endParseUnparseData(builder) { | ||
static endRPCArgs(builder) { | ||
var offset = builder.endObject(); | ||
@@ -1811,3 +1821,3 @@ return offset; | ||
} | ||
__std.ParseUnparseData = ParseUnparseData; | ||
__std.RPCArgs = RPCArgs; | ||
})(__std || (__std = {})); | ||
@@ -1818,3 +1828,3 @@ /** | ||
(function (__std) { | ||
class ParseUnparseResponse { | ||
class RPCSyncResponse { | ||
constructor() { | ||
@@ -1827,3 +1837,3 @@ this.bb = null; | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns ParseUnparseResponse | ||
* @returns RPCSyncResponse | ||
*/ | ||
@@ -1838,15 +1848,15 @@ __init(i, bb) { | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param ParseUnparseResponse= obj | ||
* @returns ParseUnparseResponse | ||
* @param RPCSyncResponse= obj | ||
* @returns RPCSyncResponse | ||
*/ | ||
static getRootAsParseUnparseResponse(bb, obj) { | ||
return (obj || new ParseUnparseResponse).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
static getRootAsRPCSyncResponse(bb, obj) { | ||
return (obj || new RPCSyncResponse).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
/** | ||
* @returns __std.ParseUnparseRetval | ||
* @returns __std.RPCSyncRetval | ||
*/ | ||
retvalType() { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
return offset ? /** */ (this.bb.readUint8(this.bb_pos + offset)) : __std.ParseUnparseRetval.NONE; | ||
return offset ? /** */ (this.bb.readUint8(this.bb_pos + offset)) : __std.RPCSyncRetval.NONE; | ||
} | ||
@@ -1866,3 +1876,3 @@ ; | ||
*/ | ||
static startParseUnparseResponse(builder) { | ||
static startRPCSyncResponse(builder) { | ||
builder.startObject(2); | ||
@@ -1873,6 +1883,6 @@ } | ||
* @param flatbuffers.Builder builder | ||
* @param __std.ParseUnparseRetval retvalType | ||
* @param __std.RPCSyncRetval retvalType | ||
*/ | ||
static addRetvalType(builder, retvalType) { | ||
builder.addFieldInt8(0, retvalType, __std.ParseUnparseRetval.NONE); | ||
builder.addFieldInt8(0, retvalType, __std.RPCSyncRetval.NONE); | ||
} | ||
@@ -1892,3 +1902,3 @@ ; | ||
*/ | ||
static endParseUnparseResponse(builder) { | ||
static endRPCSyncResponse(builder) { | ||
var offset = builder.endObject(); | ||
@@ -1899,3 +1909,3 @@ return offset; | ||
} | ||
__std.ParseUnparseResponse = ParseUnparseResponse; | ||
__std.RPCSyncResponse = RPCSyncResponse; | ||
})(__std || (__std = {})); | ||
@@ -1906,79 +1916,2 @@ /** | ||
(function (__std) { | ||
class UnparseArgs { | ||
constructor() { | ||
this.bb = null; | ||
this.bb_pos = 0; | ||
} | ||
/** | ||
* @param number i | ||
* @param flatbuffers.ByteBuffer bb | ||
* @returns UnparseArgs | ||
*/ | ||
__init(i, bb) { | ||
this.bb_pos = i; | ||
this.bb = bb; | ||
return this; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.ByteBuffer bb | ||
* @param UnparseArgs= obj | ||
* @returns UnparseArgs | ||
*/ | ||
static getRootAsUnparseArgs(bb, obj) { | ||
return (obj || new UnparseArgs).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
; | ||
object(optionalEncoding) { | ||
var offset = this.bb.__offset(this.bb_pos, 4); | ||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; | ||
} | ||
; | ||
/** | ||
* @returns __std.Format | ||
*/ | ||
format() { | ||
var offset = this.bb.__offset(this.bb_pos, 6); | ||
return offset ? /** */ (this.bb.readInt8(this.bb_pos + offset)) : __std.Format.FromExtension; | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
*/ | ||
static startUnparseArgs(builder) { | ||
builder.startObject(2); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param flatbuffers.Offset objectOffset | ||
*/ | ||
static addObject(builder, objectOffset) { | ||
builder.addFieldOffset(0, objectOffset, 0); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @param __std.Format format | ||
*/ | ||
static addFormat(builder, format) { | ||
builder.addFieldInt8(1, format, __std.Format.FromExtension); | ||
} | ||
; | ||
/** | ||
* @param flatbuffers.Builder builder | ||
* @returns flatbuffers.Offset | ||
*/ | ||
static endUnparseArgs(builder) { | ||
var offset = builder.endObject(); | ||
return offset; | ||
} | ||
; | ||
} | ||
__std.UnparseArgs = UnparseArgs; | ||
})(__std || (__std = {})); | ||
/** | ||
* @constructor | ||
*/ | ||
(function (__std) { | ||
class Message { | ||
@@ -1985,0 +1918,0 @@ constructor() { |
@@ -1,4 +0,4 @@ | ||
import { __std } from '__std_generated'; | ||
import { flatbuffers } from 'flatbuffers'; | ||
const deferreds = {}; | ||
import { __std } from './__std_generated'; | ||
import { flatbuffers } from './flatbuffers'; | ||
const deferreds = new Map(); | ||
function recv(buf) { | ||
@@ -12,3 +12,3 @@ const data = new flatbuffers.ByteBuffer(new Uint8Array(buf)); | ||
case __std.FulfilmentValue.Data: { | ||
({ data: callback } = deferreds[ser]); | ||
({ data: callback } = deferreds.get(ser)); | ||
const val = new __std.Data(); | ||
@@ -20,10 +20,14 @@ reso.value(val); | ||
case __std.FulfilmentValue.Error: { | ||
({ error: callback } = deferreds[ser]); | ||
const { error: errorCallback } = deferreds.get(ser); | ||
if (errorCallback === undefined) { | ||
return; | ||
} | ||
const err = new __std.Error(); | ||
reso.value(err); | ||
value = new Error(err.message()); | ||
break; | ||
const error = new Error(err.message()); | ||
errorCallback(error); | ||
return; | ||
} | ||
case __std.FulfilmentValue.EndOfStream: | ||
({ end: callback } = deferreds[ser]); | ||
({ end: callback } = deferreds.get(ser)); | ||
break; | ||
@@ -40,2 +44,4 @@ default: | ||
} | ||
// `recv` is our handler for bytes sent ad-hoc from the runtime. | ||
V8Worker2.recv(recv); | ||
// registerCallbacks records callbacks for the three possible outcomes | ||
@@ -45,3 +51,3 @@ // of a deferred, which is identified by a serial number returned from | ||
function registerCallbacks(serial, onData, onError, onEnd) { | ||
deferreds[serial] = { data: onData, error: onError, end: onEnd }; | ||
deferreds.set(serial, { data: onData, error: onError, end: onEnd }); | ||
} | ||
@@ -51,4 +57,7 @@ function panic(msg) { | ||
} | ||
// TODO(michael): consider factoring the V8Worker.send(...) calls into | ||
// a function here as well. | ||
// sendRequest sends an ArrayBuffer to the jk runtime and returns the | ||
// ArrayBuffer response. | ||
function sendRequest(buf) { | ||
return V8Worker2.send(buf); | ||
} | ||
// requestAsPromise performs the request given, and wraps the deferred | ||
@@ -75,3 +84,3 @@ // result in a promise. If the request provokes an error, the Promise | ||
function removeThenCall(v) { | ||
delete deferreds[ser]; | ||
deferreds.delete(ser); | ||
return this(v); | ||
@@ -85,3 +94,3 @@ } | ||
} | ||
const ondata = bytes => resolve(tx(bytes)); | ||
const ondata = (bytes) => resolve(tx(bytes)); | ||
registerCallbacks(ser, removeThenCall.bind(ondata), removeThenCall.bind(rejectWithStack), removeThenCall.bind(panic('Unexpected EndOfStream for promisified deferred'))); | ||
@@ -97,4 +106,4 @@ }); | ||
const builder = new flatbuffers.Builder(512); | ||
__std.ReadArgs.startCancelArgs(builder); | ||
__std.ReadArgs.addSerial(builder, serial); | ||
__std.CancelArgs.startCancelArgs(builder); | ||
__std.CancelArgs.addSerial(builder, builder.createLong(serial, 0)); | ||
const argsOffset = __std.CancelArgs.endCancelArgs(builder); | ||
@@ -106,5 +115,4 @@ __std.Message.startMessage(builder); | ||
builder.finish(messageOffset); | ||
return V8Worker2.send(builder.asArrayBuffer()); | ||
return sendRequest(builder.asArrayBuffer()); | ||
} | ||
V8Worker2.recv(recv); | ||
export { requestAsPromise, cancel, }; | ||
export { requestAsPromise, sendRequest, cancel, }; |
/** | ||
* @module std | ||
*/ | ||
import { WriteOptions } from './write'; | ||
export declare function log(value: any, options?: WriteOptions): void; | ||
export declare function log(value: any): void; |
11
log.js
/** | ||
* @module std | ||
*/ | ||
import { write } from './write'; | ||
export function log(value, options) { | ||
export function log(value) { | ||
if (value === undefined) { | ||
V8Worker2.print('undefined'); | ||
V8Worker2.log('undefined'); | ||
return; | ||
} | ||
write(value, '', options); | ||
if (typeof value === 'string') { | ||
V8Worker2.log(value); | ||
return; | ||
} | ||
V8Worker2.log(JSON.stringify(value)); | ||
} |
{ | ||
"name": "@jkcfg/std", | ||
"version": "0.3.0", | ||
"version": "0.3.2", | ||
"description": "jk standard library", | ||
@@ -5,0 +5,0 @@ "main": "std.js", |
@@ -6,2 +6,3 @@ /** | ||
import { __std } from './internal/__std_generated'; | ||
import { sendRequest } from './internal/deferred'; | ||
function getParameter(type, path, defaultValue) { | ||
@@ -26,3 +27,3 @@ const builder = new flatbuffers.Builder(512); | ||
builder.finish(messageOffset); | ||
const bytes = V8Worker2.send(builder.asArrayBuffer()); | ||
const bytes = sendRequest(builder.asArrayBuffer()); | ||
const buf = new flatbuffers.ByteBuffer(new Uint8Array(bytes)); | ||
@@ -29,0 +30,0 @@ const resp = __std.ParamResponse.getRootAsParamResponse(buf); |
@@ -6,2 +6,3 @@ /** | ||
import { __std } from './internal/__std_generated'; | ||
import { sendRequest } from './internal/deferred'; | ||
export function parse(input, format) { | ||
@@ -20,3 +21,3 @@ const builder = new flatbuffers.Builder(512); | ||
builder.finish(__std.Message.endMessage(builder)); | ||
const buf = V8Worker2.send(builder.asArrayBuffer()); | ||
const buf = sendRequest(builder.asArrayBuffer()); | ||
const data = new flatbuffers.ByteBuffer(new Uint8Array(buf)); | ||
@@ -52,3 +53,3 @@ const resp = __std.ParseUnparseResponse.getRootAsParseUnparseResponse(data); | ||
builder.finish(__std.Message.endMessage(builder)); | ||
const buf = V8Worker2.send(builder.asArrayBuffer()); | ||
const buf = sendRequest(builder.asArrayBuffer()); | ||
const data = new flatbuffers.ByteBuffer(new Uint8Array(buf)); | ||
@@ -55,0 +56,0 @@ const resp = __std.ParseUnparseResponse.getRootAsParseUnparseResponse(data); |
16
read.js
/** | ||
* @module std | ||
*/ | ||
import { requestAsPromise } from './internal/deferred'; | ||
import { requestAsPromise, sendRequest } from './internal/deferred'; | ||
import { ident, stringFromUTF16Bytes, valueFromUTF16Bytes, } from './internal/data'; | ||
import { flatbuffers } from './internal/flatbuffers'; | ||
@@ -15,7 +16,2 @@ import { __std } from './internal/__std_generated'; | ||
})(Encoding || (Encoding = {})); | ||
function uint8ToUint16Array(bytes) { | ||
return new Uint16Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 2); | ||
} | ||
const compose = (f, g) => (x) => f(g(x)); | ||
const stringify = (bytes) => String.fromCodePoint(...uint8ToUint16Array(bytes)); | ||
// read requests the path and returns a promise that will be resolved | ||
@@ -44,9 +40,9 @@ // with the contents at the path, or rejected. | ||
builder.finish(messageOffset); | ||
let tx = (bytes) => bytes; | ||
let tx = ident; | ||
switch (encoding) { | ||
case Encoding.String: | ||
tx = stringify; | ||
tx = stringFromUTF16Bytes; | ||
break; | ||
case Encoding.JSON: | ||
tx = compose(JSON.parse, stringify); | ||
tx = valueFromUTF16Bytes; | ||
break; | ||
@@ -56,3 +52,3 @@ default: | ||
} | ||
return requestAsPromise(() => V8Worker2.send(builder.asArrayBuffer()), tx); | ||
return requestAsPromise(() => sendRequest(builder.asArrayBuffer()), tx); | ||
} |
@@ -26,4 +26,4 @@ # jk | ||
- [A Kubernetes deployment written in Typescript][guestbook-ts] | ||
- [Mutating objects with mixins][mixins-example] | ||
- [Kustomize-like behavior][kustomize] | ||
- [Generating Kubernetes objects, using e.g., kustomize-like behavior][k8s-examples] | ||
- [Using jk with JavaScript libraries][js-examples] | ||
@@ -52,4 +52,4 @@ ## Architecture & design | ||
- [mixins][mixins]: build and compose configuration objects | ||
- [kubernetes][kubernetes]: build Kubernetes objects | ||
- [grafana][grafana]: build dashboard configs for Grafana | ||
@@ -68,7 +68,7 @@ ## Roadmap | ||
[quick-start]: https://jkcfg.github.io/#/documentation/quick-start | ||
[mixins]: https://github.com/jkcfg/mixins | ||
[grafana]: https://github.com/jkcfg/grafana | ||
[kubernetes]: https://github.com/jkcfg/kubernetes | ||
[guestbook-ts]: https://github.com/jkcfg/kubernetes/blob/master/examples/guestbook-ts | ||
[mixins-example]: https://github.com/jkcfg/mixins/blob/master/examples/mix-simple/namespace.js | ||
[kustomize]: https://github.com/jkcfg/kubernetes/tree/master/examples/overlay | ||
[js-examples]: https://github.com/jkcfg/jk/tree/master/examples | ||
[k8s-examples]: https://github.com/jkcfg/jk/tree/master/examples/kubernetes | ||
[v8worker2]: https://github.com/ry/v8worker2 | ||
@@ -93,2 +93,3 @@ [flatbuffers]: https://github.com/google/flatbuffers | ||
* `make` | ||
* `pkg-config` | ||
@@ -115,2 +116,4 @@ First off, clone this repository: | ||
# these following put files in /usr/local, so you may need sudo | ||
# x64 Linux: | ||
@@ -117,0 +120,0 @@ $ make install-linux-amd64 |
@@ -13,7 +13,13 @@ /** | ||
} | ||
export declare enum Overwrite { | ||
Skip = 0, | ||
Write = 1, | ||
Err = 2 | ||
} | ||
export interface WriteOptions { | ||
format?: Format; | ||
indent?: number; | ||
overwrite?: boolean; | ||
overwrite?: Overwrite | boolean; | ||
} | ||
export declare function write(value: any, path?: string, { format, indent, overwrite }?: WriteOptions): void; | ||
export declare function print(value: any, opts: WriteOptions): void; |
34
write.js
@@ -6,2 +6,3 @@ /** | ||
import { flatbuffers } from './internal/flatbuffers'; | ||
import { sendRequest } from './internal/deferred'; | ||
/* we re-define Format from the generated __std.Format to document it */ | ||
@@ -18,6 +19,19 @@ export var Format; | ||
})(Format || (Format = {})); | ||
export function write(value, path = '', { format = Format.FromExtension, indent = 2, overwrite = true } = {}) { | ||
export var Overwrite; | ||
(function (Overwrite) { | ||
Overwrite[Overwrite["Skip"] = 0] = "Skip"; | ||
Overwrite[Overwrite["Write"] = 1] = "Write"; | ||
Overwrite[Overwrite["Err"] = 2] = "Err"; | ||
})(Overwrite || (Overwrite = {})); | ||
export function write(value, path = '', { format = Format.FromExtension, indent = 2, overwrite = Overwrite.Write } = {}) { | ||
if (value === undefined) { | ||
throw TypeError('cannot write undefined value'); | ||
} | ||
let overwriteVal; | ||
if (typeof overwrite === 'boolean') { | ||
overwriteVal = overwrite ? Overwrite.Write : Overwrite.Skip; | ||
} | ||
else { | ||
overwriteVal = overwrite; | ||
} | ||
const builder = new flatbuffers.Builder(1024); | ||
@@ -32,3 +46,3 @@ const str = (format === Format.Raw) ? value.toString() : JSON.stringify(value); | ||
__std.WriteArgs.addIndent(builder, indent); | ||
__std.WriteArgs.addOverwrite(builder, overwrite); | ||
__std.WriteArgs.addOverwrite(builder, overwriteVal); | ||
const args = __std.WriteArgs.endWriteArgs(builder); | ||
@@ -40,3 +54,17 @@ __std.Message.startMessage(builder); | ||
builder.finish(message); | ||
V8Worker2.send(builder.asArrayBuffer()); | ||
const buf = sendRequest(builder.asArrayBuffer()); | ||
if (buf === undefined) { | ||
return; | ||
} | ||
const data = new flatbuffers.ByteBuffer(new Uint8Array(buf)); | ||
const resp = __std.Error.getRootAsError(data); | ||
throw new Error(resp.message()); | ||
} | ||
// print is a convenience for printing any value to stdout | ||
export function print(value, opts) { | ||
if (value === undefined) { | ||
write('undefined\n', '', { format: Format.Raw }); | ||
return; | ||
} | ||
write(value, '', opts); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
200050
43
5959
132
2