@gramaziokohler/compas-pb-ts
v1.3.1
Published
COMPAS Protobuf wrapper for TypeScript
Readme
COMPAS Protobuf TypeScript
TypeScript wrappers and generated protobuf codecs for COMPAS geometry, datastructures, and messages.
Install
npm install @gramaziokohler/compas-pb-tsUsage
import { Point, pointDataToBytes, bytesToPointData } from "@gramaziokohler/compas-pb-ts";
const point = new Point({
data: {
guid: "point-guid",
name: "Point",
x: 1,
y: 2,
z: 3,
},
});
const bytes = pointDataToBytes(point.data);
const decoded = bytesToPointData(bytes);Generated protobuf types are available from namespaced root exports:
import type { CompasGeometry } from "@gramaziokohler/compas-pb-ts";
const point: CompasGeometry.PointData = {
guid: "point-guid",
name: "Point",
x: 1,
y: 2,
z: 3,
};Debugging
Class names are preserved in the build for better debugging. Inspect objects in the console to see descriptive names like Point, Box, Sphere instead of minified names.
Development
pnpm install
pnpm lint
pnpm test
pnpm build