@aneoconsultingfr/armonik.api
Version:
gRPC API to interact with ArmoniK built for the web
645 lines (625 loc) • 20.9 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
var _chunkC2JMS6VKjs = require('./chunk-C2JMS6VK.js');
var _chunk5RJKX2ODjs = require('./chunk-5RJKX2OD.js');
var _chunkHV32ZXSXjs = require('./chunk-HV32ZXSX.js');
var _chunkPZPR25ASjs = require('./chunk-PZPR25AS.js');
// src/generated/partitions_common.ts
var _minimaljs = require('protobufjs/minimal.js'); var _minimaljs2 = _interopRequireDefault(_minimaljs);
var protobufPackage = "armonik.api.grpc.v1.partitions";
function createBasePartitionRaw() {
return {
id: "",
parentPartitionIds: [],
podReserved: 0,
podMax: 0,
podConfiguration: {},
preemptionPercentage: 0,
priority: 0
};
}
var PartitionRaw = {
encode(message, writer = _minimaljs2.default.Writer.create()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
for (const v of message.parentPartitionIds) {
writer.uint32(18).string(v);
}
if (message.podReserved !== 0) {
writer.uint32(24).int64(message.podReserved);
}
if (message.podMax !== 0) {
writer.uint32(32).int64(message.podMax);
}
Object.entries(message.podConfiguration).forEach(([key, value]) => {
PartitionRaw_PodConfigurationEntry.encode({ key, value }, writer.uint32(58).fork()).ldelim();
});
if (message.preemptionPercentage !== 0) {
writer.uint32(40).int64(message.preemptionPercentage);
}
if (message.priority !== 0) {
writer.uint32(48).int64(message.priority);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _minimaljs2.default.Reader ? input : _minimaljs2.default.Reader.create(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBasePartitionRaw();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.parentPartitionIds.push(reader.string());
continue;
case 3:
if (tag !== 24) {
break;
}
message.podReserved = longToNumber(reader.int64());
continue;
case 4:
if (tag !== 32) {
break;
}
message.podMax = longToNumber(reader.int64());
continue;
case 7:
if (tag !== 58) {
break;
}
const entry7 = PartitionRaw_PodConfigurationEntry.decode(reader, reader.uint32());
if (entry7.value !== void 0) {
message.podConfiguration[entry7.key] = entry7.value;
}
continue;
case 5:
if (tag !== 40) {
break;
}
message.preemptionPercentage = longToNumber(reader.int64());
continue;
case 6:
if (tag !== 48) {
break;
}
message.priority = longToNumber(reader.int64());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
id: isSet(object.id) ? String(object.id) : "",
parentPartitionIds: Array.isArray(object == null ? void 0 : object.parentPartitionIds) ? object.parentPartitionIds.map((e) => String(e)) : [],
podReserved: isSet(object.podReserved) ? Number(object.podReserved) : 0,
podMax: isSet(object.podMax) ? Number(object.podMax) : 0,
podConfiguration: isObject(object.podConfiguration) ? Object.entries(object.podConfiguration).reduce((acc, [key, value]) => {
acc[key] = String(value);
return acc;
}, {}) : {},
preemptionPercentage: isSet(object.preemptionPercentage) ? Number(object.preemptionPercentage) : 0,
priority: isSet(object.priority) ? Number(object.priority) : 0
};
},
toJSON(message) {
var _a;
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if ((_a = message.parentPartitionIds) == null ? void 0 : _a.length) {
obj.parentPartitionIds = message.parentPartitionIds;
}
if (message.podReserved !== 0) {
obj.podReserved = Math.round(message.podReserved);
}
if (message.podMax !== 0) {
obj.podMax = Math.round(message.podMax);
}
if (message.podConfiguration) {
const entries = Object.entries(message.podConfiguration);
if (entries.length > 0) {
obj.podConfiguration = {};
entries.forEach(([k, v]) => {
obj.podConfiguration[k] = v;
});
}
}
if (message.preemptionPercentage !== 0) {
obj.preemptionPercentage = Math.round(message.preemptionPercentage);
}
if (message.priority !== 0) {
obj.priority = Math.round(message.priority);
}
return obj;
},
create(base) {
return PartitionRaw.fromPartial(_nullishCoalesce(base, () => ( {})));
},
fromPartial(object) {
var _a;
const message = createBasePartitionRaw();
message.id = _nullishCoalesce(object.id, () => ( ""));
message.parentPartitionIds = ((_a = object.parentPartitionIds) == null ? void 0 : _a.map((e) => e)) || [];
message.podReserved = _nullishCoalesce(object.podReserved, () => ( 0));
message.podMax = _nullishCoalesce(object.podMax, () => ( 0));
message.podConfiguration = Object.entries(_nullishCoalesce(object.podConfiguration, () => ( {}))).reduce(
(acc, [key, value]) => {
if (value !== void 0) {
acc[key] = String(value);
}
return acc;
},
{}
);
message.preemptionPercentage = _nullishCoalesce(object.preemptionPercentage, () => ( 0));
message.priority = _nullishCoalesce(object.priority, () => ( 0));
return message;
}
};
function createBasePartitionRaw_PodConfigurationEntry() {
return { key: "", value: "" };
}
var PartitionRaw_PodConfigurationEntry = {
encode(message, writer = _minimaljs2.default.Writer.create()) {
if (message.key !== "") {
writer.uint32(10).string(message.key);
}
if (message.value !== "") {
writer.uint32(18).string(message.value);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _minimaljs2.default.Reader ? input : _minimaljs2.default.Reader.create(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBasePartitionRaw_PodConfigurationEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.value = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" };
},
toJSON(message) {
const obj = {};
if (message.key !== "") {
obj.key = message.key;
}
if (message.value !== "") {
obj.value = message.value;
}
return obj;
},
create(base) {
return PartitionRaw_PodConfigurationEntry.fromPartial(_nullishCoalesce(base, () => ( {})));
},
fromPartial(object) {
const message = createBasePartitionRaw_PodConfigurationEntry();
message.key = _nullishCoalesce(object.key, () => ( ""));
message.value = _nullishCoalesce(object.value, () => ( ""));
return message;
}
};
function createBaseListPartitionsRequest() {
return { page: 0, pageSize: 0, filters: void 0, sort: void 0 };
}
var ListPartitionsRequest = {
encode(message, writer = _minimaljs2.default.Writer.create()) {
if (message.page !== 0) {
writer.uint32(8).int32(message.page);
}
if (message.pageSize !== 0) {
writer.uint32(16).int32(message.pageSize);
}
if (message.filters !== void 0) {
_chunkC2JMS6VKjs.Filters.encode(message.filters, writer.uint32(26).fork()).ldelim();
}
if (message.sort !== void 0) {
ListPartitionsRequest_Sort.encode(message.sort, writer.uint32(34).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _minimaljs2.default.Reader ? input : _minimaljs2.default.Reader.create(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseListPartitionsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.page = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.pageSize = reader.int32();
continue;
case 3:
if (tag !== 26) {
break;
}
message.filters = _chunkC2JMS6VKjs.Filters.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}
message.sort = ListPartitionsRequest_Sort.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
page: isSet(object.page) ? Number(object.page) : 0,
pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0,
filters: isSet(object.filters) ? _chunkC2JMS6VKjs.Filters.fromJSON(object.filters) : void 0,
sort: isSet(object.sort) ? ListPartitionsRequest_Sort.fromJSON(object.sort) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.page !== 0) {
obj.page = Math.round(message.page);
}
if (message.pageSize !== 0) {
obj.pageSize = Math.round(message.pageSize);
}
if (message.filters !== void 0) {
obj.filters = _chunkC2JMS6VKjs.Filters.toJSON(message.filters);
}
if (message.sort !== void 0) {
obj.sort = ListPartitionsRequest_Sort.toJSON(message.sort);
}
return obj;
},
create(base) {
return ListPartitionsRequest.fromPartial(_nullishCoalesce(base, () => ( {})));
},
fromPartial(object) {
const message = createBaseListPartitionsRequest();
message.page = _nullishCoalesce(object.page, () => ( 0));
message.pageSize = _nullishCoalesce(object.pageSize, () => ( 0));
message.filters = object.filters !== void 0 && object.filters !== null ? _chunkC2JMS6VKjs.Filters.fromPartial(object.filters) : void 0;
message.sort = object.sort !== void 0 && object.sort !== null ? ListPartitionsRequest_Sort.fromPartial(object.sort) : void 0;
return message;
}
};
function createBaseListPartitionsRequest_Sort() {
return { field: void 0, direction: 0 };
}
var ListPartitionsRequest_Sort = {
encode(message, writer = _minimaljs2.default.Writer.create()) {
if (message.field !== void 0) {
_chunk5RJKX2ODjs.PartitionField.encode(message.field, writer.uint32(10).fork()).ldelim();
}
if (message.direction !== 0) {
writer.uint32(16).int32(message.direction);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _minimaljs2.default.Reader ? input : _minimaljs2.default.Reader.create(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseListPartitionsRequest_Sort();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.field = _chunk5RJKX2ODjs.PartitionField.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 16) {
break;
}
message.direction = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
field: isSet(object.field) ? _chunk5RJKX2ODjs.PartitionField.fromJSON(object.field) : void 0,
direction: isSet(object.direction) ? _chunkHV32ZXSXjs.sortDirectionFromJSON.call(void 0, object.direction) : 0
};
},
toJSON(message) {
const obj = {};
if (message.field !== void 0) {
obj.field = _chunk5RJKX2ODjs.PartitionField.toJSON(message.field);
}
if (message.direction !== 0) {
obj.direction = _chunkHV32ZXSXjs.sortDirectionToJSON.call(void 0, message.direction);
}
return obj;
},
create(base) {
return ListPartitionsRequest_Sort.fromPartial(_nullishCoalesce(base, () => ( {})));
},
fromPartial(object) {
const message = createBaseListPartitionsRequest_Sort();
message.field = object.field !== void 0 && object.field !== null ? _chunk5RJKX2ODjs.PartitionField.fromPartial(object.field) : void 0;
message.direction = _nullishCoalesce(object.direction, () => ( 0));
return message;
}
};
function createBaseListPartitionsResponse() {
return { partitions: [], page: 0, pageSize: 0, total: 0 };
}
var ListPartitionsResponse = {
encode(message, writer = _minimaljs2.default.Writer.create()) {
for (const v of message.partitions) {
PartitionRaw.encode(v, writer.uint32(10).fork()).ldelim();
}
if (message.page !== 0) {
writer.uint32(16).int32(message.page);
}
if (message.pageSize !== 0) {
writer.uint32(24).int32(message.pageSize);
}
if (message.total !== 0) {
writer.uint32(32).int32(message.total);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _minimaljs2.default.Reader ? input : _minimaljs2.default.Reader.create(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseListPartitionsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.partitions.push(PartitionRaw.decode(reader, reader.uint32()));
continue;
case 2:
if (tag !== 16) {
break;
}
message.page = reader.int32();
continue;
case 3:
if (tag !== 24) {
break;
}
message.pageSize = reader.int32();
continue;
case 4:
if (tag !== 32) {
break;
}
message.total = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
partitions: Array.isArray(object == null ? void 0 : object.partitions) ? object.partitions.map((e) => PartitionRaw.fromJSON(e)) : [],
page: isSet(object.page) ? Number(object.page) : 0,
pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0,
total: isSet(object.total) ? Number(object.total) : 0
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.partitions) == null ? void 0 : _a.length) {
obj.partitions = message.partitions.map((e) => PartitionRaw.toJSON(e));
}
if (message.page !== 0) {
obj.page = Math.round(message.page);
}
if (message.pageSize !== 0) {
obj.pageSize = Math.round(message.pageSize);
}
if (message.total !== 0) {
obj.total = Math.round(message.total);
}
return obj;
},
create(base) {
return ListPartitionsResponse.fromPartial(_nullishCoalesce(base, () => ( {})));
},
fromPartial(object) {
var _a;
const message = createBaseListPartitionsResponse();
message.partitions = ((_a = object.partitions) == null ? void 0 : _a.map((e) => PartitionRaw.fromPartial(e))) || [];
message.page = _nullishCoalesce(object.page, () => ( 0));
message.pageSize = _nullishCoalesce(object.pageSize, () => ( 0));
message.total = _nullishCoalesce(object.total, () => ( 0));
return message;
}
};
function createBaseGetPartitionRequest() {
return { id: "" };
}
var GetPartitionRequest = {
encode(message, writer = _minimaljs2.default.Writer.create()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _minimaljs2.default.Reader ? input : _minimaljs2.default.Reader.create(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseGetPartitionRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return { id: isSet(object.id) ? String(object.id) : "" };
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
return obj;
},
create(base) {
return GetPartitionRequest.fromPartial(_nullishCoalesce(base, () => ( {})));
},
fromPartial(object) {
const message = createBaseGetPartitionRequest();
message.id = _nullishCoalesce(object.id, () => ( ""));
return message;
}
};
function createBaseGetPartitionResponse() {
return { partition: void 0 };
}
var GetPartitionResponse = {
encode(message, writer = _minimaljs2.default.Writer.create()) {
if (message.partition !== void 0) {
PartitionRaw.encode(message.partition, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _minimaljs2.default.Reader ? input : _minimaljs2.default.Reader.create(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseGetPartitionResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.partition = PartitionRaw.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return { partition: isSet(object.partition) ? PartitionRaw.fromJSON(object.partition) : void 0 };
},
toJSON(message) {
const obj = {};
if (message.partition !== void 0) {
obj.partition = PartitionRaw.toJSON(message.partition);
}
return obj;
},
create(base) {
return GetPartitionResponse.fromPartial(_nullishCoalesce(base, () => ( {})));
},
fromPartial(object) {
const message = createBaseGetPartitionResponse();
message.partition = object.partition !== void 0 && object.partition !== null ? PartitionRaw.fromPartial(object.partition) : void 0;
return message;
}
};
var tsProtoGlobalThis = (() => {
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 longToNumber(long) {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (_minimaljs2.default.util.Long !== _chunkPZPR25ASjs.long_default) {
_minimaljs2.default.util.Long = _chunkPZPR25ASjs.long_default;
_minimaljs2.default.configure();
}
function isObject(value) {
return typeof value === "object" && value !== null;
}
function isSet(value) {
return value !== null && value !== void 0;
}
exports.protobufPackage = protobufPackage; exports.PartitionRaw = PartitionRaw; exports.PartitionRaw_PodConfigurationEntry = PartitionRaw_PodConfigurationEntry; exports.ListPartitionsRequest = ListPartitionsRequest; exports.ListPartitionsRequest_Sort = ListPartitionsRequest_Sort; exports.ListPartitionsResponse = ListPartitionsResponse; exports.GetPartitionRequest = GetPartitionRequest; exports.GetPartitionResponse = GetPartitionResponse;