spot-sdk-ts
Version:
TypeScript bindings based on protobufs (proto3) provided by Boston Dynamics
528 lines • 19.8 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserData = exports.ConstantValue = exports.VariableDeclaration = exports.Value = exports.KeyValue = exports.variableDeclaration_TypeToJSON = exports.variableDeclaration_TypeFromJSON = exports.VariableDeclaration_Type = exports.resultToJSON = exports.resultFromJSON = exports.Result = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const any_1 = require("../../../google/protobuf/any");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "bosdyn.api.mission";
/** Results from executing / ticking / running a single node. */
var Result;
(function (Result) {
/** RESULT_UNKNOWN - Invalid, should not be used. */
Result[Result["RESULT_UNKNOWN"] = 0] = "RESULT_UNKNOWN";
/** RESULT_FAILURE - The node completed running, but failed. */
Result[Result["RESULT_FAILURE"] = 1] = "RESULT_FAILURE";
/** RESULT_RUNNING - The node is still in process and has not completed. */
Result[Result["RESULT_RUNNING"] = 2] = "RESULT_RUNNING";
/** RESULT_SUCCESS - The node completed, and succeeded. */
Result[Result["RESULT_SUCCESS"] = 3] = "RESULT_SUCCESS";
/** RESULT_ERROR - The node encountered an operational error while trying to execute. */
Result[Result["RESULT_ERROR"] = 4] = "RESULT_ERROR";
Result[Result["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(Result = exports.Result || (exports.Result = {}));
function resultFromJSON(object) {
switch (object) {
case 0:
case "RESULT_UNKNOWN":
return Result.RESULT_UNKNOWN;
case 1:
case "RESULT_FAILURE":
return Result.RESULT_FAILURE;
case 2:
case "RESULT_RUNNING":
return Result.RESULT_RUNNING;
case 3:
case "RESULT_SUCCESS":
return Result.RESULT_SUCCESS;
case 4:
case "RESULT_ERROR":
return Result.RESULT_ERROR;
case -1:
case "UNRECOGNIZED":
default:
return Result.UNRECOGNIZED;
}
}
exports.resultFromJSON = resultFromJSON;
function resultToJSON(object) {
switch (object) {
case Result.RESULT_UNKNOWN:
return "RESULT_UNKNOWN";
case Result.RESULT_FAILURE:
return "RESULT_FAILURE";
case Result.RESULT_RUNNING:
return "RESULT_RUNNING";
case Result.RESULT_SUCCESS:
return "RESULT_SUCCESS";
case Result.RESULT_ERROR:
return "RESULT_ERROR";
case Result.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
exports.resultToJSON = resultToJSON;
/** Supported types for blackboard or parameter values. */
var VariableDeclaration_Type;
(function (VariableDeclaration_Type) {
VariableDeclaration_Type[VariableDeclaration_Type["TYPE_UNKNOWN"] = 0] = "TYPE_UNKNOWN";
VariableDeclaration_Type[VariableDeclaration_Type["TYPE_FLOAT"] = 1] = "TYPE_FLOAT";
VariableDeclaration_Type[VariableDeclaration_Type["TYPE_STRING"] = 2] = "TYPE_STRING";
VariableDeclaration_Type[VariableDeclaration_Type["TYPE_INT"] = 3] = "TYPE_INT";
VariableDeclaration_Type[VariableDeclaration_Type["TYPE_BOOL"] = 4] = "TYPE_BOOL";
VariableDeclaration_Type[VariableDeclaration_Type["TYPE_MESSAGE"] = 5] = "TYPE_MESSAGE";
VariableDeclaration_Type[VariableDeclaration_Type["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(VariableDeclaration_Type = exports.VariableDeclaration_Type || (exports.VariableDeclaration_Type = {}));
function variableDeclaration_TypeFromJSON(object) {
switch (object) {
case 0:
case "TYPE_UNKNOWN":
return VariableDeclaration_Type.TYPE_UNKNOWN;
case 1:
case "TYPE_FLOAT":
return VariableDeclaration_Type.TYPE_FLOAT;
case 2:
case "TYPE_STRING":
return VariableDeclaration_Type.TYPE_STRING;
case 3:
case "TYPE_INT":
return VariableDeclaration_Type.TYPE_INT;
case 4:
case "TYPE_BOOL":
return VariableDeclaration_Type.TYPE_BOOL;
case 5:
case "TYPE_MESSAGE":
return VariableDeclaration_Type.TYPE_MESSAGE;
case -1:
case "UNRECOGNIZED":
default:
return VariableDeclaration_Type.UNRECOGNIZED;
}
}
exports.variableDeclaration_TypeFromJSON = variableDeclaration_TypeFromJSON;
function variableDeclaration_TypeToJSON(object) {
switch (object) {
case VariableDeclaration_Type.TYPE_UNKNOWN:
return "TYPE_UNKNOWN";
case VariableDeclaration_Type.TYPE_FLOAT:
return "TYPE_FLOAT";
case VariableDeclaration_Type.TYPE_STRING:
return "TYPE_STRING";
case VariableDeclaration_Type.TYPE_INT:
return "TYPE_INT";
case VariableDeclaration_Type.TYPE_BOOL:
return "TYPE_BOOL";
case VariableDeclaration_Type.TYPE_MESSAGE:
return "TYPE_MESSAGE";
case VariableDeclaration_Type.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
exports.variableDeclaration_TypeToJSON = variableDeclaration_TypeToJSON;
function createBaseKeyValue() {
return { key: "", value: undefined };
}
exports.KeyValue = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.key !== "") {
writer.uint32(10).string(message.key);
}
if (message.value !== undefined) {
exports.Value.encode(message.value, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseKeyValue();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.key = reader.string();
break;
case 2:
message.value = exports.Value.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
key: isSet(object.key) ? String(object.key) : "",
value: isSet(object.value) ? exports.Value.fromJSON(object.value) : undefined,
};
},
toJSON(message) {
const obj = {};
message.key !== undefined && (obj.key = message.key);
message.value !== undefined &&
(obj.value = message.value ? exports.Value.toJSON(message.value) : undefined);
return obj;
},
fromPartial(object) {
const message = createBaseKeyValue();
message.key = object.key ?? "";
message.value =
object.value !== undefined && object.value !== null
? exports.Value.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseValue() {
return { constant: undefined, runtimeVar: undefined, parameter: undefined };
}
exports.Value = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.constant !== undefined) {
exports.ConstantValue.encode(message.constant, writer.uint32(18).fork()).ldelim();
}
if (message.runtimeVar !== undefined) {
exports.VariableDeclaration.encode(message.runtimeVar, writer.uint32(26).fork()).ldelim();
}
if (message.parameter !== undefined) {
exports.VariableDeclaration.encode(message.parameter, writer.uint32(34).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseValue();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
message.constant = exports.ConstantValue.decode(reader, reader.uint32());
break;
case 3:
message.runtimeVar = exports.VariableDeclaration.decode(reader, reader.uint32());
break;
case 4:
message.parameter = exports.VariableDeclaration.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
constant: isSet(object.constant)
? exports.ConstantValue.fromJSON(object.constant)
: undefined,
runtimeVar: isSet(object.runtimeVar)
? exports.VariableDeclaration.fromJSON(object.runtimeVar)
: undefined,
parameter: isSet(object.parameter)
? exports.VariableDeclaration.fromJSON(object.parameter)
: undefined,
};
},
toJSON(message) {
const obj = {};
message.constant !== undefined &&
(obj.constant = message.constant
? exports.ConstantValue.toJSON(message.constant)
: undefined);
message.runtimeVar !== undefined &&
(obj.runtimeVar = message.runtimeVar
? exports.VariableDeclaration.toJSON(message.runtimeVar)
: undefined);
message.parameter !== undefined &&
(obj.parameter = message.parameter
? exports.VariableDeclaration.toJSON(message.parameter)
: undefined);
return obj;
},
fromPartial(object) {
const message = createBaseValue();
message.constant =
object.constant !== undefined && object.constant !== null
? exports.ConstantValue.fromPartial(object.constant)
: undefined;
message.runtimeVar =
object.runtimeVar !== undefined && object.runtimeVar !== null
? exports.VariableDeclaration.fromPartial(object.runtimeVar)
: undefined;
message.parameter =
object.parameter !== undefined && object.parameter !== null
? exports.VariableDeclaration.fromPartial(object.parameter)
: undefined;
return message;
},
};
function createBaseVariableDeclaration() {
return { name: "", type: 0 };
}
exports.VariableDeclaration = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.type !== 0) {
writer.uint32(16).int32(message.type);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVariableDeclaration();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.name = reader.string();
break;
case 2:
message.type = reader.int32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
name: isSet(object.name) ? String(object.name) : "",
type: isSet(object.type)
? variableDeclaration_TypeFromJSON(object.type)
: 0,
};
},
toJSON(message) {
const obj = {};
message.name !== undefined && (obj.name = message.name);
message.type !== undefined &&
(obj.type = variableDeclaration_TypeToJSON(message.type));
return obj;
},
fromPartial(object) {
const message = createBaseVariableDeclaration();
message.name = object.name ?? "";
message.type = object.type ?? 0;
return message;
},
};
function createBaseConstantValue() {
return {
floatValue: undefined,
stringValue: undefined,
intValue: undefined,
boolValue: undefined,
msgValue: undefined,
};
}
exports.ConstantValue = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.floatValue !== undefined) {
writer.uint32(9).double(message.floatValue);
}
if (message.stringValue !== undefined) {
writer.uint32(18).string(message.stringValue);
}
if (message.intValue !== undefined) {
writer.uint32(24).int64(message.intValue);
}
if (message.boolValue !== undefined) {
writer.uint32(32).bool(message.boolValue);
}
if (message.msgValue !== undefined) {
any_1.Any.encode(message.msgValue, writer.uint32(42).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConstantValue();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.floatValue = reader.double();
break;
case 2:
message.stringValue = reader.string();
break;
case 3:
message.intValue = longToNumber(reader.int64());
break;
case 4:
message.boolValue = reader.bool();
break;
case 5:
message.msgValue = any_1.Any.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
floatValue: isSet(object.floatValue)
? Number(object.floatValue)
: undefined,
stringValue: isSet(object.stringValue)
? String(object.stringValue)
: undefined,
intValue: isSet(object.intValue) ? Number(object.intValue) : undefined,
boolValue: isSet(object.boolValue)
? Boolean(object.boolValue)
: undefined,
msgValue: isSet(object.msgValue)
? any_1.Any.fromJSON(object.msgValue)
: undefined,
};
},
toJSON(message) {
const obj = {};
message.floatValue !== undefined && (obj.floatValue = message.floatValue);
message.stringValue !== undefined &&
(obj.stringValue = message.stringValue);
message.intValue !== undefined &&
(obj.intValue = Math.round(message.intValue));
message.boolValue !== undefined && (obj.boolValue = message.boolValue);
message.msgValue !== undefined &&
(obj.msgValue = message.msgValue
? any_1.Any.toJSON(message.msgValue)
: undefined);
return obj;
},
fromPartial(object) {
const message = createBaseConstantValue();
message.floatValue = object.floatValue ?? undefined;
message.stringValue = object.stringValue ?? undefined;
message.intValue = object.intValue ?? undefined;
message.boolValue = object.boolValue ?? undefined;
message.msgValue =
object.msgValue !== undefined && object.msgValue !== null
? any_1.Any.fromPartial(object.msgValue)
: undefined;
return message;
},
};
function createBaseUserData() {
return { id: "", bytestring: new Uint8Array() };
}
exports.UserData = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.bytestring.length !== 0) {
writer.uint32(26).bytes(message.bytestring);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUserData();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.id = reader.string();
break;
case 3:
message.bytestring = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
id: isSet(object.id) ? String(object.id) : "",
bytestring: isSet(object.bytestring)
? bytesFromBase64(object.bytestring)
: new Uint8Array(),
};
},
toJSON(message) {
const obj = {};
message.id !== undefined && (obj.id = message.id);
message.bytestring !== undefined &&
(obj.bytestring = base64FromBytes(message.bytestring !== undefined ? message.bytestring : new Uint8Array()));
return obj;
},
fromPartial(object) {
const message = createBaseUserData();
message.id = object.id ?? "";
message.bytestring = object.bytestring ?? new Uint8Array();
return message;
},
};
var globalThis = (() => {
if (typeof globalThis !== "undefined")
return globalThis;
if (typeof self !== "undefined")
return self;
if (typeof window !== "undefined")
return window;
if (typeof global !== "undefined")
return global;
throw "Unable to locate global object";
})();
function bytesFromBase64(b64) {
if (globalThis.Buffer) {
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
}
else {
const bin = globalThis.atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
}
function base64FromBytes(arr) {
if (globalThis.Buffer) {
return globalThis.Buffer.from(arr).toString("base64");
}
else {
const bin = [];
arr.forEach((byte) => {
bin.push(String.fromCharCode(byte));
});
return globalThis.btoa(bin.join(""));
}
}
function longToNumber(long) {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
function isSet(value) {
return value !== null && value !== undefined;
}
//# sourceMappingURL=util.js.map