@selvajs/compute 1.5.3 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3FH7FKLG.cjs +2 -0
- package/dist/chunk-3FH7FKLG.cjs.map +1 -0
- package/dist/chunk-DELOBV2Q.js +2 -0
- package/dist/chunk-DELOBV2Q.js.map +1 -0
- package/dist/chunk-GTTKNF4G.js +4 -0
- package/dist/chunk-GTTKNF4G.js.map +1 -0
- package/dist/chunk-JFLD2UCY.cjs +2 -0
- package/dist/chunk-JFLD2UCY.cjs.map +1 -0
- package/dist/chunk-MA6YB3YZ.cjs +4 -0
- package/dist/chunk-MA6YB3YZ.cjs.map +1 -0
- package/dist/chunk-MKW2KTPT.js +2 -0
- package/dist/chunk-MKW2KTPT.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +10 -15
- package/dist/core.d.ts +10 -15
- package/dist/core.js +1 -1
- package/dist/grasshopper.cjs +1 -1
- package/dist/grasshopper.cjs.map +1 -1
- package/dist/grasshopper.d.cts +77 -101
- package/dist/grasshopper.d.ts +77 -101
- package/dist/grasshopper.js +1 -1
- package/dist/handle-files-DsrxHKHP.d.cts +262 -0
- package/dist/handle-files-DsrxHKHP.d.ts +262 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/{types-Dfeei0dD.d.cts → types-CJ092lxB.d.cts} +116 -73
- package/dist/types-D1SkNje_.d.cts +87 -0
- package/dist/types-D1SkNje_.d.ts +87 -0
- package/dist/{types-Dfeei0dD.d.ts → types-XCUrJGby.d.ts} +116 -73
- package/dist/visualization-GU7JIB4V.cjs +2 -0
- package/dist/visualization-GU7JIB4V.cjs.map +1 -0
- package/dist/visualization-WIUVT2FZ.js +2 -0
- package/dist/visualization.cjs +1 -1
- package/dist/visualization.cjs.map +1 -1
- package/dist/visualization.d.cts +16 -21
- package/dist/visualization.d.ts +16 -21
- package/dist/visualization.js +1 -1
- package/package.json +18 -7
- package/dist/chunk-GZYSQSLH.cjs +0 -2
- package/dist/chunk-GZYSQSLH.cjs.map +0 -1
- package/dist/chunk-JZYEMZZ5.js +0 -2
- package/dist/chunk-JZYEMZZ5.js.map +0 -1
- package/dist/chunk-OEDLGVIQ.js +0 -2
- package/dist/chunk-OEDLGVIQ.js.map +0 -1
- package/dist/chunk-OW6HV6QP.js +0 -2
- package/dist/chunk-OW6HV6QP.js.map +0 -1
- package/dist/chunk-RBNF6MNH.cjs +0 -3
- package/dist/chunk-RBNF6MNH.cjs.map +0 -1
- package/dist/chunk-SVEXPGHW.cjs +0 -2
- package/dist/chunk-SVEXPGHW.cjs.map +0 -1
- package/dist/chunk-XBIEAJBK.js +0 -3
- package/dist/chunk-XBIEAJBK.js.map +0 -1
- package/dist/chunk-ZRQRYG6F.cjs +0 -2
- package/dist/chunk-ZRQRYG6F.cjs.map +0 -1
- package/dist/errors-CEy4nM1J.d.cts +0 -149
- package/dist/errors-CEy4nM1J.d.ts +0 -149
- package/dist/types-COCuQEMk.d.cts +0 -93
- package/dist/types-COCuQEMk.d.ts +0 -93
- package/dist/visualization-ENMBHWIN.js +0 -2
- package/dist/visualization-TBPFFBFU.cjs +0 -2
- package/dist/visualization-TBPFFBFU.cjs.map +0 -1
- /package/dist/{visualization-ENMBHWIN.js.map → visualization-WIUVT2FZ.js.map} +0 -0
|
@@ -1,54 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Rhino model unit types supported by Rhino.Compute
|
|
3
|
-
*/
|
|
4
|
-
type RhinoModelUnit = 'None' | 'Microns' | 'Millimeters' | 'Centimeters' | 'Meters' | 'Kilometers' | 'Microinches' | 'Mils' | 'Inches' | 'Feet' | 'Miles' | 'CustomUnits' | 'Angstroms' | 'Nanometers' | 'Decimeters' | 'Dekameters' | 'Hectometers' | 'Megameters' | 'Gigameters' | 'Yards' | 'PrinterPoints' | 'PrinterPicas' | 'NauticalMiles' | 'AstronomicalUnits' | 'LightYears' | 'Parsecs' | 'Unset';
|
|
5
|
-
/**
|
|
6
|
-
* Retry policy for transient errors (network, 502, 503, 504, optionally 429).
|
|
7
|
-
*
|
|
8
|
-
* Retries use exponential backoff with jitter, capped at `maxDelayMs`.
|
|
9
|
-
* If the server returns `Retry-After`, that value is honored instead.
|
|
10
|
-
*/
|
|
11
|
-
interface RetryPolicy {
|
|
12
|
-
/** Maximum number of retry attempts after the initial request (default: 0). */
|
|
13
|
-
attempts?: number;
|
|
14
|
-
/** Base delay in milliseconds for exponential backoff (default: 500). */
|
|
15
|
-
baseDelayMs?: number;
|
|
16
|
-
/** Upper bound for backoff delay (default: 30_000). */
|
|
17
|
-
maxDelayMs?: number;
|
|
18
|
-
/** Whether to retry on 429 responses (default: true — honors Retry-After). */
|
|
19
|
-
retryOn429?: boolean;
|
|
20
|
-
}
|
|
21
|
-
interface ComputeConfig {
|
|
22
|
-
/** The base URL of the Rhino Compute server (e.g., http://localhost:6500) */
|
|
23
|
-
serverUrl: string;
|
|
24
|
-
/** Optional API key for authenticating with the server (RhinoComputeKey) */
|
|
25
|
-
apiKey?: string;
|
|
26
|
-
/** Optional Bearer token for authentication (e.g., when behind a proxy or API gateway) */
|
|
27
|
-
authToken?: string;
|
|
28
|
-
/** Enable debug logging to the console */
|
|
29
|
-
debug?: boolean;
|
|
30
|
-
/** Suppress browser security warnings in the console */
|
|
31
|
-
suppressBrowserWarning?: boolean;
|
|
32
|
-
/** @deprecated Renamed to `suppressBrowserWarning`. */
|
|
33
|
-
suppressClientSideWarning?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Per-request timeout in milliseconds. Set to `0` to disable (useful for long
|
|
36
|
-
* solves where any timeout is the wrong answer). Default: no timeout.
|
|
37
|
-
*
|
|
38
|
-
* Uses `AbortSignal.timeout` so the timer is not throttled when the tab is hidden.
|
|
39
|
-
*/
|
|
40
|
-
timeoutMs?: number;
|
|
41
|
-
/**
|
|
42
|
-
* Retry policy for transient errors. Default: no retries.
|
|
43
|
-
*/
|
|
44
|
-
retry?: RetryPolicy;
|
|
45
|
-
/**
|
|
46
|
-
* Optional caller-supplied AbortSignal. Composes with the internal timeout —
|
|
47
|
-
* whichever fires first wins. Lets callers cancel in-flight requests
|
|
48
|
-
* (e.g. on component unmount or when superseding a stale solve).
|
|
49
|
-
*/
|
|
50
|
-
signal?: AbortSignal;
|
|
51
|
-
}
|
|
1
|
+
import { C as ComputeConfig, a as RhinoModelUnit } from './types-D1SkNje_.cjs';
|
|
52
2
|
|
|
53
3
|
/**
|
|
54
4
|
* Grasshopper types
|
|
@@ -230,26 +180,6 @@ interface GrasshopperComputeConfig extends ComputeConfig {
|
|
|
230
180
|
/** Whether to use cached solution */
|
|
231
181
|
cachesolve?: boolean | null;
|
|
232
182
|
}
|
|
233
|
-
/**
|
|
234
|
-
* Raw I/O response schema from API (PascalCase)
|
|
235
|
-
*
|
|
236
|
-
* This is the direct response format from the Rhino Compute server API.
|
|
237
|
-
* All property names are in PascalCase, which is typical for .NET APIs.
|
|
238
|
-
* This raw response is converted to camelCase by the camelcaseKeys() function
|
|
239
|
-
* in the fetchDefinitionIO() method.
|
|
240
|
-
*/
|
|
241
|
-
interface IoResponseSchema {
|
|
242
|
-
description: string;
|
|
243
|
-
filename: string;
|
|
244
|
-
cachekey: string;
|
|
245
|
-
inputnames: string[];
|
|
246
|
-
outputnames: string[];
|
|
247
|
-
icon: string | null;
|
|
248
|
-
inputs: InputParamSchema[];
|
|
249
|
-
outputs: OutputParamSchema[];
|
|
250
|
-
warnings: any[];
|
|
251
|
-
errors: any[];
|
|
252
|
-
}
|
|
253
183
|
/**
|
|
254
184
|
* Arguments sent to Grasshopper compute endpoint
|
|
255
185
|
* Includes config options + definition source + input values
|
|
@@ -324,11 +254,20 @@ interface InputParamSchema {
|
|
|
324
254
|
groupName?: string | null;
|
|
325
255
|
}
|
|
326
256
|
/**
|
|
327
|
-
* Parsed input/output structure with raw schemas
|
|
257
|
+
* Parsed input/output structure with raw schemas.
|
|
258
|
+
*
|
|
259
|
+
* `loadWarnings` / `loadErrors` carry the server's definition-load diagnostics
|
|
260
|
+
* (missing plugin, broken component, etc.) from the `/io` response. They are
|
|
261
|
+
* distinct from per-input parse failures (`InputParseError`): these come from
|
|
262
|
+
* the server loading the definition, those from the client typing an input.
|
|
328
263
|
*/
|
|
329
264
|
interface GrasshopperParsedIORaw {
|
|
330
265
|
inputs: InputParamSchema[];
|
|
331
266
|
outputs: OutputParamSchema[];
|
|
267
|
+
/** Server-side definition-load warnings, if any. */
|
|
268
|
+
loadWarnings?: string[];
|
|
269
|
+
/** Server-side definition-load errors, if any (e.g. missing plugin). */
|
|
270
|
+
loadErrors?: string[];
|
|
332
271
|
}
|
|
333
272
|
/**
|
|
334
273
|
* Per-input parse failure. The corresponding entry in `inputs` was filled
|
|
@@ -357,6 +296,110 @@ interface GrasshopperParsedIO {
|
|
|
357
296
|
inputs: InputParam[];
|
|
358
297
|
outputs: OutputParamSchema[];
|
|
359
298
|
parseErrors?: InputParseError[];
|
|
299
|
+
/**
|
|
300
|
+
* Server-side definition-load warnings from the `/io` response (e.g. an
|
|
301
|
+
* obsolete component). Surface these so the user understands a degraded IO
|
|
302
|
+
* list. Distinct from `parseErrors` (client-side input typing failures).
|
|
303
|
+
*/
|
|
304
|
+
loadWarnings?: string[];
|
|
305
|
+
/**
|
|
306
|
+
* Server-side definition-load errors from the `/io` response (e.g. a missing
|
|
307
|
+
* plugin that left inputs unresolved). When present, the inputs/outputs may
|
|
308
|
+
* be incomplete — the user needs to fix their server/definition.
|
|
309
|
+
*/
|
|
310
|
+
loadErrors?: string[];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Material properties for Three.js rendering.
|
|
315
|
+
*/
|
|
316
|
+
interface SerializableMaterial {
|
|
317
|
+
color: string;
|
|
318
|
+
metalness: number;
|
|
319
|
+
roughness: number;
|
|
320
|
+
opacity: number;
|
|
321
|
+
transparent: boolean;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Metadata for a single mesh within a batch.
|
|
325
|
+
*
|
|
326
|
+
* Offsets and counts are expressed in **vertex-count units** (not float components) and
|
|
327
|
+
* **index-count units**. To address the typed-array storage:
|
|
328
|
+
* - vertex component offset = `vertexStart * 3`
|
|
329
|
+
* - vertex component count = `vertexCount * 3`
|
|
330
|
+
* - index byte offset = `indexStart * 4`
|
|
331
|
+
* - index count = `indexCount`
|
|
332
|
+
*/
|
|
333
|
+
interface MeshMetadata {
|
|
334
|
+
name: string;
|
|
335
|
+
/** Layer path for grouping in the scene manager (e.g. 'Structure/Walls') */
|
|
336
|
+
layer: string;
|
|
337
|
+
/** Original index in the GH input tree before material grouping. Combined with
|
|
338
|
+
* MeshBatch.sourceComponentId to uniquely identify the GH source geometry. */
|
|
339
|
+
originalIndex: number;
|
|
340
|
+
/** Number of vertices in this mesh (each vertex is 3 components: x, y, z). */
|
|
341
|
+
vertexCount: number;
|
|
342
|
+
/** Number of indices in this mesh (3 per triangle). */
|
|
343
|
+
indexCount: number;
|
|
344
|
+
/** Index of this mesh's first vertex in the combined vertex array, in vertex-count units.
|
|
345
|
+
* The corresponding component offset into the int16/float32 typed array is `vertexStart * 3`. */
|
|
346
|
+
vertexStart: number;
|
|
347
|
+
/** Index of this mesh's first index in the combined index array, in index-count units. */
|
|
348
|
+
indexStart: number;
|
|
349
|
+
/** Arbitrary key-value pairs from the GH Metadata input */
|
|
350
|
+
metadata?: Record<string, string>;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* A group of meshes sharing the same material.
|
|
354
|
+
*/
|
|
355
|
+
interface MaterialGroup {
|
|
356
|
+
/** Reference to the material ID in the materials array */
|
|
357
|
+
materialId: number;
|
|
358
|
+
/** Individual meshes in this group */
|
|
359
|
+
meshes: MeshMetadata[];
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Batched mesh data optimized for Three.js rendering.
|
|
363
|
+
*
|
|
364
|
+
* `compressedData` contains the binary "SLVA" blob (header + metadata JSON + quantized int16 or
|
|
365
|
+
* float32 vertices + uint32 indices), base64-encoded for transit inside the values JSON envelope.
|
|
366
|
+
* The blob is opaque to the outer JSON: a future binary WebSocket frame can drop the base64 step
|
|
367
|
+
* without changing this shape.
|
|
368
|
+
*/
|
|
369
|
+
interface MeshBatch {
|
|
370
|
+
/** Array of unique materials */
|
|
371
|
+
materials: SerializableMaterial[];
|
|
372
|
+
/** Groups of meshes organized by material */
|
|
373
|
+
groups: MaterialGroup[];
|
|
374
|
+
/** Base64-encoded binary blob (SLVA wire format). */
|
|
375
|
+
compressedData: string;
|
|
376
|
+
/** InstanceGuid of the WebDisplay GH component that produced this batch.
|
|
377
|
+
* Combined with MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
|
|
378
|
+
sourceComponentId?: string;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Options for parsing mesh batch data.
|
|
382
|
+
*/
|
|
383
|
+
interface MeshBatchParsingOptions {
|
|
384
|
+
/** Merge meshes with same material into single geometry (better performance). Defaults to true. */
|
|
385
|
+
mergeByMaterial?: boolean;
|
|
386
|
+
/** Apply coordinate system transformations (Rhino Z-up to Three.js Y-up). Defaults to true. */
|
|
387
|
+
applyTransforms?: boolean;
|
|
388
|
+
/** Enable performance monitoring in console. Defaults to false. */
|
|
389
|
+
debug?: boolean;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Options for extracting and processing meshes from compute responses.
|
|
393
|
+
*/
|
|
394
|
+
interface MeshExtractionOptions {
|
|
395
|
+
/** Configuration for parsing mesh batches. */
|
|
396
|
+
parsing?: MeshBatchParsingOptions;
|
|
397
|
+
/** Apply scaling based on model units. Defaults to true. */
|
|
398
|
+
allowScaling?: boolean;
|
|
399
|
+
/** Apply automatic ground offset positioning (Z=0). Defaults to true. */
|
|
400
|
+
allowAutoPosition?: boolean;
|
|
401
|
+
/** Enable verbose logging. Defaults to false. */
|
|
402
|
+
debug?: boolean;
|
|
360
403
|
}
|
|
361
404
|
|
|
362
|
-
export type { BooleanInputType as B,
|
|
405
|
+
export type { BooleanInputType as B, DataItem as D, FileInputType as F, GeometryInputType as G, InnerTreeData as I, MeshExtractionOptions as M, NumericInputType as N, OutputParamSchema as O, TextInputType as T, ValueListInputType as V, DataTree as a, DataTreeDefault as b, DataTreePath as c, DefaultValue as d, GrasshopperComputeConfig as e, GrasshopperComputeResponse as f, GrasshopperParsedIO as g, GrasshopperParsedIORaw as h, GrasshopperRequestSchema as i, InputParam as j, InputParamSchema as k, OutputType as l, MeshBatchParsingOptions as m, MeshBatch as n };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rhino model unit types supported by Rhino.Compute
|
|
3
|
+
*/
|
|
4
|
+
type RhinoModelUnit = 'None' | 'Microns' | 'Millimeters' | 'Centimeters' | 'Meters' | 'Kilometers' | 'Microinches' | 'Mils' | 'Inches' | 'Feet' | 'Miles' | 'CustomUnits' | 'Angstroms' | 'Nanometers' | 'Decimeters' | 'Dekameters' | 'Hectometers' | 'Megameters' | 'Gigameters' | 'Yards' | 'PrinterPoints' | 'PrinterPicas' | 'NauticalMiles' | 'AstronomicalUnits' | 'LightYears' | 'Parsecs' | 'Unset';
|
|
5
|
+
/**
|
|
6
|
+
* Retry policy for transient errors (network, 502, 503, 504, optionally 429).
|
|
7
|
+
*
|
|
8
|
+
* Retries use exponential backoff with jitter, capped at `maxDelayMs`.
|
|
9
|
+
* If the server returns `Retry-After`, that value is honored instead.
|
|
10
|
+
*/
|
|
11
|
+
interface RetryPolicy {
|
|
12
|
+
/** Maximum number of retry attempts after the initial request (default: 0). */
|
|
13
|
+
attempts?: number;
|
|
14
|
+
/** Base delay in milliseconds for exponential backoff (default: 500). */
|
|
15
|
+
baseDelayMs?: number;
|
|
16
|
+
/** Upper bound for backoff delay (default: 30_000). */
|
|
17
|
+
maxDelayMs?: number;
|
|
18
|
+
/** Whether to retry on 429 responses (default: true — honors Retry-After). */
|
|
19
|
+
retryOn429?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface ComputeConfig {
|
|
22
|
+
/**
|
|
23
|
+
* The base URL of the Rhino Compute server (e.g., http://localhost:6500).
|
|
24
|
+
*
|
|
25
|
+
* This should point at the `rhino.compute` front (the reverse proxy), not a
|
|
26
|
+
* bare `compute.geometry` child process. `ComputeServerStats` relies on the
|
|
27
|
+
* proxy-only endpoints `/healthcheck` and `/activechildren`; targeting a
|
|
28
|
+
* bare `compute.geometry` would make `isServerOnline()` 404 even though
|
|
29
|
+
* `/grasshopper` would still solve.
|
|
30
|
+
*/
|
|
31
|
+
serverUrl: string;
|
|
32
|
+
/** Optional API key for authenticating with the server (RhinoComputeKey) */
|
|
33
|
+
apiKey?: string;
|
|
34
|
+
/** Optional Bearer token for authentication (e.g., when behind a proxy or API gateway) */
|
|
35
|
+
authToken?: string;
|
|
36
|
+
/** Enable debug logging to the console */
|
|
37
|
+
debug?: boolean;
|
|
38
|
+
/** Suppress browser security warnings in the console */
|
|
39
|
+
suppressBrowserWarning?: boolean;
|
|
40
|
+
/** @deprecated Renamed to `suppressBrowserWarning`. */
|
|
41
|
+
suppressClientSideWarning?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Per-request timeout in milliseconds. Set to `0` to disable (useful for long
|
|
44
|
+
* solves where any timeout is the wrong answer). Default: no timeout.
|
|
45
|
+
*
|
|
46
|
+
* Uses `AbortSignal.timeout` so the timer is not throttled when the tab is hidden.
|
|
47
|
+
*/
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Retry policy for transient errors. Default: no retries.
|
|
51
|
+
*/
|
|
52
|
+
retry?: RetryPolicy;
|
|
53
|
+
/**
|
|
54
|
+
* Optional caller-supplied AbortSignal. Composes with the internal timeout —
|
|
55
|
+
* whichever fires first wins. Lets callers cancel in-flight requests
|
|
56
|
+
* (e.g. on component unmount or when superseding a stale solve).
|
|
57
|
+
*/
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
/**
|
|
60
|
+
* Optional callback invoked with the server's per-request `Server-Timing`
|
|
61
|
+
* breakdown when the response carries one (the `/grasshopper` solve endpoint
|
|
62
|
+
* emits `decode;dur=N, solve;dur=N, encode;dur=N` on every response).
|
|
63
|
+
*
|
|
64
|
+
* Fires on success only, once per request, before the parsed body is
|
|
65
|
+
* returned. The transport stays response-type-agnostic — this is a side
|
|
66
|
+
* channel for telemetry, it does not change what a call returns. Use it to
|
|
67
|
+
* feed a perf monitor or surface "solve took Nms" without server log access.
|
|
68
|
+
*/
|
|
69
|
+
onServerTiming?: (timing: ServerTiming) => void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parsed `Server-Timing` metrics from a Compute response. Durations are in
|
|
73
|
+
* milliseconds. Any metric the server omits is `undefined`. `raw` is the
|
|
74
|
+
* original header value, preserved so callers can read non-standard metrics.
|
|
75
|
+
*/
|
|
76
|
+
interface ServerTiming {
|
|
77
|
+
/** Time the server spent decoding the request (deserialize + load definition). */
|
|
78
|
+
decode?: number;
|
|
79
|
+
/** Time spent actually solving the Grasshopper definition. */
|
|
80
|
+
solve?: number;
|
|
81
|
+
/** Time spent encoding the response (serialize geometry). */
|
|
82
|
+
encode?: number;
|
|
83
|
+
/** The raw `Server-Timing` header value, e.g. `decode;dur=3, solve;dur=120, encode;dur=8`. */
|
|
84
|
+
raw: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type { ComputeConfig as C, RetryPolicy as R, ServerTiming as S, RhinoModelUnit as a };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rhino model unit types supported by Rhino.Compute
|
|
3
|
+
*/
|
|
4
|
+
type RhinoModelUnit = 'None' | 'Microns' | 'Millimeters' | 'Centimeters' | 'Meters' | 'Kilometers' | 'Microinches' | 'Mils' | 'Inches' | 'Feet' | 'Miles' | 'CustomUnits' | 'Angstroms' | 'Nanometers' | 'Decimeters' | 'Dekameters' | 'Hectometers' | 'Megameters' | 'Gigameters' | 'Yards' | 'PrinterPoints' | 'PrinterPicas' | 'NauticalMiles' | 'AstronomicalUnits' | 'LightYears' | 'Parsecs' | 'Unset';
|
|
5
|
+
/**
|
|
6
|
+
* Retry policy for transient errors (network, 502, 503, 504, optionally 429).
|
|
7
|
+
*
|
|
8
|
+
* Retries use exponential backoff with jitter, capped at `maxDelayMs`.
|
|
9
|
+
* If the server returns `Retry-After`, that value is honored instead.
|
|
10
|
+
*/
|
|
11
|
+
interface RetryPolicy {
|
|
12
|
+
/** Maximum number of retry attempts after the initial request (default: 0). */
|
|
13
|
+
attempts?: number;
|
|
14
|
+
/** Base delay in milliseconds for exponential backoff (default: 500). */
|
|
15
|
+
baseDelayMs?: number;
|
|
16
|
+
/** Upper bound for backoff delay (default: 30_000). */
|
|
17
|
+
maxDelayMs?: number;
|
|
18
|
+
/** Whether to retry on 429 responses (default: true — honors Retry-After). */
|
|
19
|
+
retryOn429?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface ComputeConfig {
|
|
22
|
+
/**
|
|
23
|
+
* The base URL of the Rhino Compute server (e.g., http://localhost:6500).
|
|
24
|
+
*
|
|
25
|
+
* This should point at the `rhino.compute` front (the reverse proxy), not a
|
|
26
|
+
* bare `compute.geometry` child process. `ComputeServerStats` relies on the
|
|
27
|
+
* proxy-only endpoints `/healthcheck` and `/activechildren`; targeting a
|
|
28
|
+
* bare `compute.geometry` would make `isServerOnline()` 404 even though
|
|
29
|
+
* `/grasshopper` would still solve.
|
|
30
|
+
*/
|
|
31
|
+
serverUrl: string;
|
|
32
|
+
/** Optional API key for authenticating with the server (RhinoComputeKey) */
|
|
33
|
+
apiKey?: string;
|
|
34
|
+
/** Optional Bearer token for authentication (e.g., when behind a proxy or API gateway) */
|
|
35
|
+
authToken?: string;
|
|
36
|
+
/** Enable debug logging to the console */
|
|
37
|
+
debug?: boolean;
|
|
38
|
+
/** Suppress browser security warnings in the console */
|
|
39
|
+
suppressBrowserWarning?: boolean;
|
|
40
|
+
/** @deprecated Renamed to `suppressBrowserWarning`. */
|
|
41
|
+
suppressClientSideWarning?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Per-request timeout in milliseconds. Set to `0` to disable (useful for long
|
|
44
|
+
* solves where any timeout is the wrong answer). Default: no timeout.
|
|
45
|
+
*
|
|
46
|
+
* Uses `AbortSignal.timeout` so the timer is not throttled when the tab is hidden.
|
|
47
|
+
*/
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Retry policy for transient errors. Default: no retries.
|
|
51
|
+
*/
|
|
52
|
+
retry?: RetryPolicy;
|
|
53
|
+
/**
|
|
54
|
+
* Optional caller-supplied AbortSignal. Composes with the internal timeout —
|
|
55
|
+
* whichever fires first wins. Lets callers cancel in-flight requests
|
|
56
|
+
* (e.g. on component unmount or when superseding a stale solve).
|
|
57
|
+
*/
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
/**
|
|
60
|
+
* Optional callback invoked with the server's per-request `Server-Timing`
|
|
61
|
+
* breakdown when the response carries one (the `/grasshopper` solve endpoint
|
|
62
|
+
* emits `decode;dur=N, solve;dur=N, encode;dur=N` on every response).
|
|
63
|
+
*
|
|
64
|
+
* Fires on success only, once per request, before the parsed body is
|
|
65
|
+
* returned. The transport stays response-type-agnostic — this is a side
|
|
66
|
+
* channel for telemetry, it does not change what a call returns. Use it to
|
|
67
|
+
* feed a perf monitor or surface "solve took Nms" without server log access.
|
|
68
|
+
*/
|
|
69
|
+
onServerTiming?: (timing: ServerTiming) => void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parsed `Server-Timing` metrics from a Compute response. Durations are in
|
|
73
|
+
* milliseconds. Any metric the server omits is `undefined`. `raw` is the
|
|
74
|
+
* original header value, preserved so callers can read non-standard metrics.
|
|
75
|
+
*/
|
|
76
|
+
interface ServerTiming {
|
|
77
|
+
/** Time the server spent decoding the request (deserialize + load definition). */
|
|
78
|
+
decode?: number;
|
|
79
|
+
/** Time spent actually solving the Grasshopper definition. */
|
|
80
|
+
solve?: number;
|
|
81
|
+
/** Time spent encoding the response (serialize geometry). */
|
|
82
|
+
encode?: number;
|
|
83
|
+
/** The raw `Server-Timing` header value, e.g. `decode;dur=3, solve;dur=120, encode;dur=8`. */
|
|
84
|
+
raw: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type { ComputeConfig as C, RetryPolicy as R, ServerTiming as S, RhinoModelUnit as a };
|
|
@@ -1,54 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Rhino model unit types supported by Rhino.Compute
|
|
3
|
-
*/
|
|
4
|
-
type RhinoModelUnit = 'None' | 'Microns' | 'Millimeters' | 'Centimeters' | 'Meters' | 'Kilometers' | 'Microinches' | 'Mils' | 'Inches' | 'Feet' | 'Miles' | 'CustomUnits' | 'Angstroms' | 'Nanometers' | 'Decimeters' | 'Dekameters' | 'Hectometers' | 'Megameters' | 'Gigameters' | 'Yards' | 'PrinterPoints' | 'PrinterPicas' | 'NauticalMiles' | 'AstronomicalUnits' | 'LightYears' | 'Parsecs' | 'Unset';
|
|
5
|
-
/**
|
|
6
|
-
* Retry policy for transient errors (network, 502, 503, 504, optionally 429).
|
|
7
|
-
*
|
|
8
|
-
* Retries use exponential backoff with jitter, capped at `maxDelayMs`.
|
|
9
|
-
* If the server returns `Retry-After`, that value is honored instead.
|
|
10
|
-
*/
|
|
11
|
-
interface RetryPolicy {
|
|
12
|
-
/** Maximum number of retry attempts after the initial request (default: 0). */
|
|
13
|
-
attempts?: number;
|
|
14
|
-
/** Base delay in milliseconds for exponential backoff (default: 500). */
|
|
15
|
-
baseDelayMs?: number;
|
|
16
|
-
/** Upper bound for backoff delay (default: 30_000). */
|
|
17
|
-
maxDelayMs?: number;
|
|
18
|
-
/** Whether to retry on 429 responses (default: true — honors Retry-After). */
|
|
19
|
-
retryOn429?: boolean;
|
|
20
|
-
}
|
|
21
|
-
interface ComputeConfig {
|
|
22
|
-
/** The base URL of the Rhino Compute server (e.g., http://localhost:6500) */
|
|
23
|
-
serverUrl: string;
|
|
24
|
-
/** Optional API key for authenticating with the server (RhinoComputeKey) */
|
|
25
|
-
apiKey?: string;
|
|
26
|
-
/** Optional Bearer token for authentication (e.g., when behind a proxy or API gateway) */
|
|
27
|
-
authToken?: string;
|
|
28
|
-
/** Enable debug logging to the console */
|
|
29
|
-
debug?: boolean;
|
|
30
|
-
/** Suppress browser security warnings in the console */
|
|
31
|
-
suppressBrowserWarning?: boolean;
|
|
32
|
-
/** @deprecated Renamed to `suppressBrowserWarning`. */
|
|
33
|
-
suppressClientSideWarning?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Per-request timeout in milliseconds. Set to `0` to disable (useful for long
|
|
36
|
-
* solves where any timeout is the wrong answer). Default: no timeout.
|
|
37
|
-
*
|
|
38
|
-
* Uses `AbortSignal.timeout` so the timer is not throttled when the tab is hidden.
|
|
39
|
-
*/
|
|
40
|
-
timeoutMs?: number;
|
|
41
|
-
/**
|
|
42
|
-
* Retry policy for transient errors. Default: no retries.
|
|
43
|
-
*/
|
|
44
|
-
retry?: RetryPolicy;
|
|
45
|
-
/**
|
|
46
|
-
* Optional caller-supplied AbortSignal. Composes with the internal timeout —
|
|
47
|
-
* whichever fires first wins. Lets callers cancel in-flight requests
|
|
48
|
-
* (e.g. on component unmount or when superseding a stale solve).
|
|
49
|
-
*/
|
|
50
|
-
signal?: AbortSignal;
|
|
51
|
-
}
|
|
1
|
+
import { C as ComputeConfig, a as RhinoModelUnit } from './types-D1SkNje_.js';
|
|
52
2
|
|
|
53
3
|
/**
|
|
54
4
|
* Grasshopper types
|
|
@@ -230,26 +180,6 @@ interface GrasshopperComputeConfig extends ComputeConfig {
|
|
|
230
180
|
/** Whether to use cached solution */
|
|
231
181
|
cachesolve?: boolean | null;
|
|
232
182
|
}
|
|
233
|
-
/**
|
|
234
|
-
* Raw I/O response schema from API (PascalCase)
|
|
235
|
-
*
|
|
236
|
-
* This is the direct response format from the Rhino Compute server API.
|
|
237
|
-
* All property names are in PascalCase, which is typical for .NET APIs.
|
|
238
|
-
* This raw response is converted to camelCase by the camelcaseKeys() function
|
|
239
|
-
* in the fetchDefinitionIO() method.
|
|
240
|
-
*/
|
|
241
|
-
interface IoResponseSchema {
|
|
242
|
-
description: string;
|
|
243
|
-
filename: string;
|
|
244
|
-
cachekey: string;
|
|
245
|
-
inputnames: string[];
|
|
246
|
-
outputnames: string[];
|
|
247
|
-
icon: string | null;
|
|
248
|
-
inputs: InputParamSchema[];
|
|
249
|
-
outputs: OutputParamSchema[];
|
|
250
|
-
warnings: any[];
|
|
251
|
-
errors: any[];
|
|
252
|
-
}
|
|
253
183
|
/**
|
|
254
184
|
* Arguments sent to Grasshopper compute endpoint
|
|
255
185
|
* Includes config options + definition source + input values
|
|
@@ -324,11 +254,20 @@ interface InputParamSchema {
|
|
|
324
254
|
groupName?: string | null;
|
|
325
255
|
}
|
|
326
256
|
/**
|
|
327
|
-
* Parsed input/output structure with raw schemas
|
|
257
|
+
* Parsed input/output structure with raw schemas.
|
|
258
|
+
*
|
|
259
|
+
* `loadWarnings` / `loadErrors` carry the server's definition-load diagnostics
|
|
260
|
+
* (missing plugin, broken component, etc.) from the `/io` response. They are
|
|
261
|
+
* distinct from per-input parse failures (`InputParseError`): these come from
|
|
262
|
+
* the server loading the definition, those from the client typing an input.
|
|
328
263
|
*/
|
|
329
264
|
interface GrasshopperParsedIORaw {
|
|
330
265
|
inputs: InputParamSchema[];
|
|
331
266
|
outputs: OutputParamSchema[];
|
|
267
|
+
/** Server-side definition-load warnings, if any. */
|
|
268
|
+
loadWarnings?: string[];
|
|
269
|
+
/** Server-side definition-load errors, if any (e.g. missing plugin). */
|
|
270
|
+
loadErrors?: string[];
|
|
332
271
|
}
|
|
333
272
|
/**
|
|
334
273
|
* Per-input parse failure. The corresponding entry in `inputs` was filled
|
|
@@ -357,6 +296,110 @@ interface GrasshopperParsedIO {
|
|
|
357
296
|
inputs: InputParam[];
|
|
358
297
|
outputs: OutputParamSchema[];
|
|
359
298
|
parseErrors?: InputParseError[];
|
|
299
|
+
/**
|
|
300
|
+
* Server-side definition-load warnings from the `/io` response (e.g. an
|
|
301
|
+
* obsolete component). Surface these so the user understands a degraded IO
|
|
302
|
+
* list. Distinct from `parseErrors` (client-side input typing failures).
|
|
303
|
+
*/
|
|
304
|
+
loadWarnings?: string[];
|
|
305
|
+
/**
|
|
306
|
+
* Server-side definition-load errors from the `/io` response (e.g. a missing
|
|
307
|
+
* plugin that left inputs unresolved). When present, the inputs/outputs may
|
|
308
|
+
* be incomplete — the user needs to fix their server/definition.
|
|
309
|
+
*/
|
|
310
|
+
loadErrors?: string[];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Material properties for Three.js rendering.
|
|
315
|
+
*/
|
|
316
|
+
interface SerializableMaterial {
|
|
317
|
+
color: string;
|
|
318
|
+
metalness: number;
|
|
319
|
+
roughness: number;
|
|
320
|
+
opacity: number;
|
|
321
|
+
transparent: boolean;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Metadata for a single mesh within a batch.
|
|
325
|
+
*
|
|
326
|
+
* Offsets and counts are expressed in **vertex-count units** (not float components) and
|
|
327
|
+
* **index-count units**. To address the typed-array storage:
|
|
328
|
+
* - vertex component offset = `vertexStart * 3`
|
|
329
|
+
* - vertex component count = `vertexCount * 3`
|
|
330
|
+
* - index byte offset = `indexStart * 4`
|
|
331
|
+
* - index count = `indexCount`
|
|
332
|
+
*/
|
|
333
|
+
interface MeshMetadata {
|
|
334
|
+
name: string;
|
|
335
|
+
/** Layer path for grouping in the scene manager (e.g. 'Structure/Walls') */
|
|
336
|
+
layer: string;
|
|
337
|
+
/** Original index in the GH input tree before material grouping. Combined with
|
|
338
|
+
* MeshBatch.sourceComponentId to uniquely identify the GH source geometry. */
|
|
339
|
+
originalIndex: number;
|
|
340
|
+
/** Number of vertices in this mesh (each vertex is 3 components: x, y, z). */
|
|
341
|
+
vertexCount: number;
|
|
342
|
+
/** Number of indices in this mesh (3 per triangle). */
|
|
343
|
+
indexCount: number;
|
|
344
|
+
/** Index of this mesh's first vertex in the combined vertex array, in vertex-count units.
|
|
345
|
+
* The corresponding component offset into the int16/float32 typed array is `vertexStart * 3`. */
|
|
346
|
+
vertexStart: number;
|
|
347
|
+
/** Index of this mesh's first index in the combined index array, in index-count units. */
|
|
348
|
+
indexStart: number;
|
|
349
|
+
/** Arbitrary key-value pairs from the GH Metadata input */
|
|
350
|
+
metadata?: Record<string, string>;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* A group of meshes sharing the same material.
|
|
354
|
+
*/
|
|
355
|
+
interface MaterialGroup {
|
|
356
|
+
/** Reference to the material ID in the materials array */
|
|
357
|
+
materialId: number;
|
|
358
|
+
/** Individual meshes in this group */
|
|
359
|
+
meshes: MeshMetadata[];
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Batched mesh data optimized for Three.js rendering.
|
|
363
|
+
*
|
|
364
|
+
* `compressedData` contains the binary "SLVA" blob (header + metadata JSON + quantized int16 or
|
|
365
|
+
* float32 vertices + uint32 indices), base64-encoded for transit inside the values JSON envelope.
|
|
366
|
+
* The blob is opaque to the outer JSON: a future binary WebSocket frame can drop the base64 step
|
|
367
|
+
* without changing this shape.
|
|
368
|
+
*/
|
|
369
|
+
interface MeshBatch {
|
|
370
|
+
/** Array of unique materials */
|
|
371
|
+
materials: SerializableMaterial[];
|
|
372
|
+
/** Groups of meshes organized by material */
|
|
373
|
+
groups: MaterialGroup[];
|
|
374
|
+
/** Base64-encoded binary blob (SLVA wire format). */
|
|
375
|
+
compressedData: string;
|
|
376
|
+
/** InstanceGuid of the WebDisplay GH component that produced this batch.
|
|
377
|
+
* Combined with MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
|
|
378
|
+
sourceComponentId?: string;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Options for parsing mesh batch data.
|
|
382
|
+
*/
|
|
383
|
+
interface MeshBatchParsingOptions {
|
|
384
|
+
/** Merge meshes with same material into single geometry (better performance). Defaults to true. */
|
|
385
|
+
mergeByMaterial?: boolean;
|
|
386
|
+
/** Apply coordinate system transformations (Rhino Z-up to Three.js Y-up). Defaults to true. */
|
|
387
|
+
applyTransforms?: boolean;
|
|
388
|
+
/** Enable performance monitoring in console. Defaults to false. */
|
|
389
|
+
debug?: boolean;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Options for extracting and processing meshes from compute responses.
|
|
393
|
+
*/
|
|
394
|
+
interface MeshExtractionOptions {
|
|
395
|
+
/** Configuration for parsing mesh batches. */
|
|
396
|
+
parsing?: MeshBatchParsingOptions;
|
|
397
|
+
/** Apply scaling based on model units. Defaults to true. */
|
|
398
|
+
allowScaling?: boolean;
|
|
399
|
+
/** Apply automatic ground offset positioning (Z=0). Defaults to true. */
|
|
400
|
+
allowAutoPosition?: boolean;
|
|
401
|
+
/** Enable verbose logging. Defaults to false. */
|
|
402
|
+
debug?: boolean;
|
|
360
403
|
}
|
|
361
404
|
|
|
362
|
-
export type { BooleanInputType as B,
|
|
405
|
+
export type { BooleanInputType as B, DataItem as D, FileInputType as F, GeometryInputType as G, InnerTreeData as I, MeshExtractionOptions as M, NumericInputType as N, OutputParamSchema as O, TextInputType as T, ValueListInputType as V, DataTree as a, DataTreeDefault as b, DataTreePath as c, DefaultValue as d, GrasshopperComputeConfig as e, GrasshopperComputeResponse as f, GrasshopperParsedIO as g, GrasshopperParsedIORaw as h, GrasshopperRequestSchema as i, InputParam as j, InputParamSchema as k, OutputType as l, MeshBatchParsingOptions as m, MeshBatch as n };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJFLD2UCYcjs = require('./chunk-JFLD2UCY.cjs');require('./chunk-MA6YB3YZ.cjs');exports.BINARY_MESH_MAGIC = _chunkJFLD2UCYcjs.g; exports.BINARY_MESH_VERSION = _chunkJFLD2UCYcjs.h; exports.FLAG_FLOAT32 = _chunkJFLD2UCYcjs.i; exports.Materials = _chunkJFLD2UCYcjs.f; exports.SCALE_FACTORS = _chunkJFLD2UCYcjs.n; exports.applyOffset = _chunkJFLD2UCYcjs.d; exports.computeCombinedBoundingBox = _chunkJFLD2UCYcjs.e; exports.getThreeMeshesFromComputeResponse = _chunkJFLD2UCYcjs.o; exports.initThree = _chunkJFLD2UCYcjs.a; exports.parseBinaryMeshBatch = _chunkJFLD2UCYcjs.j; exports.parseColor = _chunkJFLD2UCYcjs.c; exports.parseMeshBatch = _chunkJFLD2UCYcjs.k; exports.parseMeshBatchBlob = _chunkJFLD2UCYcjs.m; exports.parseMeshBatchObject = _chunkJFLD2UCYcjs.l; exports.updateScene = _chunkJFLD2UCYcjs.b;
|
|
2
|
+
//# sourceMappingURL=visualization-GU7JIB4V.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/visualization-GU7JIB4V.cjs"],"names":[],"mappings":"AAAA,iIAAqI,gCAA6B,itBAAoV","file":"/home/runner/work/selva-compute/selva-compute/dist/visualization-GU7JIB4V.cjs"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,b as r,c as o,d as t,e as a,f as s,g as i,h as p,i as n,j as h,k as M,l as f,m,n as B,o as C}from"./chunk-MKW2KTPT.js";import"./chunk-GTTKNF4G.js";export{i as BINARY_MESH_MAGIC,p as BINARY_MESH_VERSION,n as FLAG_FLOAT32,s as Materials,B as SCALE_FACTORS,t as applyOffset,a as computeCombinedBoundingBox,C as getThreeMeshesFromComputeResponse,e as initThree,h as parseBinaryMeshBatch,o as parseColor,M as parseMeshBatch,m as parseMeshBatchBlob,f as parseMeshBatchObject,r as updateScene};
|
|
2
|
+
//# sourceMappingURL=visualization-WIUVT2FZ.js.map
|
package/dist/visualization.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJFLD2UCYcjs = require('./chunk-JFLD2UCY.cjs');require('./chunk-MA6YB3YZ.cjs');exports.Materials = _chunkJFLD2UCYcjs.f; exports.SCALE_FACTORS = _chunkJFLD2UCYcjs.n; exports.getThreeMeshesFromComputeResponse = _chunkJFLD2UCYcjs.o; exports.initThree = _chunkJFLD2UCYcjs.a; exports.parseMeshBatchBlob = _chunkJFLD2UCYcjs.m; exports.parseMeshBatchObject = _chunkJFLD2UCYcjs.l; exports.updateScene = _chunkJFLD2UCYcjs.b;
|
|
2
2
|
//# sourceMappingURL=visualization.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/visualization.cjs"],"names":[],"mappings":"AAAA,iIAA6E,gCAA6B,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/visualization.cjs"],"names":[],"mappings":"AAAA,iIAA6E,gCAA6B,gVAAmK","file":"/home/runner/work/selva-compute/selva-compute/dist/visualization.cjs"}
|