mirror of
https://github.com/trailbaseio/trailbase
synced 2026-04-21 13:37:44 +00:00
203 lines
5.8 KiB
TypeScript
203 lines
5.8 KiB
TypeScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-ts_proto v2.7.0
|
|
// protoc v3.21.12
|
|
// source: vault.proto
|
|
|
|
/* eslint-disable */
|
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
|
|
export const protobufPackage = "config";
|
|
|
|
export interface Vault {
|
|
secrets: { [key: string]: string };
|
|
}
|
|
|
|
export interface Vault_SecretsEntry {
|
|
key: string;
|
|
value: string;
|
|
}
|
|
|
|
function createBaseVault(): Vault {
|
|
return { secrets: {} };
|
|
}
|
|
|
|
export const Vault: MessageFns<Vault> = {
|
|
encode(message: Vault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
Object.entries(message.secrets).forEach(([key, value]) => {
|
|
Vault_SecretsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
|
|
});
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): Vault {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseVault();
|
|
while (reader.pos < end) {
|
|
const tag = reader.uint32();
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
if (tag !== 10) {
|
|
break;
|
|
}
|
|
|
|
const entry1 = Vault_SecretsEntry.decode(reader, reader.uint32());
|
|
if (entry1.value !== undefined) {
|
|
message.secrets[entry1.key] = entry1.value;
|
|
}
|
|
continue;
|
|
}
|
|
}
|
|
if ((tag & 7) === 4 || tag === 0) {
|
|
break;
|
|
}
|
|
reader.skip(tag & 7);
|
|
}
|
|
return message;
|
|
},
|
|
|
|
fromJSON(object: any): Vault {
|
|
return {
|
|
secrets: isObject(object.secrets)
|
|
? Object.entries(object.secrets).reduce<{ [key: string]: string }>((acc, [key, value]) => {
|
|
acc[key] = String(value);
|
|
return acc;
|
|
}, {})
|
|
: {},
|
|
};
|
|
},
|
|
|
|
toJSON(message: Vault): unknown {
|
|
const obj: any = {};
|
|
if (message.secrets) {
|
|
const entries = Object.entries(message.secrets);
|
|
if (entries.length > 0) {
|
|
obj.secrets = {};
|
|
entries.forEach(([k, v]) => {
|
|
obj.secrets[k] = v;
|
|
});
|
|
}
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<Vault>, I>>(base?: I): Vault {
|
|
return Vault.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<Vault>, I>>(object: I): Vault {
|
|
const message = createBaseVault();
|
|
message.secrets = Object.entries(object.secrets ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => {
|
|
if (value !== undefined) {
|
|
acc[key] = globalThis.String(value);
|
|
}
|
|
return acc;
|
|
}, {});
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseVault_SecretsEntry(): Vault_SecretsEntry {
|
|
return { key: "", value: "" };
|
|
}
|
|
|
|
export const Vault_SecretsEntry: MessageFns<Vault_SecretsEntry> = {
|
|
encode(message: Vault_SecretsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.key !== "") {
|
|
writer.uint32(10).string(message.key);
|
|
}
|
|
if (message.value !== "") {
|
|
writer.uint32(18).string(message.value);
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): Vault_SecretsEntry {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseVault_SecretsEntry();
|
|
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.skip(tag & 7);
|
|
}
|
|
return message;
|
|
},
|
|
|
|
fromJSON(object: any): Vault_SecretsEntry {
|
|
return {
|
|
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
};
|
|
},
|
|
|
|
toJSON(message: Vault_SecretsEntry): unknown {
|
|
const obj: any = {};
|
|
if (message.key !== "") {
|
|
obj.key = message.key;
|
|
}
|
|
if (message.value !== "") {
|
|
obj.value = message.value;
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<Vault_SecretsEntry>, I>>(base?: I): Vault_SecretsEntry {
|
|
return Vault_SecretsEntry.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<Vault_SecretsEntry>, I>>(object: I): Vault_SecretsEntry {
|
|
const message = createBaseVault_SecretsEntry();
|
|
message.key = object.key ?? "";
|
|
message.value = object.value ?? "";
|
|
return message;
|
|
},
|
|
};
|
|
|
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
|
|
export type DeepPartial<T> = T extends Builtin ? T
|
|
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
: Partial<T>;
|
|
|
|
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
|
|
function isObject(value: any): boolean {
|
|
return typeof value === "object" && value !== null;
|
|
}
|
|
|
|
function isSet(value: any): boolean {
|
|
return value !== null && value !== undefined;
|
|
}
|
|
|
|
export interface MessageFns<T> {
|
|
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
fromJSON(object: any): T;
|
|
toJSON(message: T): unknown;
|
|
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
}
|