@lace-cloud/proto 0.18.0 → 0.19.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/dist/index.cjs +312 -112
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +92 -3
- package/dist/index.d.ts +92 -3
- package/dist/index.mjs +302 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -15,6 +15,7 @@ function convertDiagnostic(d) {
|
|
|
15
15
|
}
|
|
16
16
|
return {
|
|
17
17
|
severity,
|
|
18
|
+
code: d.code || void 0,
|
|
18
19
|
message: d.message,
|
|
19
20
|
module_key: d.module_key || void 0,
|
|
20
21
|
instance_id: d.instance_id || void 0,
|
|
@@ -28,6 +29,7 @@ function convertDiagnostic(d) {
|
|
|
28
29
|
// src/engine-bridge.ts
|
|
29
30
|
var ENGINE_METHODS = [
|
|
30
31
|
"Initialize",
|
|
32
|
+
"ReadCredential",
|
|
31
33
|
"SessionOpen",
|
|
32
34
|
"TestSessionOpen",
|
|
33
35
|
"SessionSave",
|
|
@@ -35,12 +37,37 @@ var ENGINE_METHODS = [
|
|
|
35
37
|
"SessionGenerate",
|
|
36
38
|
"SessionResolveConflict",
|
|
37
39
|
"ApplyAction",
|
|
40
|
+
"ReadWiringCandidates",
|
|
38
41
|
"CancelInvoke"
|
|
39
42
|
];
|
|
40
43
|
var ENGINE_STREAM_METHODS = ["Subscribe", "Invoke"];
|
|
44
|
+
var HOST_ONLY_METHODS = [
|
|
45
|
+
"TestSessionOpen",
|
|
46
|
+
"ReadCredential"
|
|
47
|
+
];
|
|
48
|
+
var HOST_ONLY_METHOD_NAMES = HOST_ONLY_METHODS;
|
|
41
49
|
var BRIDGE_METHODS = ENGINE_METHODS.filter(
|
|
42
|
-
(m) => m
|
|
50
|
+
(m) => !HOST_ONLY_METHOD_NAMES.includes(m)
|
|
43
51
|
);
|
|
52
|
+
var CONNECT_CODE_NAMES = [
|
|
53
|
+
"ok",
|
|
54
|
+
"canceled",
|
|
55
|
+
"unknown",
|
|
56
|
+
"invalid_argument",
|
|
57
|
+
"deadline_exceeded",
|
|
58
|
+
"not_found",
|
|
59
|
+
"already_exists",
|
|
60
|
+
"permission_denied",
|
|
61
|
+
"resource_exhausted",
|
|
62
|
+
"failed_precondition",
|
|
63
|
+
"aborted",
|
|
64
|
+
"out_of_range",
|
|
65
|
+
"unimplemented",
|
|
66
|
+
"internal",
|
|
67
|
+
"unavailable",
|
|
68
|
+
"data_loss",
|
|
69
|
+
"unauthenticated"
|
|
70
|
+
];
|
|
44
71
|
|
|
45
72
|
// src/generated/state.ts
|
|
46
73
|
import { BinaryReader as BinaryReader2, BinaryWriter as BinaryWriter2 } from "@bufbuild/protobuf/wire";
|
|
@@ -2648,7 +2675,7 @@ var OutputRef = {
|
|
|
2648
2675
|
}
|
|
2649
2676
|
};
|
|
2650
2677
|
function createBaseExpression() {
|
|
2651
|
-
return { lang: "", value: "" };
|
|
2678
|
+
return { lang: "", value: "", module_references: [] };
|
|
2652
2679
|
}
|
|
2653
2680
|
var Expression = {
|
|
2654
2681
|
encode(message, writer = new BinaryWriter2()) {
|
|
@@ -2658,6 +2685,9 @@ var Expression = {
|
|
|
2658
2685
|
if (message.value !== "") {
|
|
2659
2686
|
writer.uint32(18).string(message.value);
|
|
2660
2687
|
}
|
|
2688
|
+
for (const v of message.module_references) {
|
|
2689
|
+
ModuleReference.encode(v, writer.uint32(26).fork()).join();
|
|
2690
|
+
}
|
|
2661
2691
|
return writer;
|
|
2662
2692
|
},
|
|
2663
2693
|
decode(input, length) {
|
|
@@ -2681,6 +2711,13 @@ var Expression = {
|
|
|
2681
2711
|
message.value = reader.string();
|
|
2682
2712
|
continue;
|
|
2683
2713
|
}
|
|
2714
|
+
case 3: {
|
|
2715
|
+
if (tag !== 26) {
|
|
2716
|
+
break;
|
|
2717
|
+
}
|
|
2718
|
+
message.module_references.push(ModuleReference.decode(reader, reader.uint32()));
|
|
2719
|
+
continue;
|
|
2720
|
+
}
|
|
2684
2721
|
}
|
|
2685
2722
|
if ((tag & 7) === 4 || tag === 0) {
|
|
2686
2723
|
break;
|
|
@@ -2692,7 +2729,8 @@ var Expression = {
|
|
|
2692
2729
|
fromJSON(object) {
|
|
2693
2730
|
return {
|
|
2694
2731
|
lang: isSet2(object.lang) ? globalThis.String(object.lang) : "",
|
|
2695
|
-
value: isSet2(object.value) ? globalThis.String(object.value) : ""
|
|
2732
|
+
value: isSet2(object.value) ? globalThis.String(object.value) : "",
|
|
2733
|
+
module_references: globalThis.Array.isArray(object?.moduleReferences) ? object.moduleReferences.map((e) => ModuleReference.fromJSON(e)) : globalThis.Array.isArray(object?.module_references) ? object.module_references.map((e) => ModuleReference.fromJSON(e)) : []
|
|
2696
2734
|
};
|
|
2697
2735
|
},
|
|
2698
2736
|
toJSON(message) {
|
|
@@ -2703,6 +2741,9 @@ var Expression = {
|
|
|
2703
2741
|
if (message.value !== "") {
|
|
2704
2742
|
obj.value = message.value;
|
|
2705
2743
|
}
|
|
2744
|
+
if (message.module_references?.length) {
|
|
2745
|
+
obj.moduleReferences = message.module_references.map((e) => ModuleReference.toJSON(e));
|
|
2746
|
+
}
|
|
2706
2747
|
return obj;
|
|
2707
2748
|
},
|
|
2708
2749
|
create(base) {
|
|
@@ -2712,6 +2753,105 @@ var Expression = {
|
|
|
2712
2753
|
const message = createBaseExpression();
|
|
2713
2754
|
message.lang = object.lang ?? "";
|
|
2714
2755
|
message.value = object.value ?? "";
|
|
2756
|
+
message.module_references = object.module_references?.map((e) => ModuleReference.fromPartial(e)) || [];
|
|
2757
|
+
return message;
|
|
2758
|
+
}
|
|
2759
|
+
};
|
|
2760
|
+
function createBaseModuleReference() {
|
|
2761
|
+
return { call: "", output: void 0, instance_key: false, splat: false };
|
|
2762
|
+
}
|
|
2763
|
+
var ModuleReference = {
|
|
2764
|
+
encode(message, writer = new BinaryWriter2()) {
|
|
2765
|
+
if (message.call !== "") {
|
|
2766
|
+
writer.uint32(10).string(message.call);
|
|
2767
|
+
}
|
|
2768
|
+
if (message.output !== void 0) {
|
|
2769
|
+
writer.uint32(18).string(message.output);
|
|
2770
|
+
}
|
|
2771
|
+
if (message.instance_key !== false) {
|
|
2772
|
+
writer.uint32(24).bool(message.instance_key);
|
|
2773
|
+
}
|
|
2774
|
+
if (message.splat !== false) {
|
|
2775
|
+
writer.uint32(32).bool(message.splat);
|
|
2776
|
+
}
|
|
2777
|
+
return writer;
|
|
2778
|
+
},
|
|
2779
|
+
decode(input, length) {
|
|
2780
|
+
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
2781
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2782
|
+
const message = createBaseModuleReference();
|
|
2783
|
+
while (reader.pos < end) {
|
|
2784
|
+
const tag = reader.uint32();
|
|
2785
|
+
switch (tag >>> 3) {
|
|
2786
|
+
case 1: {
|
|
2787
|
+
if (tag !== 10) {
|
|
2788
|
+
break;
|
|
2789
|
+
}
|
|
2790
|
+
message.call = reader.string();
|
|
2791
|
+
continue;
|
|
2792
|
+
}
|
|
2793
|
+
case 2: {
|
|
2794
|
+
if (tag !== 18) {
|
|
2795
|
+
break;
|
|
2796
|
+
}
|
|
2797
|
+
message.output = reader.string();
|
|
2798
|
+
continue;
|
|
2799
|
+
}
|
|
2800
|
+
case 3: {
|
|
2801
|
+
if (tag !== 24) {
|
|
2802
|
+
break;
|
|
2803
|
+
}
|
|
2804
|
+
message.instance_key = reader.bool();
|
|
2805
|
+
continue;
|
|
2806
|
+
}
|
|
2807
|
+
case 4: {
|
|
2808
|
+
if (tag !== 32) {
|
|
2809
|
+
break;
|
|
2810
|
+
}
|
|
2811
|
+
message.splat = reader.bool();
|
|
2812
|
+
continue;
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2816
|
+
break;
|
|
2817
|
+
}
|
|
2818
|
+
reader.skip(tag & 7);
|
|
2819
|
+
}
|
|
2820
|
+
return message;
|
|
2821
|
+
},
|
|
2822
|
+
fromJSON(object) {
|
|
2823
|
+
return {
|
|
2824
|
+
call: isSet2(object.call) ? globalThis.String(object.call) : "",
|
|
2825
|
+
output: isSet2(object.output) ? globalThis.String(object.output) : void 0,
|
|
2826
|
+
instance_key: isSet2(object.instanceKey) ? globalThis.Boolean(object.instanceKey) : isSet2(object.instance_key) ? globalThis.Boolean(object.instance_key) : false,
|
|
2827
|
+
splat: isSet2(object.splat) ? globalThis.Boolean(object.splat) : false
|
|
2828
|
+
};
|
|
2829
|
+
},
|
|
2830
|
+
toJSON(message) {
|
|
2831
|
+
const obj = {};
|
|
2832
|
+
if (message.call !== "") {
|
|
2833
|
+
obj.call = message.call;
|
|
2834
|
+
}
|
|
2835
|
+
if (message.output !== void 0) {
|
|
2836
|
+
obj.output = message.output;
|
|
2837
|
+
}
|
|
2838
|
+
if (message.instance_key !== false) {
|
|
2839
|
+
obj.instanceKey = message.instance_key;
|
|
2840
|
+
}
|
|
2841
|
+
if (message.splat !== false) {
|
|
2842
|
+
obj.splat = message.splat;
|
|
2843
|
+
}
|
|
2844
|
+
return obj;
|
|
2845
|
+
},
|
|
2846
|
+
create(base) {
|
|
2847
|
+
return ModuleReference.fromPartial(base ?? {});
|
|
2848
|
+
},
|
|
2849
|
+
fromPartial(object) {
|
|
2850
|
+
const message = createBaseModuleReference();
|
|
2851
|
+
message.call = object.call ?? "";
|
|
2852
|
+
message.output = object.output ?? void 0;
|
|
2853
|
+
message.instance_key = object.instance_key ?? false;
|
|
2854
|
+
message.splat = object.splat ?? false;
|
|
2715
2855
|
return message;
|
|
2716
2856
|
}
|
|
2717
2857
|
};
|
|
@@ -3335,6 +3475,107 @@ function isSet2(value) {
|
|
|
3335
3475
|
return value !== null && value !== void 0;
|
|
3336
3476
|
}
|
|
3337
3477
|
|
|
3478
|
+
// src/projection/derive-edges.ts
|
|
3479
|
+
function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
|
|
3480
|
+
if (binding.out?.module && binding.out.name) {
|
|
3481
|
+
edges.push({
|
|
3482
|
+
source_instance: binding.out.module,
|
|
3483
|
+
target_instance: targetId,
|
|
3484
|
+
from_output: binding.out.name,
|
|
3485
|
+
to_input: toInput
|
|
3486
|
+
});
|
|
3487
|
+
return;
|
|
3488
|
+
}
|
|
3489
|
+
for (const ref of binding.expr?.module_references ?? []) {
|
|
3490
|
+
if (!useIds.has(ref.call)) continue;
|
|
3491
|
+
const fromOutput = ref.output ?? "";
|
|
3492
|
+
const key = `${ref.call}:${targetId}:${fromOutput}:${toInput}`;
|
|
3493
|
+
if (seen.has(key)) continue;
|
|
3494
|
+
seen.add(key);
|
|
3495
|
+
edges.push({
|
|
3496
|
+
source_instance: ref.call,
|
|
3497
|
+
target_instance: targetId,
|
|
3498
|
+
from_output: fromOutput,
|
|
3499
|
+
to_input: toInput
|
|
3500
|
+
});
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3503
|
+
function deriveEdges(uses) {
|
|
3504
|
+
const useIds = new Set(uses.map((u) => u.id));
|
|
3505
|
+
const edges = [];
|
|
3506
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3507
|
+
for (const target of uses) {
|
|
3508
|
+
const inputs = target.inputs ?? {};
|
|
3509
|
+
for (const [inputName, binding] of Object.entries(inputs)) {
|
|
3510
|
+
emitEdgesFromBinding(binding, target.id, inputName, useIds, seen, edges);
|
|
3511
|
+
}
|
|
3512
|
+
if (target.count) {
|
|
3513
|
+
emitEdgesFromBinding(target.count, target.id, "count", useIds, seen, edges);
|
|
3514
|
+
}
|
|
3515
|
+
if (target.for_each) {
|
|
3516
|
+
emitEdgesFromBinding(target.for_each, target.id, "for_each", useIds, seen, edges);
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
return edges;
|
|
3520
|
+
}
|
|
3521
|
+
function indexWires(edges) {
|
|
3522
|
+
const inputs = /* @__PURE__ */ new Map();
|
|
3523
|
+
const outputs = /* @__PURE__ */ new Map();
|
|
3524
|
+
for (const e of edges) {
|
|
3525
|
+
if (!inputs.has(e.target_instance)) inputs.set(e.target_instance, /* @__PURE__ */ new Set());
|
|
3526
|
+
inputs.get(e.target_instance).add(e.to_input);
|
|
3527
|
+
if (!outputs.has(e.source_instance)) outputs.set(e.source_instance, /* @__PURE__ */ new Set());
|
|
3528
|
+
outputs.get(e.source_instance).add(e.from_output);
|
|
3529
|
+
}
|
|
3530
|
+
return { inputs, outputs };
|
|
3531
|
+
}
|
|
3532
|
+
|
|
3533
|
+
// src/projection/resolve-schema.ts
|
|
3534
|
+
function resolveSchema(bundle, use, readOutputs) {
|
|
3535
|
+
const target = bundle.modules[use.module];
|
|
3536
|
+
if (!target) return { inputs: [], outputs: [] };
|
|
3537
|
+
if (target.interface) {
|
|
3538
|
+
return { inputs: target.interface.inputs, outputs: target.interface.outputs };
|
|
3539
|
+
}
|
|
3540
|
+
return {
|
|
3541
|
+
inputs: Object.keys(use.inputs ?? {}).sort().map((name) => InputDef.create({ name })),
|
|
3542
|
+
outputs: [...new Set(readOutputs)].filter((name) => name !== "").sort().map((name) => OutputDef.create({ name }))
|
|
3543
|
+
};
|
|
3544
|
+
}
|
|
3545
|
+
function findChild(mod, id) {
|
|
3546
|
+
for (const use of mod.modules ?? []) {
|
|
3547
|
+
if (use.id === id) return { id, use };
|
|
3548
|
+
}
|
|
3549
|
+
for (const resource of mod.resources ?? []) {
|
|
3550
|
+
if (resource.id === id) return { id, resource };
|
|
3551
|
+
}
|
|
3552
|
+
return null;
|
|
3553
|
+
}
|
|
3554
|
+
function resolveInstance(bundle, id) {
|
|
3555
|
+
return resolveFrom(bundle, bundle.entry, id);
|
|
3556
|
+
}
|
|
3557
|
+
function resolveFrom(bundle, scopeKey, id) {
|
|
3558
|
+
const scope = bundle.modules[scopeKey];
|
|
3559
|
+
if (!scope) return null;
|
|
3560
|
+
for (const use of scope.modules ?? []) {
|
|
3561
|
+
if (!id.startsWith(`${use.id}.`)) continue;
|
|
3562
|
+
const nested = resolveFrom(bundle, use.module, id.slice(use.id.length + 1));
|
|
3563
|
+
if (nested) return nested;
|
|
3564
|
+
}
|
|
3565
|
+
const child = findChild(scope, id);
|
|
3566
|
+
return child ? { scopeKey, scope, child } : null;
|
|
3567
|
+
}
|
|
3568
|
+
function instanceAddress(bundle, id) {
|
|
3569
|
+
const resolved = resolveInstance(bundle, id);
|
|
3570
|
+
return resolved ? { scope: resolved.scopeKey, id: resolved.child.id } : { scope: bundle.entry, id };
|
|
3571
|
+
}
|
|
3572
|
+
function resolveScopePath(bundle, path) {
|
|
3573
|
+
if (path === "") {
|
|
3574
|
+
return bundle.modules[bundle.entry] ? bundle.entry : null;
|
|
3575
|
+
}
|
|
3576
|
+
return resolveInstance(bundle, path)?.child.use?.module ?? null;
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3338
3579
|
// src/projection/inspect.ts
|
|
3339
3580
|
function hclLiteralText(lit) {
|
|
3340
3581
|
if (typeof lit === "string") return quoteHclString(lit);
|
|
@@ -3403,23 +3644,14 @@ function bindingMode(b) {
|
|
|
3403
3644
|
function describeBinding(b) {
|
|
3404
3645
|
return { mode: bindingMode(b).mode, display: bindingText(b) };
|
|
3405
3646
|
}
|
|
3406
|
-
function findChild(mod, id) {
|
|
3407
|
-
for (const use of mod.modules ?? []) {
|
|
3408
|
-
if (use.id === id) return { id, use };
|
|
3409
|
-
}
|
|
3410
|
-
for (const resource of mod.resources ?? []) {
|
|
3411
|
-
if (resource.id === id) return { id, resource };
|
|
3412
|
-
}
|
|
3413
|
-
return null;
|
|
3414
|
-
}
|
|
3415
3647
|
function deriveNodeConfig(bundle, instanceId) {
|
|
3416
|
-
const
|
|
3417
|
-
if (!
|
|
3418
|
-
const child =
|
|
3419
|
-
|
|
3420
|
-
const
|
|
3421
|
-
const schemaInputs =
|
|
3422
|
-
const schemaOutputs =
|
|
3648
|
+
const resolved = resolveInstance(bundle, instanceId);
|
|
3649
|
+
if (!resolved) return null;
|
|
3650
|
+
const { scope, child } = resolved;
|
|
3651
|
+
const readOutputs = indexWires(deriveEdges(scope.modules ?? [])).outputs.get(child.id) ?? [];
|
|
3652
|
+
const schema = child.use ? resolveSchema(bundle, child.use, readOutputs) : { inputs: [], outputs: [] };
|
|
3653
|
+
const schemaInputs = schema.inputs;
|
|
3654
|
+
const schemaOutputs = schema.outputs;
|
|
3423
3655
|
const boundInputs = child.use?.inputs ?? child.resource?.inputs ?? {};
|
|
3424
3656
|
const inputs = schemaInputs.map((def) => ({
|
|
3425
3657
|
name: def.name,
|
|
@@ -3437,12 +3669,12 @@ function deriveNodeConfig(bundle, instanceId) {
|
|
|
3437
3669
|
sensitive: def.sensitive || void 0
|
|
3438
3670
|
}));
|
|
3439
3671
|
const siblingIds = [
|
|
3440
|
-
...(
|
|
3441
|
-
...(
|
|
3442
|
-
].filter((id) => id !==
|
|
3672
|
+
...(scope.modules ?? []).map((u) => u.id),
|
|
3673
|
+
...(scope.resources ?? []).map((r) => r.id)
|
|
3674
|
+
].filter((id) => id !== child.id);
|
|
3443
3675
|
const dependsOn = child.use?.depends_on ?? child.resource?.depends_on ?? [];
|
|
3444
3676
|
const providers = child.use?.providers ?? {};
|
|
3445
|
-
const availableVariables = (
|
|
3677
|
+
const availableVariables = (scope.interface?.inputs ?? []).map((v) => ({
|
|
3446
3678
|
name: v.name,
|
|
3447
3679
|
type: v.type
|
|
3448
3680
|
}));
|
|
@@ -3512,6 +3744,14 @@ function deriveSettingsConfig(bundle) {
|
|
|
3512
3744
|
function joinPath(prefix, localId) {
|
|
3513
3745
|
return prefix === "" ? localId : `${prefix}.${localId}`;
|
|
3514
3746
|
}
|
|
3747
|
+
function splitPath(canvasPath) {
|
|
3748
|
+
const lastDot = canvasPath.lastIndexOf(".");
|
|
3749
|
+
if (lastDot === -1) return { parentPath: "", localId: canvasPath };
|
|
3750
|
+
return { parentPath: canvasPath.slice(0, lastDot), localId: canvasPath.slice(lastDot + 1) };
|
|
3751
|
+
}
|
|
3752
|
+
function callText(sourcePath) {
|
|
3753
|
+
return `module.${splitPath(sourcePath).localId}`;
|
|
3754
|
+
}
|
|
3515
3755
|
|
|
3516
3756
|
// src/projection/node-for-address.ts
|
|
3517
3757
|
var INSTANCE_KEY = /\[[^\]]*\]$/;
|
|
@@ -3715,65 +3955,6 @@ function columnByDepth(ids, edges) {
|
|
|
3715
3955
|
return depth;
|
|
3716
3956
|
}
|
|
3717
3957
|
|
|
3718
|
-
// src/projection/derive-edges.ts
|
|
3719
|
-
var moduleDepPattern = /\bmodule\.([A-Za-z_][A-Za-z0-9_-]*)(?:\[\s*(?:\*|[0-9]+|"[^"]*")\s*\])?\.([A-Za-z_][A-Za-z0-9_-]*)/g;
|
|
3720
|
-
function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
|
|
3721
|
-
if (binding.out?.module && binding.out.name) {
|
|
3722
|
-
edges.push({
|
|
3723
|
-
source_instance: binding.out.module,
|
|
3724
|
-
target_instance: targetId,
|
|
3725
|
-
from_output: binding.out.name,
|
|
3726
|
-
to_input: toInput
|
|
3727
|
-
});
|
|
3728
|
-
return;
|
|
3729
|
-
}
|
|
3730
|
-
if (binding.expr?.value) {
|
|
3731
|
-
for (const match of binding.expr.value.matchAll(moduleDepPattern)) {
|
|
3732
|
-
const srcInstance = match[1];
|
|
3733
|
-
const srcOutput = match[2];
|
|
3734
|
-
if (!useIds.has(srcInstance)) continue;
|
|
3735
|
-
const key = `${srcInstance}:${targetId}:${srcOutput}:${toInput}`;
|
|
3736
|
-
if (seen.has(key)) continue;
|
|
3737
|
-
seen.add(key);
|
|
3738
|
-
edges.push({
|
|
3739
|
-
source_instance: srcInstance,
|
|
3740
|
-
target_instance: targetId,
|
|
3741
|
-
from_output: srcOutput,
|
|
3742
|
-
to_input: toInput
|
|
3743
|
-
});
|
|
3744
|
-
}
|
|
3745
|
-
}
|
|
3746
|
-
}
|
|
3747
|
-
function deriveEdges(uses) {
|
|
3748
|
-
const useIds = new Set(uses.map((u) => u.id));
|
|
3749
|
-
const edges = [];
|
|
3750
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3751
|
-
for (const target of uses) {
|
|
3752
|
-
const inputs = target.inputs ?? {};
|
|
3753
|
-
for (const [inputName, binding] of Object.entries(inputs)) {
|
|
3754
|
-
emitEdgesFromBinding(binding, target.id, inputName, useIds, seen, edges);
|
|
3755
|
-
}
|
|
3756
|
-
if (target.count) {
|
|
3757
|
-
emitEdgesFromBinding(target.count, target.id, "count", useIds, seen, edges);
|
|
3758
|
-
}
|
|
3759
|
-
if (target.for_each) {
|
|
3760
|
-
emitEdgesFromBinding(target.for_each, target.id, "for_each", useIds, seen, edges);
|
|
3761
|
-
}
|
|
3762
|
-
}
|
|
3763
|
-
return edges;
|
|
3764
|
-
}
|
|
3765
|
-
function indexWires(edges) {
|
|
3766
|
-
const inputs = /* @__PURE__ */ new Map();
|
|
3767
|
-
const outputs = /* @__PURE__ */ new Map();
|
|
3768
|
-
for (const e of edges) {
|
|
3769
|
-
if (!inputs.has(e.target_instance)) inputs.set(e.target_instance, /* @__PURE__ */ new Set());
|
|
3770
|
-
inputs.get(e.target_instance).add(e.to_input);
|
|
3771
|
-
if (!outputs.has(e.source_instance)) outputs.set(e.source_instance, /* @__PURE__ */ new Set());
|
|
3772
|
-
outputs.get(e.source_instance).add(e.from_output);
|
|
3773
|
-
}
|
|
3774
|
-
return { inputs, outputs };
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3777
3958
|
// src/projection/project-group.ts
|
|
3778
3959
|
function projectGroup(use, target, fullId, parentArrangement) {
|
|
3779
3960
|
const childIds = (target.modules ?? []).map((u) => joinPath(fullId, u.id));
|
|
@@ -3803,35 +3984,9 @@ function projectGroup(use, target, fullId, parentArrangement) {
|
|
|
3803
3984
|
};
|
|
3804
3985
|
}
|
|
3805
3986
|
|
|
3806
|
-
// src/projection/resolve-schema.ts
|
|
3807
|
-
function resolveSchema(bundle, use) {
|
|
3808
|
-
const target = bundle.modules[use.module];
|
|
3809
|
-
if (!target) return { inputs: [], outputs: [] };
|
|
3810
|
-
return {
|
|
3811
|
-
inputs: target.interface?.inputs ?? [],
|
|
3812
|
-
outputs: target.interface?.outputs ?? []
|
|
3813
|
-
};
|
|
3814
|
-
}
|
|
3815
|
-
function resolveScopePath(bundle, path) {
|
|
3816
|
-
if (path === "") {
|
|
3817
|
-
return bundle.modules[bundle.entry] ? bundle.entry : null;
|
|
3818
|
-
}
|
|
3819
|
-
return descendScope(bundle, bundle.entry, path.split("."));
|
|
3820
|
-
}
|
|
3821
|
-
function descendScope(bundle, scopeKey, segments) {
|
|
3822
|
-
if (segments.length === 0) return scopeKey;
|
|
3823
|
-
const mod = bundle.modules[scopeKey];
|
|
3824
|
-
if (!mod) return null;
|
|
3825
|
-
const [head, ...tail] = segments;
|
|
3826
|
-
for (const u of mod.modules ?? []) {
|
|
3827
|
-
if (u.id === head) return descendScope(bundle, u.module, tail);
|
|
3828
|
-
}
|
|
3829
|
-
return null;
|
|
3830
|
-
}
|
|
3831
|
-
|
|
3832
3987
|
// src/projection/project-node.ts
|
|
3833
3988
|
function projectNode(bundle, use, fullId, position, wiredIn, wiredOut) {
|
|
3834
|
-
const schema = resolveSchema(bundle, use);
|
|
3989
|
+
const schema = resolveSchema(bundle, use, wiredOut);
|
|
3835
3990
|
return {
|
|
3836
3991
|
id: fullId,
|
|
3837
3992
|
label: use.id,
|
|
@@ -3851,7 +4006,8 @@ function projectNode(bundle, use, fullId, position, wiredIn, wiredOut) {
|
|
|
3851
4006
|
wired: wiredOut.has(out.name),
|
|
3852
4007
|
description: out.description,
|
|
3853
4008
|
sensitive: out.sensitive
|
|
3854
|
-
}))
|
|
4009
|
+
})),
|
|
4010
|
+
call_wired: wiredOut.has("")
|
|
3855
4011
|
};
|
|
3856
4012
|
}
|
|
3857
4013
|
|
|
@@ -4751,22 +4907,57 @@ function isSet3(value) {
|
|
|
4751
4907
|
|
|
4752
4908
|
// src/proto-messages.ts
|
|
4753
4909
|
var CanvasViewProto = CanvasView;
|
|
4910
|
+
|
|
4911
|
+
// src/protocol-version.ts
|
|
4912
|
+
var ENGINE_PROTOCOL_VERSION = String(3 /* PROTOCOL_VERSION_CURRENT */);
|
|
4913
|
+
var EngineProtocolMismatchError = class extends Error {
|
|
4914
|
+
constructor(engineVersion, engineProtocol, requiredProtocol) {
|
|
4915
|
+
super(
|
|
4916
|
+
`Lace engine ${engineVersion} speaks protocol ${engineProtocol}; this host speaks protocol ${requiredProtocol}`
|
|
4917
|
+
);
|
|
4918
|
+
this.engineVersion = engineVersion;
|
|
4919
|
+
this.engineProtocol = engineProtocol;
|
|
4920
|
+
this.requiredProtocol = requiredProtocol;
|
|
4921
|
+
this.name = "EngineProtocolMismatchError";
|
|
4922
|
+
}
|
|
4923
|
+
/**
|
|
4924
|
+
* The engine is the side that is behind: a newer Lace CLI speaks this
|
|
4925
|
+
* host's protocol. False when the engine is ahead of the host.
|
|
4926
|
+
*/
|
|
4927
|
+
get engineTooOld() {
|
|
4928
|
+
return Number(this.engineProtocol) < Number(this.requiredProtocol);
|
|
4929
|
+
}
|
|
4930
|
+
};
|
|
4931
|
+
function checkEngineProtocol(engineVersion, engineProtocol) {
|
|
4932
|
+
if (engineProtocol !== ENGINE_PROTOCOL_VERSION) {
|
|
4933
|
+
throw new EngineProtocolMismatchError(engineVersion, engineProtocol, ENGINE_PROTOCOL_VERSION);
|
|
4934
|
+
}
|
|
4935
|
+
}
|
|
4754
4936
|
export {
|
|
4755
4937
|
BRIDGE_METHODS,
|
|
4756
4938
|
Bundle,
|
|
4939
|
+
CONNECT_CODE_NAMES,
|
|
4757
4940
|
CanvasViewProto,
|
|
4758
4941
|
EMPTY_BUNDLE,
|
|
4759
4942
|
ENGINE_METHODS,
|
|
4943
|
+
ENGINE_PROTOCOL_VERSION,
|
|
4760
4944
|
ENGINE_STREAM_METHODS,
|
|
4945
|
+
EngineProtocolMismatchError,
|
|
4946
|
+
HOST_ONLY_METHODS,
|
|
4947
|
+
callText,
|
|
4948
|
+
checkEngineProtocol,
|
|
4761
4949
|
convertDiagnostic,
|
|
4762
4950
|
deriveNodeConfig,
|
|
4763
4951
|
deriveSettingsConfig,
|
|
4952
|
+
instanceAddress,
|
|
4764
4953
|
nodeIdForAddress,
|
|
4765
4954
|
nodeIdForDiagnostic,
|
|
4766
4955
|
parseModuleKey,
|
|
4767
4956
|
projectCanvasView,
|
|
4957
|
+
resolveInstance,
|
|
4768
4958
|
resolveScopePath,
|
|
4769
4959
|
resolveScopePositions,
|
|
4770
|
-
resolveScopePositionsByDepth
|
|
4960
|
+
resolveScopePositionsByDepth,
|
|
4961
|
+
splitPath
|
|
4771
4962
|
};
|
|
4772
4963
|
//# sourceMappingURL=index.mjs.map
|