ballistics-engine 0.36.0 → 0.36.2
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/ballistics_engine.d.ts +30 -1
- package/ballistics_engine.js +43 -0
- package/ballistics_engine_bg.wasm +0 -0
- package/package.json +1 -1
package/ballistics_engine.d.ts
CHANGED
|
@@ -158,12 +158,41 @@ export class WasmBallistics {
|
|
|
158
158
|
runCommand(command: string): string;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
/**
|
|
162
|
+
* The engine's versioned JSON command bridge, as one JavaScript function.
|
|
163
|
+
*
|
|
164
|
+
* One request envelope in, one response envelope out, both as strings:
|
|
165
|
+
*
|
|
166
|
+
* ```text
|
|
167
|
+
* in: {"api_version":1,"command":"solve","request":{ … }}
|
|
168
|
+
* ok: {"ok":true,"api_version":1,"engine_version":"…","command":"solve","result":{ … }}
|
|
169
|
+
* err: {"ok":false,"api_version":1,"engine_version":"…","error":{"code":"…","message":"…"}}
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* This is the module's programmatic surface, deliberately separate from the
|
|
173
|
+
* browser terminal above. The terminal's commands are per-feature gated because a
|
|
174
|
+
* stripped build is a smaller download; the bridge is not gateable that way — it
|
|
175
|
+
* is a single entry point onto every command the build actually contains, and it
|
|
176
|
+
* costs nothing but serde, which is already a core dependency.
|
|
177
|
+
*
|
|
178
|
+
* It is the ONLY route from JavaScript to `corrections.bc5d_table_path` and
|
|
179
|
+
* `atmosphere.pressure_reference`, and the only one that validates
|
|
180
|
+
* `effects.wind_shear_model` against a typed enum rather than silently resolving
|
|
181
|
+
* an unrecognised name to the power law.
|
|
182
|
+
*
|
|
183
|
+
* Failures arrive INSIDE the returned JSON — this never throws. Ask
|
|
184
|
+
* `meta.capabilities` for the command list, which depends on what this build
|
|
185
|
+
* compiled in rather than on what the bridge knows how to dispatch.
|
|
186
|
+
*/
|
|
187
|
+
export function bridgeCall(request_json: string): string;
|
|
188
|
+
|
|
161
189
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
162
190
|
|
|
163
191
|
export interface InitOutput {
|
|
164
192
|
readonly memory: WebAssembly.Memory;
|
|
165
193
|
readonly __wbg_calculator_free: (a: number, b: number) => void;
|
|
166
194
|
readonly __wbg_wasmballistics_free: (a: number, b: number) => void;
|
|
195
|
+
readonly bridgeCall: (a: number, b: number) => [number, number];
|
|
167
196
|
readonly calculator_addWindSegment: (a: number, b: number, c: number, d: number) => number;
|
|
168
197
|
readonly calculator_calculateTrajectory: (a: number, b: number) => [number, number, number];
|
|
169
198
|
readonly calculator_clearWindSegments: (a: number) => number;
|
|
@@ -198,10 +227,10 @@ export interface InitOutput {
|
|
|
198
227
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
199
228
|
readonly __externref_table_alloc: () => number;
|
|
200
229
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
201
|
-
readonly __externref_table_dealloc: (a: number) => void;
|
|
202
230
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
203
231
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
204
232
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
233
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
205
234
|
readonly __wbindgen_start: () => void;
|
|
206
235
|
}
|
|
207
236
|
|
package/ballistics_engine.js
CHANGED
|
@@ -444,6 +444,49 @@ export class WasmBallistics {
|
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
if (Symbol.dispose) WasmBallistics.prototype[Symbol.dispose] = WasmBallistics.prototype.free;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* The engine's versioned JSON command bridge, as one JavaScript function.
|
|
450
|
+
*
|
|
451
|
+
* One request envelope in, one response envelope out, both as strings:
|
|
452
|
+
*
|
|
453
|
+
* ```text
|
|
454
|
+
* in: {"api_version":1,"command":"solve","request":{ … }}
|
|
455
|
+
* ok: {"ok":true,"api_version":1,"engine_version":"…","command":"solve","result":{ … }}
|
|
456
|
+
* err: {"ok":false,"api_version":1,"engine_version":"…","error":{"code":"…","message":"…"}}
|
|
457
|
+
* ```
|
|
458
|
+
*
|
|
459
|
+
* This is the module's programmatic surface, deliberately separate from the
|
|
460
|
+
* browser terminal above. The terminal's commands are per-feature gated because a
|
|
461
|
+
* stripped build is a smaller download; the bridge is not gateable that way — it
|
|
462
|
+
* is a single entry point onto every command the build actually contains, and it
|
|
463
|
+
* costs nothing but serde, which is already a core dependency.
|
|
464
|
+
*
|
|
465
|
+
* It is the ONLY route from JavaScript to `corrections.bc5d_table_path` and
|
|
466
|
+
* `atmosphere.pressure_reference`, and the only one that validates
|
|
467
|
+
* `effects.wind_shear_model` against a typed enum rather than silently resolving
|
|
468
|
+
* an unrecognised name to the power law.
|
|
469
|
+
*
|
|
470
|
+
* Failures arrive INSIDE the returned JSON — this never throws. Ask
|
|
471
|
+
* `meta.capabilities` for the command list, which depends on what this build
|
|
472
|
+
* compiled in rather than on what the bridge knows how to dispatch.
|
|
473
|
+
* @param {string} request_json
|
|
474
|
+
* @returns {string}
|
|
475
|
+
*/
|
|
476
|
+
export function bridgeCall(request_json) {
|
|
477
|
+
let deferred2_0;
|
|
478
|
+
let deferred2_1;
|
|
479
|
+
try {
|
|
480
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
481
|
+
const len0 = WASM_VECTOR_LEN;
|
|
482
|
+
const ret = wasm.bridgeCall(ptr0, len0);
|
|
483
|
+
deferred2_0 = ret[0];
|
|
484
|
+
deferred2_1 = ret[1];
|
|
485
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
486
|
+
} finally {
|
|
487
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
447
490
|
function __wbg_get_imports() {
|
|
448
491
|
const import0 = {
|
|
449
492
|
__proto__: null,
|
|
Binary file
|
package/package.json
CHANGED