space-data-module-sdk 0.10.4 → 0.12.0
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/bin/space-data-module.js +28 -6
- package/docs/conformance.html +1 -1
- package/docs/conformance.md +4 -2
- package/docs/isomorphic-pthreads.html +10 -0
- package/docs/module-publication-standard.html +6 -4
- package/docs/module-publication-standard.md +30 -8
- package/docs/protect-and-sign.html +3 -3
- package/docs/protect-and-sign.md +12 -5
- package/package.json +5 -3
- package/src/bundle/codeManifest.js +579 -0
- package/src/bundle/index.js +1 -0
- package/src/bundle/signing.js +385 -304
- package/src/bundle/wasm.js +60 -0
- package/src/compliance/index.js +2 -0
- package/src/compliance/pluginCompliance.js +144 -32
- package/src/flow/flowCompiler.js +41 -43
- package/src/flow/isomorphicFlowHost.js +17 -27
- package/src/host/isomorphicLoader.js +89 -11
- package/src/index.d.ts +406 -0
- package/src/runtime-host/ephemerisGridStore.js +1688 -0
- package/src/runtime-host/index.js +83 -1
- package/src/runtime-host/runtimeRegionStore.js +382 -3
|
@@ -27,6 +27,8 @@ import {
|
|
|
27
27
|
resolveModuleSignaturePolicy,
|
|
28
28
|
verifyModuleArtifact,
|
|
29
29
|
} from "../bundle/signing.js";
|
|
30
|
+
import { readBoundManifestBytes } from "../bundle/codeManifest.js";
|
|
31
|
+
import { decodePlgManifest } from "../manifest/plgCodec.js";
|
|
30
32
|
import { attachHostDispatch, inspectModule } from "./isomorphicLoaderCore.js";
|
|
31
33
|
import { assertArtifactRuntimeTarget } from "./runtimeTargetGate.js";
|
|
32
34
|
import { DEFAULT_HOSTCALL_IMPORT_MODULE } from "./abi.js";
|
|
@@ -67,8 +69,9 @@ async function createWasmEdgeCommandHarness(options = {}) {
|
|
|
67
69
|
// Signed/published artifacts carry an appended publication record
|
|
68
70
|
// collection that WasmEdge rejects ("malformed section id"). Strip to the
|
|
69
71
|
// canonical module payload; if anything was stripped, launch WasmEdge from
|
|
70
|
-
// a temp copy of the stripped bytes
|
|
71
|
-
//
|
|
72
|
+
// a temp copy of the stripped bytes. Under a signature policy loadModule()
|
|
73
|
+
// passes, as wasmSource, its own private copy of the bytes it verified, so
|
|
74
|
+
// these are those bytes, not a second read of the caller's file.
|
|
72
75
|
const loadableBytes = toLoadableWasmBytes(wasmBytes);
|
|
73
76
|
const inspection = await inspectModule(loadableBytes);
|
|
74
77
|
|
|
@@ -270,7 +273,58 @@ export async function loadModule(options = {}) {
|
|
|
270
273
|
if (isBrowser) {
|
|
271
274
|
return createBrowserModuleHarness(options);
|
|
272
275
|
}
|
|
276
|
+
const owned = { verifiedCopy: null };
|
|
277
|
+
let harness;
|
|
278
|
+
try {
|
|
279
|
+
harness = await loadServerModule(options, signaturePolicy, owned);
|
|
280
|
+
} catch (error) {
|
|
281
|
+
await owned.verifiedCopy?.remove();
|
|
282
|
+
throw error;
|
|
283
|
+
}
|
|
284
|
+
const verifiedCopy = owned.verifiedCopy;
|
|
285
|
+
if (!verifiedCopy) {
|
|
286
|
+
return harness;
|
|
287
|
+
}
|
|
288
|
+
// The verified copy lives as long as the harness that runs it.
|
|
289
|
+
const destroy = typeof harness.destroy === "function" ? harness.destroy.bind(harness) : null;
|
|
290
|
+
harness.verifiedArtifactPath = verifiedCopy.path;
|
|
291
|
+
harness.destroy = async (...args) => {
|
|
292
|
+
try {
|
|
293
|
+
return destroy ? await destroy(...args) : undefined;
|
|
294
|
+
} finally {
|
|
295
|
+
await verifiedCopy.remove();
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
return harness;
|
|
299
|
+
}
|
|
273
300
|
|
|
301
|
+
// The verified bytes, written to a new private temporary directory
|
|
302
|
+
// (owner-only), for the harness to read instead of the caller's path.
|
|
303
|
+
async function writeVerifiedArtifactCopy(bytes) {
|
|
304
|
+
const [{ mkdtemp, writeFile, rm }, osModule, pathModule] = await Promise.all([
|
|
305
|
+
import("node:fs/promises"),
|
|
306
|
+
import("node:os"),
|
|
307
|
+
import("node:path"),
|
|
308
|
+
]);
|
|
309
|
+
const os = osModule.default ?? osModule;
|
|
310
|
+
const path = pathModule.default ?? pathModule;
|
|
311
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "sdm-verified-"));
|
|
312
|
+
const filePath = path.join(dir, "module.wasm");
|
|
313
|
+
try {
|
|
314
|
+
await writeFile(filePath, bytes, { mode: 0o600, flag: "wx" });
|
|
315
|
+
} catch (error) {
|
|
316
|
+
await rm(dir, { recursive: true, force: true });
|
|
317
|
+
throw error;
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
path: filePath,
|
|
321
|
+
async remove() {
|
|
322
|
+
await rm(dir, { recursive: true, force: true });
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
async function loadServerModule(options, signaturePolicy, owned) {
|
|
274
328
|
const { createModuleHarness } = await import("../testing/moduleHarness.js");
|
|
275
329
|
const source = options.wasmSource;
|
|
276
330
|
if (typeof source !== "string") {
|
|
@@ -304,18 +358,40 @@ export async function loadModule(options = {}) {
|
|
|
304
358
|
let artifactBytes = null;
|
|
305
359
|
let wasmModule = null;
|
|
306
360
|
let embeddedManifest = null;
|
|
361
|
+
// Under a signature policy every runtime runs the bytes that were VERIFIED:
|
|
362
|
+
// they are written to a private temporary file and that file, never the
|
|
363
|
+
// caller's path, is what the harness reads and launches. Reading the path
|
|
364
|
+
// again after the check would let a file swapped in between run unverified.
|
|
365
|
+
let launchSource = source;
|
|
307
366
|
if (needsBytes) {
|
|
308
367
|
const { readFile } = await import("node:fs/promises");
|
|
309
368
|
artifactBytes = new Uint8Array(await readFile(source));
|
|
369
|
+
let verifiedSignature = false;
|
|
310
370
|
if (signaturePolicy) {
|
|
311
|
-
await verifyModuleArtifact(artifactBytes, signaturePolicy);
|
|
371
|
+
const verification = await verifyModuleArtifact(artifactBytes, signaturePolicy);
|
|
372
|
+
verifiedSignature =
|
|
373
|
+
signaturePolicy.requireSignature === true && verification?.verified === true;
|
|
374
|
+
owned.verifiedCopy = await writeVerifiedArtifactCopy(artifactBytes);
|
|
375
|
+
launchSource = owned.verifiedCopy.path;
|
|
312
376
|
}
|
|
313
377
|
if (runtimeKind === "wasmedge") {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
378
|
+
// The declaration comes from the SIGNED code (readBoundManifestBytes),
|
|
379
|
+
// never from the trailer's manifest entry, which the signature does not
|
|
380
|
+
// cover; a trailer copy that differs from the code's is refused by name.
|
|
381
|
+
// The code is run in this process to ask it ONLY when its signature
|
|
382
|
+
// was verified under a policy that requires one; otherwise the manifest
|
|
383
|
+
// exports are answered from the bytes alone or not at all.
|
|
384
|
+
const manifestBytes = await readBoundManifestBytes(artifactBytes, {
|
|
385
|
+
verifiedSignature,
|
|
386
|
+
});
|
|
387
|
+
embeddedManifest = null;
|
|
388
|
+
if (manifestBytes) {
|
|
389
|
+
try {
|
|
390
|
+
embeddedManifest = decodePlgManifest(manifestBytes);
|
|
391
|
+
} catch {
|
|
392
|
+
// An undecodable manifest is not a declaration.
|
|
393
|
+
}
|
|
394
|
+
}
|
|
319
395
|
}
|
|
320
396
|
if (needsCompiledModule) {
|
|
321
397
|
wasmModule = await WebAssembly.compile(toLoadableWasmBytes(artifactBytes));
|
|
@@ -346,7 +422,7 @@ export async function loadModule(options = {}) {
|
|
|
346
422
|
(!options.wasmEdgeRunnerBinary || options.surface === "command" || useRunner)
|
|
347
423
|
) {
|
|
348
424
|
return attachHostDispatch(
|
|
349
|
-
await createWasmEdgeCommandHarness(options),
|
|
425
|
+
await createWasmEdgeCommandHarness({ ...options, wasmSource: launchSource }),
|
|
350
426
|
options.host ?? null,
|
|
351
427
|
);
|
|
352
428
|
}
|
|
@@ -356,7 +432,7 @@ export async function loadModule(options = {}) {
|
|
|
356
432
|
await createModuleHarness({
|
|
357
433
|
runtime: {
|
|
358
434
|
kind: "wasmedge",
|
|
359
|
-
wasmPath:
|
|
435
|
+
wasmPath: launchSource,
|
|
360
436
|
wasmEdgeBinary: options.wasmEdgeBinary,
|
|
361
437
|
wasmEdgeRunnerBinary: options.wasmEdgeRunnerBinary,
|
|
362
438
|
enableThreads: options.enableThreads,
|
|
@@ -377,7 +453,9 @@ export async function loadModule(options = {}) {
|
|
|
377
453
|
runtime: {
|
|
378
454
|
kind: runtimeKind,
|
|
379
455
|
command: options.command ?? runtimeKind,
|
|
380
|
-
args:
|
|
456
|
+
// Caller-given args are the caller's: the loader cannot know what
|
|
457
|
+
// they read. The default runs the verified copy.
|
|
458
|
+
args: options.args ?? [launchSource],
|
|
381
459
|
env: options.env,
|
|
382
460
|
cwd: options.cwd,
|
|
383
461
|
hostProfile: options.hostProfile,
|
package/src/index.d.ts
CHANGED
|
@@ -461,6 +461,38 @@ export interface RuntimeRegionDescriptor {
|
|
|
461
461
|
recordByteLength: number;
|
|
462
462
|
alignment: number;
|
|
463
463
|
recordCount: number;
|
|
464
|
+
kind?: "owned" | "external" | "contiguous";
|
|
465
|
+
shared?: boolean;
|
|
466
|
+
generation?: number;
|
|
467
|
+
byteLength?: number;
|
|
468
|
+
activeConsumers?: number;
|
|
469
|
+
invalidated?: boolean;
|
|
470
|
+
metadata?: unknown;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export interface RuntimeRegionArena {
|
|
474
|
+
regionId: number;
|
|
475
|
+
buffer: ArrayBufferLike;
|
|
476
|
+
byteOffset: number;
|
|
477
|
+
byteLength: number;
|
|
478
|
+
bytes: Uint8Array;
|
|
479
|
+
shared: boolean;
|
|
480
|
+
alignment: number;
|
|
481
|
+
generation: number;
|
|
482
|
+
recordCount: number;
|
|
483
|
+
recordByteLength: number;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export interface RuntimeRegionConsumerLease {
|
|
487
|
+
readonly leaseId: number;
|
|
488
|
+
readonly regionId: number;
|
|
489
|
+
readonly consumerId: string;
|
|
490
|
+
readonly mode: "read-only";
|
|
491
|
+
readonly roleMask: number | null;
|
|
492
|
+
readonly generation: number;
|
|
493
|
+
isCurrent(): boolean;
|
|
494
|
+
assertCurrent(): boolean;
|
|
495
|
+
detach(): boolean;
|
|
464
496
|
}
|
|
465
497
|
|
|
466
498
|
export interface RuntimeRegionRecord {
|
|
@@ -481,6 +513,9 @@ export interface RuntimeRegionExternalRecordView {
|
|
|
481
513
|
alignment: number;
|
|
482
514
|
byteOffset?: number;
|
|
483
515
|
buffer?: ArrayBufferLike;
|
|
516
|
+
shared?: boolean;
|
|
517
|
+
generation?: number;
|
|
518
|
+
bytes?: Uint8Array;
|
|
484
519
|
elementType?: string;
|
|
485
520
|
elementCount?: number;
|
|
486
521
|
strideElements?: number;
|
|
@@ -499,6 +534,15 @@ export interface RuntimeRegionStore {
|
|
|
499
534
|
alignment?: number;
|
|
500
535
|
initialRecords?: Array<Uint8Array | ArrayBuffer | ArrayBufferView | null | undefined>;
|
|
501
536
|
}): RuntimeRegionDescriptor;
|
|
537
|
+
allocateContiguousRegion(options: {
|
|
538
|
+
layoutId: string;
|
|
539
|
+
recordByteLength: number;
|
|
540
|
+
alignment?: number;
|
|
541
|
+
recordCount?: number;
|
|
542
|
+
shared?: boolean;
|
|
543
|
+
initialBytes?: Uint8Array | ArrayBuffer | ArrayBufferView | null;
|
|
544
|
+
metadata?: unknown;
|
|
545
|
+
}): RuntimeRegionDescriptor;
|
|
502
546
|
registerExternalRegion(options: {
|
|
503
547
|
layoutId: string;
|
|
504
548
|
recordByteLength: number;
|
|
@@ -521,12 +565,342 @@ export interface RuntimeRegionStore {
|
|
|
521
565
|
}): RuntimeRegionDescriptor;
|
|
522
566
|
setRegionRecordCount(regionId: number, recordCount: number): RuntimeRegionDescriptor | null;
|
|
523
567
|
describeRegion(regionId: number): RuntimeRegionDescriptor | null;
|
|
568
|
+
getRegionArena(regionId: number): RuntimeRegionArena | null;
|
|
569
|
+
updateContiguousRecord(options: {
|
|
570
|
+
regionId: number;
|
|
571
|
+
recordIndex: number;
|
|
572
|
+
bytes: Uint8Array | ArrayBuffer | ArrayBufferView | null | undefined;
|
|
573
|
+
bumpGeneration?: boolean;
|
|
574
|
+
}): {
|
|
575
|
+
regionId: number;
|
|
576
|
+
recordIndex: number;
|
|
577
|
+
generation: number;
|
|
578
|
+
byteLength: number;
|
|
579
|
+
};
|
|
580
|
+
resizeContiguousRegion(
|
|
581
|
+
regionId: number,
|
|
582
|
+
newRecordCount: number,
|
|
583
|
+
options?: { shared?: boolean },
|
|
584
|
+
): RuntimeRegionDescriptor | null;
|
|
585
|
+
bumpRegionGeneration(regionId: number): number | null;
|
|
586
|
+
invalidateRegion(regionId: number): boolean;
|
|
587
|
+
attachRegionConsumer(
|
|
588
|
+
regionId: number,
|
|
589
|
+
options: {
|
|
590
|
+
consumerId: string;
|
|
591
|
+
mode?: "read-only";
|
|
592
|
+
roleMask?: number | null;
|
|
593
|
+
},
|
|
594
|
+
): RuntimeRegionConsumerLease;
|
|
595
|
+
detachRegionConsumer(regionId: number, leaseId: number): boolean;
|
|
596
|
+
listRegionConsumers(regionId: number): Array<{
|
|
597
|
+
leaseId: number;
|
|
598
|
+
regionId: number;
|
|
599
|
+
consumerId: string;
|
|
600
|
+
mode: "read-only";
|
|
601
|
+
roleMask: number | null;
|
|
602
|
+
generation: number;
|
|
603
|
+
attachedAt: number;
|
|
604
|
+
}>;
|
|
524
605
|
resolveRecord(options: RuntimeRegionRecordViewRequest): RuntimeRegionRecord | null;
|
|
525
606
|
resolveRecordView(
|
|
526
607
|
options: RuntimeRegionRecordViewRequest,
|
|
527
608
|
): RuntimeRegionRecord | RuntimeRegionExternalRecordView | null;
|
|
528
609
|
}
|
|
529
610
|
|
|
611
|
+
export type DeclaredOrbitTheory = "SGP4" | "SGP4XP" | "AP";
|
|
612
|
+
|
|
613
|
+
export interface EphemerisCatalogRecord {
|
|
614
|
+
id?: string | number;
|
|
615
|
+
ID?: string | number;
|
|
616
|
+
OBJECT_ID?: string;
|
|
617
|
+
NORAD_CAT_ID?: number;
|
|
618
|
+
declaredTheory?: DeclaredOrbitTheory | string;
|
|
619
|
+
MEAN_ELEMENT_THEORY?: DeclaredOrbitTheory | string;
|
|
620
|
+
theory?: DeclaredOrbitTheory | string;
|
|
621
|
+
propagatorId?: string;
|
|
622
|
+
[key: string]: unknown;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export interface RoutedCatalogRecord {
|
|
626
|
+
index: number;
|
|
627
|
+
recordId: string;
|
|
628
|
+
declaredTheory: DeclaredOrbitTheory;
|
|
629
|
+
propagatorId: string;
|
|
630
|
+
record: EphemerisCatalogRecord;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
export interface PropagatorGridContext {
|
|
634
|
+
records: EphemerisCatalogRecord[];
|
|
635
|
+
routedRecords: RoutedCatalogRecord[];
|
|
636
|
+
updatedIndices?: number[];
|
|
637
|
+
statesView: Float32Array;
|
|
638
|
+
bandsView: Float32Array;
|
|
639
|
+
firstStep: number;
|
|
640
|
+
stepCount: number;
|
|
641
|
+
objectCount: number;
|
|
642
|
+
windowStart: number;
|
|
643
|
+
windowEnd: number;
|
|
644
|
+
stepS: number;
|
|
645
|
+
frame: string;
|
|
646
|
+
propagatorId: string;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export interface PropagatorRecordContext {
|
|
650
|
+
record: EphemerisCatalogRecord;
|
|
651
|
+
objectIndex: number;
|
|
652
|
+
declaredTheory: DeclaredOrbitTheory;
|
|
653
|
+
propagatorId: string;
|
|
654
|
+
statesView: Float32Array;
|
|
655
|
+
bandsView: Float32Array;
|
|
656
|
+
firstStep: number;
|
|
657
|
+
stepCount: number;
|
|
658
|
+
objectCount: number;
|
|
659
|
+
windowStart: number;
|
|
660
|
+
windowEnd: number;
|
|
661
|
+
stepS: number;
|
|
662
|
+
frame: string;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
export interface PropagatorAdapter {
|
|
666
|
+
supportedTheories?: Iterable<DeclaredOrbitTheory | string>;
|
|
667
|
+
strict?: boolean;
|
|
668
|
+
supportsTheory?: (theory: DeclaredOrbitTheory) => boolean;
|
|
669
|
+
propagateGrid?: (
|
|
670
|
+
context: PropagatorGridContext,
|
|
671
|
+
) => { excludedIndices?: number[] } | void;
|
|
672
|
+
propagateRecord?: (
|
|
673
|
+
context: PropagatorRecordContext,
|
|
674
|
+
) => { excluded?: boolean } | void;
|
|
675
|
+
[key: string]: unknown;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export interface RegisteredPropagatorAdapter extends PropagatorAdapter {
|
|
679
|
+
propagatorId: string;
|
|
680
|
+
supportedTheories: Set<DeclaredOrbitTheory> | null;
|
|
681
|
+
supportsTheory(theory: DeclaredOrbitTheory | string): boolean;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
export interface PropagatorRegistry {
|
|
685
|
+
defaultPropagatorId: string;
|
|
686
|
+
supportedPropagatorIds: readonly string[];
|
|
687
|
+
registerPropagator(id: string, adapter: PropagatorAdapter): RegisteredPropagatorAdapter;
|
|
688
|
+
getPropagator(id?: string): RegisteredPropagatorAdapter | null;
|
|
689
|
+
hasPropagator(id?: string): boolean;
|
|
690
|
+
listPropagators(): string[];
|
|
691
|
+
unregisterPropagator(id: string): boolean;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
export interface EphemerisGridDescriptor {
|
|
695
|
+
readonly regionId: number;
|
|
696
|
+
readonly roleMask: number;
|
|
697
|
+
readonly propagatorId: string;
|
|
698
|
+
readonly catalogRevision: string;
|
|
699
|
+
readonly windowStart: number;
|
|
700
|
+
readonly windowEnd: number;
|
|
701
|
+
readonly stepS: number;
|
|
702
|
+
readonly frame: string;
|
|
703
|
+
readonly firstStep: number;
|
|
704
|
+
readonly stepCount: number;
|
|
705
|
+
readonly objectCount: number;
|
|
706
|
+
readonly generation: number;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
export interface PopulateEphemerisGridSpec {
|
|
710
|
+
propagatorId?: string;
|
|
711
|
+
catalogRevision: string | number;
|
|
712
|
+
windowStart: number;
|
|
713
|
+
windowEnd: number;
|
|
714
|
+
stepS: number;
|
|
715
|
+
frame?: string;
|
|
716
|
+
firstStep?: number;
|
|
717
|
+
stepCount?: number;
|
|
718
|
+
roleMask?: number;
|
|
719
|
+
roles?: Uint8Array | number[] | null;
|
|
720
|
+
records?: EphemerisCatalogRecord[];
|
|
721
|
+
objectCount?: number;
|
|
722
|
+
shared?: boolean;
|
|
723
|
+
allowMixedRouting?: boolean;
|
|
724
|
+
populateFn?: (
|
|
725
|
+
context: PropagatorGridContext,
|
|
726
|
+
) => { excludedIndices?: number[] } | void;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export interface PopulateEphemerisGridResult {
|
|
730
|
+
descriptor: EphemerisGridDescriptor;
|
|
731
|
+
regionId: number;
|
|
732
|
+
cacheHit: boolean;
|
|
733
|
+
propagationCount: number;
|
|
734
|
+
propagatedObjectCount: number;
|
|
735
|
+
excludedIndices: number[];
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
export interface EphemerisGridStatus {
|
|
739
|
+
descriptor: EphemerisGridDescriptor;
|
|
740
|
+
regionId: number;
|
|
741
|
+
shared: boolean;
|
|
742
|
+
generation: number;
|
|
743
|
+
byteLength: number;
|
|
744
|
+
statesByteLength: number;
|
|
745
|
+
bandsByteLength: number;
|
|
746
|
+
propagationCount: number;
|
|
747
|
+
propagatedObjectCount: number;
|
|
748
|
+
spliceCount: number;
|
|
749
|
+
activeConsumers: number;
|
|
750
|
+
invalidated: boolean;
|
|
751
|
+
excludedIndices: number[];
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export interface GridAttachLease {
|
|
755
|
+
readonly leaseId: number;
|
|
756
|
+
readonly regionId: number;
|
|
757
|
+
readonly moduleId: string;
|
|
758
|
+
readonly mode: "read-only";
|
|
759
|
+
readonly shared: boolean;
|
|
760
|
+
readonly generation: number;
|
|
761
|
+
readonly descriptor: EphemerisGridDescriptor;
|
|
762
|
+
readonly arenaBytes: Uint8Array;
|
|
763
|
+
getStatesView(): Float32Array;
|
|
764
|
+
getBandsView(): Float32Array;
|
|
765
|
+
getRolesView(): Uint8Array;
|
|
766
|
+
encodeAlignedExternalFrame(options?: {
|
|
767
|
+
portId?: string;
|
|
768
|
+
typeRef?: PayloadTypeRef;
|
|
769
|
+
}): InvokeFrame & { shared: boolean; regionId: number };
|
|
770
|
+
encodeScrGridFrame(): Uint8Array;
|
|
771
|
+
isCurrent(): boolean;
|
|
772
|
+
assertCurrent(): boolean;
|
|
773
|
+
detach(): boolean;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
export interface SpliceEphemerisGridSpec {
|
|
777
|
+
regionId: number;
|
|
778
|
+
newCatalogRevision: string | number;
|
|
779
|
+
updatedIndices: number[];
|
|
780
|
+
records?: EphemerisCatalogRecord[];
|
|
781
|
+
excludedIndices?: number[];
|
|
782
|
+
allowMixedRouting?: boolean;
|
|
783
|
+
populateFn?: (
|
|
784
|
+
context: PropagatorGridContext & { updatedIndices: number[] },
|
|
785
|
+
) => { excludedIndices?: number[] } | void;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
export interface InvalidateEphemerisGridFilter {
|
|
789
|
+
regionId?: number;
|
|
790
|
+
propagatorId?: string;
|
|
791
|
+
catalogRevision?: string | number;
|
|
792
|
+
windowStart?: number;
|
|
793
|
+
windowEnd?: number;
|
|
794
|
+
stepS?: number;
|
|
795
|
+
frame?: string;
|
|
796
|
+
all?: boolean;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
export interface SharedEphemerisGridManager {
|
|
800
|
+
populateGrid(spec: PopulateEphemerisGridSpec): PopulateEphemerisGridResult;
|
|
801
|
+
getGrid(regionId: number): EphemerisGridStatus | null;
|
|
802
|
+
attachGridModule(
|
|
803
|
+
regionId: number,
|
|
804
|
+
options: {
|
|
805
|
+
moduleId: string;
|
|
806
|
+
roleMask?: number;
|
|
807
|
+
roles?: Uint8Array | number[] | null;
|
|
808
|
+
mode?: "read-only";
|
|
809
|
+
},
|
|
810
|
+
): GridAttachLease;
|
|
811
|
+
spliceGridObjects(spec: SpliceEphemerisGridSpec): {
|
|
812
|
+
descriptor: EphemerisGridDescriptor;
|
|
813
|
+
regionId: number;
|
|
814
|
+
generation: number;
|
|
815
|
+
updatedIndices: number[];
|
|
816
|
+
propagatedObjectCount: number;
|
|
817
|
+
};
|
|
818
|
+
invalidateGrid(filter: number | InvalidateEphemerisGridFilter): {
|
|
819
|
+
invalidatedRegionIds: number[];
|
|
820
|
+
count: number;
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
export const SCR_GRID_STATE_FLOATS: number;
|
|
825
|
+
export const SCR_GRID_STATE_BYTES: number;
|
|
826
|
+
export const SCR_RADIUS_BAND_FLOATS: number;
|
|
827
|
+
export const SCR_RADIUS_BAND_BYTES: number;
|
|
828
|
+
export const SCR_ROLE: Readonly<{ SECONDARY: 0; PRIMARY: 1; SKIP: 2 }>;
|
|
829
|
+
export const SCR_ROLE_MASK_ALL: number;
|
|
830
|
+
export const SCR_GRID_LAYOUT_ID: string;
|
|
831
|
+
export const DEFAULT_PROPAGATOR_ID: string;
|
|
832
|
+
export const SUPPORTED_PROPAGATOR_IDS: readonly string[];
|
|
833
|
+
export const DECLARED_ORBIT_THEORIES: readonly DeclaredOrbitTheory[];
|
|
834
|
+
|
|
835
|
+
export class TheoryMismatchError extends Error {
|
|
836
|
+
code: string;
|
|
837
|
+
recordId: string | null;
|
|
838
|
+
declaredTheory: string | null;
|
|
839
|
+
propagatorId: string | null;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
export class StaleGridLeaseError extends Error {
|
|
843
|
+
code: string;
|
|
844
|
+
regionId: number | null;
|
|
845
|
+
moduleId: string | null;
|
|
846
|
+
attachedGeneration: number | null;
|
|
847
|
+
currentGeneration: number | null;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
export function isSharedBuffer(buffer: unknown): buffer is SharedArrayBuffer;
|
|
851
|
+
export function createArenaBuffer(
|
|
852
|
+
byteLength: number,
|
|
853
|
+
options?: { shared?: boolean },
|
|
854
|
+
): ArrayBuffer | SharedArrayBuffer;
|
|
855
|
+
export function resolvePropagatorId(id?: string): string;
|
|
856
|
+
export function normalizeDeclaredTheory(
|
|
857
|
+
value: unknown,
|
|
858
|
+
recordLabel?: string,
|
|
859
|
+
): DeclaredOrbitTheory;
|
|
860
|
+
export function createPropagatorRegistry(
|
|
861
|
+
initialAdapters?:
|
|
862
|
+
| Map<string, PropagatorAdapter>
|
|
863
|
+
| Record<string, PropagatorAdapter>,
|
|
864
|
+
): PropagatorRegistry;
|
|
865
|
+
export function routeCatalogRecordsByTheory(
|
|
866
|
+
records: EphemerisCatalogRecord[],
|
|
867
|
+
options?: {
|
|
868
|
+
propagatorId?: string;
|
|
869
|
+
registry?: PropagatorRegistry | null;
|
|
870
|
+
allowMixedRouting?: boolean;
|
|
871
|
+
},
|
|
872
|
+
): RoutedCatalogRecord[];
|
|
873
|
+
export function gridCacheKey(spec: {
|
|
874
|
+
propagatorId?: string;
|
|
875
|
+
catalogRevision: string | number;
|
|
876
|
+
windowStart: number;
|
|
877
|
+
windowEnd: number;
|
|
878
|
+
stepS: number;
|
|
879
|
+
frame?: string;
|
|
880
|
+
}): string;
|
|
881
|
+
export function encodeScrGridFlatBuffer(spec: {
|
|
882
|
+
firstStep?: number;
|
|
883
|
+
stepCount: number;
|
|
884
|
+
objectCount: number;
|
|
885
|
+
frame?: string;
|
|
886
|
+
stepS?: number;
|
|
887
|
+
statesView: Float32Array;
|
|
888
|
+
bandsView: Float32Array;
|
|
889
|
+
}): Uint8Array;
|
|
890
|
+
export function decodeScrGridFlatBuffer(bytes: Uint8Array): {
|
|
891
|
+
firstStep: number;
|
|
892
|
+
stepCount: number;
|
|
893
|
+
objectCount: number;
|
|
894
|
+
frame: string;
|
|
895
|
+
stepS: number;
|
|
896
|
+
statesView: Float32Array;
|
|
897
|
+
bandsView: Float32Array;
|
|
898
|
+
};
|
|
899
|
+
export function createSharedEphemerisGridManager(options?: {
|
|
900
|
+
regions?: RuntimeRegionStore;
|
|
901
|
+
propagators?: PropagatorRegistry;
|
|
902
|
+
}): SharedEphemerisGridManager;
|
|
903
|
+
|
|
530
904
|
export interface InstalledRuntimeModule {
|
|
531
905
|
moduleId: string;
|
|
532
906
|
metadata: unknown;
|
|
@@ -557,6 +931,33 @@ export interface RuntimeHost {
|
|
|
557
931
|
rows: FlatSqlRuntimeStore;
|
|
558
932
|
regions: RuntimeRegionStore;
|
|
559
933
|
moduleRegistry: RuntimeModuleRegistry;
|
|
934
|
+
propagators: PropagatorRegistry;
|
|
935
|
+
ephemerisGrids: SharedEphemerisGridManager;
|
|
936
|
+
registerPropagator(id: string, adapter: PropagatorAdapter): RegisteredPropagatorAdapter;
|
|
937
|
+
listPropagators(): string[];
|
|
938
|
+
populateEphemerisGrid(spec: PopulateEphemerisGridSpec): PopulateEphemerisGridResult;
|
|
939
|
+
getEphemerisGrid(regionId: number): EphemerisGridStatus | null;
|
|
940
|
+
attachEphemerisGrid(
|
|
941
|
+
regionId: number,
|
|
942
|
+
options: {
|
|
943
|
+
moduleId: string;
|
|
944
|
+
roleMask?: number;
|
|
945
|
+
roles?: Uint8Array | number[] | null;
|
|
946
|
+
mode?: "read-only";
|
|
947
|
+
},
|
|
948
|
+
): GridAttachLease;
|
|
949
|
+
detachEphemerisGrid(lease: GridAttachLease): boolean;
|
|
950
|
+
spliceEphemerisGrid(spec: SpliceEphemerisGridSpec): {
|
|
951
|
+
descriptor: EphemerisGridDescriptor;
|
|
952
|
+
regionId: number;
|
|
953
|
+
generation: number;
|
|
954
|
+
updatedIndices: number[];
|
|
955
|
+
propagatedObjectCount: number;
|
|
956
|
+
};
|
|
957
|
+
invalidateEphemerisGrid(filter: number | InvalidateEphemerisGridFilter): {
|
|
958
|
+
invalidatedRegionIds: number[];
|
|
959
|
+
count: number;
|
|
960
|
+
};
|
|
560
961
|
listCapabilities(): string[];
|
|
561
962
|
listSupportedCapabilities(): string[];
|
|
562
963
|
listOperations(): string[];
|
|
@@ -600,6 +1001,11 @@ export function createRuntimeHost(options?: {
|
|
|
600
1001
|
rows?: FlatSqlRuntimeStore;
|
|
601
1002
|
regions?: RuntimeRegionStore;
|
|
602
1003
|
moduleRegistry?: RuntimeModuleRegistry;
|
|
1004
|
+
propagators?: PropagatorRegistry;
|
|
1005
|
+
propagatorAdapters?:
|
|
1006
|
+
| Map<string, PropagatorAdapter>
|
|
1007
|
+
| Record<string, PropagatorAdapter>;
|
|
1008
|
+
ephemerisGrids?: SharedEphemerisGridManager;
|
|
603
1009
|
}): RuntimeHost;
|
|
604
1010
|
export function getWasmExportNamesFromFile(wasmPath: string): Promise<string[]>;
|
|
605
1011
|
|