nucleation 0.10.4 → 0.10.7
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/CellExecutor.d.mts +51 -0
- package/CellExecutor.d.ts +51 -0
- package/CellExecutor.mjs +171 -0
- package/Curve3D.mjs +1 -1
- package/DefinitionRegion.mjs +4 -4
- package/Design.d.mts +348 -0
- package/Design.d.ts +348 -0
- package/Design.mjs +1334 -0
- package/Hdl.d.mts +56 -0
- package/Hdl.d.ts +56 -0
- package/Hdl.mjs +163 -0
- package/MchprsWorld.mjs +2 -2
- package/MeshConfig.mjs +4 -4
- package/MeshResult.d.mts +11 -0
- package/MeshResult.d.ts +11 -0
- package/MeshResult.mjs +38 -1
- package/NucleationError.d.mts +12 -0
- package/NucleationError.d.ts +12 -0
- package/NucleationError.mjs +25 -0
- package/Routing.d.mts +66 -0
- package/Routing.d.ts +66 -0
- package/Routing.mjs +220 -0
- package/Schematic.d.mts +73 -1
- package/Schematic.d.ts +73 -1
- package/Schematic.mjs +259 -1
- package/SchematicSplitResult.d.mts +26 -0
- package/SchematicSplitResult.d.ts +26 -0
- package/SchematicSplitResult.mjs +84 -0
- package/Store.d.mts +1 -1
- package/Store.d.ts +1 -1
- package/Store.mjs +1 -1
- package/TickSimulation.d.mts +231 -0
- package/TickSimulation.d.ts +231 -0
- package/TickSimulation.mjs +404 -2
- package/index.d.mts +10 -0
- package/index.d.ts +10 -0
- package/index.mjs +10 -0
- package/nucleation.wasm +0 -0
- package/package.json +6 -1
- package/veneer/design.d.ts +167 -0
- package/veneer/design.mjs +480 -0
package/Schematic.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { BlockPos } from "./BlockPos.mjs"
|
|
|
3
3
|
import { BlockState } from "./BlockState.mjs"
|
|
4
4
|
import { Dimensions } from "./Dimensions.mjs"
|
|
5
5
|
import { NucleationError } from "./NucleationError.mjs"
|
|
6
|
+
import { SchematicSplitResult } from "./SchematicSplitResult.mjs"
|
|
6
7
|
import wasm from "./diplomat-wasm.mjs";
|
|
7
8
|
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
8
9
|
|
|
@@ -77,6 +78,26 @@ export class Schematic {
|
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Split spatially independent machines while keeping nearby tiny
|
|
83
|
+
* detached parts with their machine. Components at least
|
|
84
|
+
* `min_standalone_blocks` large always remain independent; smaller
|
|
85
|
+
* components attach only directly to a core within `max_air_gap`.
|
|
86
|
+
* Attachment is non-transitive and the operation is lossless.
|
|
87
|
+
*/
|
|
88
|
+
splitConnectedAttachNearby(minStandaloneBlocks, maxAirGap) {
|
|
89
|
+
|
|
90
|
+
const result = wasm.Schematic_split_connected_attach_nearby(this.ffiValue, minStandaloneBlocks, maxAirGap);
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
return new SchematicSplitResult(diplomatRuntime.internalConstructor, result, []);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
finally {
|
|
97
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
80
101
|
/**
|
|
81
102
|
* The allocated dimensions (width, height, length) of the schematic's
|
|
82
103
|
* bounding box.
|
|
@@ -1506,8 +1527,11 @@ export class Schematic {
|
|
|
1506
1527
|
}
|
|
1507
1528
|
|
|
1508
1529
|
/**
|
|
1509
|
-
* Every
|
|
1530
|
+
* Every IN-BOUNDS cell as a JSON array of
|
|
1510
1531
|
* `{"x", "y", "z", "name", "properties"}` (the old `CBlockArray`).
|
|
1532
|
+
* Air cells are materialized too — on a large sparse build this
|
|
1533
|
+
* dump is `volume()`-sized and can exhaust wasm memory; renderers
|
|
1534
|
+
* and analyzers want `get_non_air_blocks_json`.
|
|
1511
1535
|
*/
|
|
1512
1536
|
getAllBlocksJson() {
|
|
1513
1537
|
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
@@ -1524,6 +1548,58 @@ export class Schematic {
|
|
|
1524
1548
|
}
|
|
1525
1549
|
}
|
|
1526
1550
|
|
|
1551
|
+
/**
|
|
1552
|
+
* Every non-air block of ONE named region (a flattened design names
|
|
1553
|
+
* one per layer: `inst:{name}`, `bus:{name}`), same JSON shape as
|
|
1554
|
+
* `get_all_blocks_json`. Unknown region names error.
|
|
1555
|
+
*/
|
|
1556
|
+
getRegionNonAirBlocksJson(regionName) {
|
|
1557
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1558
|
+
|
|
1559
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
1560
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1561
|
+
|
|
1562
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
const result = wasm.Schematic_get_region_non_air_blocks_json(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, write.buffer);
|
|
1566
|
+
|
|
1567
|
+
try {
|
|
1568
|
+
if (!diplomatReceive.resultFlag) {
|
|
1569
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1570
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1571
|
+
}
|
|
1572
|
+
return write.readString8();
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
finally {
|
|
1576
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1577
|
+
functionCleanupArena.free();
|
|
1578
|
+
|
|
1579
|
+
diplomatReceive.free();
|
|
1580
|
+
write.free();
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* Every non-air block, same JSON shape as `get_all_blocks_json`.
|
|
1586
|
+
* `block_count()`-sized regardless of the bounding volume.
|
|
1587
|
+
*/
|
|
1588
|
+
getNonAirBlocksJson() {
|
|
1589
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1590
|
+
|
|
1591
|
+
wasm.Schematic_get_non_air_blocks_json(this.ffiValue, write.buffer);
|
|
1592
|
+
|
|
1593
|
+
try {
|
|
1594
|
+
return write.readString8();
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
finally {
|
|
1598
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1599
|
+
write.free();
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1527
1603
|
/**
|
|
1528
1604
|
* All blocks within a sub-region (chunk) of the schematic, as the same
|
|
1529
1605
|
* JSON array shape as `get_all_blocks_json`.
|
|
@@ -2050,6 +2126,73 @@ export class Schematic {
|
|
|
2050
2126
|
}
|
|
2051
2127
|
}
|
|
2052
2128
|
|
|
2129
|
+
/**
|
|
2130
|
+
* Standard embedded source provenance as canonical JSON. Returns an
|
|
2131
|
+
* empty string when none is present.
|
|
2132
|
+
*/
|
|
2133
|
+
provenanceJson() {
|
|
2134
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2135
|
+
|
|
2136
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2137
|
+
|
|
2138
|
+
|
|
2139
|
+
const result = wasm.Schematic_provenance_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
2140
|
+
|
|
2141
|
+
try {
|
|
2142
|
+
if (!diplomatReceive.resultFlag) {
|
|
2143
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2144
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2145
|
+
}
|
|
2146
|
+
return write.readString8();
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
finally {
|
|
2150
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2151
|
+
diplomatReceive.free();
|
|
2152
|
+
write.free();
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
/**
|
|
2157
|
+
* Validate and set standard embedded source provenance from JSON.
|
|
2158
|
+
*/
|
|
2159
|
+
setProvenanceJson(json) {
|
|
2160
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2161
|
+
|
|
2162
|
+
const jsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, json)));
|
|
2163
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2164
|
+
|
|
2165
|
+
|
|
2166
|
+
const result = wasm.Schematic_set_provenance_json(diplomatReceive.buffer, this.ffiValue, jsonSlice.ptr);
|
|
2167
|
+
|
|
2168
|
+
try {
|
|
2169
|
+
if (!diplomatReceive.resultFlag) {
|
|
2170
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2171
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
finally {
|
|
2176
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2177
|
+
functionCleanupArena.free();
|
|
2178
|
+
|
|
2179
|
+
diplomatReceive.free();
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
/**
|
|
2184
|
+
* Remove embedded source provenance.
|
|
2185
|
+
*/
|
|
2186
|
+
clearProvenance() {
|
|
2187
|
+
wasm.Schematic_clear_provenance(this.ffiValue);
|
|
2188
|
+
|
|
2189
|
+
try {}
|
|
2190
|
+
|
|
2191
|
+
finally {
|
|
2192
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2053
2196
|
/**
|
|
2054
2197
|
* Mirror the default region along the X axis (in place). Block
|
|
2055
2198
|
* orientations, block entities, and entities are mirrored too.
|
|
@@ -2995,6 +3138,121 @@ export class Schematic {
|
|
|
2995
3138
|
}
|
|
2996
3139
|
}
|
|
2997
3140
|
|
|
3141
|
+
/**
|
|
3142
|
+
* Embed a `CellContract` (JSON) in the schematic's metadata,
|
|
3143
|
+
* validating it parses first. The contract is carried through
|
|
3144
|
+
* `.schem` save/open and autodetected on open — schematic +
|
|
3145
|
+
* contract = one self-describing typed cell.
|
|
3146
|
+
*/
|
|
3147
|
+
setCellContractJson(json) {
|
|
3148
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3149
|
+
|
|
3150
|
+
const jsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, json)));
|
|
3151
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3152
|
+
|
|
3153
|
+
|
|
3154
|
+
const result = wasm.Schematic_set_cell_contract_json(diplomatReceive.buffer, this.ffiValue, jsonSlice.ptr);
|
|
3155
|
+
|
|
3156
|
+
try {
|
|
3157
|
+
if (!diplomatReceive.resultFlag) {
|
|
3158
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3159
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
|
|
3163
|
+
finally {
|
|
3164
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3165
|
+
functionCleanupArena.free();
|
|
3166
|
+
|
|
3167
|
+
diplomatReceive.free();
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
/**
|
|
3172
|
+
* The contract embedded in the schematic's metadata, as JSON.
|
|
3173
|
+
* Errors with `NotFound` when none is embedded, `Parse` when an
|
|
3174
|
+
* embedded string exists but is corrupt (loud, never silent).
|
|
3175
|
+
*/
|
|
3176
|
+
cellContractJson() {
|
|
3177
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3178
|
+
|
|
3179
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3180
|
+
|
|
3181
|
+
|
|
3182
|
+
const result = wasm.Schematic_cell_contract_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
3183
|
+
|
|
3184
|
+
try {
|
|
3185
|
+
if (!diplomatReceive.resultFlag) {
|
|
3186
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3187
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3188
|
+
}
|
|
3189
|
+
return write.readString8();
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
finally {
|
|
3193
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3194
|
+
diplomatReceive.free();
|
|
3195
|
+
write.free();
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
/**
|
|
3200
|
+
* Resolve the schematic's cell contract from its sources in
|
|
3201
|
+
* strict precedence — embedded metadata over Insign signs — with
|
|
3202
|
+
* loud conflict warnings. Writes `{"contract": ..., "warnings":
|
|
3203
|
+
* [...]}`; errors with `NotFound` when no source defines one.
|
|
3204
|
+
*/
|
|
3205
|
+
resolveCellContractJson() {
|
|
3206
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3207
|
+
|
|
3208
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3209
|
+
|
|
3210
|
+
|
|
3211
|
+
const result = wasm.Schematic_resolve_cell_contract_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
3212
|
+
|
|
3213
|
+
try {
|
|
3214
|
+
if (!diplomatReceive.resultFlag) {
|
|
3215
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3216
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3217
|
+
}
|
|
3218
|
+
return write.readString8();
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
finally {
|
|
3222
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3223
|
+
diplomatReceive.free();
|
|
3224
|
+
write.free();
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
/**
|
|
3229
|
+
* Parse the schematic's IO-contract insign annotations (`#cell`
|
|
3230
|
+
* header, `bus.*` port annotations, `#route_zone` zones) to JSON:
|
|
3231
|
+
* `{"cell": ..., "buses": [...], "route_zones": {...}}`.
|
|
3232
|
+
*/
|
|
3233
|
+
compileIoContractsJson() {
|
|
3234
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3235
|
+
|
|
3236
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3237
|
+
|
|
3238
|
+
|
|
3239
|
+
const result = wasm.Schematic_compile_io_contracts_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
3240
|
+
|
|
3241
|
+
try {
|
|
3242
|
+
if (!diplomatReceive.resultFlag) {
|
|
3243
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3244
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3245
|
+
}
|
|
3246
|
+
return write.readString8();
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
finally {
|
|
3250
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3251
|
+
diplomatReceive.free();
|
|
3252
|
+
write.free();
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
|
|
2998
3256
|
/**
|
|
2999
3257
|
* Every region's palette, as a JSON object mapping region name → array of
|
|
3000
3258
|
* block names (the default region under `"default"`).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
4
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Deterministic, lossless pieces returned by
|
|
10
|
+
* {@link Schematic::split_connected_attach_nearby}. Pieces are ordered by their
|
|
11
|
+
* largest connected component, largest first.
|
|
12
|
+
*/
|
|
13
|
+
export class SchematicSplitResult {
|
|
14
|
+
/** @internal */
|
|
15
|
+
get ffiValue(): pointer;
|
|
16
|
+
/** @internal */
|
|
17
|
+
constructor();
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
len(): number;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Return an independently owned piece by zero-based index.
|
|
24
|
+
*/
|
|
25
|
+
piece(index: number): Schematic;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
4
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Deterministic, lossless pieces returned by
|
|
10
|
+
* {@link Schematic::split_connected_attach_nearby}. Pieces are ordered by their
|
|
11
|
+
* largest connected component, largest first.
|
|
12
|
+
*/
|
|
13
|
+
export class SchematicSplitResult {
|
|
14
|
+
/** @internal */
|
|
15
|
+
get ffiValue(): pointer;
|
|
16
|
+
/** @internal */
|
|
17
|
+
constructor();
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
len(): number;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Return an independently owned piece by zero-based index.
|
|
24
|
+
*/
|
|
25
|
+
piece(index: number): Schematic;
|
|
26
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import { Schematic } from "./Schematic.mjs"
|
|
4
|
+
import wasm from "./diplomat-wasm.mjs";
|
|
5
|
+
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
6
|
+
|
|
7
|
+
const SchematicSplitResult_box_destroy_registry = new FinalizationRegistry((ptr) => {
|
|
8
|
+
wasm.SchematicSplitResult_destroy(ptr);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Deterministic, lossless pieces returned by
|
|
13
|
+
* {@link Schematic::split_connected_attach_nearby}. Pieces are ordered by their
|
|
14
|
+
* largest connected component, largest first.
|
|
15
|
+
*/
|
|
16
|
+
export class SchematicSplitResult {
|
|
17
|
+
// Internal ptr reference:
|
|
18
|
+
#ptr = null;
|
|
19
|
+
|
|
20
|
+
// Lifetimes are only to keep dependencies alive.
|
|
21
|
+
// Since JS won't garbage collect until there are no incoming edges.
|
|
22
|
+
#selfEdge = [];
|
|
23
|
+
|
|
24
|
+
#internalConstructor(symbol, ptr, selfEdge) {
|
|
25
|
+
if (symbol !== diplomatRuntime.internalConstructor) {
|
|
26
|
+
console.error("SchematicSplitResult is an Opaque type. You cannot call its constructor.");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.#ptr = ptr;
|
|
30
|
+
this.#selfEdge = selfEdge;
|
|
31
|
+
|
|
32
|
+
// Are we being borrowed? If not, we can register.
|
|
33
|
+
if (this.#selfEdge.length === 0) {
|
|
34
|
+
SchematicSplitResult_box_destroy_registry.register(this, this.#ptr);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
/** @internal */
|
|
40
|
+
get ffiValue() {
|
|
41
|
+
return this.#ptr;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
len() {
|
|
46
|
+
|
|
47
|
+
const result = wasm.SchematicSplitResult_len(this.ffiValue);
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
finally {
|
|
54
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Return an independently owned piece by zero-based index.
|
|
60
|
+
*/
|
|
61
|
+
piece(index) {
|
|
62
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
const result = wasm.SchematicSplitResult_piece(diplomatReceive.buffer, this.ffiValue, index);
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
if (!diplomatReceive.resultFlag) {
|
|
69
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
70
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
71
|
+
}
|
|
72
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
finally {
|
|
76
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
77
|
+
diplomatReceive.free();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
constructor(symbol, ptr, selfEdge) {
|
|
82
|
+
return this.#internalConstructor(...arguments)
|
|
83
|
+
}
|
|
84
|
+
}
|
package/Store.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A key/value store opened from a URL (e.g. `mem://`, `file:///path`,
|
|
10
|
-
* `s3://bucket/prefix`, `redis://…`, `postgres://…`).
|
|
10
|
+
* `ssh://user@host/path`, `s3://bucket/prefix`, `redis://…`, `postgres://…`).
|
|
11
11
|
*/
|
|
12
12
|
export class Store {
|
|
13
13
|
/** @internal */
|
package/Store.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A key/value store opened from a URL (e.g. `mem://`, `file:///path`,
|
|
10
|
-
* `s3://bucket/prefix`, `redis://…`, `postgres://…`).
|
|
10
|
+
* `ssh://user@host/path`, `s3://bucket/prefix`, `redis://…`, `postgres://…`).
|
|
11
11
|
*/
|
|
12
12
|
export class Store {
|
|
13
13
|
/** @internal */
|
package/Store.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const Store_box_destroy_registry = new FinalizationRegistry((ptr) => {
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A key/value store opened from a URL (e.g. `mem://`, `file:///path`,
|
|
13
|
-
* `s3://bucket/prefix`, `redis://…`, `postgres://…`).
|
|
13
|
+
* `ssh://user@host/path`, `s3://bucket/prefix`, `redis://…`, `postgres://…`).
|
|
14
14
|
*/
|
|
15
15
|
export class Store {
|
|
16
16
|
// Internal ptr reference:
|