mirror of
https://github.com/zap-proto/js.git
synced 2026-10-30 15:04:48 +00:00
@zap-proto/zap is the native ZAP TS implementation (zero-copy,
byte-compat with github.com/zap-proto/go). The previous content
was an absorbed fork of unjs/capnp-es (now archived as zap-es).
ZAP is not Cap'n Proto. Reset to v0.1.0; no tags until 1.0 works
end-to-end across @zap-proto/{zap,web,mcp} + the esign migration.
121 lines
4.9 KiB
TypeScript
121 lines
4.9 KiB
TypeScript
// Code generated by zapgen --target=ts; DO NOT EDIT.
|
|
// source: ui-customization.zap
|
|
|
|
import {
|
|
Builder,
|
|
Message,
|
|
StructView,
|
|
type ListView,
|
|
} from "@zap-proto/zap";
|
|
|
|
const uiCustomizationConfigOff = {
|
|
Present: 0,
|
|
Hostname: 4,
|
|
DocumentationHref: 12,
|
|
SupportHref: 20,
|
|
FeedbackHref: 28,
|
|
LogoLightModeHref: 36,
|
|
LogoDarkModeHref: 44,
|
|
DefaultModelAdapter: 52,
|
|
DefaultBaseUrlOpenAI: 60,
|
|
DefaultBaseUrlAnthropic: 68,
|
|
DefaultBaseUrlAzure: 76,
|
|
VisibleModules: 84,
|
|
} as const;
|
|
const uiCustomizationConfigSize = 92;
|
|
|
|
/** Zero-copy view into a ZAP-encoded UiCustomizationConfig message. */
|
|
export class UiCustomizationConfig extends StructView {
|
|
/** Parse `b` and return a typed view. Throws on a wire-level check failure (magic, version, size). */
|
|
static wrap(b: Uint8Array): UiCustomizationConfig {
|
|
const root = Message.parse(b).root();
|
|
return new UiCustomizationConfig(root.data, root.offset);
|
|
}
|
|
|
|
get present(): boolean { return this.bool(uiCustomizationConfigOff.Present); }
|
|
get hostname(): string { return this.text(uiCustomizationConfigOff.Hostname); }
|
|
get documentationHref(): string { return this.text(uiCustomizationConfigOff.DocumentationHref); }
|
|
get supportHref(): string { return this.text(uiCustomizationConfigOff.SupportHref); }
|
|
get feedbackHref(): string { return this.text(uiCustomizationConfigOff.FeedbackHref); }
|
|
get logoLightModeHref(): string { return this.text(uiCustomizationConfigOff.LogoLightModeHref); }
|
|
get logoDarkModeHref(): string { return this.text(uiCustomizationConfigOff.LogoDarkModeHref); }
|
|
get defaultModelAdapter(): string { return this.text(uiCustomizationConfigOff.DefaultModelAdapter); }
|
|
get defaultBaseUrlOpenAI(): string { return this.text(uiCustomizationConfigOff.DefaultBaseUrlOpenAI); }
|
|
get defaultBaseUrlAnthropic(): string { return this.text(uiCustomizationConfigOff.DefaultBaseUrlAnthropic); }
|
|
get defaultBaseUrlAzure(): string { return this.text(uiCustomizationConfigOff.DefaultBaseUrlAzure); }
|
|
get visibleModules(): ListView { return this.list(uiCustomizationConfigOff.VisibleModules); }
|
|
}
|
|
|
|
/** Field values for newUiCustomizationConfig. */
|
|
export interface UiCustomizationConfigInput {
|
|
present: boolean;
|
|
hostname: string;
|
|
documentationHref: string;
|
|
supportHref: string;
|
|
feedbackHref: string;
|
|
logoLightModeHref: string;
|
|
logoDarkModeHref: string;
|
|
defaultModelAdapter: string;
|
|
defaultBaseUrlOpenAI: string;
|
|
defaultBaseUrlAnthropic: string;
|
|
defaultBaseUrlAzure: string;
|
|
visibleModules: Uint8Array[];
|
|
}
|
|
|
|
/** Build a ZAP-encoded UiCustomizationConfig message from `in` and return the bytes. */
|
|
export function newUiCustomizationConfig(in_: UiCustomizationConfigInput): Uint8Array {
|
|
const b = new Builder(256);
|
|
const ob = b.startObject(uiCustomizationConfigSize);
|
|
ob.setBool(uiCustomizationConfigOff.Present, in_.present);
|
|
ob.setText(uiCustomizationConfigOff.Hostname, in_.hostname);
|
|
ob.setText(uiCustomizationConfigOff.DocumentationHref, in_.documentationHref);
|
|
ob.setText(uiCustomizationConfigOff.SupportHref, in_.supportHref);
|
|
ob.setText(uiCustomizationConfigOff.FeedbackHref, in_.feedbackHref);
|
|
ob.setText(uiCustomizationConfigOff.LogoLightModeHref, in_.logoLightModeHref);
|
|
ob.setText(uiCustomizationConfigOff.LogoDarkModeHref, in_.logoDarkModeHref);
|
|
ob.setText(uiCustomizationConfigOff.DefaultModelAdapter, in_.defaultModelAdapter);
|
|
ob.setText(uiCustomizationConfigOff.DefaultBaseUrlOpenAI, in_.defaultBaseUrlOpenAI);
|
|
ob.setText(uiCustomizationConfigOff.DefaultBaseUrlAnthropic, in_.defaultBaseUrlAnthropic);
|
|
ob.setText(uiCustomizationConfigOff.DefaultBaseUrlAzure, in_.defaultBaseUrlAzure);
|
|
const visibleModulesLB = b.startList();
|
|
for (const elem of in_.visibleModules) visibleModulesLB.addObjectBytes(elem);
|
|
ob.setList(uiCustomizationConfigOff.VisibleModules, visibleModulesLB.finishOffset(), in_.visibleModules.length);
|
|
ob.finishAsRoot();
|
|
return b.finish();
|
|
}
|
|
|
|
|
|
const visibleModulesOff = {
|
|
Modules: 0,
|
|
} as const;
|
|
const visibleModulesSize = 8;
|
|
|
|
/** Zero-copy view into a ZAP-encoded VisibleModules message. */
|
|
export class VisibleModules extends StructView {
|
|
/** Parse `b` and return a typed view. Throws on a wire-level check failure (magic, version, size). */
|
|
static wrap(b: Uint8Array): VisibleModules {
|
|
const root = Message.parse(b).root();
|
|
return new VisibleModules(root.data, root.offset);
|
|
}
|
|
|
|
get modules(): ListView { return this.list(visibleModulesOff.Modules); }
|
|
}
|
|
|
|
/** Field values for newVisibleModules. */
|
|
export interface VisibleModulesInput {
|
|
modules: Uint8Array[];
|
|
}
|
|
|
|
/** Build a ZAP-encoded VisibleModules message from `in` and return the bytes. */
|
|
export function newVisibleModules(in_: VisibleModulesInput): Uint8Array {
|
|
const b = new Builder(256);
|
|
const ob = b.startObject(visibleModulesSize);
|
|
const modulesLB = b.startList();
|
|
for (const elem of in_.modules) modulesLB.addObjectBytes(elem);
|
|
ob.setList(visibleModulesOff.Modules, modulesLB.finishOffset(), in_.modules.length);
|
|
ob.finishAsRoot();
|
|
return b.finish();
|
|
}
|
|
|
|
|