@lace-cloud/proto 0.21.1 → 0.23.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 +91 -202
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +283 -246
- package/dist/index.d.ts +283 -246
- package/dist/index.mjs +91 -202
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2852,7 +2852,7 @@ var ModuleReference = {
|
|
|
2852
2852
|
}
|
|
2853
2853
|
};
|
|
2854
2854
|
function createBaseTerraformBlock() {
|
|
2855
|
-
return { required_version: "", required_providers: {}
|
|
2855
|
+
return { required_version: "", required_providers: {} };
|
|
2856
2856
|
}
|
|
2857
2857
|
var TerraformBlock = {
|
|
2858
2858
|
encode(message, writer = new BinaryWriter2()) {
|
|
@@ -2862,9 +2862,6 @@ var TerraformBlock = {
|
|
|
2862
2862
|
globalThis.Object.entries(message.required_providers).forEach(([key, value]) => {
|
|
2863
2863
|
TerraformBlock_RequiredProvidersEntry.encode({ key, value }, writer.uint32(18).fork()).join();
|
|
2864
2864
|
});
|
|
2865
|
-
if (message.backend !== void 0) {
|
|
2866
|
-
BackendConfig.encode(message.backend, writer.uint32(26).fork()).join();
|
|
2867
|
-
}
|
|
2868
2865
|
return writer;
|
|
2869
2866
|
},
|
|
2870
2867
|
decode(input, length) {
|
|
@@ -2891,13 +2888,6 @@ var TerraformBlock = {
|
|
|
2891
2888
|
}
|
|
2892
2889
|
continue;
|
|
2893
2890
|
}
|
|
2894
|
-
case 3: {
|
|
2895
|
-
if (tag !== 26) {
|
|
2896
|
-
break;
|
|
2897
|
-
}
|
|
2898
|
-
message.backend = BackendConfig.decode(reader, reader.uint32());
|
|
2899
|
-
continue;
|
|
2900
|
-
}
|
|
2901
2891
|
}
|
|
2902
2892
|
if ((tag & 7) === 4 || tag === 0) {
|
|
2903
2893
|
break;
|
|
@@ -2921,8 +2911,7 @@ var TerraformBlock = {
|
|
|
2921
2911
|
return acc;
|
|
2922
2912
|
},
|
|
2923
2913
|
{}
|
|
2924
|
-
) : {}
|
|
2925
|
-
backend: isSet2(object.backend) ? BackendConfig.fromJSON(object.backend) : void 0
|
|
2914
|
+
) : {}
|
|
2926
2915
|
};
|
|
2927
2916
|
},
|
|
2928
2917
|
toJSON(message) {
|
|
@@ -2939,9 +2928,6 @@ var TerraformBlock = {
|
|
|
2939
2928
|
});
|
|
2940
2929
|
}
|
|
2941
2930
|
}
|
|
2942
|
-
if (message.backend !== void 0) {
|
|
2943
|
-
obj.backend = BackendConfig.toJSON(message.backend);
|
|
2944
|
-
}
|
|
2945
2931
|
return obj;
|
|
2946
2932
|
},
|
|
2947
2933
|
create(base) {
|
|
@@ -2959,7 +2945,6 @@ var TerraformBlock = {
|
|
|
2959
2945
|
},
|
|
2960
2946
|
{}
|
|
2961
2947
|
);
|
|
2962
|
-
message.backend = object.backend !== void 0 && object.backend !== null ? BackendConfig.fromPartial(object.backend) : void 0;
|
|
2963
2948
|
return message;
|
|
2964
2949
|
}
|
|
2965
2950
|
};
|
|
@@ -3114,167 +3099,6 @@ var ProviderRequirement = {
|
|
|
3114
3099
|
return message;
|
|
3115
3100
|
}
|
|
3116
3101
|
};
|
|
3117
|
-
function createBaseBackendConfig() {
|
|
3118
|
-
return { type: "", config: {} };
|
|
3119
|
-
}
|
|
3120
|
-
var BackendConfig = {
|
|
3121
|
-
encode(message, writer = new BinaryWriter2()) {
|
|
3122
|
-
if (message.type !== "") {
|
|
3123
|
-
writer.uint32(10).string(message.type);
|
|
3124
|
-
}
|
|
3125
|
-
globalThis.Object.entries(message.config).forEach(([key, value]) => {
|
|
3126
|
-
if (value !== void 0) {
|
|
3127
|
-
BackendConfig_ConfigEntry.encode({ key, value }, writer.uint32(18).fork()).join();
|
|
3128
|
-
}
|
|
3129
|
-
});
|
|
3130
|
-
return writer;
|
|
3131
|
-
},
|
|
3132
|
-
decode(input, length) {
|
|
3133
|
-
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
3134
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3135
|
-
const message = createBaseBackendConfig();
|
|
3136
|
-
while (reader.pos < end) {
|
|
3137
|
-
const tag = reader.uint32();
|
|
3138
|
-
switch (tag >>> 3) {
|
|
3139
|
-
case 1: {
|
|
3140
|
-
if (tag !== 10) {
|
|
3141
|
-
break;
|
|
3142
|
-
}
|
|
3143
|
-
message.type = reader.string();
|
|
3144
|
-
continue;
|
|
3145
|
-
}
|
|
3146
|
-
case 2: {
|
|
3147
|
-
if (tag !== 18) {
|
|
3148
|
-
break;
|
|
3149
|
-
}
|
|
3150
|
-
const entry2 = BackendConfig_ConfigEntry.decode(reader, reader.uint32());
|
|
3151
|
-
if (entry2.value !== void 0) {
|
|
3152
|
-
message.config[entry2.key] = entry2.value;
|
|
3153
|
-
}
|
|
3154
|
-
continue;
|
|
3155
|
-
}
|
|
3156
|
-
}
|
|
3157
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
3158
|
-
break;
|
|
3159
|
-
}
|
|
3160
|
-
reader.skip(tag & 7);
|
|
3161
|
-
}
|
|
3162
|
-
return message;
|
|
3163
|
-
},
|
|
3164
|
-
fromJSON(object) {
|
|
3165
|
-
return {
|
|
3166
|
-
type: isSet2(object.type) ? globalThis.String(object.type) : "",
|
|
3167
|
-
config: isObject2(object.config) ? globalThis.Object.entries(object.config).reduce(
|
|
3168
|
-
(acc, [key, value]) => {
|
|
3169
|
-
acc[key] = value;
|
|
3170
|
-
return acc;
|
|
3171
|
-
},
|
|
3172
|
-
{}
|
|
3173
|
-
) : {}
|
|
3174
|
-
};
|
|
3175
|
-
},
|
|
3176
|
-
toJSON(message) {
|
|
3177
|
-
const obj = {};
|
|
3178
|
-
if (message.type !== "") {
|
|
3179
|
-
obj.type = message.type;
|
|
3180
|
-
}
|
|
3181
|
-
if (message.config) {
|
|
3182
|
-
const entries = globalThis.Object.entries(message.config);
|
|
3183
|
-
if (entries.length > 0) {
|
|
3184
|
-
obj.config = {};
|
|
3185
|
-
entries.forEach(([k, v]) => {
|
|
3186
|
-
obj.config[k] = v;
|
|
3187
|
-
});
|
|
3188
|
-
}
|
|
3189
|
-
}
|
|
3190
|
-
return obj;
|
|
3191
|
-
},
|
|
3192
|
-
create(base) {
|
|
3193
|
-
return BackendConfig.fromPartial(base ?? {});
|
|
3194
|
-
},
|
|
3195
|
-
fromPartial(object) {
|
|
3196
|
-
const message = createBaseBackendConfig();
|
|
3197
|
-
message.type = object.type ?? "";
|
|
3198
|
-
message.config = globalThis.Object.entries(object.config ?? {}).reduce(
|
|
3199
|
-
(acc, [key, value]) => {
|
|
3200
|
-
if (value !== void 0) {
|
|
3201
|
-
acc[key] = value;
|
|
3202
|
-
}
|
|
3203
|
-
return acc;
|
|
3204
|
-
},
|
|
3205
|
-
{}
|
|
3206
|
-
);
|
|
3207
|
-
return message;
|
|
3208
|
-
}
|
|
3209
|
-
};
|
|
3210
|
-
function createBaseBackendConfig_ConfigEntry() {
|
|
3211
|
-
return { key: "", value: void 0 };
|
|
3212
|
-
}
|
|
3213
|
-
var BackendConfig_ConfigEntry = {
|
|
3214
|
-
encode(message, writer = new BinaryWriter2()) {
|
|
3215
|
-
if (message.key !== "") {
|
|
3216
|
-
writer.uint32(10).string(message.key);
|
|
3217
|
-
}
|
|
3218
|
-
if (message.value !== void 0) {
|
|
3219
|
-
Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).join();
|
|
3220
|
-
}
|
|
3221
|
-
return writer;
|
|
3222
|
-
},
|
|
3223
|
-
decode(input, length) {
|
|
3224
|
-
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
3225
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3226
|
-
const message = createBaseBackendConfig_ConfigEntry();
|
|
3227
|
-
while (reader.pos < end) {
|
|
3228
|
-
const tag = reader.uint32();
|
|
3229
|
-
switch (tag >>> 3) {
|
|
3230
|
-
case 1: {
|
|
3231
|
-
if (tag !== 10) {
|
|
3232
|
-
break;
|
|
3233
|
-
}
|
|
3234
|
-
message.key = reader.string();
|
|
3235
|
-
continue;
|
|
3236
|
-
}
|
|
3237
|
-
case 2: {
|
|
3238
|
-
if (tag !== 18) {
|
|
3239
|
-
break;
|
|
3240
|
-
}
|
|
3241
|
-
message.value = Value.unwrap(Value.decode(reader, reader.uint32()));
|
|
3242
|
-
continue;
|
|
3243
|
-
}
|
|
3244
|
-
}
|
|
3245
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
3246
|
-
break;
|
|
3247
|
-
}
|
|
3248
|
-
reader.skip(tag & 7);
|
|
3249
|
-
}
|
|
3250
|
-
return message;
|
|
3251
|
-
},
|
|
3252
|
-
fromJSON(object) {
|
|
3253
|
-
return {
|
|
3254
|
-
key: isSet2(object.key) ? globalThis.String(object.key) : "",
|
|
3255
|
-
value: isSet2(object?.value) ? object.value : void 0
|
|
3256
|
-
};
|
|
3257
|
-
},
|
|
3258
|
-
toJSON(message) {
|
|
3259
|
-
const obj = {};
|
|
3260
|
-
if (message.key !== "") {
|
|
3261
|
-
obj.key = message.key;
|
|
3262
|
-
}
|
|
3263
|
-
if (message.value !== void 0) {
|
|
3264
|
-
obj.value = message.value;
|
|
3265
|
-
}
|
|
3266
|
-
return obj;
|
|
3267
|
-
},
|
|
3268
|
-
create(base) {
|
|
3269
|
-
return BackendConfig_ConfigEntry.fromPartial(base ?? {});
|
|
3270
|
-
},
|
|
3271
|
-
fromPartial(object) {
|
|
3272
|
-
const message = createBaseBackendConfig_ConfigEntry();
|
|
3273
|
-
message.key = object.key ?? "";
|
|
3274
|
-
message.value = object.value ?? void 0;
|
|
3275
|
-
return message;
|
|
3276
|
-
}
|
|
3277
|
-
};
|
|
3278
3102
|
function createBaseProviderConfig() {
|
|
3279
3103
|
return { name: "", alias: "", config: {}, blocks: [] };
|
|
3280
3104
|
}
|
|
@@ -3629,6 +3453,16 @@ function bindingText(b) {
|
|
|
3629
3453
|
if (b.expr) return b.expr.value;
|
|
3630
3454
|
return "";
|
|
3631
3455
|
}
|
|
3456
|
+
function exportText(e) {
|
|
3457
|
+
if (!e) return "";
|
|
3458
|
+
if (e.out) return `${childReference(e.out.module)}.${e.out.name}`;
|
|
3459
|
+
return bindingText({ lit: e.lit, var: e.var, out: void 0, expr: e.expr });
|
|
3460
|
+
}
|
|
3461
|
+
function childReference(id) {
|
|
3462
|
+
if (id.startsWith("resource.")) return id.slice("resource.".length);
|
|
3463
|
+
if (id.startsWith("data.")) return id;
|
|
3464
|
+
return `module.${id}`;
|
|
3465
|
+
}
|
|
3632
3466
|
function bindingMode(b) {
|
|
3633
3467
|
if (!b) return { mode: "empty" };
|
|
3634
3468
|
if (b.out) return { mode: "wired", wired_source: bindingText(b) };
|
|
@@ -3637,9 +3471,6 @@ function bindingMode(b) {
|
|
|
3637
3471
|
if (b.lit !== void 0 && b.lit !== null) return { mode: "literal", value: b.lit };
|
|
3638
3472
|
return { mode: "empty" };
|
|
3639
3473
|
}
|
|
3640
|
-
function describeBinding(b) {
|
|
3641
|
-
return { mode: bindingMode(b).mode, display: bindingText(b) };
|
|
3642
|
-
}
|
|
3643
3474
|
function deriveNodeConfig(bundle, instanceId) {
|
|
3644
3475
|
const resolved = resolveInstance(bundle, instanceId);
|
|
3645
3476
|
if (!resolved) return null;
|
|
@@ -3670,25 +3501,64 @@ function deriveNodeConfig(bundle, instanceId) {
|
|
|
3670
3501
|
].filter((id) => id !== child.id);
|
|
3671
3502
|
const dependsOn = child.use?.depends_on ?? child.resource?.depends_on ?? [];
|
|
3672
3503
|
const providers = child.use?.providers ?? {};
|
|
3504
|
+
const meta = child.use ?? child.resource;
|
|
3673
3505
|
const availableVariables = (scope.interface?.inputs ?? []).map((v) => ({
|
|
3674
3506
|
name: v.name,
|
|
3675
3507
|
type: v.type
|
|
3676
3508
|
}));
|
|
3677
3509
|
return {
|
|
3678
3510
|
instance_id: instanceId,
|
|
3511
|
+
module_key: child.use?.module,
|
|
3679
3512
|
inputs,
|
|
3680
3513
|
outputs,
|
|
3681
3514
|
sibling_ids: siblingIds,
|
|
3682
3515
|
depends_on: dependsOn,
|
|
3683
3516
|
providers,
|
|
3517
|
+
count: bindingText(meta?.count),
|
|
3518
|
+
for_each: bindingText(meta?.for_each),
|
|
3684
3519
|
available_variables: availableVariables
|
|
3685
3520
|
};
|
|
3686
3521
|
}
|
|
3687
|
-
function
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3522
|
+
function sourceText(source) {
|
|
3523
|
+
if (source.kind === "git") {
|
|
3524
|
+
const subdir = source.subdir ? `//${source.subdir}` : "";
|
|
3525
|
+
const ref = source.ref ? `?ref=${source.ref}` : "";
|
|
3526
|
+
return `git::${source.repo}${subdir}${ref}`;
|
|
3527
|
+
}
|
|
3528
|
+
return source.kind === "local" ? source.subdir : source.ref;
|
|
3529
|
+
}
|
|
3530
|
+
function defaultText(value) {
|
|
3531
|
+
return value === void 0 || value === null ? "null" : hclLiteralText(value);
|
|
3532
|
+
}
|
|
3533
|
+
function blockConfigs(blocks) {
|
|
3534
|
+
return (blocks ?? []).map((b) => ({
|
|
3535
|
+
type: b.type,
|
|
3536
|
+
labels: [...b.labels],
|
|
3537
|
+
attributes: b.attributes.map((a) => ({ name: a.name, value: bindingText(a.value) })),
|
|
3538
|
+
blocks: blockConfigs(b.blocks)
|
|
3539
|
+
}));
|
|
3540
|
+
}
|
|
3541
|
+
function resourceConfig(r) {
|
|
3542
|
+
const kind = r.kind === "data" ? "data" : "resource";
|
|
3543
|
+
return {
|
|
3544
|
+
id: r.id,
|
|
3545
|
+
kind,
|
|
3546
|
+
type: r.type,
|
|
3547
|
+
name: r.id.slice(`${kind}.${r.type}.`.length),
|
|
3548
|
+
arguments: Object.keys(r.inputs ?? {}).sort().map((name) => ({ name, value: bindingText(r.inputs[name]) })),
|
|
3549
|
+
blocks: blockConfigs(r.blocks),
|
|
3550
|
+
count: bindingText(r.count),
|
|
3551
|
+
for_each: bindingText(r.for_each),
|
|
3552
|
+
provider: r.provider_ref,
|
|
3553
|
+
depends_on: [...r.depends_on ?? []]
|
|
3554
|
+
};
|
|
3555
|
+
}
|
|
3556
|
+
function deriveSettingsConfig(bundle, moduleKey) {
|
|
3557
|
+
const mod = bundle.modules[moduleKey];
|
|
3558
|
+
if (!mod) return null;
|
|
3559
|
+
const terraform = mod.terraform ? {
|
|
3560
|
+
required_version: mod.terraform.required_version,
|
|
3561
|
+
required_providers: Object.entries(mod.terraform.required_providers ?? {}).map(
|
|
3692
3562
|
([name, req]) => ({
|
|
3693
3563
|
name,
|
|
3694
3564
|
source: req.source,
|
|
@@ -3697,18 +3567,15 @@ function deriveSettingsConfig(bundle) {
|
|
|
3697
3567
|
})
|
|
3698
3568
|
)
|
|
3699
3569
|
} : { required_version: "", required_providers: [] };
|
|
3700
|
-
const providers = (
|
|
3570
|
+
const providers = (mod.providers ?? []).map((p) => {
|
|
3701
3571
|
const config = {};
|
|
3702
3572
|
for (const [k, v] of Object.entries(p.config ?? {})) {
|
|
3703
|
-
config[k] =
|
|
3573
|
+
config[k] = bindingText(v);
|
|
3704
3574
|
}
|
|
3705
|
-
return { name: p.name, alias: p.alias, config, blocks: p.blocks };
|
|
3706
|
-
});
|
|
3707
|
-
const locals = (entry?.locals ?? []).map((l) => {
|
|
3708
|
-
const { mode, display } = describeBinding(l.value);
|
|
3709
|
-
return { name: l.name, mode, value_display: display };
|
|
3575
|
+
return { name: p.name, alias: p.alias, config, blocks: blockConfigs(p.blocks) };
|
|
3710
3576
|
});
|
|
3711
|
-
const
|
|
3577
|
+
const locals = (mod.locals ?? []).map((l) => ({ name: l.name, value: bindingText(l.value) }));
|
|
3578
|
+
const variables = (mod.interface?.inputs ?? []).map((v) => ({
|
|
3712
3579
|
name: v.name,
|
|
3713
3580
|
type: v.type,
|
|
3714
3581
|
required: v.required,
|
|
@@ -3720,20 +3587,42 @@ function deriveSettingsConfig(bundle) {
|
|
|
3720
3587
|
})),
|
|
3721
3588
|
ephemeral: v.ephemeral,
|
|
3722
3589
|
sensitive: v.sensitive || void 0,
|
|
3723
|
-
nullable: v.nullable
|
|
3590
|
+
nullable: v.nullable,
|
|
3591
|
+
default: v.required ? "" : defaultText(v.default_value)
|
|
3724
3592
|
}));
|
|
3725
|
-
const
|
|
3593
|
+
const outputs = (mod.interface?.outputs ?? []).map((o) => ({
|
|
3726
3594
|
name: o.name,
|
|
3727
3595
|
type: o.type,
|
|
3596
|
+
value: exportText(mod.exports?.outputs?.[o.name]),
|
|
3728
3597
|
description: o.description || void 0,
|
|
3729
3598
|
sensitive: o.sensitive || void 0,
|
|
3730
3599
|
depends_on: o.depends_on
|
|
3731
3600
|
}));
|
|
3732
|
-
const
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3601
|
+
const read = indexWires(deriveEdges(mod.modules ?? [])).outputs;
|
|
3602
|
+
const callOutputs = (mod.modules ?? []).flatMap(
|
|
3603
|
+
(use) => resolveSchema(bundle, use, read.get(use.id) ?? []).outputs.map(
|
|
3604
|
+
(o) => `module.${use.id}.${o.name}`
|
|
3605
|
+
)
|
|
3606
|
+
);
|
|
3607
|
+
const resources = (mod.resources ?? []).map(resourceConfig);
|
|
3608
|
+
const leaf = !mod.source && moduleKey !== bundle.entry && (mod.modules ?? []).length === 0;
|
|
3609
|
+
return {
|
|
3610
|
+
module_key: moduleKey,
|
|
3611
|
+
reference: mod.source ? { source: sourceText(mod.source), version: mod.version } : void 0,
|
|
3612
|
+
terraform,
|
|
3613
|
+
providers,
|
|
3614
|
+
locals,
|
|
3615
|
+
variables,
|
|
3616
|
+
outputs,
|
|
3617
|
+
resources,
|
|
3618
|
+
holds_managed_resources: resources.some((r) => r.kind === "resource") || leaf,
|
|
3619
|
+
directives: blockConfigs(mod.top_level_blocks),
|
|
3620
|
+
call_outputs: callOutputs,
|
|
3621
|
+
dependency_options: [
|
|
3622
|
+
...(mod.modules ?? []).map((u) => childReference(u.id)),
|
|
3623
|
+
...(mod.resources ?? []).map((r) => childReference(r.id))
|
|
3624
|
+
]
|
|
3625
|
+
};
|
|
3737
3626
|
}
|
|
3738
3627
|
|
|
3739
3628
|
// src/projection/join-path.ts
|
|
@@ -5104,7 +4993,7 @@ function isSet3(value) {
|
|
|
5104
4993
|
var CanvasViewProto = CanvasView;
|
|
5105
4994
|
|
|
5106
4995
|
// src/protocol-version.ts
|
|
5107
|
-
var ENGINE_PROTOCOL_VERSION = String(
|
|
4996
|
+
var ENGINE_PROTOCOL_VERSION = String(5 /* PROTOCOL_VERSION_CURRENT */);
|
|
5108
4997
|
var EngineProtocolMismatchError = class extends Error {
|
|
5109
4998
|
constructor(engineVersion, engineProtocol, requiredProtocol) {
|
|
5110
4999
|
super(
|