@selvajs/compute 1.5.2-beta.0 → 1.5.2-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.
Files changed (60) hide show
  1. package/README.md +12 -8
  2. package/dist/chunk-2D74PNQU.cjs +2 -0
  3. package/dist/chunk-2D74PNQU.cjs.map +1 -0
  4. package/dist/chunk-5465MDT4.cjs +2 -0
  5. package/dist/chunk-5465MDT4.cjs.map +1 -0
  6. package/dist/chunk-DADFXYBV.js +2 -0
  7. package/dist/chunk-DADFXYBV.js.map +1 -0
  8. package/dist/chunk-MZGKJZVP.cjs +2 -0
  9. package/dist/chunk-MZGKJZVP.cjs.map +1 -0
  10. package/dist/chunk-RHULSS7S.js +3 -0
  11. package/dist/chunk-RHULSS7S.js.map +1 -0
  12. package/dist/chunk-VWOEUM7C.cjs +3 -0
  13. package/dist/chunk-VWOEUM7C.cjs.map +1 -0
  14. package/dist/chunk-XIBQV4XW.js +2 -0
  15. package/dist/chunk-XIBQV4XW.js.map +1 -0
  16. package/dist/chunk-XLHA5YPH.js +2 -0
  17. package/dist/chunk-XLHA5YPH.js.map +1 -0
  18. package/dist/core.cjs +1 -1
  19. package/dist/core.d.cts +3 -21
  20. package/dist/core.d.ts +3 -21
  21. package/dist/core.js +1 -1
  22. package/dist/errors-CiA83qw2.d.cts +510 -0
  23. package/dist/errors-CiA83qw2.d.ts +510 -0
  24. package/dist/grasshopper.cjs +1 -1
  25. package/dist/grasshopper.d.cts +75 -142
  26. package/dist/grasshopper.d.ts +75 -142
  27. package/dist/grasshopper.js +1 -1
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.cts +3 -5
  30. package/dist/index.d.ts +3 -5
  31. package/dist/index.js +1 -1
  32. package/dist/visualization-3HFOMXUY.cjs +2 -0
  33. package/dist/visualization-3HFOMXUY.cjs.map +1 -0
  34. package/dist/visualization-XXHESVUI.js +2 -0
  35. package/dist/visualization-XXHESVUI.js.map +1 -0
  36. package/dist/visualization.cjs +1 -1
  37. package/dist/visualization.cjs.map +1 -1
  38. package/dist/visualization.d.cts +1 -76
  39. package/dist/visualization.d.ts +1 -76
  40. package/dist/visualization.js +1 -1
  41. package/dist/visualization.js.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/base-dtik4Dlu.d.cts +0 -138
  44. package/dist/base-dtik4Dlu.d.ts +0 -138
  45. package/dist/chunk-2NFN5ERT.cjs +0 -2
  46. package/dist/chunk-2NFN5ERT.cjs.map +0 -1
  47. package/dist/chunk-BKGFHI2J.js +0 -2
  48. package/dist/chunk-BKGFHI2J.js.map +0 -1
  49. package/dist/chunk-CZCPL35F.js +0 -3
  50. package/dist/chunk-CZCPL35F.js.map +0 -1
  51. package/dist/chunk-JSS6OQML.cjs +0 -2
  52. package/dist/chunk-JSS6OQML.cjs.map +0 -1
  53. package/dist/chunk-XULONXVP.cjs +0 -3
  54. package/dist/chunk-XULONXVP.cjs.map +0 -1
  55. package/dist/chunk-XZUTU46G.js +0 -2
  56. package/dist/chunk-XZUTU46G.js.map +0 -1
  57. package/dist/schemas-Ct7lU-IH.d.cts +0 -247
  58. package/dist/schemas-Ct7lU-IH.d.ts +0 -247
  59. package/dist/types-B24K2LG4.d.cts +0 -85
  60. package/dist/types-B24K2LG4.d.ts +0 -85
@@ -1,247 +0,0 @@
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
- suppressClientSideWarning?: boolean;
32
- /**
33
- * Per-request timeout in milliseconds. Set to `0` to disable (useful for long
34
- * solves where any timeout is the wrong answer). Default: no timeout.
35
- *
36
- * Uses `AbortSignal.timeout` so the timer is not throttled when the tab is hidden.
37
- */
38
- timeoutMs?: number;
39
- /**
40
- * Retry policy for transient errors. Default: no retries.
41
- */
42
- retry?: RetryPolicy;
43
- /**
44
- * Optional caller-supplied AbortSignal. Composes with the internal timeout —
45
- * whichever fires first wins. Lets callers cancel in-flight requests
46
- * (e.g. on component unmount or when superseding a stale solve).
47
- */
48
- signal?: AbortSignal;
49
- }
50
-
51
- /**
52
- * Data tree types for Grasshopper parameter structures
53
- */
54
- /**
55
- * Grasshopper-style data tree branch path
56
- * @example "{0}", "{0;0}", "{0;1;2}"
57
- */
58
- type DataTreePath = `{${string}}`;
59
- /**
60
- * Represents a data item in a data tree
61
- */
62
- interface DataItem {
63
- /** The type of the data, inferred from the Grasshopper GOO class */
64
- type: string;
65
- /** The actual returned data as a string that may need to be parsed */
66
- data: string;
67
- /** The grasshopper refrence id of the output */
68
- id: string;
69
- }
70
- /**
71
- * Grasshopper-style data tree for input defaults
72
- * @example
73
- * ```typescript
74
- * const numericTree: DataTreeDefault<number> = {
75
- * "{0}": [1, 2, 3],
76
- * "{0;0}": [4, 5],
77
- * "{1}": [6]
78
- * };
79
- * ```
80
- */
81
- type DataTreeDefault<T = any> = {
82
- [K in DataTreePath]?: T[];
83
- };
84
- /**
85
- * Data structure for InnerTreeData matching Rhino Compute responses
86
- */
87
- type InnerTreeData = {
88
- [path in DataTreePath]: DataItem[];
89
- };
90
- /**
91
- * Tree with parameter metadata (used in compute responses)
92
- */
93
- interface DataTree {
94
- InnerTree: InnerTreeData;
95
- ParamName: string;
96
- }
97
-
98
- /**
99
- * API request/response schemas for Grasshopper compute operations
100
- *
101
- * @important These types mirror the Rhino.Compute API schema (Resthopper.IO).
102
- * When Rhino.Compute is updated or types change, these definitions must be
103
- * adjusted to maintain compatibility with the Compute server API.
104
- *
105
- * Reference: https://github.com/mcneel/rhino-compute/tree/main/src/compute.sln/Resthopper.IO
106
- */
107
-
108
- /**
109
- * Base Grasshopper schema properties shared by config, args, and response
110
- */
111
- interface GrasshopperBaseSchema {
112
- /** Absolute tolerance used in computation */
113
- absolutetolerance?: number | null;
114
- /** Angular tolerance used in computation */
115
- angletolerance?: number | null;
116
- /** Model units used */
117
- modelunits?: RhinoModelUnit | null;
118
- /** Data version (7 or 8) */
119
- dataversion?: 7 | 8 | null;
120
- /** Whether to use cached solution */
121
- cachesolve?: boolean | null;
122
- }
123
- /**
124
- * Definition source (used in args and response)
125
- */
126
- interface GrasshopperDefinitionSource {
127
- /** Base64 encoded algorithm (if embedded) */
128
- algo?: string | null;
129
- /** URL pointer to definition file */
130
- pointer?: string | null;
131
- /** Filename of the definition */
132
- filename?: string | null;
133
- }
134
- /**
135
- * Configuration for Grasshopper compute operations
136
- * Combines server config with optional Grasshopper-specific computation settings
137
- *
138
- * Note: The definition source (pointer/algo) is NOT part of config.
139
- * Instead, pass the definition directly to methods like solve(), getIO(), etc.
140
- */
141
- interface GrasshopperComputeConfig extends ComputeConfig {
142
- /** Absolute tolerance used in computation */
143
- absolutetolerance?: number | null;
144
- /** Angular tolerance used in computation */
145
- angletolerance?: number | null;
146
- /** Model units used */
147
- modelunits?: RhinoModelUnit | null;
148
- /** Data version (7 or 8) */
149
- dataversion?: 7 | 8 | null;
150
- /** Whether to use cached solution */
151
- cachesolve?: boolean | null;
152
- }
153
- /**
154
- * Raw I/O response schema from API (PascalCase)
155
- *
156
- * This is the direct response format from the Rhino Compute server API.
157
- * All property names are in PascalCase, which is typical for .NET APIs.
158
- * This raw response is converted to camelCase by the camelcaseKeys() function
159
- * in the fetchDefinitionIO() method.
160
- */
161
- interface IoResponseSchema {
162
- description: string;
163
- filename: string;
164
- cachekey: string;
165
- inputnames: string[];
166
- outputnames: string[];
167
- icon: string | null;
168
- inputs: InputParamSchema[];
169
- outputs: OutputParamSchema[];
170
- warnings: any[];
171
- errors: any[];
172
- }
173
- /**
174
- * Arguments sent to Grasshopper compute endpoint
175
- * Includes config options + definition source + input values
176
- */
177
- interface GrasshopperRequestSchema extends GrasshopperBaseSchema, GrasshopperDefinitionSource {
178
- /** Input values organized by parameter */
179
- values?: DataTree[];
180
- }
181
- /**
182
- * Response from Grasshopper compute server
183
- * Includes all schema fields + computed results
184
- */
185
- interface GrasshopperComputeResponse extends GrasshopperBaseSchema, GrasshopperDefinitionSource {
186
- /** Whether cache was used (always present in response) */
187
- cachesolve: boolean;
188
- /** Model units (always present in response) */
189
- modelunits: RhinoModelUnit;
190
- /** Base64 encoded algorithm (always present in response) */
191
- algo: string;
192
- /** Filename of the definition (always present in response) */
193
- filename: string | null;
194
- /** Data version */
195
- dataversion: 7 | 8;
196
- /** Recursion level used */
197
- recursionlevel?: number;
198
- /** Output values organized by parameter */
199
- values: DataTree[];
200
- /** Computation errors */
201
- errors?: string[];
202
- /** Computation warnings */
203
- warnings?: string[];
204
- }
205
- /**
206
- * Output parameter
207
- */
208
- interface OutputParamSchema {
209
- name: string;
210
- nickname: string | null;
211
- paramType: string;
212
- /**
213
- * Grasshopper parameter instance GUID
214
- */
215
- id: string;
216
- }
217
- /**
218
- * Input parameter
219
- */
220
- interface InputParamSchema {
221
- /**
222
- * Grasshopper parameter instance GUID
223
- */
224
- id: string;
225
- name: string;
226
- nickname: string | null;
227
- description: string;
228
- paramType: string;
229
- treeAccess: boolean;
230
- minimum: number | null;
231
- maximum: number | null;
232
- atLeast: number;
233
- atMost: number;
234
- stepSize?: number;
235
- default: any;
236
- /**
237
- * Key-value pairs for dropdown options
238
- */
239
- values?: Record<string, string>;
240
- /**
241
- * Accepted file formats for File input
242
- */
243
- acceptedFormats?: string[];
244
- groupName?: string | null;
245
- }
246
-
247
- export type { ComputeConfig as C, DataItem as D, GrasshopperComputeConfig as G, InnerTreeData as I, OutputParamSchema as O, RetryPolicy as R, DataTree as a, DataTreeDefault as b, DataTreePath as c, GrasshopperComputeResponse as d, GrasshopperRequestSchema as e, InputParamSchema as f, RhinoModelUnit as g, IoResponseSchema as h };
@@ -1,85 +0,0 @@
1
- /**
2
- * Material properties for Three.js rendering.
3
- */
4
- interface SerializableMaterial {
5
- color: string;
6
- metalness: number;
7
- roughness: number;
8
- opacity: number;
9
- transparent: boolean;
10
- }
11
- /**
12
- * Metadata for a single mesh within a batch.
13
- */
14
- interface MeshMetadata {
15
- name: string;
16
- /** Layer path for grouping in the scene manager (e.g. 'Structure/Walls') */
17
- layer: string;
18
- /** Original index in the GH input tree before material grouping. Combined with
19
- * MeshBatch.sourceComponentId to uniquely identify the GH source geometry. */
20
- originalIndex: number;
21
- vertexCount: number;
22
- faceCount: number;
23
- /** Offset in the combined vertex array (in number of floats) */
24
- vertexOffset: number;
25
- /** Offset in the combined face index array (in number of integers) */
26
- faceOffset: number;
27
- /** Arbitrary key-value pairs from the GH Metadata input */
28
- metadata?: Record<string, string>;
29
- }
30
- /**
31
- * A group of meshes sharing the same material.
32
- */
33
- interface MaterialGroup {
34
- /** Reference to the material ID in the materials array */
35
- materialId: number;
36
- /** Individual meshes in this group */
37
- meshes: MeshMetadata[];
38
- }
39
- /**
40
- * Batched mesh data optimized for Three.js rendering.
41
- */
42
- interface MeshBatch {
43
- /** Array of unique materials */
44
- materials: SerializableMaterial[];
45
- /** Groups of meshes organized by material */
46
- groups: MaterialGroup[];
47
- /** Compressed binary data containing all vertices and faces */
48
- compressedData: string;
49
- /** InstanceGuid of the WebDisplay GH component that produced this batch.
50
- * Combined with MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
51
- sourceComponentId?: string;
52
- }
53
- /**
54
- * Decompressed mesh data.
55
- */
56
- interface DecompressedMeshData {
57
- vertices: Float32Array;
58
- faces: Uint32Array;
59
- }
60
- /**
61
- * Options for parsing mesh batch data.
62
- */
63
- interface MeshBatchParsingOptions {
64
- /** Merge meshes with same material into single geometry (better performance). Defaults to true. */
65
- mergeByMaterial?: boolean;
66
- /** Apply coordinate system transformations (Rhino Z-up to Three.js Y-up). Defaults to true. */
67
- applyTransforms?: boolean;
68
- /** Enable performance monitoring in console. Defaults to false. */
69
- debug?: boolean;
70
- }
71
- /**
72
- * Options for extracting and processing meshes from compute responses.
73
- */
74
- interface MeshExtractionOptions {
75
- /** Configuration for parsing mesh batches. */
76
- parsing?: MeshBatchParsingOptions;
77
- /** Apply scaling based on model units. Defaults to true. */
78
- allowScaling?: boolean;
79
- /** Apply automatic ground offset positioning (Z=0). Defaults to true. */
80
- allowAutoPosition?: boolean;
81
- /** Enable verbose logging. Defaults to false. */
82
- debug?: boolean;
83
- }
84
-
85
- export type { DecompressedMeshData as D, MeshExtractionOptions as M, SerializableMaterial as S, MeshBatch as a, MaterialGroup as b, MeshBatchParsingOptions as c, MeshMetadata as d };
@@ -1,85 +0,0 @@
1
- /**
2
- * Material properties for Three.js rendering.
3
- */
4
- interface SerializableMaterial {
5
- color: string;
6
- metalness: number;
7
- roughness: number;
8
- opacity: number;
9
- transparent: boolean;
10
- }
11
- /**
12
- * Metadata for a single mesh within a batch.
13
- */
14
- interface MeshMetadata {
15
- name: string;
16
- /** Layer path for grouping in the scene manager (e.g. 'Structure/Walls') */
17
- layer: string;
18
- /** Original index in the GH input tree before material grouping. Combined with
19
- * MeshBatch.sourceComponentId to uniquely identify the GH source geometry. */
20
- originalIndex: number;
21
- vertexCount: number;
22
- faceCount: number;
23
- /** Offset in the combined vertex array (in number of floats) */
24
- vertexOffset: number;
25
- /** Offset in the combined face index array (in number of integers) */
26
- faceOffset: number;
27
- /** Arbitrary key-value pairs from the GH Metadata input */
28
- metadata?: Record<string, string>;
29
- }
30
- /**
31
- * A group of meshes sharing the same material.
32
- */
33
- interface MaterialGroup {
34
- /** Reference to the material ID in the materials array */
35
- materialId: number;
36
- /** Individual meshes in this group */
37
- meshes: MeshMetadata[];
38
- }
39
- /**
40
- * Batched mesh data optimized for Three.js rendering.
41
- */
42
- interface MeshBatch {
43
- /** Array of unique materials */
44
- materials: SerializableMaterial[];
45
- /** Groups of meshes organized by material */
46
- groups: MaterialGroup[];
47
- /** Compressed binary data containing all vertices and faces */
48
- compressedData: string;
49
- /** InstanceGuid of the WebDisplay GH component that produced this batch.
50
- * Combined with MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
51
- sourceComponentId?: string;
52
- }
53
- /**
54
- * Decompressed mesh data.
55
- */
56
- interface DecompressedMeshData {
57
- vertices: Float32Array;
58
- faces: Uint32Array;
59
- }
60
- /**
61
- * Options for parsing mesh batch data.
62
- */
63
- interface MeshBatchParsingOptions {
64
- /** Merge meshes with same material into single geometry (better performance). Defaults to true. */
65
- mergeByMaterial?: boolean;
66
- /** Apply coordinate system transformations (Rhino Z-up to Three.js Y-up). Defaults to true. */
67
- applyTransforms?: boolean;
68
- /** Enable performance monitoring in console. Defaults to false. */
69
- debug?: boolean;
70
- }
71
- /**
72
- * Options for extracting and processing meshes from compute responses.
73
- */
74
- interface MeshExtractionOptions {
75
- /** Configuration for parsing mesh batches. */
76
- parsing?: MeshBatchParsingOptions;
77
- /** Apply scaling based on model units. Defaults to true. */
78
- allowScaling?: boolean;
79
- /** Apply automatic ground offset positioning (Z=0). Defaults to true. */
80
- allowAutoPosition?: boolean;
81
- /** Enable verbose logging. Defaults to false. */
82
- debug?: boolean;
83
- }
84
-
85
- export type { DecompressedMeshData as D, MeshExtractionOptions as M, SerializableMaterial as S, MeshBatch as a, MaterialGroup as b, MeshBatchParsingOptions as c, MeshMetadata as d };