UNPKG

@speckle/objectsender

Version:

Simple API helper to serialize and send objects to the server.

30 lines (29 loc) 1.08 kB
import { TransportOptions } from './transports/ServerTransport'; import { Base } from './utils/Base'; export { Base }; export { Detach, Chunkable } from './utils/Decorators'; export type SendParams = { serverUrl?: string; projectId: string; token: string; logger?: { log: (message: unknown) => void; error: (message: unknown) => void; }; options?: { transport: TransportOptions; chunkSize?: number; hashingFunction?: (s: string) => string; }; }; export type SendResult = { hash: string; traversed: Record<string, unknown>; }; /** * Decomposes, serializes and sends to a speckle server a given object. Note, for objects to be detached, they need to have a 'speckle_type' property. * @param object object to decompose, serialise and send to speckle * @param parameters: server url, project id and token * @returns the hash of the root object and the value of the root object */ export declare const send: (object: Base, { serverUrl, projectId, token, logger, options }: SendParams) => Promise<SendResult>;