@lace-cloud/proto 0.37.1 → 0.39.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 +391 -1002
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +45 -138
- package/dist/index.d.ts +45 -138
- package/dist/index.mjs +380 -996
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -72,7 +72,7 @@ var CONNECT_CODE_NAMES = [
|
|
|
72
72
|
];
|
|
73
73
|
|
|
74
74
|
// src/engine-contract.gen.ts
|
|
75
|
-
var GENERATED_ENGINE_CONTRACT = "
|
|
75
|
+
var GENERATED_ENGINE_CONTRACT = "710665dfdb3c4c3201231e4e707f3f781123944c45cf5cea8ee6078ad4c2b61b";
|
|
76
76
|
|
|
77
77
|
// src/generated/service.ts
|
|
78
78
|
import { BinaryReader as BinaryReader3, BinaryWriter as BinaryWriter3 } from "@bufbuild/protobuf/wire";
|
|
@@ -503,6 +503,183 @@ function isSet(value) {
|
|
|
503
503
|
return value !== null && value !== void 0;
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
+
// src/generated/reason.ts
|
|
507
|
+
var Reason = /* @__PURE__ */ ((Reason3) => {
|
|
508
|
+
Reason3[Reason3["REASON_UNSPECIFIED"] = 0] = "REASON_UNSPECIFIED";
|
|
509
|
+
Reason3[Reason3["REASON_NOT_LACE_FORM"] = 1] = "REASON_NOT_LACE_FORM";
|
|
510
|
+
Reason3[Reason3["REASON_HASH_MISMATCH"] = 2] = "REASON_HASH_MISMATCH";
|
|
511
|
+
Reason3[Reason3["REASON_REGISTRY_UNAVAILABLE"] = 3] = "REASON_REGISTRY_UNAVAILABLE";
|
|
512
|
+
Reason3[Reason3["REASON_ROOT_LOCKED"] = 4] = "REASON_ROOT_LOCKED";
|
|
513
|
+
Reason3[Reason3["REASON_UNSAVED"] = 5] = "REASON_UNSAVED";
|
|
514
|
+
Reason3[Reason3["REASON_CONFLICT"] = 6] = "REASON_CONFLICT";
|
|
515
|
+
Reason3[Reason3["REASON_SOURCE_REFUSED"] = 7] = "REASON_SOURCE_REFUSED";
|
|
516
|
+
Reason3[Reason3["REASON_NOT_GIT_REPOSITORY"] = 8] = "REASON_NOT_GIT_REPOSITORY";
|
|
517
|
+
Reason3[Reason3["REASON_GENERATE_IN_PROGRESS"] = 9] = "REASON_GENERATE_IN_PROGRESS";
|
|
518
|
+
Reason3[Reason3["REASON_NO_ORGANIZATION"] = 10] = "REASON_NO_ORGANIZATION";
|
|
519
|
+
Reason3[Reason3["REASON_NO_TEAM"] = 11] = "REASON_NO_TEAM";
|
|
520
|
+
Reason3[Reason3["REASON_NO_CERTIFICATION"] = 12] = "REASON_NO_CERTIFICATION";
|
|
521
|
+
Reason3[Reason3["REASON_STALE_CERTIFICATION"] = 13] = "REASON_STALE_CERTIFICATION";
|
|
522
|
+
Reason3[Reason3["REASON_TOOL_MISSING"] = 14] = "REASON_TOOL_MISSING";
|
|
523
|
+
Reason3[Reason3["REASON_CROSS_SCOPE"] = 15] = "REASON_CROSS_SCOPE";
|
|
524
|
+
Reason3[Reason3["REASON_UNAUTHENTICATED"] = 16] = "REASON_UNAUTHENTICATED";
|
|
525
|
+
Reason3[Reason3["REASON_IMPORT_RESIDUAL"] = 17] = "REASON_IMPORT_RESIDUAL";
|
|
526
|
+
Reason3[Reason3["REASON_STACK_HAS_STATE"] = 18] = "REASON_STACK_HAS_STATE";
|
|
527
|
+
Reason3[Reason3["REASON_NO_ORIGIN_REMOTE"] = 19] = "REASON_NO_ORIGIN_REMOTE";
|
|
528
|
+
Reason3[Reason3["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
|
|
529
|
+
Reason3[Reason3["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
|
|
530
|
+
Reason3[Reason3["REASON_NO_LOCKFILE"] = 22] = "REASON_NO_LOCKFILE";
|
|
531
|
+
Reason3[Reason3["REASON_NO_COMMIT"] = 23] = "REASON_NO_COMMIT";
|
|
532
|
+
Reason3[Reason3["REASON_STALE_WORKING_STATE"] = 24] = "REASON_STALE_WORKING_STATE";
|
|
533
|
+
Reason3[Reason3["REASON_NO_STACK"] = 25] = "REASON_NO_STACK";
|
|
534
|
+
Reason3[Reason3["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
535
|
+
return Reason3;
|
|
536
|
+
})(Reason || {});
|
|
537
|
+
function reasonFromJSON(object) {
|
|
538
|
+
switch (object) {
|
|
539
|
+
case 0:
|
|
540
|
+
case "REASON_UNSPECIFIED":
|
|
541
|
+
return 0 /* REASON_UNSPECIFIED */;
|
|
542
|
+
case 1:
|
|
543
|
+
case "REASON_NOT_LACE_FORM":
|
|
544
|
+
return 1 /* REASON_NOT_LACE_FORM */;
|
|
545
|
+
case 2:
|
|
546
|
+
case "REASON_HASH_MISMATCH":
|
|
547
|
+
return 2 /* REASON_HASH_MISMATCH */;
|
|
548
|
+
case 3:
|
|
549
|
+
case "REASON_REGISTRY_UNAVAILABLE":
|
|
550
|
+
return 3 /* REASON_REGISTRY_UNAVAILABLE */;
|
|
551
|
+
case 4:
|
|
552
|
+
case "REASON_ROOT_LOCKED":
|
|
553
|
+
return 4 /* REASON_ROOT_LOCKED */;
|
|
554
|
+
case 5:
|
|
555
|
+
case "REASON_UNSAVED":
|
|
556
|
+
return 5 /* REASON_UNSAVED */;
|
|
557
|
+
case 6:
|
|
558
|
+
case "REASON_CONFLICT":
|
|
559
|
+
return 6 /* REASON_CONFLICT */;
|
|
560
|
+
case 7:
|
|
561
|
+
case "REASON_SOURCE_REFUSED":
|
|
562
|
+
return 7 /* REASON_SOURCE_REFUSED */;
|
|
563
|
+
case 8:
|
|
564
|
+
case "REASON_NOT_GIT_REPOSITORY":
|
|
565
|
+
return 8 /* REASON_NOT_GIT_REPOSITORY */;
|
|
566
|
+
case 9:
|
|
567
|
+
case "REASON_GENERATE_IN_PROGRESS":
|
|
568
|
+
return 9 /* REASON_GENERATE_IN_PROGRESS */;
|
|
569
|
+
case 10:
|
|
570
|
+
case "REASON_NO_ORGANIZATION":
|
|
571
|
+
return 10 /* REASON_NO_ORGANIZATION */;
|
|
572
|
+
case 11:
|
|
573
|
+
case "REASON_NO_TEAM":
|
|
574
|
+
return 11 /* REASON_NO_TEAM */;
|
|
575
|
+
case 12:
|
|
576
|
+
case "REASON_NO_CERTIFICATION":
|
|
577
|
+
return 12 /* REASON_NO_CERTIFICATION */;
|
|
578
|
+
case 13:
|
|
579
|
+
case "REASON_STALE_CERTIFICATION":
|
|
580
|
+
return 13 /* REASON_STALE_CERTIFICATION */;
|
|
581
|
+
case 14:
|
|
582
|
+
case "REASON_TOOL_MISSING":
|
|
583
|
+
return 14 /* REASON_TOOL_MISSING */;
|
|
584
|
+
case 15:
|
|
585
|
+
case "REASON_CROSS_SCOPE":
|
|
586
|
+
return 15 /* REASON_CROSS_SCOPE */;
|
|
587
|
+
case 16:
|
|
588
|
+
case "REASON_UNAUTHENTICATED":
|
|
589
|
+
return 16 /* REASON_UNAUTHENTICATED */;
|
|
590
|
+
case 17:
|
|
591
|
+
case "REASON_IMPORT_RESIDUAL":
|
|
592
|
+
return 17 /* REASON_IMPORT_RESIDUAL */;
|
|
593
|
+
case 18:
|
|
594
|
+
case "REASON_STACK_HAS_STATE":
|
|
595
|
+
return 18 /* REASON_STACK_HAS_STATE */;
|
|
596
|
+
case 19:
|
|
597
|
+
case "REASON_NO_ORIGIN_REMOTE":
|
|
598
|
+
return 19 /* REASON_NO_ORIGIN_REMOTE */;
|
|
599
|
+
case 20:
|
|
600
|
+
case "REASON_IMPORT_UNDECLARED":
|
|
601
|
+
return 20 /* REASON_IMPORT_UNDECLARED */;
|
|
602
|
+
case 21:
|
|
603
|
+
case "REASON_ALREADY_IMPORTED":
|
|
604
|
+
return 21 /* REASON_ALREADY_IMPORTED */;
|
|
605
|
+
case 22:
|
|
606
|
+
case "REASON_NO_LOCKFILE":
|
|
607
|
+
return 22 /* REASON_NO_LOCKFILE */;
|
|
608
|
+
case 23:
|
|
609
|
+
case "REASON_NO_COMMIT":
|
|
610
|
+
return 23 /* REASON_NO_COMMIT */;
|
|
611
|
+
case 24:
|
|
612
|
+
case "REASON_STALE_WORKING_STATE":
|
|
613
|
+
return 24 /* REASON_STALE_WORKING_STATE */;
|
|
614
|
+
case 25:
|
|
615
|
+
case "REASON_NO_STACK":
|
|
616
|
+
return 25 /* REASON_NO_STACK */;
|
|
617
|
+
case -1:
|
|
618
|
+
case "UNRECOGNIZED":
|
|
619
|
+
default:
|
|
620
|
+
return -1 /* UNRECOGNIZED */;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function reasonToJSON(object) {
|
|
624
|
+
switch (object) {
|
|
625
|
+
case 0 /* REASON_UNSPECIFIED */:
|
|
626
|
+
return "REASON_UNSPECIFIED";
|
|
627
|
+
case 1 /* REASON_NOT_LACE_FORM */:
|
|
628
|
+
return "REASON_NOT_LACE_FORM";
|
|
629
|
+
case 2 /* REASON_HASH_MISMATCH */:
|
|
630
|
+
return "REASON_HASH_MISMATCH";
|
|
631
|
+
case 3 /* REASON_REGISTRY_UNAVAILABLE */:
|
|
632
|
+
return "REASON_REGISTRY_UNAVAILABLE";
|
|
633
|
+
case 4 /* REASON_ROOT_LOCKED */:
|
|
634
|
+
return "REASON_ROOT_LOCKED";
|
|
635
|
+
case 5 /* REASON_UNSAVED */:
|
|
636
|
+
return "REASON_UNSAVED";
|
|
637
|
+
case 6 /* REASON_CONFLICT */:
|
|
638
|
+
return "REASON_CONFLICT";
|
|
639
|
+
case 7 /* REASON_SOURCE_REFUSED */:
|
|
640
|
+
return "REASON_SOURCE_REFUSED";
|
|
641
|
+
case 8 /* REASON_NOT_GIT_REPOSITORY */:
|
|
642
|
+
return "REASON_NOT_GIT_REPOSITORY";
|
|
643
|
+
case 9 /* REASON_GENERATE_IN_PROGRESS */:
|
|
644
|
+
return "REASON_GENERATE_IN_PROGRESS";
|
|
645
|
+
case 10 /* REASON_NO_ORGANIZATION */:
|
|
646
|
+
return "REASON_NO_ORGANIZATION";
|
|
647
|
+
case 11 /* REASON_NO_TEAM */:
|
|
648
|
+
return "REASON_NO_TEAM";
|
|
649
|
+
case 12 /* REASON_NO_CERTIFICATION */:
|
|
650
|
+
return "REASON_NO_CERTIFICATION";
|
|
651
|
+
case 13 /* REASON_STALE_CERTIFICATION */:
|
|
652
|
+
return "REASON_STALE_CERTIFICATION";
|
|
653
|
+
case 14 /* REASON_TOOL_MISSING */:
|
|
654
|
+
return "REASON_TOOL_MISSING";
|
|
655
|
+
case 15 /* REASON_CROSS_SCOPE */:
|
|
656
|
+
return "REASON_CROSS_SCOPE";
|
|
657
|
+
case 16 /* REASON_UNAUTHENTICATED */:
|
|
658
|
+
return "REASON_UNAUTHENTICATED";
|
|
659
|
+
case 17 /* REASON_IMPORT_RESIDUAL */:
|
|
660
|
+
return "REASON_IMPORT_RESIDUAL";
|
|
661
|
+
case 18 /* REASON_STACK_HAS_STATE */:
|
|
662
|
+
return "REASON_STACK_HAS_STATE";
|
|
663
|
+
case 19 /* REASON_NO_ORIGIN_REMOTE */:
|
|
664
|
+
return "REASON_NO_ORIGIN_REMOTE";
|
|
665
|
+
case 20 /* REASON_IMPORT_UNDECLARED */:
|
|
666
|
+
return "REASON_IMPORT_UNDECLARED";
|
|
667
|
+
case 21 /* REASON_ALREADY_IMPORTED */:
|
|
668
|
+
return "REASON_ALREADY_IMPORTED";
|
|
669
|
+
case 22 /* REASON_NO_LOCKFILE */:
|
|
670
|
+
return "REASON_NO_LOCKFILE";
|
|
671
|
+
case 23 /* REASON_NO_COMMIT */:
|
|
672
|
+
return "REASON_NO_COMMIT";
|
|
673
|
+
case 24 /* REASON_STALE_WORKING_STATE */:
|
|
674
|
+
return "REASON_STALE_WORKING_STATE";
|
|
675
|
+
case 25 /* REASON_NO_STACK */:
|
|
676
|
+
return "REASON_NO_STACK";
|
|
677
|
+
case -1 /* UNRECOGNIZED */:
|
|
678
|
+
default:
|
|
679
|
+
return "UNRECOGNIZED";
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
506
683
|
// src/generated/state.ts
|
|
507
684
|
import { BinaryReader as BinaryReader2, BinaryWriter as BinaryWriter2 } from "@bufbuild/protobuf/wire";
|
|
508
685
|
function createBaseBundle() {
|
|
@@ -3305,940 +3482,209 @@ function isSet2(value) {
|
|
|
3305
3482
|
return value !== null && value !== void 0;
|
|
3306
3483
|
}
|
|
3307
3484
|
|
|
3308
|
-
// src/
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3485
|
+
// src/engine-identity.ts
|
|
3486
|
+
var ENGINE_PROTOCOL_VERSION = String(13 /* PROTOCOL_VERSION_CURRENT */);
|
|
3487
|
+
var ENGINE_CONTRACT = GENERATED_ENGINE_CONTRACT;
|
|
3488
|
+
var EngineIdentityMismatchError = class extends Error {
|
|
3489
|
+
constructor(engine, required) {
|
|
3490
|
+
const behind = engine.protocol === required.protocol ? void 0 : Number(engine.protocol) < Number(required.protocol) ? "engine" : "host";
|
|
3491
|
+
super(mismatchMessage(engine, required, behind));
|
|
3492
|
+
this.name = "EngineIdentityMismatchError";
|
|
3493
|
+
this.engineVersion = engine.version;
|
|
3494
|
+
this.engineProtocol = engine.protocol;
|
|
3495
|
+
this.engineContract = engine.contract;
|
|
3496
|
+
this.requiredProtocol = required.protocol;
|
|
3497
|
+
this.requiredContract = required.contract;
|
|
3498
|
+
this.behind = behind;
|
|
3499
|
+
}
|
|
3500
|
+
};
|
|
3501
|
+
function mismatchMessage(engine, required, behind) {
|
|
3502
|
+
const protocols = `Lace engine ${engine.version} speaks protocol ${engine.protocol}; this host speaks protocol ${required.protocol}`;
|
|
3503
|
+
switch (behind) {
|
|
3504
|
+
case "engine":
|
|
3505
|
+
return `${protocols}: update the Lace CLI`;
|
|
3506
|
+
case "host":
|
|
3507
|
+
return `${protocols}: update this host`;
|
|
3508
|
+
case void 0:
|
|
3509
|
+
return `this host and Lace engine ${engine.version} were built from different trees of protocol ${required.protocol}: rebuild both from one checkout, or install the Lace CLI release that matches this host`;
|
|
3327
3510
|
}
|
|
3328
3511
|
}
|
|
3329
|
-
function
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
case 2 /* NODE_KIND_RESOURCE */:
|
|
3336
|
-
return "NODE_KIND_RESOURCE";
|
|
3337
|
-
case 3 /* NODE_KIND_DATA */:
|
|
3338
|
-
return "NODE_KIND_DATA";
|
|
3339
|
-
case -1 /* UNRECOGNIZED */:
|
|
3340
|
-
default:
|
|
3341
|
-
return "UNRECOGNIZED";
|
|
3512
|
+
function checkEngineIdentity(engine) {
|
|
3513
|
+
if (engine.protocol !== ENGINE_PROTOCOL_VERSION || engine.contract !== ENGINE_CONTRACT) {
|
|
3514
|
+
throw new EngineIdentityMismatchError(engine, {
|
|
3515
|
+
protocol: ENGINE_PROTOCOL_VERSION,
|
|
3516
|
+
contract: ENGINE_CONTRACT
|
|
3517
|
+
});
|
|
3342
3518
|
}
|
|
3343
3519
|
}
|
|
3344
|
-
|
|
3345
|
-
|
|
3520
|
+
|
|
3521
|
+
// src/projection/join-path.ts
|
|
3522
|
+
function joinPath(prefix, localId) {
|
|
3523
|
+
return prefix === "" ? localId : `${prefix}.${localId}`;
|
|
3524
|
+
}
|
|
3525
|
+
function splitPath(canvasPath) {
|
|
3526
|
+
const lastDot = canvasPath.lastIndexOf(".");
|
|
3527
|
+
if (lastDot === -1) return { parentPath: "", localId: canvasPath };
|
|
3528
|
+
return { parentPath: canvasPath.slice(0, lastDot), localId: canvasPath.slice(lastDot + 1) };
|
|
3346
3529
|
}
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3530
|
+
function callText(sourcePath) {
|
|
3531
|
+
return `module.${splitPath(sourcePath).localId}`;
|
|
3532
|
+
}
|
|
3533
|
+
function groupPinText(group, end, pin) {
|
|
3534
|
+
return `${group}.${end === "source" ? "inputs" : "outputs"}.${pin}`;
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
// src/projection/address.ts
|
|
3538
|
+
function addressParts(address) {
|
|
3539
|
+
const parts = [];
|
|
3540
|
+
let current = "";
|
|
3541
|
+
let depth = 0;
|
|
3542
|
+
let quoted = false;
|
|
3543
|
+
let escaped = false;
|
|
3544
|
+
for (const ch of address) {
|
|
3545
|
+
if (quoted) {
|
|
3546
|
+
current += ch;
|
|
3547
|
+
if (escaped) escaped = false;
|
|
3548
|
+
else if (ch === "\\") escaped = true;
|
|
3549
|
+
else if (ch === '"') quoted = false;
|
|
3550
|
+
continue;
|
|
3354
3551
|
}
|
|
3355
|
-
|
|
3356
|
-
|
|
3552
|
+
if (ch === "." && depth === 0) {
|
|
3553
|
+
parts.push(current);
|
|
3554
|
+
current = "";
|
|
3555
|
+
continue;
|
|
3357
3556
|
}
|
|
3358
|
-
if (
|
|
3359
|
-
|
|
3557
|
+
if (ch === '"') quoted = true;
|
|
3558
|
+
else if (ch === "[") depth++;
|
|
3559
|
+
else if (ch === "]") depth--;
|
|
3560
|
+
current += ch;
|
|
3561
|
+
}
|
|
3562
|
+
parts.push(current);
|
|
3563
|
+
return parts;
|
|
3564
|
+
}
|
|
3565
|
+
function splitAddress(address) {
|
|
3566
|
+
const parts = addressParts(address);
|
|
3567
|
+
const modules = [];
|
|
3568
|
+
let i = 0;
|
|
3569
|
+
while (i + 1 < parts.length && parts[i] === "module") {
|
|
3570
|
+
modules.push(parts[i + 1]);
|
|
3571
|
+
i += 2;
|
|
3572
|
+
}
|
|
3573
|
+
return { modules, resource: parts.slice(i).join(".") };
|
|
3574
|
+
}
|
|
3575
|
+
function callName(step) {
|
|
3576
|
+
const bracket = step.indexOf("[");
|
|
3577
|
+
return bracket === -1 ? step : step.slice(0, bracket);
|
|
3578
|
+
}
|
|
3579
|
+
function moduleCallPath(address) {
|
|
3580
|
+
return splitAddress(address).modules.map(callName).reduce(joinPath, "");
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3583
|
+
// src/render.ts
|
|
3584
|
+
var META_ARGUMENTS = ["count", "for_each"];
|
|
3585
|
+
|
|
3586
|
+
// src/projection/classify-child.ts
|
|
3587
|
+
function isGroupUse(bundle, use) {
|
|
3588
|
+
const target = bundle.modules[use.module];
|
|
3589
|
+
return target !== void 0 && isGroupModule(target);
|
|
3590
|
+
}
|
|
3591
|
+
function isGroupModule(mod) {
|
|
3592
|
+
return (mod.modules?.length ?? 0) > 0;
|
|
3593
|
+
}
|
|
3594
|
+
|
|
3595
|
+
// src/projection/derive-edges.ts
|
|
3596
|
+
function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
|
|
3597
|
+
if (binding.out?.module && binding.out.name) {
|
|
3598
|
+
edges.push({
|
|
3599
|
+
source_instance: binding.out.module,
|
|
3600
|
+
target_instance: targetId,
|
|
3601
|
+
from_output: binding.out.name,
|
|
3602
|
+
to_input: toInput
|
|
3603
|
+
});
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3606
|
+
for (const ref of binding.expr?.module_references ?? []) {
|
|
3607
|
+
if (!useIds.has(ref.call)) continue;
|
|
3608
|
+
const fromOutput = ref.output ?? "";
|
|
3609
|
+
const key = `${ref.call}:${targetId}:${fromOutput}:${toInput}`;
|
|
3610
|
+
if (seen.has(key)) continue;
|
|
3611
|
+
seen.add(key);
|
|
3612
|
+
edges.push({
|
|
3613
|
+
source_instance: ref.call,
|
|
3614
|
+
target_instance: targetId,
|
|
3615
|
+
from_output: fromOutput,
|
|
3616
|
+
to_input: toInput
|
|
3617
|
+
});
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
function deriveEdges(uses) {
|
|
3621
|
+
const useIds = new Set(uses.map((u) => u.id));
|
|
3622
|
+
const edges = [];
|
|
3623
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3624
|
+
for (const target of uses) {
|
|
3625
|
+
const inputs = target.inputs ?? {};
|
|
3626
|
+
for (const [inputName, binding] of Object.entries(inputs)) {
|
|
3627
|
+
emitEdgesFromBinding(binding, target.id, inputName, useIds, seen, edges);
|
|
3360
3628
|
}
|
|
3361
|
-
|
|
3362
|
-
|
|
3629
|
+
for (const meta of META_ARGUMENTS) {
|
|
3630
|
+
const binding = target[meta];
|
|
3631
|
+
if (binding) emitEdgesFromBinding(binding, target.id, meta, useIds, seen, edges);
|
|
3363
3632
|
}
|
|
3364
|
-
|
|
3365
|
-
|
|
3633
|
+
}
|
|
3634
|
+
return edges;
|
|
3635
|
+
}
|
|
3636
|
+
function addPin(index, call, pin) {
|
|
3637
|
+
if (!index.has(call)) index.set(call, /* @__PURE__ */ new Set());
|
|
3638
|
+
index.get(call).add(pin);
|
|
3639
|
+
}
|
|
3640
|
+
function indexWires(edges) {
|
|
3641
|
+
const inputs = /* @__PURE__ */ new Map();
|
|
3642
|
+
const outputs = /* @__PURE__ */ new Map();
|
|
3643
|
+
for (const e of edges) {
|
|
3644
|
+
addPin(inputs, e.target_instance, e.to_input);
|
|
3645
|
+
addPin(outputs, e.source_instance, e.from_output);
|
|
3646
|
+
}
|
|
3647
|
+
return { inputs, outputs };
|
|
3648
|
+
}
|
|
3649
|
+
function deriveInterfaceEdges(mod) {
|
|
3650
|
+
const uses = mod.modules ?? [];
|
|
3651
|
+
const useIds = new Set(uses.map((u) => u.id));
|
|
3652
|
+
const declaredIn = new Set((mod.interface?.inputs ?? []).map((i) => i.name));
|
|
3653
|
+
const declaredOut = new Set((mod.interface?.outputs ?? []).map((o) => o.name));
|
|
3654
|
+
const edges = [];
|
|
3655
|
+
const fromInput = (pin, target, toInput) => {
|
|
3656
|
+
if (!pin || !declaredIn.has(pin)) return;
|
|
3657
|
+
edges.push({
|
|
3658
|
+
source_instance: "",
|
|
3659
|
+
target_instance: target,
|
|
3660
|
+
from_output: pin,
|
|
3661
|
+
to_input: toInput,
|
|
3662
|
+
source_pin: true
|
|
3663
|
+
});
|
|
3664
|
+
};
|
|
3665
|
+
for (const use of uses) {
|
|
3666
|
+
for (const [name, binding] of Object.entries(use.inputs ?? {})) {
|
|
3667
|
+
fromInput(binding.var ?? "", use.id, name);
|
|
3366
3668
|
}
|
|
3367
|
-
for (const
|
|
3368
|
-
|
|
3669
|
+
for (const meta of META_ARGUMENTS) fromInput(use[meta]?.var ?? "", use.id, meta);
|
|
3670
|
+
}
|
|
3671
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3672
|
+
for (const [name, exported] of Object.entries(mod.exports?.outputs ?? {})) {
|
|
3673
|
+
if (!declaredOut.has(name)) continue;
|
|
3674
|
+
const read = [];
|
|
3675
|
+
emitEdgesFromBinding(exported, "", name, useIds, seen, read);
|
|
3676
|
+
for (const edge of read) {
|
|
3677
|
+
if (useIds.has(edge.source_instance)) edges.push({ ...edge, target_pin: true });
|
|
3369
3678
|
}
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
case 1: {
|
|
3380
|
-
if (tag !== 10) {
|
|
3381
|
-
break;
|
|
3382
|
-
}
|
|
3383
|
-
message.module_name = reader.string();
|
|
3384
|
-
continue;
|
|
3385
|
-
}
|
|
3386
|
-
case 2: {
|
|
3387
|
-
if (tag !== 18) {
|
|
3388
|
-
break;
|
|
3389
|
-
}
|
|
3390
|
-
message.nodes.push(RenderNode.decode(reader, reader.uint32()));
|
|
3391
|
-
continue;
|
|
3392
|
-
}
|
|
3393
|
-
case 3: {
|
|
3394
|
-
if (tag !== 26) {
|
|
3395
|
-
break;
|
|
3396
|
-
}
|
|
3397
|
-
message.edges.push(RenderEdge.decode(reader, reader.uint32()));
|
|
3398
|
-
continue;
|
|
3399
|
-
}
|
|
3400
|
-
case 5: {
|
|
3401
|
-
if (tag !== 40) {
|
|
3402
|
-
break;
|
|
3403
|
-
}
|
|
3404
|
-
message.can_undo = reader.bool();
|
|
3405
|
-
continue;
|
|
3406
|
-
}
|
|
3407
|
-
case 6: {
|
|
3408
|
-
if (tag !== 48) {
|
|
3409
|
-
break;
|
|
3410
|
-
}
|
|
3411
|
-
message.can_redo = reader.bool();
|
|
3412
|
-
continue;
|
|
3413
|
-
}
|
|
3414
|
-
case 7: {
|
|
3415
|
-
if (tag !== 56) {
|
|
3416
|
-
break;
|
|
3417
|
-
}
|
|
3418
|
-
message.unsaved = reader.bool();
|
|
3419
|
-
continue;
|
|
3420
|
-
}
|
|
3421
|
-
case 8: {
|
|
3422
|
-
if (tag !== 66) {
|
|
3423
|
-
break;
|
|
3424
|
-
}
|
|
3425
|
-
message.groups.push(RenderGroup.decode(reader, reader.uint32()));
|
|
3426
|
-
continue;
|
|
3427
|
-
}
|
|
3428
|
-
}
|
|
3429
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
3430
|
-
break;
|
|
3431
|
-
}
|
|
3432
|
-
reader.skip(tag & 7);
|
|
3433
|
-
}
|
|
3434
|
-
return message;
|
|
3435
|
-
},
|
|
3436
|
-
fromJSON(object) {
|
|
3437
|
-
return {
|
|
3438
|
-
module_name: isSet3(object.moduleName) ? globalThis.String(object.moduleName) : isSet3(object.module_name) ? globalThis.String(object.module_name) : "",
|
|
3439
|
-
nodes: globalThis.Array.isArray(object?.nodes) ? object.nodes.map((e) => RenderNode.fromJSON(e)) : [],
|
|
3440
|
-
edges: globalThis.Array.isArray(object?.edges) ? object.edges.map((e) => RenderEdge.fromJSON(e)) : [],
|
|
3441
|
-
can_undo: isSet3(object.canUndo) ? globalThis.Boolean(object.canUndo) : isSet3(object.can_undo) ? globalThis.Boolean(object.can_undo) : false,
|
|
3442
|
-
can_redo: isSet3(object.canRedo) ? globalThis.Boolean(object.canRedo) : isSet3(object.can_redo) ? globalThis.Boolean(object.can_redo) : false,
|
|
3443
|
-
unsaved: isSet3(object.unsaved) ? globalThis.Boolean(object.unsaved) : false,
|
|
3444
|
-
groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e) => RenderGroup.fromJSON(e)) : []
|
|
3445
|
-
};
|
|
3446
|
-
},
|
|
3447
|
-
toJSON(message) {
|
|
3448
|
-
const obj = {};
|
|
3449
|
-
if (message.module_name !== "") {
|
|
3450
|
-
obj.moduleName = message.module_name;
|
|
3451
|
-
}
|
|
3452
|
-
if (message.nodes?.length) {
|
|
3453
|
-
obj.nodes = message.nodes.map((e) => RenderNode.toJSON(e));
|
|
3454
|
-
}
|
|
3455
|
-
if (message.edges?.length) {
|
|
3456
|
-
obj.edges = message.edges.map((e) => RenderEdge.toJSON(e));
|
|
3457
|
-
}
|
|
3458
|
-
if (message.can_undo !== false) {
|
|
3459
|
-
obj.canUndo = message.can_undo;
|
|
3460
|
-
}
|
|
3461
|
-
if (message.can_redo !== false) {
|
|
3462
|
-
obj.canRedo = message.can_redo;
|
|
3463
|
-
}
|
|
3464
|
-
if (message.unsaved !== false) {
|
|
3465
|
-
obj.unsaved = message.unsaved;
|
|
3466
|
-
}
|
|
3467
|
-
if (message.groups?.length) {
|
|
3468
|
-
obj.groups = message.groups.map((e) => RenderGroup.toJSON(e));
|
|
3469
|
-
}
|
|
3470
|
-
return obj;
|
|
3471
|
-
},
|
|
3472
|
-
create(base) {
|
|
3473
|
-
return CanvasView.fromPartial(base ?? {});
|
|
3474
|
-
},
|
|
3475
|
-
fromPartial(object) {
|
|
3476
|
-
const message = createBaseCanvasView();
|
|
3477
|
-
message.module_name = object.module_name ?? "";
|
|
3478
|
-
message.nodes = object.nodes?.map((e) => RenderNode.fromPartial(e)) || [];
|
|
3479
|
-
message.edges = object.edges?.map((e) => RenderEdge.fromPartial(e)) || [];
|
|
3480
|
-
message.can_undo = object.can_undo ?? false;
|
|
3481
|
-
message.can_redo = object.can_redo ?? false;
|
|
3482
|
-
message.unsaved = object.unsaved ?? false;
|
|
3483
|
-
message.groups = object.groups?.map((e) => RenderGroup.fromPartial(e)) || [];
|
|
3484
|
-
return message;
|
|
3485
|
-
}
|
|
3486
|
-
};
|
|
3487
|
-
function createBaseRenderGroup() {
|
|
3488
|
-
return { id: "", label: "", node_ids: [], collapsed: false, module_key: "", inputs: [], outputs: [] };
|
|
3489
|
-
}
|
|
3490
|
-
var RenderGroup = {
|
|
3491
|
-
encode(message, writer = new BinaryWriter3()) {
|
|
3492
|
-
if (message.id !== "") {
|
|
3493
|
-
writer.uint32(10).string(message.id);
|
|
3494
|
-
}
|
|
3495
|
-
if (message.label !== "") {
|
|
3496
|
-
writer.uint32(18).string(message.label);
|
|
3497
|
-
}
|
|
3498
|
-
for (const v of message.node_ids) {
|
|
3499
|
-
writer.uint32(26).string(v);
|
|
3500
|
-
}
|
|
3501
|
-
if (message.collapsed !== false) {
|
|
3502
|
-
writer.uint32(32).bool(message.collapsed);
|
|
3503
|
-
}
|
|
3504
|
-
if (message.module_key !== "") {
|
|
3505
|
-
writer.uint32(42).string(message.module_key);
|
|
3506
|
-
}
|
|
3507
|
-
for (const v of message.inputs) {
|
|
3508
|
-
NodePin.encode(v, writer.uint32(50).fork()).join();
|
|
3509
|
-
}
|
|
3510
|
-
for (const v of message.outputs) {
|
|
3511
|
-
NodePin.encode(v, writer.uint32(58).fork()).join();
|
|
3512
|
-
}
|
|
3513
|
-
return writer;
|
|
3514
|
-
},
|
|
3515
|
-
decode(input, length) {
|
|
3516
|
-
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
3517
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3518
|
-
const message = createBaseRenderGroup();
|
|
3519
|
-
while (reader.pos < end) {
|
|
3520
|
-
const tag = reader.uint32();
|
|
3521
|
-
switch (tag >>> 3) {
|
|
3522
|
-
case 1: {
|
|
3523
|
-
if (tag !== 10) {
|
|
3524
|
-
break;
|
|
3525
|
-
}
|
|
3526
|
-
message.id = reader.string();
|
|
3527
|
-
continue;
|
|
3528
|
-
}
|
|
3529
|
-
case 2: {
|
|
3530
|
-
if (tag !== 18) {
|
|
3531
|
-
break;
|
|
3532
|
-
}
|
|
3533
|
-
message.label = reader.string();
|
|
3534
|
-
continue;
|
|
3535
|
-
}
|
|
3536
|
-
case 3: {
|
|
3537
|
-
if (tag !== 26) {
|
|
3538
|
-
break;
|
|
3539
|
-
}
|
|
3540
|
-
message.node_ids.push(reader.string());
|
|
3541
|
-
continue;
|
|
3542
|
-
}
|
|
3543
|
-
case 4: {
|
|
3544
|
-
if (tag !== 32) {
|
|
3545
|
-
break;
|
|
3546
|
-
}
|
|
3547
|
-
message.collapsed = reader.bool();
|
|
3548
|
-
continue;
|
|
3549
|
-
}
|
|
3550
|
-
case 5: {
|
|
3551
|
-
if (tag !== 42) {
|
|
3552
|
-
break;
|
|
3553
|
-
}
|
|
3554
|
-
message.module_key = reader.string();
|
|
3555
|
-
continue;
|
|
3556
|
-
}
|
|
3557
|
-
case 6: {
|
|
3558
|
-
if (tag !== 50) {
|
|
3559
|
-
break;
|
|
3560
|
-
}
|
|
3561
|
-
message.inputs.push(NodePin.decode(reader, reader.uint32()));
|
|
3562
|
-
continue;
|
|
3563
|
-
}
|
|
3564
|
-
case 7: {
|
|
3565
|
-
if (tag !== 58) {
|
|
3566
|
-
break;
|
|
3567
|
-
}
|
|
3568
|
-
message.outputs.push(NodePin.decode(reader, reader.uint32()));
|
|
3569
|
-
continue;
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
3573
|
-
break;
|
|
3574
|
-
}
|
|
3575
|
-
reader.skip(tag & 7);
|
|
3576
|
-
}
|
|
3577
|
-
return message;
|
|
3578
|
-
},
|
|
3579
|
-
fromJSON(object) {
|
|
3580
|
-
return {
|
|
3581
|
-
id: isSet3(object.id) ? globalThis.String(object.id) : "",
|
|
3582
|
-
label: isSet3(object.label) ? globalThis.String(object.label) : "",
|
|
3583
|
-
node_ids: globalThis.Array.isArray(object?.nodeIds) ? object.nodeIds.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.node_ids) ? object.node_ids.map((e) => globalThis.String(e)) : [],
|
|
3584
|
-
collapsed: isSet3(object.collapsed) ? globalThis.Boolean(object.collapsed) : false,
|
|
3585
|
-
module_key: isSet3(object.moduleKey) ? globalThis.String(object.moduleKey) : isSet3(object.module_key) ? globalThis.String(object.module_key) : "",
|
|
3586
|
-
inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => NodePin.fromJSON(e)) : [],
|
|
3587
|
-
outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => NodePin.fromJSON(e)) : []
|
|
3588
|
-
};
|
|
3589
|
-
},
|
|
3590
|
-
toJSON(message) {
|
|
3591
|
-
const obj = {};
|
|
3592
|
-
if (message.id !== "") {
|
|
3593
|
-
obj.id = message.id;
|
|
3594
|
-
}
|
|
3595
|
-
if (message.label !== "") {
|
|
3596
|
-
obj.label = message.label;
|
|
3597
|
-
}
|
|
3598
|
-
if (message.node_ids?.length) {
|
|
3599
|
-
obj.nodeIds = message.node_ids;
|
|
3600
|
-
}
|
|
3601
|
-
if (message.collapsed !== false) {
|
|
3602
|
-
obj.collapsed = message.collapsed;
|
|
3603
|
-
}
|
|
3604
|
-
if (message.module_key !== "") {
|
|
3605
|
-
obj.moduleKey = message.module_key;
|
|
3606
|
-
}
|
|
3607
|
-
if (message.inputs?.length) {
|
|
3608
|
-
obj.inputs = message.inputs.map((e) => NodePin.toJSON(e));
|
|
3609
|
-
}
|
|
3610
|
-
if (message.outputs?.length) {
|
|
3611
|
-
obj.outputs = message.outputs.map((e) => NodePin.toJSON(e));
|
|
3612
|
-
}
|
|
3613
|
-
return obj;
|
|
3614
|
-
},
|
|
3615
|
-
create(base) {
|
|
3616
|
-
return RenderGroup.fromPartial(base ?? {});
|
|
3617
|
-
},
|
|
3618
|
-
fromPartial(object) {
|
|
3619
|
-
const message = createBaseRenderGroup();
|
|
3620
|
-
message.id = object.id ?? "";
|
|
3621
|
-
message.label = object.label ?? "";
|
|
3622
|
-
message.node_ids = object.node_ids?.map((e) => e) || [];
|
|
3623
|
-
message.collapsed = object.collapsed ?? false;
|
|
3624
|
-
message.module_key = object.module_key ?? "";
|
|
3625
|
-
message.inputs = object.inputs?.map((e) => NodePin.fromPartial(e)) || [];
|
|
3626
|
-
message.outputs = object.outputs?.map((e) => NodePin.fromPartial(e)) || [];
|
|
3627
|
-
return message;
|
|
3628
|
-
}
|
|
3629
|
-
};
|
|
3630
|
-
function createBaseRenderNode() {
|
|
3631
|
-
return { id: "", label: "", kind: 0, module_key: "", icon_url: "", position: void 0, inputs: [], outputs: [] };
|
|
3632
|
-
}
|
|
3633
|
-
var RenderNode = {
|
|
3634
|
-
encode(message, writer = new BinaryWriter3()) {
|
|
3635
|
-
if (message.id !== "") {
|
|
3636
|
-
writer.uint32(10).string(message.id);
|
|
3637
|
-
}
|
|
3638
|
-
if (message.label !== "") {
|
|
3639
|
-
writer.uint32(18).string(message.label);
|
|
3640
|
-
}
|
|
3641
|
-
if (message.kind !== 0) {
|
|
3642
|
-
writer.uint32(24).int32(message.kind);
|
|
3643
|
-
}
|
|
3644
|
-
if (message.module_key !== "") {
|
|
3645
|
-
writer.uint32(34).string(message.module_key);
|
|
3646
|
-
}
|
|
3647
|
-
if (message.icon_url !== "") {
|
|
3648
|
-
writer.uint32(42).string(message.icon_url);
|
|
3649
|
-
}
|
|
3650
|
-
if (message.position !== void 0) {
|
|
3651
|
-
Position.encode(message.position, writer.uint32(50).fork()).join();
|
|
3652
|
-
}
|
|
3653
|
-
for (const v of message.inputs) {
|
|
3654
|
-
NodePin.encode(v, writer.uint32(74).fork()).join();
|
|
3655
|
-
}
|
|
3656
|
-
for (const v of message.outputs) {
|
|
3657
|
-
NodePin.encode(v, writer.uint32(82).fork()).join();
|
|
3658
|
-
}
|
|
3659
|
-
return writer;
|
|
3660
|
-
},
|
|
3661
|
-
decode(input, length) {
|
|
3662
|
-
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
3663
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3664
|
-
const message = createBaseRenderNode();
|
|
3665
|
-
while (reader.pos < end) {
|
|
3666
|
-
const tag = reader.uint32();
|
|
3667
|
-
switch (tag >>> 3) {
|
|
3668
|
-
case 1: {
|
|
3669
|
-
if (tag !== 10) {
|
|
3670
|
-
break;
|
|
3671
|
-
}
|
|
3672
|
-
message.id = reader.string();
|
|
3673
|
-
continue;
|
|
3674
|
-
}
|
|
3675
|
-
case 2: {
|
|
3676
|
-
if (tag !== 18) {
|
|
3677
|
-
break;
|
|
3678
|
-
}
|
|
3679
|
-
message.label = reader.string();
|
|
3680
|
-
continue;
|
|
3681
|
-
}
|
|
3682
|
-
case 3: {
|
|
3683
|
-
if (tag !== 24) {
|
|
3684
|
-
break;
|
|
3685
|
-
}
|
|
3686
|
-
message.kind = reader.int32();
|
|
3687
|
-
continue;
|
|
3688
|
-
}
|
|
3689
|
-
case 4: {
|
|
3690
|
-
if (tag !== 34) {
|
|
3691
|
-
break;
|
|
3692
|
-
}
|
|
3693
|
-
message.module_key = reader.string();
|
|
3694
|
-
continue;
|
|
3695
|
-
}
|
|
3696
|
-
case 5: {
|
|
3697
|
-
if (tag !== 42) {
|
|
3698
|
-
break;
|
|
3699
|
-
}
|
|
3700
|
-
message.icon_url = reader.string();
|
|
3701
|
-
continue;
|
|
3702
|
-
}
|
|
3703
|
-
case 6: {
|
|
3704
|
-
if (tag !== 50) {
|
|
3705
|
-
break;
|
|
3706
|
-
}
|
|
3707
|
-
message.position = Position.decode(reader, reader.uint32());
|
|
3708
|
-
continue;
|
|
3709
|
-
}
|
|
3710
|
-
case 9: {
|
|
3711
|
-
if (tag !== 74) {
|
|
3712
|
-
break;
|
|
3713
|
-
}
|
|
3714
|
-
message.inputs.push(NodePin.decode(reader, reader.uint32()));
|
|
3715
|
-
continue;
|
|
3716
|
-
}
|
|
3717
|
-
case 10: {
|
|
3718
|
-
if (tag !== 82) {
|
|
3719
|
-
break;
|
|
3720
|
-
}
|
|
3721
|
-
message.outputs.push(NodePin.decode(reader, reader.uint32()));
|
|
3722
|
-
continue;
|
|
3723
|
-
}
|
|
3724
|
-
}
|
|
3725
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
3726
|
-
break;
|
|
3727
|
-
}
|
|
3728
|
-
reader.skip(tag & 7);
|
|
3729
|
-
}
|
|
3730
|
-
return message;
|
|
3731
|
-
},
|
|
3732
|
-
fromJSON(object) {
|
|
3733
|
-
return {
|
|
3734
|
-
id: isSet3(object.id) ? globalThis.String(object.id) : "",
|
|
3735
|
-
label: isSet3(object.label) ? globalThis.String(object.label) : "",
|
|
3736
|
-
kind: isSet3(object.kind) ? nodeKindFromJSON(object.kind) : 0,
|
|
3737
|
-
module_key: isSet3(object.moduleKey) ? globalThis.String(object.moduleKey) : isSet3(object.module_key) ? globalThis.String(object.module_key) : "",
|
|
3738
|
-
icon_url: isSet3(object.iconUrl) ? globalThis.String(object.iconUrl) : isSet3(object.icon_url) ? globalThis.String(object.icon_url) : "",
|
|
3739
|
-
position: isSet3(object.position) ? Position.fromJSON(object.position) : void 0,
|
|
3740
|
-
inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => NodePin.fromJSON(e)) : [],
|
|
3741
|
-
outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => NodePin.fromJSON(e)) : []
|
|
3742
|
-
};
|
|
3743
|
-
},
|
|
3744
|
-
toJSON(message) {
|
|
3745
|
-
const obj = {};
|
|
3746
|
-
if (message.id !== "") {
|
|
3747
|
-
obj.id = message.id;
|
|
3748
|
-
}
|
|
3749
|
-
if (message.label !== "") {
|
|
3750
|
-
obj.label = message.label;
|
|
3751
|
-
}
|
|
3752
|
-
if (message.kind !== 0) {
|
|
3753
|
-
obj.kind = nodeKindToJSON(message.kind);
|
|
3754
|
-
}
|
|
3755
|
-
if (message.module_key !== "") {
|
|
3756
|
-
obj.moduleKey = message.module_key;
|
|
3757
|
-
}
|
|
3758
|
-
if (message.icon_url !== "") {
|
|
3759
|
-
obj.iconUrl = message.icon_url;
|
|
3760
|
-
}
|
|
3761
|
-
if (message.position !== void 0) {
|
|
3762
|
-
obj.position = Position.toJSON(message.position);
|
|
3763
|
-
}
|
|
3764
|
-
if (message.inputs?.length) {
|
|
3765
|
-
obj.inputs = message.inputs.map((e) => NodePin.toJSON(e));
|
|
3766
|
-
}
|
|
3767
|
-
if (message.outputs?.length) {
|
|
3768
|
-
obj.outputs = message.outputs.map((e) => NodePin.toJSON(e));
|
|
3769
|
-
}
|
|
3770
|
-
return obj;
|
|
3771
|
-
},
|
|
3772
|
-
create(base) {
|
|
3773
|
-
return RenderNode.fromPartial(base ?? {});
|
|
3774
|
-
},
|
|
3775
|
-
fromPartial(object) {
|
|
3776
|
-
const message = createBaseRenderNode();
|
|
3777
|
-
message.id = object.id ?? "";
|
|
3778
|
-
message.label = object.label ?? "";
|
|
3779
|
-
message.kind = object.kind ?? 0;
|
|
3780
|
-
message.module_key = object.module_key ?? "";
|
|
3781
|
-
message.icon_url = object.icon_url ?? "";
|
|
3782
|
-
message.position = object.position !== void 0 && object.position !== null ? Position.fromPartial(object.position) : void 0;
|
|
3783
|
-
message.inputs = object.inputs?.map((e) => NodePin.fromPartial(e)) || [];
|
|
3784
|
-
message.outputs = object.outputs?.map((e) => NodePin.fromPartial(e)) || [];
|
|
3785
|
-
return message;
|
|
3786
|
-
}
|
|
3787
|
-
};
|
|
3788
|
-
function createBaseNodePin() {
|
|
3789
|
-
return { name: "", type: "", required: false, wired: false, description: "", sensitive: false };
|
|
3790
|
-
}
|
|
3791
|
-
var NodePin = {
|
|
3792
|
-
encode(message, writer = new BinaryWriter3()) {
|
|
3793
|
-
if (message.name !== "") {
|
|
3794
|
-
writer.uint32(10).string(message.name);
|
|
3795
|
-
}
|
|
3796
|
-
if (message.type !== "") {
|
|
3797
|
-
writer.uint32(18).string(message.type);
|
|
3798
|
-
}
|
|
3799
|
-
if (message.required !== false) {
|
|
3800
|
-
writer.uint32(24).bool(message.required);
|
|
3801
|
-
}
|
|
3802
|
-
if (message.wired !== false) {
|
|
3803
|
-
writer.uint32(32).bool(message.wired);
|
|
3804
|
-
}
|
|
3805
|
-
if (message.description !== "") {
|
|
3806
|
-
writer.uint32(42).string(message.description);
|
|
3807
|
-
}
|
|
3808
|
-
if (message.sensitive !== false) {
|
|
3809
|
-
writer.uint32(48).bool(message.sensitive);
|
|
3810
|
-
}
|
|
3811
|
-
return writer;
|
|
3812
|
-
},
|
|
3813
|
-
decode(input, length) {
|
|
3814
|
-
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
3815
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3816
|
-
const message = createBaseNodePin();
|
|
3817
|
-
while (reader.pos < end) {
|
|
3818
|
-
const tag = reader.uint32();
|
|
3819
|
-
switch (tag >>> 3) {
|
|
3820
|
-
case 1: {
|
|
3821
|
-
if (tag !== 10) {
|
|
3822
|
-
break;
|
|
3823
|
-
}
|
|
3824
|
-
message.name = reader.string();
|
|
3825
|
-
continue;
|
|
3826
|
-
}
|
|
3827
|
-
case 2: {
|
|
3828
|
-
if (tag !== 18) {
|
|
3829
|
-
break;
|
|
3830
|
-
}
|
|
3831
|
-
message.type = reader.string();
|
|
3832
|
-
continue;
|
|
3833
|
-
}
|
|
3834
|
-
case 3: {
|
|
3835
|
-
if (tag !== 24) {
|
|
3836
|
-
break;
|
|
3837
|
-
}
|
|
3838
|
-
message.required = reader.bool();
|
|
3839
|
-
continue;
|
|
3840
|
-
}
|
|
3841
|
-
case 4: {
|
|
3842
|
-
if (tag !== 32) {
|
|
3843
|
-
break;
|
|
3844
|
-
}
|
|
3845
|
-
message.wired = reader.bool();
|
|
3846
|
-
continue;
|
|
3847
|
-
}
|
|
3848
|
-
case 5: {
|
|
3849
|
-
if (tag !== 42) {
|
|
3850
|
-
break;
|
|
3851
|
-
}
|
|
3852
|
-
message.description = reader.string();
|
|
3853
|
-
continue;
|
|
3854
|
-
}
|
|
3855
|
-
case 6: {
|
|
3856
|
-
if (tag !== 48) {
|
|
3857
|
-
break;
|
|
3858
|
-
}
|
|
3859
|
-
message.sensitive = reader.bool();
|
|
3860
|
-
continue;
|
|
3861
|
-
}
|
|
3862
|
-
}
|
|
3863
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
3864
|
-
break;
|
|
3865
|
-
}
|
|
3866
|
-
reader.skip(tag & 7);
|
|
3867
|
-
}
|
|
3868
|
-
return message;
|
|
3869
|
-
},
|
|
3870
|
-
fromJSON(object) {
|
|
3871
|
-
return {
|
|
3872
|
-
name: isSet3(object.name) ? globalThis.String(object.name) : "",
|
|
3873
|
-
type: isSet3(object.type) ? globalThis.String(object.type) : "",
|
|
3874
|
-
required: isSet3(object.required) ? globalThis.Boolean(object.required) : false,
|
|
3875
|
-
wired: isSet3(object.wired) ? globalThis.Boolean(object.wired) : false,
|
|
3876
|
-
description: isSet3(object.description) ? globalThis.String(object.description) : "",
|
|
3877
|
-
sensitive: isSet3(object.sensitive) ? globalThis.Boolean(object.sensitive) : false
|
|
3878
|
-
};
|
|
3879
|
-
},
|
|
3880
|
-
toJSON(message) {
|
|
3881
|
-
const obj = {};
|
|
3882
|
-
if (message.name !== "") {
|
|
3883
|
-
obj.name = message.name;
|
|
3884
|
-
}
|
|
3885
|
-
if (message.type !== "") {
|
|
3886
|
-
obj.type = message.type;
|
|
3887
|
-
}
|
|
3888
|
-
if (message.required !== false) {
|
|
3889
|
-
obj.required = message.required;
|
|
3890
|
-
}
|
|
3891
|
-
if (message.wired !== false) {
|
|
3892
|
-
obj.wired = message.wired;
|
|
3893
|
-
}
|
|
3894
|
-
if (message.description !== "") {
|
|
3895
|
-
obj.description = message.description;
|
|
3896
|
-
}
|
|
3897
|
-
if (message.sensitive !== false) {
|
|
3898
|
-
obj.sensitive = message.sensitive;
|
|
3899
|
-
}
|
|
3900
|
-
return obj;
|
|
3901
|
-
},
|
|
3902
|
-
create(base) {
|
|
3903
|
-
return NodePin.fromPartial(base ?? {});
|
|
3904
|
-
},
|
|
3905
|
-
fromPartial(object) {
|
|
3906
|
-
const message = createBaseNodePin();
|
|
3907
|
-
message.name = object.name ?? "";
|
|
3908
|
-
message.type = object.type ?? "";
|
|
3909
|
-
message.required = object.required ?? false;
|
|
3910
|
-
message.wired = object.wired ?? false;
|
|
3911
|
-
message.description = object.description ?? "";
|
|
3912
|
-
message.sensitive = object.sensitive ?? false;
|
|
3913
|
-
return message;
|
|
3914
|
-
}
|
|
3915
|
-
};
|
|
3916
|
-
function createBaseRenderEdge() {
|
|
3917
|
-
return { id: "", source: "", target: "", source_output: "", target_input: "" };
|
|
3918
|
-
}
|
|
3919
|
-
var RenderEdge = {
|
|
3920
|
-
encode(message, writer = new BinaryWriter3()) {
|
|
3921
|
-
if (message.id !== "") {
|
|
3922
|
-
writer.uint32(10).string(message.id);
|
|
3923
|
-
}
|
|
3924
|
-
if (message.source !== "") {
|
|
3925
|
-
writer.uint32(18).string(message.source);
|
|
3926
|
-
}
|
|
3927
|
-
if (message.target !== "") {
|
|
3928
|
-
writer.uint32(26).string(message.target);
|
|
3929
|
-
}
|
|
3930
|
-
if (message.source_output !== "") {
|
|
3931
|
-
writer.uint32(34).string(message.source_output);
|
|
3932
|
-
}
|
|
3933
|
-
if (message.target_input !== "") {
|
|
3934
|
-
writer.uint32(42).string(message.target_input);
|
|
3935
|
-
}
|
|
3936
|
-
return writer;
|
|
3937
|
-
},
|
|
3938
|
-
decode(input, length) {
|
|
3939
|
-
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
3940
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3941
|
-
const message = createBaseRenderEdge();
|
|
3942
|
-
while (reader.pos < end) {
|
|
3943
|
-
const tag = reader.uint32();
|
|
3944
|
-
switch (tag >>> 3) {
|
|
3945
|
-
case 1: {
|
|
3946
|
-
if (tag !== 10) {
|
|
3947
|
-
break;
|
|
3948
|
-
}
|
|
3949
|
-
message.id = reader.string();
|
|
3950
|
-
continue;
|
|
3951
|
-
}
|
|
3952
|
-
case 2: {
|
|
3953
|
-
if (tag !== 18) {
|
|
3954
|
-
break;
|
|
3955
|
-
}
|
|
3956
|
-
message.source = reader.string();
|
|
3957
|
-
continue;
|
|
3958
|
-
}
|
|
3959
|
-
case 3: {
|
|
3960
|
-
if (tag !== 26) {
|
|
3961
|
-
break;
|
|
3962
|
-
}
|
|
3963
|
-
message.target = reader.string();
|
|
3964
|
-
continue;
|
|
3965
|
-
}
|
|
3966
|
-
case 4: {
|
|
3967
|
-
if (tag !== 34) {
|
|
3968
|
-
break;
|
|
3969
|
-
}
|
|
3970
|
-
message.source_output = reader.string();
|
|
3971
|
-
continue;
|
|
3972
|
-
}
|
|
3973
|
-
case 5: {
|
|
3974
|
-
if (tag !== 42) {
|
|
3975
|
-
break;
|
|
3976
|
-
}
|
|
3977
|
-
message.target_input = reader.string();
|
|
3978
|
-
continue;
|
|
3979
|
-
}
|
|
3980
|
-
}
|
|
3981
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
3982
|
-
break;
|
|
3983
|
-
}
|
|
3984
|
-
reader.skip(tag & 7);
|
|
3985
|
-
}
|
|
3986
|
-
return message;
|
|
3987
|
-
},
|
|
3988
|
-
fromJSON(object) {
|
|
3989
|
-
return {
|
|
3990
|
-
id: isSet3(object.id) ? globalThis.String(object.id) : "",
|
|
3991
|
-
source: isSet3(object.source) ? globalThis.String(object.source) : "",
|
|
3992
|
-
target: isSet3(object.target) ? globalThis.String(object.target) : "",
|
|
3993
|
-
source_output: isSet3(object.sourceOutput) ? globalThis.String(object.sourceOutput) : isSet3(object.source_output) ? globalThis.String(object.source_output) : "",
|
|
3994
|
-
target_input: isSet3(object.targetInput) ? globalThis.String(object.targetInput) : isSet3(object.target_input) ? globalThis.String(object.target_input) : ""
|
|
3995
|
-
};
|
|
3996
|
-
},
|
|
3997
|
-
toJSON(message) {
|
|
3998
|
-
const obj = {};
|
|
3999
|
-
if (message.id !== "") {
|
|
4000
|
-
obj.id = message.id;
|
|
4001
|
-
}
|
|
4002
|
-
if (message.source !== "") {
|
|
4003
|
-
obj.source = message.source;
|
|
4004
|
-
}
|
|
4005
|
-
if (message.target !== "") {
|
|
4006
|
-
obj.target = message.target;
|
|
4007
|
-
}
|
|
4008
|
-
if (message.source_output !== "") {
|
|
4009
|
-
obj.sourceOutput = message.source_output;
|
|
4010
|
-
}
|
|
4011
|
-
if (message.target_input !== "") {
|
|
4012
|
-
obj.targetInput = message.target_input;
|
|
4013
|
-
}
|
|
4014
|
-
return obj;
|
|
4015
|
-
},
|
|
4016
|
-
create(base) {
|
|
4017
|
-
return RenderEdge.fromPartial(base ?? {});
|
|
4018
|
-
},
|
|
4019
|
-
fromPartial(object) {
|
|
4020
|
-
const message = createBaseRenderEdge();
|
|
4021
|
-
message.id = object.id ?? "";
|
|
4022
|
-
message.source = object.source ?? "";
|
|
4023
|
-
message.target = object.target ?? "";
|
|
4024
|
-
message.source_output = object.source_output ?? "";
|
|
4025
|
-
message.target_input = object.target_input ?? "";
|
|
4026
|
-
return message;
|
|
4027
|
-
}
|
|
4028
|
-
};
|
|
4029
|
-
function createBasePosition() {
|
|
4030
|
-
return { x: 0, y: 0 };
|
|
4031
|
-
}
|
|
4032
|
-
var Position = {
|
|
4033
|
-
encode(message, writer = new BinaryWriter3()) {
|
|
4034
|
-
if (message.x !== 0) {
|
|
4035
|
-
writer.uint32(9).double(message.x);
|
|
4036
|
-
}
|
|
4037
|
-
if (message.y !== 0) {
|
|
4038
|
-
writer.uint32(17).double(message.y);
|
|
4039
|
-
}
|
|
4040
|
-
return writer;
|
|
4041
|
-
},
|
|
4042
|
-
decode(input, length) {
|
|
4043
|
-
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
4044
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4045
|
-
const message = createBasePosition();
|
|
4046
|
-
while (reader.pos < end) {
|
|
4047
|
-
const tag = reader.uint32();
|
|
4048
|
-
switch (tag >>> 3) {
|
|
4049
|
-
case 1: {
|
|
4050
|
-
if (tag !== 9) {
|
|
4051
|
-
break;
|
|
4052
|
-
}
|
|
4053
|
-
message.x = reader.double();
|
|
4054
|
-
continue;
|
|
4055
|
-
}
|
|
4056
|
-
case 2: {
|
|
4057
|
-
if (tag !== 17) {
|
|
4058
|
-
break;
|
|
4059
|
-
}
|
|
4060
|
-
message.y = reader.double();
|
|
4061
|
-
continue;
|
|
4062
|
-
}
|
|
4063
|
-
}
|
|
4064
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
4065
|
-
break;
|
|
4066
|
-
}
|
|
4067
|
-
reader.skip(tag & 7);
|
|
4068
|
-
}
|
|
4069
|
-
return message;
|
|
4070
|
-
},
|
|
4071
|
-
fromJSON(object) {
|
|
4072
|
-
return {
|
|
4073
|
-
x: isSet3(object.x) ? globalThis.Number(object.x) : 0,
|
|
4074
|
-
y: isSet3(object.y) ? globalThis.Number(object.y) : 0
|
|
4075
|
-
};
|
|
4076
|
-
},
|
|
4077
|
-
toJSON(message) {
|
|
4078
|
-
const obj = {};
|
|
4079
|
-
if (message.x !== 0) {
|
|
4080
|
-
obj.x = message.x;
|
|
4081
|
-
}
|
|
4082
|
-
if (message.y !== 0) {
|
|
4083
|
-
obj.y = message.y;
|
|
4084
|
-
}
|
|
4085
|
-
return obj;
|
|
4086
|
-
},
|
|
4087
|
-
create(base) {
|
|
4088
|
-
return Position.fromPartial(base ?? {});
|
|
4089
|
-
},
|
|
4090
|
-
fromPartial(object) {
|
|
4091
|
-
const message = createBasePosition();
|
|
4092
|
-
message.x = object.x ?? 0;
|
|
4093
|
-
message.y = object.y ?? 0;
|
|
4094
|
-
return message;
|
|
4095
|
-
}
|
|
4096
|
-
};
|
|
4097
|
-
function isSet3(value) {
|
|
4098
|
-
return value !== null && value !== void 0;
|
|
4099
|
-
}
|
|
4100
|
-
|
|
4101
|
-
// src/engine-identity.ts
|
|
4102
|
-
var ENGINE_PROTOCOL_VERSION = String(11 /* PROTOCOL_VERSION_CURRENT */);
|
|
4103
|
-
var ENGINE_CONTRACT = GENERATED_ENGINE_CONTRACT;
|
|
4104
|
-
var EngineIdentityMismatchError = class extends Error {
|
|
4105
|
-
constructor(engine, required) {
|
|
4106
|
-
const behind = engine.protocol === required.protocol ? void 0 : Number(engine.protocol) < Number(required.protocol) ? "engine" : "host";
|
|
4107
|
-
super(mismatchMessage(engine, required, behind));
|
|
4108
|
-
this.name = "EngineIdentityMismatchError";
|
|
4109
|
-
this.engineVersion = engine.version;
|
|
4110
|
-
this.engineProtocol = engine.protocol;
|
|
4111
|
-
this.engineContract = engine.contract;
|
|
4112
|
-
this.requiredProtocol = required.protocol;
|
|
4113
|
-
this.requiredContract = required.contract;
|
|
4114
|
-
this.behind = behind;
|
|
4115
|
-
}
|
|
4116
|
-
};
|
|
4117
|
-
function mismatchMessage(engine, required, behind) {
|
|
4118
|
-
const protocols = `Lace engine ${engine.version} speaks protocol ${engine.protocol}; this host speaks protocol ${required.protocol}`;
|
|
4119
|
-
switch (behind) {
|
|
4120
|
-
case "engine":
|
|
4121
|
-
return `${protocols}: update the Lace CLI`;
|
|
4122
|
-
case "host":
|
|
4123
|
-
return `${protocols}: update this host`;
|
|
4124
|
-
case void 0:
|
|
4125
|
-
return `this host and Lace engine ${engine.version} were built from different trees of protocol ${required.protocol}: rebuild both from one checkout, or install the Lace CLI release that matches this host`;
|
|
4126
|
-
}
|
|
4127
|
-
}
|
|
4128
|
-
function checkEngineIdentity(engine) {
|
|
4129
|
-
if (engine.protocol !== ENGINE_PROTOCOL_VERSION || engine.contract !== ENGINE_CONTRACT) {
|
|
4130
|
-
throw new EngineIdentityMismatchError(engine, {
|
|
4131
|
-
protocol: ENGINE_PROTOCOL_VERSION,
|
|
4132
|
-
contract: ENGINE_CONTRACT
|
|
4133
|
-
});
|
|
4134
|
-
}
|
|
4135
|
-
}
|
|
4136
|
-
|
|
4137
|
-
// src/render.ts
|
|
4138
|
-
var META_ARGUMENTS = ["count", "for_each"];
|
|
4139
|
-
|
|
4140
|
-
// src/projection/classify-child.ts
|
|
4141
|
-
function isGroupUse(bundle, use) {
|
|
4142
|
-
const target = bundle.modules[use.module];
|
|
4143
|
-
return target !== void 0 && isGroupModule(target);
|
|
4144
|
-
}
|
|
4145
|
-
function isGroupModule(mod) {
|
|
4146
|
-
return (mod.modules?.length ?? 0) > 0;
|
|
4147
|
-
}
|
|
4148
|
-
|
|
4149
|
-
// src/projection/derive-edges.ts
|
|
4150
|
-
function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
|
|
4151
|
-
if (binding.out?.module && binding.out.name) {
|
|
4152
|
-
edges.push({
|
|
4153
|
-
source_instance: binding.out.module,
|
|
4154
|
-
target_instance: targetId,
|
|
4155
|
-
from_output: binding.out.name,
|
|
4156
|
-
to_input: toInput
|
|
4157
|
-
});
|
|
4158
|
-
return;
|
|
4159
|
-
}
|
|
4160
|
-
for (const ref of binding.expr?.module_references ?? []) {
|
|
4161
|
-
if (!useIds.has(ref.call)) continue;
|
|
4162
|
-
const fromOutput = ref.output ?? "";
|
|
4163
|
-
const key = `${ref.call}:${targetId}:${fromOutput}:${toInput}`;
|
|
4164
|
-
if (seen.has(key)) continue;
|
|
4165
|
-
seen.add(key);
|
|
4166
|
-
edges.push({
|
|
4167
|
-
source_instance: ref.call,
|
|
4168
|
-
target_instance: targetId,
|
|
4169
|
-
from_output: fromOutput,
|
|
4170
|
-
to_input: toInput
|
|
4171
|
-
});
|
|
4172
|
-
}
|
|
4173
|
-
}
|
|
4174
|
-
function deriveEdges(uses) {
|
|
4175
|
-
const useIds = new Set(uses.map((u) => u.id));
|
|
4176
|
-
const edges = [];
|
|
4177
|
-
const seen = /* @__PURE__ */ new Set();
|
|
4178
|
-
for (const target of uses) {
|
|
4179
|
-
const inputs = target.inputs ?? {};
|
|
4180
|
-
for (const [inputName, binding] of Object.entries(inputs)) {
|
|
4181
|
-
emitEdgesFromBinding(binding, target.id, inputName, useIds, seen, edges);
|
|
4182
|
-
}
|
|
4183
|
-
for (const meta of META_ARGUMENTS) {
|
|
4184
|
-
const binding = target[meta];
|
|
4185
|
-
if (binding) emitEdgesFromBinding(binding, target.id, meta, useIds, seen, edges);
|
|
4186
|
-
}
|
|
4187
|
-
}
|
|
4188
|
-
return edges;
|
|
4189
|
-
}
|
|
4190
|
-
function addPin(index, call, pin) {
|
|
4191
|
-
if (!index.has(call)) index.set(call, /* @__PURE__ */ new Set());
|
|
4192
|
-
index.get(call).add(pin);
|
|
4193
|
-
}
|
|
4194
|
-
function indexWires(edges) {
|
|
4195
|
-
const inputs = /* @__PURE__ */ new Map();
|
|
4196
|
-
const outputs = /* @__PURE__ */ new Map();
|
|
4197
|
-
for (const e of edges) {
|
|
4198
|
-
addPin(inputs, e.target_instance, e.to_input);
|
|
4199
|
-
addPin(outputs, e.source_instance, e.from_output);
|
|
4200
|
-
}
|
|
4201
|
-
return { inputs, outputs };
|
|
4202
|
-
}
|
|
4203
|
-
function deriveInterfaceEdges(mod) {
|
|
4204
|
-
const uses = mod.modules ?? [];
|
|
4205
|
-
const useIds = new Set(uses.map((u) => u.id));
|
|
4206
|
-
const declaredIn = new Set((mod.interface?.inputs ?? []).map((i) => i.name));
|
|
4207
|
-
const declaredOut = new Set((mod.interface?.outputs ?? []).map((o) => o.name));
|
|
4208
|
-
const edges = [];
|
|
4209
|
-
const fromInput = (pin, target, toInput) => {
|
|
4210
|
-
if (!pin || !declaredIn.has(pin)) return;
|
|
4211
|
-
edges.push({
|
|
4212
|
-
source_instance: "",
|
|
4213
|
-
target_instance: target,
|
|
4214
|
-
from_output: pin,
|
|
4215
|
-
to_input: toInput,
|
|
4216
|
-
source_pin: true
|
|
4217
|
-
});
|
|
4218
|
-
};
|
|
4219
|
-
for (const use of uses) {
|
|
4220
|
-
for (const [name, binding] of Object.entries(use.inputs ?? {})) {
|
|
4221
|
-
fromInput(binding.var ?? "", use.id, name);
|
|
4222
|
-
}
|
|
4223
|
-
for (const meta of META_ARGUMENTS) fromInput(use[meta]?.var ?? "", use.id, meta);
|
|
4224
|
-
}
|
|
4225
|
-
const seen = /* @__PURE__ */ new Set();
|
|
4226
|
-
for (const [name, exported] of Object.entries(mod.exports?.outputs ?? {})) {
|
|
4227
|
-
if (!declaredOut.has(name)) continue;
|
|
4228
|
-
const read = [];
|
|
4229
|
-
emitEdgesFromBinding(exported, "", name, useIds, seen, read);
|
|
4230
|
-
for (const edge of read) {
|
|
4231
|
-
if (useIds.has(edge.source_instance)) edges.push({ ...edge, target_pin: true });
|
|
4232
|
-
}
|
|
4233
|
-
if (exported.var && declaredIn.has(exported.var)) {
|
|
4234
|
-
edges.push({
|
|
4235
|
-
source_instance: "",
|
|
4236
|
-
target_instance: "",
|
|
4237
|
-
from_output: exported.var,
|
|
4238
|
-
to_input: name,
|
|
4239
|
-
source_pin: true,
|
|
4240
|
-
target_pin: true
|
|
4241
|
-
});
|
|
3679
|
+
if (exported.var && declaredIn.has(exported.var)) {
|
|
3680
|
+
edges.push({
|
|
3681
|
+
source_instance: "",
|
|
3682
|
+
target_instance: "",
|
|
3683
|
+
from_output: exported.var,
|
|
3684
|
+
to_input: name,
|
|
3685
|
+
source_pin: true,
|
|
3686
|
+
target_pin: true
|
|
3687
|
+
});
|
|
4242
3688
|
}
|
|
4243
3689
|
}
|
|
4244
3690
|
return edges;
|
|
@@ -4299,12 +3745,6 @@ function instanceAddress(bundle, id) {
|
|
|
4299
3745
|
const resolved = resolveInstance(bundle, id);
|
|
4300
3746
|
return resolved ? { scope: resolved.scopeKey, id: resolved.child.id } : { scope: bundle.entry, id };
|
|
4301
3747
|
}
|
|
4302
|
-
function resolveScopePath(bundle, path) {
|
|
4303
|
-
if (path === "") {
|
|
4304
|
-
return bundle.modules[bundle.entry] ? bundle.entry : null;
|
|
4305
|
-
}
|
|
4306
|
-
return resolveInstance(bundle, path)?.child.use?.module ?? null;
|
|
4307
|
-
}
|
|
4308
3748
|
|
|
4309
3749
|
// src/projection/inspect.ts
|
|
4310
3750
|
function hclLiteralText(lit) {
|
|
@@ -4568,56 +4008,10 @@ function deriveSettingsConfig(bundle, moduleKey) {
|
|
|
4568
4008
|
};
|
|
4569
4009
|
}
|
|
4570
4010
|
|
|
4571
|
-
// src/projection/join-path.ts
|
|
4572
|
-
function joinPath(prefix, localId) {
|
|
4573
|
-
return prefix === "" ? localId : `${prefix}.${localId}`;
|
|
4574
|
-
}
|
|
4575
|
-
function splitPath(canvasPath) {
|
|
4576
|
-
const lastDot = canvasPath.lastIndexOf(".");
|
|
4577
|
-
if (lastDot === -1) return { parentPath: "", localId: canvasPath };
|
|
4578
|
-
return { parentPath: canvasPath.slice(0, lastDot), localId: canvasPath.slice(lastDot + 1) };
|
|
4579
|
-
}
|
|
4580
|
-
function callText(sourcePath) {
|
|
4581
|
-
return `module.${splitPath(sourcePath).localId}`;
|
|
4582
|
-
}
|
|
4583
|
-
function groupPinText(group, end, pin) {
|
|
4584
|
-
return `${group}.${end === "source" ? "inputs" : "outputs"}.${pin}`;
|
|
4585
|
-
}
|
|
4586
|
-
|
|
4587
4011
|
// src/projection/node-for-address.ts
|
|
4588
|
-
var INSTANCE_KEY = /\[[^\]]*\]$/;
|
|
4589
|
-
function tokenizeAddress(address) {
|
|
4590
|
-
const tokens = [];
|
|
4591
|
-
let current = "";
|
|
4592
|
-
let depth = 0;
|
|
4593
|
-
for (const ch of address) {
|
|
4594
|
-
if (ch === "[") depth++;
|
|
4595
|
-
else if (ch === "]") depth--;
|
|
4596
|
-
if (ch === "." && depth === 0) {
|
|
4597
|
-
tokens.push(current);
|
|
4598
|
-
current = "";
|
|
4599
|
-
} else {
|
|
4600
|
-
current += ch;
|
|
4601
|
-
}
|
|
4602
|
-
}
|
|
4603
|
-
tokens.push(current);
|
|
4604
|
-
return tokens;
|
|
4605
|
-
}
|
|
4606
4012
|
function nodeIdForAddress(view, address) {
|
|
4607
|
-
const
|
|
4608
|
-
|
|
4609
|
-
let i = 0;
|
|
4610
|
-
while (i + 1 < tokens.length && tokens[i] === "module") {
|
|
4611
|
-
moduleNames.push(tokens[i + 1].replace(INSTANCE_KEY, ""));
|
|
4612
|
-
i += 2;
|
|
4613
|
-
}
|
|
4614
|
-
if (moduleNames.length === 0) return null;
|
|
4615
|
-
const known = /* @__PURE__ */ new Set();
|
|
4616
|
-
for (const n of view.nodes) known.add(n.id);
|
|
4617
|
-
for (const g of view.groups) known.add(g.id);
|
|
4618
|
-
for (let k = moduleNames.length; k >= 1; k--) {
|
|
4619
|
-
let path = "";
|
|
4620
|
-
for (let j = 0; j < k; j++) path = joinPath(path, moduleNames[j]);
|
|
4013
|
+
const known = new Set([...view.nodes, ...view.groups].map((item) => item.id));
|
|
4014
|
+
for (let path = moduleCallPath(address); path !== ""; path = splitPath(path).parentPath) {
|
|
4621
4015
|
if (known.has(path)) return path;
|
|
4622
4016
|
}
|
|
4623
4017
|
return null;
|
|
@@ -4786,18 +4180,6 @@ function freeSlot(extent, occupied) {
|
|
|
4786
4180
|
occupied.map((r) => ({ x: r.x, y: r.y, ...slotOf(r) }))
|
|
4787
4181
|
);
|
|
4788
4182
|
}
|
|
4789
|
-
function resolveScopePositionsByDepth(ids, arrangementNodes, edges) {
|
|
4790
|
-
const stored = /* @__PURE__ */ new Map();
|
|
4791
|
-
for (const id of ids) {
|
|
4792
|
-
const at = arrangementNodes?.[id];
|
|
4793
|
-
if (at) stored.set(id, at);
|
|
4794
|
-
}
|
|
4795
|
-
return layoutByDepth(
|
|
4796
|
-
ids.map((id) => ({ id, size: ORDINARY })),
|
|
4797
|
-
stored,
|
|
4798
|
-
edges
|
|
4799
|
-
);
|
|
4800
|
-
}
|
|
4801
4183
|
function layoutByDepth(items, stored, edges) {
|
|
4802
4184
|
const byId = new Map(items.map((item) => [item.id, item]));
|
|
4803
4185
|
const ids = items.map((item) => item.id);
|
|
@@ -5149,15 +4531,11 @@ function projectCanvasView(bundle, arrangement, meta) {
|
|
|
5149
4531
|
groups
|
|
5150
4532
|
};
|
|
5151
4533
|
}
|
|
5152
|
-
|
|
5153
|
-
// src/proto-messages.ts
|
|
5154
|
-
var CanvasViewProto = CanvasView;
|
|
5155
4534
|
export {
|
|
5156
4535
|
BRIDGE_METHODS,
|
|
5157
4536
|
Bundle,
|
|
5158
4537
|
COLLAPSED_GROUP_WIDTH,
|
|
5159
4538
|
CONNECT_CODE_NAMES,
|
|
5160
|
-
CanvasViewProto,
|
|
5161
4539
|
EMPTY_BUNDLE,
|
|
5162
4540
|
ENGINE_CONTRACT,
|
|
5163
4541
|
ENGINE_METHODS,
|
|
@@ -5168,9 +4546,13 @@ export {
|
|
|
5168
4546
|
GROUP_PADDING,
|
|
5169
4547
|
HOST_ONLY_METHODS,
|
|
5170
4548
|
META_ARGUMENTS,
|
|
4549
|
+
Module,
|
|
5171
4550
|
NODE_HEADER_HEIGHT,
|
|
5172
4551
|
NODE_ROW_HEIGHT,
|
|
5173
4552
|
NODE_WIDTH,
|
|
4553
|
+
Reason,
|
|
4554
|
+
Resource,
|
|
4555
|
+
Use,
|
|
5174
4556
|
apiFields,
|
|
5175
4557
|
boxAt,
|
|
5176
4558
|
callText,
|
|
@@ -5197,6 +4579,7 @@ export {
|
|
|
5197
4579
|
keepOrder,
|
|
5198
4580
|
layoutByDepth,
|
|
5199
4581
|
localIn,
|
|
4582
|
+
moduleCallPath,
|
|
5200
4583
|
nodeIdForAddress,
|
|
5201
4584
|
nodeIdForDiagnostic,
|
|
5202
4585
|
nodeRows,
|
|
@@ -5205,9 +4588,10 @@ export {
|
|
|
5205
4588
|
parseModuleKey,
|
|
5206
4589
|
projectCanvasView,
|
|
5207
4590
|
reachRect,
|
|
4591
|
+
reasonFromJSON,
|
|
4592
|
+
reasonToJSON,
|
|
5208
4593
|
resolveInstance,
|
|
5209
|
-
|
|
5210
|
-
resolveScopePositionsByDepth,
|
|
4594
|
+
splitAddress,
|
|
5211
4595
|
splitPath,
|
|
5212
4596
|
stepDown,
|
|
5213
4597
|
visibleInputs
|