@bian-womp/spark-workbench 0.3.78 → 0.3.80
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/lib/cjs/index.cjs +111 -143
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/runtime/LocalGraphRunner.d.ts.map +1 -1
- package/lib/cjs/src/runtime/RemoteGraphRunner.d.ts +8 -14
- package/lib/cjs/src/runtime/RemoteGraphRunner.d.ts.map +1 -1
- package/lib/esm/index.js +111 -143
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/runtime/LocalGraphRunner.d.ts.map +1 -1
- package/lib/esm/src/runtime/RemoteGraphRunner.d.ts +8 -14
- package/lib/esm/src/runtime/RemoteGraphRunner.d.ts.map +1 -1
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalGraphRunner.d.ts","sourceRoot":"","sources":["../../../../src/runtime/LocalGraphRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,WAAW,EAKZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,aAAa,EAEb,eAAe,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAK5D,qBAAa,gBAAiB,SAAQ,mBAAmB;IACvD,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC/B,OAAO,CAAC,OAAO,CAA+B;gBAElC,QAAQ,CAAC,EAAE,QAAQ;IAW/B,KAAK,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAenE,MAAM,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,OAAO,CAAA;K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AM,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,UAevF;IAEF,cAAc,QAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAEtD;IAEI,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxD,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAejF,YAAY;;;;;;;IA6BZ,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE;IAYhG,eAAe,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAQ5G,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAK7B,OAAO,CAAC,OAAO;IAgCf,OAAO,IAAI,IAAI;CAKhB"}
|
|
@@ -14,25 +14,19 @@ export declare class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
14
14
|
private valueCache;
|
|
15
15
|
private listenersBound;
|
|
16
16
|
private registryFetched;
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
private readonly
|
|
17
|
+
private registryBootstrapPromise?;
|
|
18
|
+
private registryBootstrapResolve?;
|
|
19
|
+
private registryBootstrapReject?;
|
|
20
|
+
private readonly REGISTRY_BOOTSTRAP_TIMEOUT_MS;
|
|
21
21
|
/**
|
|
22
22
|
* Generate cache key that includes io type to prevent collisions
|
|
23
23
|
* between input and output handles with the same name
|
|
24
24
|
*/
|
|
25
25
|
private getCacheKey;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
31
|
-
private fetchRegistry;
|
|
32
|
-
/**
|
|
33
|
-
* Internal method that performs the actual registry fetch.
|
|
34
|
-
*/
|
|
35
|
-
private _doFetchRegistry;
|
|
26
|
+
private applyRegistryDescriptor;
|
|
27
|
+
private isRecord;
|
|
28
|
+
private isRegistryDescriptorEvent;
|
|
29
|
+
private waitForRegistryBootstrap;
|
|
36
30
|
/**
|
|
37
31
|
* Build RemoteRuntimeClient config from RemoteExecutionBackend config.
|
|
38
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteGraphRunner.d.ts","sourceRoot":"","sources":["../../../../src/runtime/RemoteGraphRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,OAAO,EACP,eAAe,
|
|
1
|
+
{"version":3,"file":"RemoteGraphRunner.d.ts","sourceRoot":"","sources":["../../../../src/runtime/RemoteGraphRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,OAAO,EACP,eAAe,EAOhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,mBAAmB,EAGpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,sBAAsB,EAGtB,eAAe,EACf,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAM5D,qBAAa,iBAAkB,SAAQ,mBAAmB;IACxD,SAAS,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC;IACp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;IAyBlE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAwC9B;;;OAGG;IACH,EAAE,CAAC,CAAC,SAAS,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;CAerF"}
|
package/lib/esm/index.js
CHANGED
|
@@ -1423,10 +1423,7 @@ class LocalGraphRunner extends AbstractGraphRunner {
|
|
|
1423
1423
|
const snapshot = await this.snapshotFull();
|
|
1424
1424
|
const converter = buildValueConverter(converterConfig);
|
|
1425
1425
|
const converted = convertSnapshot(snapshot, converter);
|
|
1426
|
-
await this.applySnapshotFull(converted, {
|
|
1427
|
-
skipBuild: true,
|
|
1428
|
-
dry: options?.dry,
|
|
1429
|
-
});
|
|
1426
|
+
await this.applySnapshotFull(converted, { skipBuild: true, dry: options?.dry });
|
|
1430
1427
|
return converted;
|
|
1431
1428
|
}
|
|
1432
1429
|
async pause() {
|
|
@@ -1504,139 +1501,101 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1504
1501
|
getCacheKey(nodeId, handle, io) {
|
|
1505
1502
|
return `${nodeId}.${io}.${handle}`;
|
|
1506
1503
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
}
|
|
1516
|
-
// If already fetching, wait for that fetch to complete
|
|
1517
|
-
if (this.registryFetchPromise) {
|
|
1518
|
-
return this.registryFetchPromise;
|
|
1519
|
-
}
|
|
1520
|
-
// Create promise wrapper and assign atomically to prevent race conditions
|
|
1521
|
-
// This ensures concurrent calls will see the promise and wait for it
|
|
1522
|
-
let promise;
|
|
1523
|
-
this.registryFetchPromise = promise = (async () => {
|
|
1524
|
-
try {
|
|
1525
|
-
await this._doFetchRegistry(client);
|
|
1504
|
+
applyRegistryDescriptor(desc) {
|
|
1505
|
+
for (const t of desc.types) {
|
|
1506
|
+
if (t.options) {
|
|
1507
|
+
this.registry.registerEnum({
|
|
1508
|
+
id: t.id,
|
|
1509
|
+
options: t.options,
|
|
1510
|
+
bakeTarget: t.bakeTarget,
|
|
1511
|
+
});
|
|
1526
1512
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1513
|
+
else if (!this.registry.types.has(t.id)) {
|
|
1514
|
+
this.registry.registerType({
|
|
1515
|
+
id: t.id,
|
|
1516
|
+
displayName: t.displayName,
|
|
1517
|
+
validate: (_v) => true,
|
|
1518
|
+
bakeTarget: t.bakeTarget,
|
|
1519
|
+
});
|
|
1530
1520
|
}
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1521
|
+
}
|
|
1522
|
+
for (const c of desc.categories || []) {
|
|
1523
|
+
if (!this.registry.categories.has(c.id)) {
|
|
1524
|
+
const category = {
|
|
1525
|
+
id: c.id,
|
|
1526
|
+
displayName: c.displayName,
|
|
1527
|
+
createRuntime: () => ({
|
|
1528
|
+
async onInputsChanged() { },
|
|
1529
|
+
}),
|
|
1530
|
+
policy: { asyncConcurrency: "switch" },
|
|
1531
|
+
};
|
|
1532
|
+
this.registry.categories.register(category);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
for (const c of desc.coercions) {
|
|
1536
|
+
if (c.async) {
|
|
1537
|
+
this.registry.registerAsyncCoercion(c.from, c.to, async (v) => v, {
|
|
1538
|
+
nonTransitive: c.nonTransitive,
|
|
1545
1539
|
});
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
timeoutId = undefined;
|
|
1551
|
-
}
|
|
1540
|
+
}
|
|
1541
|
+
else {
|
|
1542
|
+
this.registry.registerCoercion(c.from, c.to, (v) => v, {
|
|
1543
|
+
nonTransitive: c.nonTransitive,
|
|
1552
1544
|
});
|
|
1553
|
-
const desc = await Promise.race([fetchPromise, timeoutPromise]);
|
|
1554
|
-
// Register types
|
|
1555
|
-
for (const t of desc.types) {
|
|
1556
|
-
if (t.options) {
|
|
1557
|
-
this.registry.registerEnum({
|
|
1558
|
-
id: t.id,
|
|
1559
|
-
options: t.options,
|
|
1560
|
-
bakeTarget: t.bakeTarget,
|
|
1561
|
-
});
|
|
1562
|
-
}
|
|
1563
|
-
else {
|
|
1564
|
-
if (!this.registry.types.has(t.id)) {
|
|
1565
|
-
this.registry.registerType({
|
|
1566
|
-
id: t.id,
|
|
1567
|
-
displayName: t.displayName,
|
|
1568
|
-
validate: (_v) => true,
|
|
1569
|
-
bakeTarget: t.bakeTarget,
|
|
1570
|
-
});
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
// Register categories
|
|
1575
|
-
for (const c of desc.categories || []) {
|
|
1576
|
-
if (!this.registry.categories.has(c.id)) {
|
|
1577
|
-
// Create placeholder category descriptor
|
|
1578
|
-
const category = {
|
|
1579
|
-
id: c.id,
|
|
1580
|
-
displayName: c.displayName,
|
|
1581
|
-
createRuntime: () => ({
|
|
1582
|
-
async onInputsChanged() { },
|
|
1583
|
-
}),
|
|
1584
|
-
policy: { asyncConcurrency: "switch" },
|
|
1585
|
-
};
|
|
1586
|
-
this.registry.categories.register(category);
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
// Register coercions
|
|
1590
|
-
for (const c of desc.coercions) {
|
|
1591
|
-
if (c.async) {
|
|
1592
|
-
this.registry.registerAsyncCoercion(c.from, c.to, async (v) => v, {
|
|
1593
|
-
nonTransitive: c.nonTransitive,
|
|
1594
|
-
});
|
|
1595
|
-
}
|
|
1596
|
-
else {
|
|
1597
|
-
this.registry.registerCoercion(c.from, c.to, (v) => v, {
|
|
1598
|
-
nonTransitive: c.nonTransitive,
|
|
1599
|
-
});
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
// Register nodes
|
|
1603
|
-
for (const n of desc.nodes) {
|
|
1604
|
-
if (!this.registry.nodes.has(n.id)) {
|
|
1605
|
-
this.registry.registerNode({
|
|
1606
|
-
id: n.id,
|
|
1607
|
-
categoryId: n.categoryId,
|
|
1608
|
-
displayName: n.displayName,
|
|
1609
|
-
inputs: n.inputs || {},
|
|
1610
|
-
outputs: n.outputs || {},
|
|
1611
|
-
policy: n.policy || {},
|
|
1612
|
-
impl: () => { },
|
|
1613
|
-
});
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
this.registryFetched = true;
|
|
1617
|
-
this.emit("registry", this.registry);
|
|
1618
|
-
return;
|
|
1619
1545
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1546
|
+
}
|
|
1547
|
+
for (const n of desc.nodes) {
|
|
1548
|
+
if (!this.registry.nodes.has(n.id)) {
|
|
1549
|
+
this.registry.registerNode({
|
|
1550
|
+
id: n.id,
|
|
1551
|
+
categoryId: n.categoryId,
|
|
1552
|
+
displayName: n.displayName,
|
|
1553
|
+
inputs: n.inputs || {},
|
|
1554
|
+
outputs: n.outputs || {},
|
|
1555
|
+
policy: n.policy || {},
|
|
1556
|
+
impl: () => { },
|
|
1557
|
+
});
|
|
1628
1558
|
}
|
|
1629
1559
|
}
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1560
|
+
this.registryFetched = true;
|
|
1561
|
+
if (this.registryBootstrapResolve) {
|
|
1562
|
+
this.registryBootstrapResolve();
|
|
1563
|
+
this.registryBootstrapResolve = undefined;
|
|
1564
|
+
this.registryBootstrapReject = undefined;
|
|
1565
|
+
}
|
|
1566
|
+
this.emit("registry", this.registry);
|
|
1567
|
+
}
|
|
1568
|
+
isRecord(value) {
|
|
1569
|
+
return typeof value === "object" && value !== null;
|
|
1570
|
+
}
|
|
1571
|
+
isRegistryDescriptorEvent(message) {
|
|
1572
|
+
if (!this.isRecord(message))
|
|
1573
|
+
return false;
|
|
1574
|
+
if (message.type !== "registry-descriptor")
|
|
1575
|
+
return false;
|
|
1576
|
+
if (!this.isRecord(message.payload))
|
|
1577
|
+
return false;
|
|
1578
|
+
return "registry" in message.payload;
|
|
1579
|
+
}
|
|
1580
|
+
waitForRegistryBootstrap() {
|
|
1581
|
+
if (this.registryFetched)
|
|
1582
|
+
return Promise.resolve();
|
|
1583
|
+
if (this.registryBootstrapPromise)
|
|
1584
|
+
return this.registryBootstrapPromise;
|
|
1585
|
+
this.registryBootstrapPromise = new Promise((resolve, reject) => {
|
|
1586
|
+
this.registryBootstrapResolve = resolve;
|
|
1587
|
+
this.registryBootstrapReject = reject;
|
|
1588
|
+
setTimeout(() => {
|
|
1589
|
+
if (!this.registryFetched && this.registryBootstrapReject) {
|
|
1590
|
+
this.registryBootstrapReject(new Error(`Registry bootstrap timeout (${this.REGISTRY_BOOTSTRAP_TIMEOUT_MS}ms exceeded)`));
|
|
1591
|
+
this.registryBootstrapResolve = undefined;
|
|
1592
|
+
this.registryBootstrapReject = undefined;
|
|
1593
|
+
}
|
|
1594
|
+
}, this.REGISTRY_BOOTSTRAP_TIMEOUT_MS);
|
|
1595
|
+
}).finally(() => {
|
|
1596
|
+
this.registryBootstrapPromise = undefined;
|
|
1638
1597
|
});
|
|
1639
|
-
|
|
1598
|
+
return this.registryBootstrapPromise;
|
|
1640
1599
|
}
|
|
1641
1600
|
/**
|
|
1642
1601
|
* Build RemoteRuntimeClient config from RemoteExecutionBackend config.
|
|
@@ -1698,13 +1657,27 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1698
1657
|
const clientConfig = this.buildClientConfig(backend);
|
|
1699
1658
|
// Wrap custom event handler to intercept viewport events and emit viewport event
|
|
1700
1659
|
const wrappedOnCustomEvent = (event) => {
|
|
1701
|
-
const msg = event
|
|
1702
|
-
if (msg &&
|
|
1703
|
-
const viewport = msg.payload
|
|
1660
|
+
const msg = event.message;
|
|
1661
|
+
if (this.isRecord(msg) && msg.type === "viewport" && this.isRecord(msg.payload)) {
|
|
1662
|
+
const viewport = msg.payload.viewport;
|
|
1704
1663
|
if (isValidViewport(viewport)) {
|
|
1705
1664
|
this.emit("viewport", { viewport });
|
|
1706
1665
|
}
|
|
1707
1666
|
}
|
|
1667
|
+
else if (this.isRecord(msg) && msg.type === "flow-opened" && this.isRecord(msg.payload)) {
|
|
1668
|
+
const sessionId = msg.payload.sessionId;
|
|
1669
|
+
const resumed = msg.payload.resumed;
|
|
1670
|
+
if (typeof sessionId === "number") {
|
|
1671
|
+
console.info(`[RemoteGraphRunner] Flow opened (runner=${this.runnerId}, sessionId=${sessionId}, resumed=${Boolean(resumed)})`);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
else if (this.isRecord(msg) && msg.type === "flow-closed" && this.isRecord(msg.payload)) {
|
|
1675
|
+
const reason = msg.payload.reason;
|
|
1676
|
+
console.warn(`[RemoteGraphRunner] Flow closed (runner=${this.runnerId}, reason=${typeof reason === "string" ? reason : "unknown"})`);
|
|
1677
|
+
}
|
|
1678
|
+
else if (this.isRegistryDescriptorEvent(msg)) {
|
|
1679
|
+
this.applyRegistryDescriptor(msg.payload.registry);
|
|
1680
|
+
}
|
|
1708
1681
|
// Call original handler if provided
|
|
1709
1682
|
if (backend.onCustomEvent) {
|
|
1710
1683
|
backend.onCustomEvent(event);
|
|
@@ -1722,12 +1695,11 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1722
1695
|
this.client = client;
|
|
1723
1696
|
this.valueCache.clear();
|
|
1724
1697
|
this.listenersBound = false;
|
|
1725
|
-
//
|
|
1726
|
-
// Only fetch if not already fetched (handles concurrent calls)
|
|
1698
|
+
// Wait for registry descriptor pushed by backend on flow-open.
|
|
1727
1699
|
if (!this.registryFetched) {
|
|
1728
|
-
console.info("[RemoteGraphRunner]
|
|
1729
|
-
await this.
|
|
1730
|
-
console.info("[RemoteGraphRunner]
|
|
1700
|
+
console.info("[RemoteGraphRunner] Waiting for registry bootstrap event...");
|
|
1701
|
+
await this.waitForRegistryBootstrap();
|
|
1702
|
+
console.info("[RemoteGraphRunner] Received registry bootstrap event");
|
|
1731
1703
|
}
|
|
1732
1704
|
// Clear promise on success
|
|
1733
1705
|
this.clientPromise = undefined;
|
|
@@ -1741,9 +1713,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1741
1713
|
this.valueCache = new Map();
|
|
1742
1714
|
this.listenersBound = false;
|
|
1743
1715
|
this.registryFetched = false;
|
|
1744
|
-
this.
|
|
1745
|
-
this.INITIAL_RETRY_DELAY_MS = 1000; // 1 second
|
|
1746
|
-
this.REGISTRY_FETCH_TIMEOUT_MS = 3000; // 3 seconds
|
|
1716
|
+
this.REGISTRY_BOOTSTRAP_TIMEOUT_MS = 15000; // 15 seconds
|
|
1747
1717
|
// Generate readable ID for this runner instance (e.g., remote-001, remote-002)
|
|
1748
1718
|
remoteRunnerCounter++;
|
|
1749
1719
|
this.runnerId = `remote-${String(remoteRunnerCounter).padStart(3, "0")}`;
|
|
@@ -2030,9 +2000,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
2030
2000
|
this.hydrateValueCache(payload, { dry: options?.dry });
|
|
2031
2001
|
// Then sync with backend
|
|
2032
2002
|
const client = await this.ensureClient();
|
|
2033
|
-
await client.api.applySnapshotFull(payload, {
|
|
2034
|
-
skipBuild: options?.skipBuild,
|
|
2035
|
-
});
|
|
2003
|
+
await client.api.applySnapshotFull(payload, { skipBuild: options?.skipBuild });
|
|
2036
2004
|
}
|
|
2037
2005
|
async convertSnapshot(converterConfig, options) {
|
|
2038
2006
|
const client = await this.ensureClient();
|