@boundaryml/baml-bridge 0.16.0 → 0.17.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.
@@ -60,6 +60,7 @@ export const baml_bridge = $root.baml_bridge = (() => {
60
60
  * @property {Uint8Array|null} [uint8arrayValue] InboundValue uint8arrayValue
61
61
  * @property {string|null} [bigintValue] InboundValue bigintValue
62
62
  * @property {baml_bridge.cffi.v1.IBamlTy|null} [tyValue] InboundValue tyValue
63
+ * @property {baml_bridge.cffi.v1.IBamlTyDef|null} [tyDefValue] InboundValue tyDefValue
63
64
  */
64
65
 
65
66
  /**
@@ -181,17 +182,25 @@ export const baml_bridge = $root.baml_bridge = (() => {
181
182
  */
182
183
  InboundValue.prototype.tyValue = null;
183
184
 
185
+ /**
186
+ * InboundValue tyDefValue.
187
+ * @member {baml_bridge.cffi.v1.IBamlTyDef|null|undefined} tyDefValue
188
+ * @memberof baml_bridge.cffi.v1.InboundValue
189
+ * @instance
190
+ */
191
+ InboundValue.prototype.tyDefValue = null;
192
+
184
193
  // OneOf field names bound to virtual getters and setters
185
194
  let $oneOfFields;
186
195
 
187
196
  /**
188
197
  * InboundValue value.
189
- * @member {"stringValue"|"intValue"|"floatValue"|"boolValue"|"listValue"|"mapValue"|"classValue"|"enumValue"|"handle"|"uint8arrayValue"|"bigintValue"|"tyValue"|undefined} value
198
+ * @member {"stringValue"|"intValue"|"floatValue"|"boolValue"|"listValue"|"mapValue"|"classValue"|"enumValue"|"handle"|"uint8arrayValue"|"bigintValue"|"tyValue"|"tyDefValue"|undefined} value
190
199
  * @memberof baml_bridge.cffi.v1.InboundValue
191
200
  * @instance
192
201
  */
193
202
  Object.defineProperty(InboundValue.prototype, "value", {
194
- get: $util.oneOfGetter($oneOfFields = ["stringValue", "intValue", "floatValue", "boolValue", "listValue", "mapValue", "classValue", "enumValue", "handle", "uint8arrayValue", "bigintValue", "tyValue"]),
203
+ get: $util.oneOfGetter($oneOfFields = ["stringValue", "intValue", "floatValue", "boolValue", "listValue", "mapValue", "classValue", "enumValue", "handle", "uint8arrayValue", "bigintValue", "tyValue", "tyDefValue"]),
195
204
  set: $util.oneOfSetter($oneOfFields)
196
205
  });
197
206
 
@@ -249,6 +258,8 @@ export const baml_bridge = $root.baml_bridge = (() => {
249
258
  writer.uint32(/* id 12, wireType 2 =*/98).string(message.bigintValue);
250
259
  if (message.tyValue != null && Object.hasOwnProperty.call(message, "tyValue"))
251
260
  $root.baml_bridge.cffi.v1.BamlTy.encode(message.tyValue, writer.uint32(/* id 13, wireType 2 =*/106).fork(), q + 1).ldelim();
261
+ if (message.tyDefValue != null && Object.hasOwnProperty.call(message, "tyDefValue"))
262
+ $root.baml_bridge.cffi.v1.BamlTyDef.encode(message.tyDefValue, writer.uint32(/* id 14, wireType 2 =*/114).fork(), q + 1).ldelim();
252
263
  return writer;
253
264
  };
254
265
 
@@ -341,6 +352,10 @@ export const baml_bridge = $root.baml_bridge = (() => {
341
352
  message.tyValue = $root.baml_bridge.cffi.v1.BamlTy.decode(reader, reader.uint32(), undefined, long + 1);
342
353
  break;
343
354
  }
355
+ case 14: {
356
+ message.tyDefValue = $root.baml_bridge.cffi.v1.BamlTyDef.decode(reader, reader.uint32(), undefined, long + 1);
357
+ break;
358
+ }
344
359
  default:
345
360
  reader.skipType(tag & 7, long);
346
361
  break;
@@ -486,6 +501,16 @@ export const baml_bridge = $root.baml_bridge = (() => {
486
501
  return "tyValue." + error;
487
502
  }
488
503
  }
504
+ if (message.tyDefValue != null && message.hasOwnProperty("tyDefValue")) {
505
+ if (properties.value === 1)
506
+ return "value: multiple values";
507
+ properties.value = 1;
508
+ {
509
+ let error = $root.baml_bridge.cffi.v1.BamlTyDef.verify(message.tyDefValue, long + 1);
510
+ if (error)
511
+ return "tyDefValue." + error;
512
+ }
513
+ }
489
514
  return null;
490
515
  };
491
516
 
@@ -564,6 +589,11 @@ export const baml_bridge = $root.baml_bridge = (() => {
564
589
  throw TypeError(".baml_bridge.cffi.v1.InboundValue.tyValue: object expected");
565
590
  message.tyValue = $root.baml_bridge.cffi.v1.BamlTy.fromObject(object.tyValue, long + 1);
566
591
  }
592
+ if (object.tyDefValue != null) {
593
+ if (!$util.isObject(object.tyDefValue))
594
+ throw TypeError(".baml_bridge.cffi.v1.InboundValue.tyDefValue: object expected");
595
+ message.tyDefValue = $root.baml_bridge.cffi.v1.BamlTyDef.fromObject(object.tyDefValue, long + 1);
596
+ }
567
597
  return message;
568
598
  };
569
599
 
@@ -653,6 +683,11 @@ export const baml_bridge = $root.baml_bridge = (() => {
653
683
  if (options.oneofs)
654
684
  object.value = "tyValue";
655
685
  }
686
+ if (message.tyDefValue != null && message.hasOwnProperty("tyDefValue")) {
687
+ object.tyDefValue = $root.baml_bridge.cffi.v1.BamlTyDef.toObject(message.tyDefValue, options, q + 1);
688
+ if (options.oneofs)
689
+ object.value = "tyDefValue";
690
+ }
656
691
  return object;
657
692
  };
658
693
 
@@ -2067,6 +2102,7 @@ export const baml_bridge = $root.baml_bridge = (() => {
2067
2102
  * @interface IBamlTyArg
2068
2103
  * @property {string|null} [typeVar] BamlTyArg typeVar
2069
2104
  * @property {baml_bridge.cffi.v1.IBamlTy|null} [typeValue] BamlTyArg typeValue
2105
+ * @property {baml_bridge.cffi.v1.IBamlTyDef|null} [typeDefinition] BamlTyArg typeDefinition
2070
2106
  */
2071
2107
 
2072
2108
  /**
@@ -2100,6 +2136,14 @@ export const baml_bridge = $root.baml_bridge = (() => {
2100
2136
  */
2101
2137
  BamlTyArg.prototype.typeValue = null;
2102
2138
 
2139
+ /**
2140
+ * BamlTyArg typeDefinition.
2141
+ * @member {baml_bridge.cffi.v1.IBamlTyDef|null|undefined} typeDefinition
2142
+ * @memberof baml_bridge.cffi.v1.BamlTyArg
2143
+ * @instance
2144
+ */
2145
+ BamlTyArg.prototype.typeDefinition = null;
2146
+
2103
2147
  /**
2104
2148
  * Creates a new BamlTyArg instance using the specified properties.
2105
2149
  * @function create
@@ -2132,6 +2176,8 @@ export const baml_bridge = $root.baml_bridge = (() => {
2132
2176
  writer.uint32(/* id 1, wireType 2 =*/10).string(message.typeVar);
2133
2177
  if (message.typeValue != null && Object.hasOwnProperty.call(message, "typeValue"))
2134
2178
  $root.baml_bridge.cffi.v1.BamlTy.encode(message.typeValue, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim();
2179
+ if (message.typeDefinition != null && Object.hasOwnProperty.call(message, "typeDefinition"))
2180
+ $root.baml_bridge.cffi.v1.BamlTyDef.encode(message.typeDefinition, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim();
2135
2181
  return writer;
2136
2182
  };
2137
2183
 
@@ -2180,6 +2226,10 @@ export const baml_bridge = $root.baml_bridge = (() => {
2180
2226
  message.typeValue = $root.baml_bridge.cffi.v1.BamlTy.decode(reader, reader.uint32(), undefined, long + 1);
2181
2227
  break;
2182
2228
  }
2229
+ case 3: {
2230
+ message.typeDefinition = $root.baml_bridge.cffi.v1.BamlTyDef.decode(reader, reader.uint32(), undefined, long + 1);
2231
+ break;
2232
+ }
2183
2233
  default:
2184
2234
  reader.skipType(tag & 7, long);
2185
2235
  break;
@@ -2227,6 +2277,11 @@ export const baml_bridge = $root.baml_bridge = (() => {
2227
2277
  if (error)
2228
2278
  return "typeValue." + error;
2229
2279
  }
2280
+ if (message.typeDefinition != null && message.hasOwnProperty("typeDefinition")) {
2281
+ let error = $root.baml_bridge.cffi.v1.BamlTyDef.verify(message.typeDefinition, long + 1);
2282
+ if (error)
2283
+ return "typeDefinition." + error;
2284
+ }
2230
2285
  return null;
2231
2286
  };
2232
2287
 
@@ -2255,6 +2310,11 @@ export const baml_bridge = $root.baml_bridge = (() => {
2255
2310
  throw TypeError(".baml_bridge.cffi.v1.BamlTyArg.typeValue: object expected");
2256
2311
  message.typeValue = $root.baml_bridge.cffi.v1.BamlTy.fromObject(object.typeValue, long + 1);
2257
2312
  }
2313
+ if (object.typeDefinition != null) {
2314
+ if (!$util.isObject(object.typeDefinition))
2315
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyArg.typeDefinition: object expected");
2316
+ message.typeDefinition = $root.baml_bridge.cffi.v1.BamlTyDef.fromObject(object.typeDefinition, long + 1);
2317
+ }
2258
2318
  return message;
2259
2319
  };
2260
2320
 
@@ -2278,11 +2338,14 @@ export const baml_bridge = $root.baml_bridge = (() => {
2278
2338
  if (options.defaults) {
2279
2339
  object.typeVar = "";
2280
2340
  object.typeValue = null;
2341
+ object.typeDefinition = null;
2281
2342
  }
2282
2343
  if (message.typeVar != null && message.hasOwnProperty("typeVar"))
2283
2344
  object.typeVar = message.typeVar;
2284
2345
  if (message.typeValue != null && message.hasOwnProperty("typeValue"))
2285
2346
  object.typeValue = $root.baml_bridge.cffi.v1.BamlTy.toObject(message.typeValue, options, q + 1);
2347
+ if (message.typeDefinition != null && message.hasOwnProperty("typeDefinition"))
2348
+ object.typeDefinition = $root.baml_bridge.cffi.v1.BamlTyDef.toObject(message.typeDefinition, options, q + 1);
2286
2349
  return object;
2287
2350
  };
2288
2351
 
@@ -4211,29 +4274,2695 @@ export const baml_bridge = $root.baml_bridge = (() => {
4211
4274
  throw TypeError(".baml_bridge.cffi.v1.BamlTy.typeVar: object expected");
4212
4275
  message.typeVar = $root.baml_bridge.cffi.v1.BamlTyTypeVar.fromObject(object.typeVar, long + 1);
4213
4276
  }
4214
- if (object.associatedTypeProjection != null) {
4215
- if (!$util.isObject(object.associatedTypeProjection))
4216
- throw TypeError(".baml_bridge.cffi.v1.BamlTy.associatedTypeProjection: object expected");
4217
- message.associatedTypeProjection = $root.baml_bridge.cffi.v1.BamlTyAssociatedTypeProjection.fromObject(object.associatedTypeProjection, long + 1);
4277
+ if (object.associatedTypeProjection != null) {
4278
+ if (!$util.isObject(object.associatedTypeProjection))
4279
+ throw TypeError(".baml_bridge.cffi.v1.BamlTy.associatedTypeProjection: object expected");
4280
+ message.associatedTypeProjection = $root.baml_bridge.cffi.v1.BamlTyAssociatedTypeProjection.fromObject(object.associatedTypeProjection, long + 1);
4281
+ }
4282
+ if (object.never != null) {
4283
+ if (!$util.isObject(object.never))
4284
+ throw TypeError(".baml_bridge.cffi.v1.BamlTy.never: object expected");
4285
+ message.never = $root.baml_bridge.cffi.v1.BamlTyNever.fromObject(object.never, long + 1);
4286
+ }
4287
+ return message;
4288
+ };
4289
+
4290
+ /**
4291
+ * Creates a plain object from a BamlTy message. Also converts values to other types if specified.
4292
+ * @function toObject
4293
+ * @memberof baml_bridge.cffi.v1.BamlTy
4294
+ * @static
4295
+ * @param {baml_bridge.cffi.v1.BamlTy} message BamlTy
4296
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
4297
+ * @returns {Object.<string,*>} Plain object
4298
+ */
4299
+ BamlTy.toObject = function toObject(message, options, q) {
4300
+ if (!options)
4301
+ options = {};
4302
+ if (q === undefined)
4303
+ q = 0;
4304
+ if (q > $util.recursionLimit)
4305
+ throw Error("max depth exceeded");
4306
+ let object = {};
4307
+ if (message.primitive != null && message.hasOwnProperty("primitive")) {
4308
+ object.primitive = $root.baml_bridge.cffi.v1.BamlTyPrimitive.toObject(message.primitive, options, q + 1);
4309
+ if (options.oneofs)
4310
+ object.ty = "primitive";
4311
+ }
4312
+ if (message.classTy != null && message.hasOwnProperty("classTy")) {
4313
+ object.classTy = $root.baml_bridge.cffi.v1.BamlTyClass.toObject(message.classTy, options, q + 1);
4314
+ if (options.oneofs)
4315
+ object.ty = "classTy";
4316
+ }
4317
+ if (message["enum"] != null && message.hasOwnProperty("enum")) {
4318
+ object["enum"] = $root.baml_bridge.cffi.v1.BamlTyEnum.toObject(message["enum"], options, q + 1);
4319
+ if (options.oneofs)
4320
+ object.ty = "enum";
4321
+ }
4322
+ if (message.list != null && message.hasOwnProperty("list")) {
4323
+ object.list = $root.baml_bridge.cffi.v1.BamlTyList.toObject(message.list, options, q + 1);
4324
+ if (options.oneofs)
4325
+ object.ty = "list";
4326
+ }
4327
+ if (message.map != null && message.hasOwnProperty("map")) {
4328
+ object.map = $root.baml_bridge.cffi.v1.BamlTyMap.toObject(message.map, options, q + 1);
4329
+ if (options.oneofs)
4330
+ object.ty = "map";
4331
+ }
4332
+ if (message.optional != null && message.hasOwnProperty("optional")) {
4333
+ object.optional = $root.baml_bridge.cffi.v1.BamlTyOptional.toObject(message.optional, options, q + 1);
4334
+ if (options.oneofs)
4335
+ object.ty = "optional";
4336
+ }
4337
+ if (message.union != null && message.hasOwnProperty("union")) {
4338
+ object.union = $root.baml_bridge.cffi.v1.BamlTyUnion.toObject(message.union, options, q + 1);
4339
+ if (options.oneofs)
4340
+ object.ty = "union";
4341
+ }
4342
+ if (message.literal != null && message.hasOwnProperty("literal")) {
4343
+ object.literal = $root.baml_bridge.cffi.v1.BamlTyLiteral.toObject(message.literal, options, q + 1);
4344
+ if (options.oneofs)
4345
+ object.ty = "literal";
4346
+ }
4347
+ if (message.typeAlias != null && message.hasOwnProperty("typeAlias")) {
4348
+ object.typeAlias = $root.baml_bridge.cffi.v1.BamlTyTypeAlias.toObject(message.typeAlias, options, q + 1);
4349
+ if (options.oneofs)
4350
+ object.ty = "typeAlias";
4351
+ }
4352
+ if (message.unknown != null && message.hasOwnProperty("unknown")) {
4353
+ object.unknown = $root.baml_bridge.cffi.v1.BamlTyUnknown.toObject(message.unknown, options, q + 1);
4354
+ if (options.oneofs)
4355
+ object.ty = "unknown";
4356
+ }
4357
+ if (message.media != null && message.hasOwnProperty("media")) {
4358
+ object.media = $root.baml_bridge.cffi.v1.BamlTyMedia.toObject(message.media, options, q + 1);
4359
+ if (options.oneofs)
4360
+ object.ty = "media";
4361
+ }
4362
+ if (message["interface"] != null && message.hasOwnProperty("interface")) {
4363
+ object["interface"] = $root.baml_bridge.cffi.v1.BamlTyInterface.toObject(message["interface"], options, q + 1);
4364
+ if (options.oneofs)
4365
+ object.ty = "interface";
4366
+ }
4367
+ if (message.enumVariant != null && message.hasOwnProperty("enumVariant")) {
4368
+ object.enumVariant = $root.baml_bridge.cffi.v1.BamlTyEnumVariant.toObject(message.enumVariant, options, q + 1);
4369
+ if (options.oneofs)
4370
+ object.ty = "enumVariant";
4371
+ }
4372
+ if (message["function"] != null && message.hasOwnProperty("function")) {
4373
+ object["function"] = $root.baml_bridge.cffi.v1.BamlTyFunction.toObject(message["function"], options, q + 1);
4374
+ if (options.oneofs)
4375
+ object.ty = "function";
4376
+ }
4377
+ if (message.future != null && message.hasOwnProperty("future")) {
4378
+ object.future = $root.baml_bridge.cffi.v1.BamlTyFuture.toObject(message.future, options, q + 1);
4379
+ if (options.oneofs)
4380
+ object.ty = "future";
4381
+ }
4382
+ if (message.rustType != null && message.hasOwnProperty("rustType")) {
4383
+ object.rustType = $root.baml_bridge.cffi.v1.BamlTyRustType.toObject(message.rustType, options, q + 1);
4384
+ if (options.oneofs)
4385
+ object.ty = "rustType";
4386
+ }
4387
+ if (message.metaType != null && message.hasOwnProperty("metaType")) {
4388
+ object.metaType = $root.baml_bridge.cffi.v1.BamlTyMetaType.toObject(message.metaType, options, q + 1);
4389
+ if (options.oneofs)
4390
+ object.ty = "metaType";
4391
+ }
4392
+ if (message.resource != null && message.hasOwnProperty("resource")) {
4393
+ object.resource = $root.baml_bridge.cffi.v1.BamlTyResource.toObject(message.resource, options, q + 1);
4394
+ if (options.oneofs)
4395
+ object.ty = "resource";
4396
+ }
4397
+ if (message.promptAst != null && message.hasOwnProperty("promptAst")) {
4398
+ object.promptAst = $root.baml_bridge.cffi.v1.BamlTyPromptAst.toObject(message.promptAst, options, q + 1);
4399
+ if (options.oneofs)
4400
+ object.ty = "promptAst";
4401
+ }
4402
+ if (message["void"] != null && message.hasOwnProperty("void")) {
4403
+ object["void"] = $root.baml_bridge.cffi.v1.BamlTyVoid.toObject(message["void"], options, q + 1);
4404
+ if (options.oneofs)
4405
+ object.ty = "void";
4406
+ }
4407
+ if (message.typeVar != null && message.hasOwnProperty("typeVar")) {
4408
+ object.typeVar = $root.baml_bridge.cffi.v1.BamlTyTypeVar.toObject(message.typeVar, options, q + 1);
4409
+ if (options.oneofs)
4410
+ object.ty = "typeVar";
4411
+ }
4412
+ if (message.associatedTypeProjection != null && message.hasOwnProperty("associatedTypeProjection")) {
4413
+ object.associatedTypeProjection = $root.baml_bridge.cffi.v1.BamlTyAssociatedTypeProjection.toObject(message.associatedTypeProjection, options, q + 1);
4414
+ if (options.oneofs)
4415
+ object.ty = "associatedTypeProjection";
4416
+ }
4417
+ if (message.never != null && message.hasOwnProperty("never")) {
4418
+ object.never = $root.baml_bridge.cffi.v1.BamlTyNever.toObject(message.never, options, q + 1);
4419
+ if (options.oneofs)
4420
+ object.ty = "never";
4421
+ }
4422
+ return object;
4423
+ };
4424
+
4425
+ /**
4426
+ * Converts this BamlTy to JSON.
4427
+ * @function toJSON
4428
+ * @memberof baml_bridge.cffi.v1.BamlTy
4429
+ * @instance
4430
+ * @returns {Object.<string,*>} JSON object
4431
+ */
4432
+ BamlTy.prototype.toJSON = function toJSON() {
4433
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4434
+ };
4435
+
4436
+ /**
4437
+ * Gets the default type url for BamlTy
4438
+ * @function getTypeUrl
4439
+ * @memberof baml_bridge.cffi.v1.BamlTy
4440
+ * @static
4441
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4442
+ * @returns {string} The default type url
4443
+ */
4444
+ BamlTy.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4445
+ if (typeUrlPrefix === undefined) {
4446
+ typeUrlPrefix = "type.googleapis.com";
4447
+ }
4448
+ return typeUrlPrefix + "/baml_bridge.cffi.v1.BamlTy";
4449
+ };
4450
+
4451
+ return BamlTy;
4452
+ })();
4453
+
4454
+ v1.BamlTyDef = (function() {
4455
+
4456
+ /**
4457
+ * Properties of a BamlTyDef.
4458
+ * @memberof baml_bridge.cffi.v1
4459
+ * @interface IBamlTyDef
4460
+ * @property {baml_bridge.cffi.v1.IBamlTy|null} [root] BamlTyDef root
4461
+ * @property {Array.<baml_bridge.cffi.v1.IBamlClassDef>|null} [classes] BamlTyDef classes
4462
+ * @property {Array.<baml_bridge.cffi.v1.IBamlEnumDef>|null} [enums] BamlTyDef enums
4463
+ * @property {Array.<baml_bridge.cffi.v1.IBamlWitnessDef>|null} [witnesses] BamlTyDef witnesses
4464
+ */
4465
+
4466
+ /**
4467
+ * Constructs a new BamlTyDef.
4468
+ * @memberof baml_bridge.cffi.v1
4469
+ * @classdesc Represents a BamlTyDef.
4470
+ * @implements IBamlTyDef
4471
+ * @constructor
4472
+ * @param {baml_bridge.cffi.v1.IBamlTyDef=} [properties] Properties to set
4473
+ */
4474
+ function BamlTyDef(properties) {
4475
+ this.classes = [];
4476
+ this.enums = [];
4477
+ this.witnesses = [];
4478
+ if (properties)
4479
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
4480
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
4481
+ this[keys[i]] = properties[keys[i]];
4482
+ }
4483
+
4484
+ /**
4485
+ * BamlTyDef root.
4486
+ * @member {baml_bridge.cffi.v1.IBamlTy|null|undefined} root
4487
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4488
+ * @instance
4489
+ */
4490
+ BamlTyDef.prototype.root = null;
4491
+
4492
+ /**
4493
+ * BamlTyDef classes.
4494
+ * @member {Array.<baml_bridge.cffi.v1.IBamlClassDef>} classes
4495
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4496
+ * @instance
4497
+ */
4498
+ BamlTyDef.prototype.classes = $util.emptyArray;
4499
+
4500
+ /**
4501
+ * BamlTyDef enums.
4502
+ * @member {Array.<baml_bridge.cffi.v1.IBamlEnumDef>} enums
4503
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4504
+ * @instance
4505
+ */
4506
+ BamlTyDef.prototype.enums = $util.emptyArray;
4507
+
4508
+ /**
4509
+ * BamlTyDef witnesses.
4510
+ * @member {Array.<baml_bridge.cffi.v1.IBamlWitnessDef>} witnesses
4511
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4512
+ * @instance
4513
+ */
4514
+ BamlTyDef.prototype.witnesses = $util.emptyArray;
4515
+
4516
+ /**
4517
+ * Creates a new BamlTyDef instance using the specified properties.
4518
+ * @function create
4519
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4520
+ * @static
4521
+ * @param {baml_bridge.cffi.v1.IBamlTyDef=} [properties] Properties to set
4522
+ * @returns {baml_bridge.cffi.v1.BamlTyDef} BamlTyDef instance
4523
+ */
4524
+ BamlTyDef.create = function create(properties) {
4525
+ return new BamlTyDef(properties);
4526
+ };
4527
+
4528
+ /**
4529
+ * Encodes the specified BamlTyDef message. Does not implicitly {@link baml_bridge.cffi.v1.BamlTyDef.verify|verify} messages.
4530
+ * @function encode
4531
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4532
+ * @static
4533
+ * @param {baml_bridge.cffi.v1.IBamlTyDef} message BamlTyDef message or plain object to encode
4534
+ * @param {$protobuf.Writer} [writer] Writer to encode to
4535
+ * @returns {$protobuf.Writer} Writer
4536
+ */
4537
+ BamlTyDef.encode = function encode(message, writer, q) {
4538
+ if (!writer)
4539
+ writer = $Writer.create();
4540
+ if (q === undefined)
4541
+ q = 0;
4542
+ if (q > $util.recursionLimit)
4543
+ throw Error("max depth exceeded");
4544
+ if (message.root != null && Object.hasOwnProperty.call(message, "root"))
4545
+ $root.baml_bridge.cffi.v1.BamlTy.encode(message.root, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim();
4546
+ if (message.classes != null && message.classes.length)
4547
+ for (let i = 0; i < message.classes.length; ++i)
4548
+ $root.baml_bridge.cffi.v1.BamlClassDef.encode(message.classes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim();
4549
+ if (message.enums != null && message.enums.length)
4550
+ for (let i = 0; i < message.enums.length; ++i)
4551
+ $root.baml_bridge.cffi.v1.BamlEnumDef.encode(message.enums[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim();
4552
+ if (message.witnesses != null && message.witnesses.length)
4553
+ for (let i = 0; i < message.witnesses.length; ++i)
4554
+ $root.baml_bridge.cffi.v1.BamlWitnessDef.encode(message.witnesses[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim();
4555
+ return writer;
4556
+ };
4557
+
4558
+ /**
4559
+ * Encodes the specified BamlTyDef message, length delimited. Does not implicitly {@link baml_bridge.cffi.v1.BamlTyDef.verify|verify} messages.
4560
+ * @function encodeDelimited
4561
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4562
+ * @static
4563
+ * @param {baml_bridge.cffi.v1.IBamlTyDef} message BamlTyDef message or plain object to encode
4564
+ * @param {$protobuf.Writer} [writer] Writer to encode to
4565
+ * @returns {$protobuf.Writer} Writer
4566
+ */
4567
+ BamlTyDef.encodeDelimited = function encodeDelimited(message, writer) {
4568
+ return this.encode(message, writer).ldelim();
4569
+ };
4570
+
4571
+ /**
4572
+ * Decodes a BamlTyDef message from the specified reader or buffer.
4573
+ * @function decode
4574
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4575
+ * @static
4576
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4577
+ * @param {number} [length] Message length if known beforehand
4578
+ * @returns {baml_bridge.cffi.v1.BamlTyDef} BamlTyDef
4579
+ * @throws {Error} If the payload is not a reader or valid buffer
4580
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
4581
+ */
4582
+ BamlTyDef.decode = function decode(reader, length, error, long) {
4583
+ if (!(reader instanceof $Reader))
4584
+ reader = $Reader.create(reader);
4585
+ if (long === undefined)
4586
+ long = 0;
4587
+ if (long > $Reader.recursionLimit)
4588
+ throw Error("maximum nesting depth exceeded");
4589
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.baml_bridge.cffi.v1.BamlTyDef();
4590
+ while (reader.pos < end) {
4591
+ let tag = reader.uint32();
4592
+ if (tag === error)
4593
+ break;
4594
+ switch (tag >>> 3) {
4595
+ case 1: {
4596
+ message.root = $root.baml_bridge.cffi.v1.BamlTy.decode(reader, reader.uint32(), undefined, long + 1);
4597
+ break;
4598
+ }
4599
+ case 2: {
4600
+ if (!(message.classes && message.classes.length))
4601
+ message.classes = [];
4602
+ message.classes.push($root.baml_bridge.cffi.v1.BamlClassDef.decode(reader, reader.uint32(), undefined, long + 1));
4603
+ break;
4604
+ }
4605
+ case 3: {
4606
+ if (!(message.enums && message.enums.length))
4607
+ message.enums = [];
4608
+ message.enums.push($root.baml_bridge.cffi.v1.BamlEnumDef.decode(reader, reader.uint32(), undefined, long + 1));
4609
+ break;
4610
+ }
4611
+ case 4: {
4612
+ if (!(message.witnesses && message.witnesses.length))
4613
+ message.witnesses = [];
4614
+ message.witnesses.push($root.baml_bridge.cffi.v1.BamlWitnessDef.decode(reader, reader.uint32(), undefined, long + 1));
4615
+ break;
4616
+ }
4617
+ default:
4618
+ reader.skipType(tag & 7, long);
4619
+ break;
4620
+ }
4621
+ }
4622
+ return message;
4623
+ };
4624
+
4625
+ /**
4626
+ * Decodes a BamlTyDef message from the specified reader or buffer, length delimited.
4627
+ * @function decodeDelimited
4628
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4629
+ * @static
4630
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4631
+ * @returns {baml_bridge.cffi.v1.BamlTyDef} BamlTyDef
4632
+ * @throws {Error} If the payload is not a reader or valid buffer
4633
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
4634
+ */
4635
+ BamlTyDef.decodeDelimited = function decodeDelimited(reader) {
4636
+ if (!(reader instanceof $Reader))
4637
+ reader = new $Reader(reader);
4638
+ return this.decode(reader, reader.uint32());
4639
+ };
4640
+
4641
+ /**
4642
+ * Verifies a BamlTyDef message.
4643
+ * @function verify
4644
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4645
+ * @static
4646
+ * @param {Object.<string,*>} message Plain object to verify
4647
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
4648
+ */
4649
+ BamlTyDef.verify = function verify(message, long) {
4650
+ if (typeof message !== "object" || message === null)
4651
+ return "object expected";
4652
+ if (long === undefined)
4653
+ long = 0;
4654
+ if (long > $util.recursionLimit)
4655
+ return "maximum nesting depth exceeded";
4656
+ if (message.root != null && message.hasOwnProperty("root")) {
4657
+ let error = $root.baml_bridge.cffi.v1.BamlTy.verify(message.root, long + 1);
4658
+ if (error)
4659
+ return "root." + error;
4660
+ }
4661
+ if (message.classes != null && message.hasOwnProperty("classes")) {
4662
+ if (!Array.isArray(message.classes))
4663
+ return "classes: array expected";
4664
+ for (let i = 0; i < message.classes.length; ++i) {
4665
+ let error = $root.baml_bridge.cffi.v1.BamlClassDef.verify(message.classes[i], long + 1);
4666
+ if (error)
4667
+ return "classes." + error;
4668
+ }
4669
+ }
4670
+ if (message.enums != null && message.hasOwnProperty("enums")) {
4671
+ if (!Array.isArray(message.enums))
4672
+ return "enums: array expected";
4673
+ for (let i = 0; i < message.enums.length; ++i) {
4674
+ let error = $root.baml_bridge.cffi.v1.BamlEnumDef.verify(message.enums[i], long + 1);
4675
+ if (error)
4676
+ return "enums." + error;
4677
+ }
4678
+ }
4679
+ if (message.witnesses != null && message.hasOwnProperty("witnesses")) {
4680
+ if (!Array.isArray(message.witnesses))
4681
+ return "witnesses: array expected";
4682
+ for (let i = 0; i < message.witnesses.length; ++i) {
4683
+ let error = $root.baml_bridge.cffi.v1.BamlWitnessDef.verify(message.witnesses[i], long + 1);
4684
+ if (error)
4685
+ return "witnesses." + error;
4686
+ }
4687
+ }
4688
+ return null;
4689
+ };
4690
+
4691
+ /**
4692
+ * Creates a BamlTyDef message from a plain object. Also converts values to their respective internal types.
4693
+ * @function fromObject
4694
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4695
+ * @static
4696
+ * @param {Object.<string,*>} object Plain object
4697
+ * @returns {baml_bridge.cffi.v1.BamlTyDef} BamlTyDef
4698
+ */
4699
+ BamlTyDef.fromObject = function fromObject(object, long) {
4700
+ if (object instanceof $root.baml_bridge.cffi.v1.BamlTyDef)
4701
+ return object;
4702
+ if (!$util.isObject(object))
4703
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyDef: object expected");
4704
+ if (long === undefined)
4705
+ long = 0;
4706
+ if (long > $util.recursionLimit)
4707
+ throw Error("maximum nesting depth exceeded");
4708
+ let message = new $root.baml_bridge.cffi.v1.BamlTyDef();
4709
+ if (object.root != null) {
4710
+ if (!$util.isObject(object.root))
4711
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyDef.root: object expected");
4712
+ message.root = $root.baml_bridge.cffi.v1.BamlTy.fromObject(object.root, long + 1);
4713
+ }
4714
+ if (object.classes) {
4715
+ if (!Array.isArray(object.classes))
4716
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyDef.classes: array expected");
4717
+ message.classes = [];
4718
+ for (let i = 0; i < object.classes.length; ++i) {
4719
+ if (!$util.isObject(object.classes[i]))
4720
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyDef.classes: object expected");
4721
+ message.classes[i] = $root.baml_bridge.cffi.v1.BamlClassDef.fromObject(object.classes[i], long + 1);
4722
+ }
4723
+ }
4724
+ if (object.enums) {
4725
+ if (!Array.isArray(object.enums))
4726
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyDef.enums: array expected");
4727
+ message.enums = [];
4728
+ for (let i = 0; i < object.enums.length; ++i) {
4729
+ if (!$util.isObject(object.enums[i]))
4730
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyDef.enums: object expected");
4731
+ message.enums[i] = $root.baml_bridge.cffi.v1.BamlEnumDef.fromObject(object.enums[i], long + 1);
4732
+ }
4733
+ }
4734
+ if (object.witnesses) {
4735
+ if (!Array.isArray(object.witnesses))
4736
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyDef.witnesses: array expected");
4737
+ message.witnesses = [];
4738
+ for (let i = 0; i < object.witnesses.length; ++i) {
4739
+ if (!$util.isObject(object.witnesses[i]))
4740
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyDef.witnesses: object expected");
4741
+ message.witnesses[i] = $root.baml_bridge.cffi.v1.BamlWitnessDef.fromObject(object.witnesses[i], long + 1);
4742
+ }
4743
+ }
4744
+ return message;
4745
+ };
4746
+
4747
+ /**
4748
+ * Creates a plain object from a BamlTyDef message. Also converts values to other types if specified.
4749
+ * @function toObject
4750
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4751
+ * @static
4752
+ * @param {baml_bridge.cffi.v1.BamlTyDef} message BamlTyDef
4753
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
4754
+ * @returns {Object.<string,*>} Plain object
4755
+ */
4756
+ BamlTyDef.toObject = function toObject(message, options, q) {
4757
+ if (!options)
4758
+ options = {};
4759
+ if (q === undefined)
4760
+ q = 0;
4761
+ if (q > $util.recursionLimit)
4762
+ throw Error("max depth exceeded");
4763
+ let object = {};
4764
+ if (options.arrays || options.defaults) {
4765
+ object.classes = [];
4766
+ object.enums = [];
4767
+ object.witnesses = [];
4768
+ }
4769
+ if (options.defaults)
4770
+ object.root = null;
4771
+ if (message.root != null && message.hasOwnProperty("root"))
4772
+ object.root = $root.baml_bridge.cffi.v1.BamlTy.toObject(message.root, options, q + 1);
4773
+ if (message.classes && message.classes.length) {
4774
+ object.classes = [];
4775
+ for (let j = 0; j < message.classes.length; ++j)
4776
+ object.classes[j] = $root.baml_bridge.cffi.v1.BamlClassDef.toObject(message.classes[j], options, q + 1);
4777
+ }
4778
+ if (message.enums && message.enums.length) {
4779
+ object.enums = [];
4780
+ for (let j = 0; j < message.enums.length; ++j)
4781
+ object.enums[j] = $root.baml_bridge.cffi.v1.BamlEnumDef.toObject(message.enums[j], options, q + 1);
4782
+ }
4783
+ if (message.witnesses && message.witnesses.length) {
4784
+ object.witnesses = [];
4785
+ for (let j = 0; j < message.witnesses.length; ++j)
4786
+ object.witnesses[j] = $root.baml_bridge.cffi.v1.BamlWitnessDef.toObject(message.witnesses[j], options, q + 1);
4787
+ }
4788
+ return object;
4789
+ };
4790
+
4791
+ /**
4792
+ * Converts this BamlTyDef to JSON.
4793
+ * @function toJSON
4794
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4795
+ * @instance
4796
+ * @returns {Object.<string,*>} JSON object
4797
+ */
4798
+ BamlTyDef.prototype.toJSON = function toJSON() {
4799
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4800
+ };
4801
+
4802
+ /**
4803
+ * Gets the default type url for BamlTyDef
4804
+ * @function getTypeUrl
4805
+ * @memberof baml_bridge.cffi.v1.BamlTyDef
4806
+ * @static
4807
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4808
+ * @returns {string} The default type url
4809
+ */
4810
+ BamlTyDef.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4811
+ if (typeUrlPrefix === undefined) {
4812
+ typeUrlPrefix = "type.googleapis.com";
4813
+ }
4814
+ return typeUrlPrefix + "/baml_bridge.cffi.v1.BamlTyDef";
4815
+ };
4816
+
4817
+ return BamlTyDef;
4818
+ })();
4819
+
4820
+ v1.BamlWitnessDef = (function() {
4821
+
4822
+ /**
4823
+ * Properties of a BamlWitnessDef.
4824
+ * @memberof baml_bridge.cffi.v1
4825
+ * @interface IBamlWitnessDef
4826
+ * @property {string|null} ["interface"] BamlWitnessDef interface
4827
+ * @property {Array.<baml_bridge.cffi.v1.IBamlTy>|null} [interfaceArgs] BamlWitnessDef interfaceArgs
4828
+ * @property {Array.<baml_bridge.cffi.v1.IBamlTyAssociatedBinding>|null} [associatedTypes] BamlWitnessDef associatedTypes
4829
+ * @property {Array.<baml_bridge.cffi.v1.IBamlWitnessFieldLink>|null} [fieldLinks] BamlWitnessDef fieldLinks
4830
+ */
4831
+
4832
+ /**
4833
+ * Constructs a new BamlWitnessDef.
4834
+ * @memberof baml_bridge.cffi.v1
4835
+ * @classdesc Represents a BamlWitnessDef.
4836
+ * @implements IBamlWitnessDef
4837
+ * @constructor
4838
+ * @param {baml_bridge.cffi.v1.IBamlWitnessDef=} [properties] Properties to set
4839
+ */
4840
+ function BamlWitnessDef(properties) {
4841
+ this.interfaceArgs = [];
4842
+ this.associatedTypes = [];
4843
+ this.fieldLinks = [];
4844
+ if (properties)
4845
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
4846
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
4847
+ this[keys[i]] = properties[keys[i]];
4848
+ }
4849
+
4850
+ /**
4851
+ * BamlWitnessDef interface.
4852
+ * @member {string} interface
4853
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
4854
+ * @instance
4855
+ */
4856
+ BamlWitnessDef.prototype["interface"] = "";
4857
+
4858
+ /**
4859
+ * BamlWitnessDef interfaceArgs.
4860
+ * @member {Array.<baml_bridge.cffi.v1.IBamlTy>} interfaceArgs
4861
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
4862
+ * @instance
4863
+ */
4864
+ BamlWitnessDef.prototype.interfaceArgs = $util.emptyArray;
4865
+
4866
+ /**
4867
+ * BamlWitnessDef associatedTypes.
4868
+ * @member {Array.<baml_bridge.cffi.v1.IBamlTyAssociatedBinding>} associatedTypes
4869
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
4870
+ * @instance
4871
+ */
4872
+ BamlWitnessDef.prototype.associatedTypes = $util.emptyArray;
4873
+
4874
+ /**
4875
+ * BamlWitnessDef fieldLinks.
4876
+ * @member {Array.<baml_bridge.cffi.v1.IBamlWitnessFieldLink>} fieldLinks
4877
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
4878
+ * @instance
4879
+ */
4880
+ BamlWitnessDef.prototype.fieldLinks = $util.emptyArray;
4881
+
4882
+ /**
4883
+ * Creates a new BamlWitnessDef instance using the specified properties.
4884
+ * @function create
4885
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
4886
+ * @static
4887
+ * @param {baml_bridge.cffi.v1.IBamlWitnessDef=} [properties] Properties to set
4888
+ * @returns {baml_bridge.cffi.v1.BamlWitnessDef} BamlWitnessDef instance
4889
+ */
4890
+ BamlWitnessDef.create = function create(properties) {
4891
+ return new BamlWitnessDef(properties);
4892
+ };
4893
+
4894
+ /**
4895
+ * Encodes the specified BamlWitnessDef message. Does not implicitly {@link baml_bridge.cffi.v1.BamlWitnessDef.verify|verify} messages.
4896
+ * @function encode
4897
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
4898
+ * @static
4899
+ * @param {baml_bridge.cffi.v1.IBamlWitnessDef} message BamlWitnessDef message or plain object to encode
4900
+ * @param {$protobuf.Writer} [writer] Writer to encode to
4901
+ * @returns {$protobuf.Writer} Writer
4902
+ */
4903
+ BamlWitnessDef.encode = function encode(message, writer, q) {
4904
+ if (!writer)
4905
+ writer = $Writer.create();
4906
+ if (q === undefined)
4907
+ q = 0;
4908
+ if (q > $util.recursionLimit)
4909
+ throw Error("max depth exceeded");
4910
+ if (message["interface"] != null && Object.hasOwnProperty.call(message, "interface"))
4911
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message["interface"]);
4912
+ if (message.interfaceArgs != null && message.interfaceArgs.length)
4913
+ for (let i = 0; i < message.interfaceArgs.length; ++i)
4914
+ $root.baml_bridge.cffi.v1.BamlTy.encode(message.interfaceArgs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim();
4915
+ if (message.associatedTypes != null && message.associatedTypes.length)
4916
+ for (let i = 0; i < message.associatedTypes.length; ++i)
4917
+ $root.baml_bridge.cffi.v1.BamlTyAssociatedBinding.encode(message.associatedTypes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim();
4918
+ if (message.fieldLinks != null && message.fieldLinks.length)
4919
+ for (let i = 0; i < message.fieldLinks.length; ++i)
4920
+ $root.baml_bridge.cffi.v1.BamlWitnessFieldLink.encode(message.fieldLinks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim();
4921
+ return writer;
4922
+ };
4923
+
4924
+ /**
4925
+ * Encodes the specified BamlWitnessDef message, length delimited. Does not implicitly {@link baml_bridge.cffi.v1.BamlWitnessDef.verify|verify} messages.
4926
+ * @function encodeDelimited
4927
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
4928
+ * @static
4929
+ * @param {baml_bridge.cffi.v1.IBamlWitnessDef} message BamlWitnessDef message or plain object to encode
4930
+ * @param {$protobuf.Writer} [writer] Writer to encode to
4931
+ * @returns {$protobuf.Writer} Writer
4932
+ */
4933
+ BamlWitnessDef.encodeDelimited = function encodeDelimited(message, writer) {
4934
+ return this.encode(message, writer).ldelim();
4935
+ };
4936
+
4937
+ /**
4938
+ * Decodes a BamlWitnessDef message from the specified reader or buffer.
4939
+ * @function decode
4940
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
4941
+ * @static
4942
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4943
+ * @param {number} [length] Message length if known beforehand
4944
+ * @returns {baml_bridge.cffi.v1.BamlWitnessDef} BamlWitnessDef
4945
+ * @throws {Error} If the payload is not a reader or valid buffer
4946
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
4947
+ */
4948
+ BamlWitnessDef.decode = function decode(reader, length, error, long) {
4949
+ if (!(reader instanceof $Reader))
4950
+ reader = $Reader.create(reader);
4951
+ if (long === undefined)
4952
+ long = 0;
4953
+ if (long > $Reader.recursionLimit)
4954
+ throw Error("maximum nesting depth exceeded");
4955
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.baml_bridge.cffi.v1.BamlWitnessDef();
4956
+ while (reader.pos < end) {
4957
+ let tag = reader.uint32();
4958
+ if (tag === error)
4959
+ break;
4960
+ switch (tag >>> 3) {
4961
+ case 1: {
4962
+ message["interface"] = reader.string();
4963
+ break;
4964
+ }
4965
+ case 2: {
4966
+ if (!(message.interfaceArgs && message.interfaceArgs.length))
4967
+ message.interfaceArgs = [];
4968
+ message.interfaceArgs.push($root.baml_bridge.cffi.v1.BamlTy.decode(reader, reader.uint32(), undefined, long + 1));
4969
+ break;
4970
+ }
4971
+ case 3: {
4972
+ if (!(message.associatedTypes && message.associatedTypes.length))
4973
+ message.associatedTypes = [];
4974
+ message.associatedTypes.push($root.baml_bridge.cffi.v1.BamlTyAssociatedBinding.decode(reader, reader.uint32(), undefined, long + 1));
4975
+ break;
4976
+ }
4977
+ case 4: {
4978
+ if (!(message.fieldLinks && message.fieldLinks.length))
4979
+ message.fieldLinks = [];
4980
+ message.fieldLinks.push($root.baml_bridge.cffi.v1.BamlWitnessFieldLink.decode(reader, reader.uint32(), undefined, long + 1));
4981
+ break;
4982
+ }
4983
+ default:
4984
+ reader.skipType(tag & 7, long);
4985
+ break;
4986
+ }
4987
+ }
4988
+ return message;
4989
+ };
4990
+
4991
+ /**
4992
+ * Decodes a BamlWitnessDef message from the specified reader or buffer, length delimited.
4993
+ * @function decodeDelimited
4994
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
4995
+ * @static
4996
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4997
+ * @returns {baml_bridge.cffi.v1.BamlWitnessDef} BamlWitnessDef
4998
+ * @throws {Error} If the payload is not a reader or valid buffer
4999
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
5000
+ */
5001
+ BamlWitnessDef.decodeDelimited = function decodeDelimited(reader) {
5002
+ if (!(reader instanceof $Reader))
5003
+ reader = new $Reader(reader);
5004
+ return this.decode(reader, reader.uint32());
5005
+ };
5006
+
5007
+ /**
5008
+ * Verifies a BamlWitnessDef message.
5009
+ * @function verify
5010
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
5011
+ * @static
5012
+ * @param {Object.<string,*>} message Plain object to verify
5013
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
5014
+ */
5015
+ BamlWitnessDef.verify = function verify(message, long) {
5016
+ if (typeof message !== "object" || message === null)
5017
+ return "object expected";
5018
+ if (long === undefined)
5019
+ long = 0;
5020
+ if (long > $util.recursionLimit)
5021
+ return "maximum nesting depth exceeded";
5022
+ if (message["interface"] != null && message.hasOwnProperty("interface"))
5023
+ if (!$util.isString(message["interface"]))
5024
+ return "interface: string expected";
5025
+ if (message.interfaceArgs != null && message.hasOwnProperty("interfaceArgs")) {
5026
+ if (!Array.isArray(message.interfaceArgs))
5027
+ return "interfaceArgs: array expected";
5028
+ for (let i = 0; i < message.interfaceArgs.length; ++i) {
5029
+ let error = $root.baml_bridge.cffi.v1.BamlTy.verify(message.interfaceArgs[i], long + 1);
5030
+ if (error)
5031
+ return "interfaceArgs." + error;
5032
+ }
5033
+ }
5034
+ if (message.associatedTypes != null && message.hasOwnProperty("associatedTypes")) {
5035
+ if (!Array.isArray(message.associatedTypes))
5036
+ return "associatedTypes: array expected";
5037
+ for (let i = 0; i < message.associatedTypes.length; ++i) {
5038
+ let error = $root.baml_bridge.cffi.v1.BamlTyAssociatedBinding.verify(message.associatedTypes[i], long + 1);
5039
+ if (error)
5040
+ return "associatedTypes." + error;
5041
+ }
5042
+ }
5043
+ if (message.fieldLinks != null && message.hasOwnProperty("fieldLinks")) {
5044
+ if (!Array.isArray(message.fieldLinks))
5045
+ return "fieldLinks: array expected";
5046
+ for (let i = 0; i < message.fieldLinks.length; ++i) {
5047
+ let error = $root.baml_bridge.cffi.v1.BamlWitnessFieldLink.verify(message.fieldLinks[i], long + 1);
5048
+ if (error)
5049
+ return "fieldLinks." + error;
5050
+ }
5051
+ }
5052
+ return null;
5053
+ };
5054
+
5055
+ /**
5056
+ * Creates a BamlWitnessDef message from a plain object. Also converts values to their respective internal types.
5057
+ * @function fromObject
5058
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
5059
+ * @static
5060
+ * @param {Object.<string,*>} object Plain object
5061
+ * @returns {baml_bridge.cffi.v1.BamlWitnessDef} BamlWitnessDef
5062
+ */
5063
+ BamlWitnessDef.fromObject = function fromObject(object, long) {
5064
+ if (object instanceof $root.baml_bridge.cffi.v1.BamlWitnessDef)
5065
+ return object;
5066
+ if (!$util.isObject(object))
5067
+ throw TypeError(".baml_bridge.cffi.v1.BamlWitnessDef: object expected");
5068
+ if (long === undefined)
5069
+ long = 0;
5070
+ if (long > $util.recursionLimit)
5071
+ throw Error("maximum nesting depth exceeded");
5072
+ let message = new $root.baml_bridge.cffi.v1.BamlWitnessDef();
5073
+ if (object["interface"] != null)
5074
+ message["interface"] = String(object["interface"]);
5075
+ if (object.interfaceArgs) {
5076
+ if (!Array.isArray(object.interfaceArgs))
5077
+ throw TypeError(".baml_bridge.cffi.v1.BamlWitnessDef.interfaceArgs: array expected");
5078
+ message.interfaceArgs = [];
5079
+ for (let i = 0; i < object.interfaceArgs.length; ++i) {
5080
+ if (!$util.isObject(object.interfaceArgs[i]))
5081
+ throw TypeError(".baml_bridge.cffi.v1.BamlWitnessDef.interfaceArgs: object expected");
5082
+ message.interfaceArgs[i] = $root.baml_bridge.cffi.v1.BamlTy.fromObject(object.interfaceArgs[i], long + 1);
5083
+ }
5084
+ }
5085
+ if (object.associatedTypes) {
5086
+ if (!Array.isArray(object.associatedTypes))
5087
+ throw TypeError(".baml_bridge.cffi.v1.BamlWitnessDef.associatedTypes: array expected");
5088
+ message.associatedTypes = [];
5089
+ for (let i = 0; i < object.associatedTypes.length; ++i) {
5090
+ if (!$util.isObject(object.associatedTypes[i]))
5091
+ throw TypeError(".baml_bridge.cffi.v1.BamlWitnessDef.associatedTypes: object expected");
5092
+ message.associatedTypes[i] = $root.baml_bridge.cffi.v1.BamlTyAssociatedBinding.fromObject(object.associatedTypes[i], long + 1);
5093
+ }
5094
+ }
5095
+ if (object.fieldLinks) {
5096
+ if (!Array.isArray(object.fieldLinks))
5097
+ throw TypeError(".baml_bridge.cffi.v1.BamlWitnessDef.fieldLinks: array expected");
5098
+ message.fieldLinks = [];
5099
+ for (let i = 0; i < object.fieldLinks.length; ++i) {
5100
+ if (!$util.isObject(object.fieldLinks[i]))
5101
+ throw TypeError(".baml_bridge.cffi.v1.BamlWitnessDef.fieldLinks: object expected");
5102
+ message.fieldLinks[i] = $root.baml_bridge.cffi.v1.BamlWitnessFieldLink.fromObject(object.fieldLinks[i], long + 1);
5103
+ }
5104
+ }
5105
+ return message;
5106
+ };
5107
+
5108
+ /**
5109
+ * Creates a plain object from a BamlWitnessDef message. Also converts values to other types if specified.
5110
+ * @function toObject
5111
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
5112
+ * @static
5113
+ * @param {baml_bridge.cffi.v1.BamlWitnessDef} message BamlWitnessDef
5114
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
5115
+ * @returns {Object.<string,*>} Plain object
5116
+ */
5117
+ BamlWitnessDef.toObject = function toObject(message, options, q) {
5118
+ if (!options)
5119
+ options = {};
5120
+ if (q === undefined)
5121
+ q = 0;
5122
+ if (q > $util.recursionLimit)
5123
+ throw Error("max depth exceeded");
5124
+ let object = {};
5125
+ if (options.arrays || options.defaults) {
5126
+ object.interfaceArgs = [];
5127
+ object.associatedTypes = [];
5128
+ object.fieldLinks = [];
5129
+ }
5130
+ if (options.defaults)
5131
+ object["interface"] = "";
5132
+ if (message["interface"] != null && message.hasOwnProperty("interface"))
5133
+ object["interface"] = message["interface"];
5134
+ if (message.interfaceArgs && message.interfaceArgs.length) {
5135
+ object.interfaceArgs = [];
5136
+ for (let j = 0; j < message.interfaceArgs.length; ++j)
5137
+ object.interfaceArgs[j] = $root.baml_bridge.cffi.v1.BamlTy.toObject(message.interfaceArgs[j], options, q + 1);
5138
+ }
5139
+ if (message.associatedTypes && message.associatedTypes.length) {
5140
+ object.associatedTypes = [];
5141
+ for (let j = 0; j < message.associatedTypes.length; ++j)
5142
+ object.associatedTypes[j] = $root.baml_bridge.cffi.v1.BamlTyAssociatedBinding.toObject(message.associatedTypes[j], options, q + 1);
5143
+ }
5144
+ if (message.fieldLinks && message.fieldLinks.length) {
5145
+ object.fieldLinks = [];
5146
+ for (let j = 0; j < message.fieldLinks.length; ++j)
5147
+ object.fieldLinks[j] = $root.baml_bridge.cffi.v1.BamlWitnessFieldLink.toObject(message.fieldLinks[j], options, q + 1);
5148
+ }
5149
+ return object;
5150
+ };
5151
+
5152
+ /**
5153
+ * Converts this BamlWitnessDef to JSON.
5154
+ * @function toJSON
5155
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
5156
+ * @instance
5157
+ * @returns {Object.<string,*>} JSON object
5158
+ */
5159
+ BamlWitnessDef.prototype.toJSON = function toJSON() {
5160
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
5161
+ };
5162
+
5163
+ /**
5164
+ * Gets the default type url for BamlWitnessDef
5165
+ * @function getTypeUrl
5166
+ * @memberof baml_bridge.cffi.v1.BamlWitnessDef
5167
+ * @static
5168
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
5169
+ * @returns {string} The default type url
5170
+ */
5171
+ BamlWitnessDef.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
5172
+ if (typeUrlPrefix === undefined) {
5173
+ typeUrlPrefix = "type.googleapis.com";
5174
+ }
5175
+ return typeUrlPrefix + "/baml_bridge.cffi.v1.BamlWitnessDef";
5176
+ };
5177
+
5178
+ return BamlWitnessDef;
5179
+ })();
5180
+
5181
+ v1.BamlWitnessFieldLink = (function() {
5182
+
5183
+ /**
5184
+ * Properties of a BamlWitnessFieldLink.
5185
+ * @memberof baml_bridge.cffi.v1
5186
+ * @interface IBamlWitnessFieldLink
5187
+ * @property {string|null} [interfaceField] BamlWitnessFieldLink interfaceField
5188
+ * @property {string|null} [classField] BamlWitnessFieldLink classField
5189
+ */
5190
+
5191
+ /**
5192
+ * Constructs a new BamlWitnessFieldLink.
5193
+ * @memberof baml_bridge.cffi.v1
5194
+ * @classdesc Represents a BamlWitnessFieldLink.
5195
+ * @implements IBamlWitnessFieldLink
5196
+ * @constructor
5197
+ * @param {baml_bridge.cffi.v1.IBamlWitnessFieldLink=} [properties] Properties to set
5198
+ */
5199
+ function BamlWitnessFieldLink(properties) {
5200
+ if (properties)
5201
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
5202
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
5203
+ this[keys[i]] = properties[keys[i]];
5204
+ }
5205
+
5206
+ /**
5207
+ * BamlWitnessFieldLink interfaceField.
5208
+ * @member {string} interfaceField
5209
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5210
+ * @instance
5211
+ */
5212
+ BamlWitnessFieldLink.prototype.interfaceField = "";
5213
+
5214
+ /**
5215
+ * BamlWitnessFieldLink classField.
5216
+ * @member {string} classField
5217
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5218
+ * @instance
5219
+ */
5220
+ BamlWitnessFieldLink.prototype.classField = "";
5221
+
5222
+ /**
5223
+ * Creates a new BamlWitnessFieldLink instance using the specified properties.
5224
+ * @function create
5225
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5226
+ * @static
5227
+ * @param {baml_bridge.cffi.v1.IBamlWitnessFieldLink=} [properties] Properties to set
5228
+ * @returns {baml_bridge.cffi.v1.BamlWitnessFieldLink} BamlWitnessFieldLink instance
5229
+ */
5230
+ BamlWitnessFieldLink.create = function create(properties) {
5231
+ return new BamlWitnessFieldLink(properties);
5232
+ };
5233
+
5234
+ /**
5235
+ * Encodes the specified BamlWitnessFieldLink message. Does not implicitly {@link baml_bridge.cffi.v1.BamlWitnessFieldLink.verify|verify} messages.
5236
+ * @function encode
5237
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5238
+ * @static
5239
+ * @param {baml_bridge.cffi.v1.IBamlWitnessFieldLink} message BamlWitnessFieldLink message or plain object to encode
5240
+ * @param {$protobuf.Writer} [writer] Writer to encode to
5241
+ * @returns {$protobuf.Writer} Writer
5242
+ */
5243
+ BamlWitnessFieldLink.encode = function encode(message, writer, q) {
5244
+ if (!writer)
5245
+ writer = $Writer.create();
5246
+ if (q === undefined)
5247
+ q = 0;
5248
+ if (q > $util.recursionLimit)
5249
+ throw Error("max depth exceeded");
5250
+ if (message.interfaceField != null && Object.hasOwnProperty.call(message, "interfaceField"))
5251
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.interfaceField);
5252
+ if (message.classField != null && Object.hasOwnProperty.call(message, "classField"))
5253
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.classField);
5254
+ return writer;
5255
+ };
5256
+
5257
+ /**
5258
+ * Encodes the specified BamlWitnessFieldLink message, length delimited. Does not implicitly {@link baml_bridge.cffi.v1.BamlWitnessFieldLink.verify|verify} messages.
5259
+ * @function encodeDelimited
5260
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5261
+ * @static
5262
+ * @param {baml_bridge.cffi.v1.IBamlWitnessFieldLink} message BamlWitnessFieldLink message or plain object to encode
5263
+ * @param {$protobuf.Writer} [writer] Writer to encode to
5264
+ * @returns {$protobuf.Writer} Writer
5265
+ */
5266
+ BamlWitnessFieldLink.encodeDelimited = function encodeDelimited(message, writer) {
5267
+ return this.encode(message, writer).ldelim();
5268
+ };
5269
+
5270
+ /**
5271
+ * Decodes a BamlWitnessFieldLink message from the specified reader or buffer.
5272
+ * @function decode
5273
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5274
+ * @static
5275
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5276
+ * @param {number} [length] Message length if known beforehand
5277
+ * @returns {baml_bridge.cffi.v1.BamlWitnessFieldLink} BamlWitnessFieldLink
5278
+ * @throws {Error} If the payload is not a reader or valid buffer
5279
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
5280
+ */
5281
+ BamlWitnessFieldLink.decode = function decode(reader, length, error, long) {
5282
+ if (!(reader instanceof $Reader))
5283
+ reader = $Reader.create(reader);
5284
+ if (long === undefined)
5285
+ long = 0;
5286
+ if (long > $Reader.recursionLimit)
5287
+ throw Error("maximum nesting depth exceeded");
5288
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.baml_bridge.cffi.v1.BamlWitnessFieldLink();
5289
+ while (reader.pos < end) {
5290
+ let tag = reader.uint32();
5291
+ if (tag === error)
5292
+ break;
5293
+ switch (tag >>> 3) {
5294
+ case 1: {
5295
+ message.interfaceField = reader.string();
5296
+ break;
5297
+ }
5298
+ case 2: {
5299
+ message.classField = reader.string();
5300
+ break;
5301
+ }
5302
+ default:
5303
+ reader.skipType(tag & 7, long);
5304
+ break;
5305
+ }
5306
+ }
5307
+ return message;
5308
+ };
5309
+
5310
+ /**
5311
+ * Decodes a BamlWitnessFieldLink message from the specified reader or buffer, length delimited.
5312
+ * @function decodeDelimited
5313
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5314
+ * @static
5315
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5316
+ * @returns {baml_bridge.cffi.v1.BamlWitnessFieldLink} BamlWitnessFieldLink
5317
+ * @throws {Error} If the payload is not a reader or valid buffer
5318
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
5319
+ */
5320
+ BamlWitnessFieldLink.decodeDelimited = function decodeDelimited(reader) {
5321
+ if (!(reader instanceof $Reader))
5322
+ reader = new $Reader(reader);
5323
+ return this.decode(reader, reader.uint32());
5324
+ };
5325
+
5326
+ /**
5327
+ * Verifies a BamlWitnessFieldLink message.
5328
+ * @function verify
5329
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5330
+ * @static
5331
+ * @param {Object.<string,*>} message Plain object to verify
5332
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
5333
+ */
5334
+ BamlWitnessFieldLink.verify = function verify(message, long) {
5335
+ if (typeof message !== "object" || message === null)
5336
+ return "object expected";
5337
+ if (long === undefined)
5338
+ long = 0;
5339
+ if (long > $util.recursionLimit)
5340
+ return "maximum nesting depth exceeded";
5341
+ if (message.interfaceField != null && message.hasOwnProperty("interfaceField"))
5342
+ if (!$util.isString(message.interfaceField))
5343
+ return "interfaceField: string expected";
5344
+ if (message.classField != null && message.hasOwnProperty("classField"))
5345
+ if (!$util.isString(message.classField))
5346
+ return "classField: string expected";
5347
+ return null;
5348
+ };
5349
+
5350
+ /**
5351
+ * Creates a BamlWitnessFieldLink message from a plain object. Also converts values to their respective internal types.
5352
+ * @function fromObject
5353
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5354
+ * @static
5355
+ * @param {Object.<string,*>} object Plain object
5356
+ * @returns {baml_bridge.cffi.v1.BamlWitnessFieldLink} BamlWitnessFieldLink
5357
+ */
5358
+ BamlWitnessFieldLink.fromObject = function fromObject(object, long) {
5359
+ if (object instanceof $root.baml_bridge.cffi.v1.BamlWitnessFieldLink)
5360
+ return object;
5361
+ if (!$util.isObject(object))
5362
+ throw TypeError(".baml_bridge.cffi.v1.BamlWitnessFieldLink: object expected");
5363
+ if (long === undefined)
5364
+ long = 0;
5365
+ if (long > $util.recursionLimit)
5366
+ throw Error("maximum nesting depth exceeded");
5367
+ let message = new $root.baml_bridge.cffi.v1.BamlWitnessFieldLink();
5368
+ if (object.interfaceField != null)
5369
+ message.interfaceField = String(object.interfaceField);
5370
+ if (object.classField != null)
5371
+ message.classField = String(object.classField);
5372
+ return message;
5373
+ };
5374
+
5375
+ /**
5376
+ * Creates a plain object from a BamlWitnessFieldLink message. Also converts values to other types if specified.
5377
+ * @function toObject
5378
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5379
+ * @static
5380
+ * @param {baml_bridge.cffi.v1.BamlWitnessFieldLink} message BamlWitnessFieldLink
5381
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
5382
+ * @returns {Object.<string,*>} Plain object
5383
+ */
5384
+ BamlWitnessFieldLink.toObject = function toObject(message, options, q) {
5385
+ if (!options)
5386
+ options = {};
5387
+ if (q === undefined)
5388
+ q = 0;
5389
+ if (q > $util.recursionLimit)
5390
+ throw Error("max depth exceeded");
5391
+ let object = {};
5392
+ if (options.defaults) {
5393
+ object.interfaceField = "";
5394
+ object.classField = "";
5395
+ }
5396
+ if (message.interfaceField != null && message.hasOwnProperty("interfaceField"))
5397
+ object.interfaceField = message.interfaceField;
5398
+ if (message.classField != null && message.hasOwnProperty("classField"))
5399
+ object.classField = message.classField;
5400
+ return object;
5401
+ };
5402
+
5403
+ /**
5404
+ * Converts this BamlWitnessFieldLink to JSON.
5405
+ * @function toJSON
5406
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5407
+ * @instance
5408
+ * @returns {Object.<string,*>} JSON object
5409
+ */
5410
+ BamlWitnessFieldLink.prototype.toJSON = function toJSON() {
5411
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
5412
+ };
5413
+
5414
+ /**
5415
+ * Gets the default type url for BamlWitnessFieldLink
5416
+ * @function getTypeUrl
5417
+ * @memberof baml_bridge.cffi.v1.BamlWitnessFieldLink
5418
+ * @static
5419
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
5420
+ * @returns {string} The default type url
5421
+ */
5422
+ BamlWitnessFieldLink.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
5423
+ if (typeUrlPrefix === undefined) {
5424
+ typeUrlPrefix = "type.googleapis.com";
5425
+ }
5426
+ return typeUrlPrefix + "/baml_bridge.cffi.v1.BamlWitnessFieldLink";
5427
+ };
5428
+
5429
+ return BamlWitnessFieldLink;
5430
+ })();
5431
+
5432
+ v1.BamlTyMetadata = (function() {
5433
+
5434
+ /**
5435
+ * Properties of a BamlTyMetadata.
5436
+ * @memberof baml_bridge.cffi.v1
5437
+ * @interface IBamlTyMetadata
5438
+ * @property {string|null} [description] BamlTyMetadata description
5439
+ * @property {string|null} [alias] BamlTyMetadata alias
5440
+ * @property {string|null} [docstring] BamlTyMetadata docstring
5441
+ * @property {Object.<string,string>|null} [other] BamlTyMetadata other
5442
+ */
5443
+
5444
+ /**
5445
+ * Constructs a new BamlTyMetadata.
5446
+ * @memberof baml_bridge.cffi.v1
5447
+ * @classdesc Represents a BamlTyMetadata.
5448
+ * @implements IBamlTyMetadata
5449
+ * @constructor
5450
+ * @param {baml_bridge.cffi.v1.IBamlTyMetadata=} [properties] Properties to set
5451
+ */
5452
+ function BamlTyMetadata(properties) {
5453
+ this.other = {};
5454
+ if (properties)
5455
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
5456
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
5457
+ this[keys[i]] = properties[keys[i]];
5458
+ }
5459
+
5460
+ /**
5461
+ * BamlTyMetadata description.
5462
+ * @member {string|null|undefined} description
5463
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5464
+ * @instance
5465
+ */
5466
+ BamlTyMetadata.prototype.description = null;
5467
+
5468
+ /**
5469
+ * BamlTyMetadata alias.
5470
+ * @member {string|null|undefined} alias
5471
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5472
+ * @instance
5473
+ */
5474
+ BamlTyMetadata.prototype.alias = null;
5475
+
5476
+ /**
5477
+ * BamlTyMetadata docstring.
5478
+ * @member {string|null|undefined} docstring
5479
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5480
+ * @instance
5481
+ */
5482
+ BamlTyMetadata.prototype.docstring = null;
5483
+
5484
+ /**
5485
+ * BamlTyMetadata other.
5486
+ * @member {Object.<string,string>} other
5487
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5488
+ * @instance
5489
+ */
5490
+ BamlTyMetadata.prototype.other = $util.emptyObject;
5491
+
5492
+ // OneOf field names bound to virtual getters and setters
5493
+ let $oneOfFields;
5494
+
5495
+ // Virtual OneOf for proto3 optional field
5496
+ Object.defineProperty(BamlTyMetadata.prototype, "_description", {
5497
+ get: $util.oneOfGetter($oneOfFields = ["description"]),
5498
+ set: $util.oneOfSetter($oneOfFields)
5499
+ });
5500
+
5501
+ // Virtual OneOf for proto3 optional field
5502
+ Object.defineProperty(BamlTyMetadata.prototype, "_alias", {
5503
+ get: $util.oneOfGetter($oneOfFields = ["alias"]),
5504
+ set: $util.oneOfSetter($oneOfFields)
5505
+ });
5506
+
5507
+ // Virtual OneOf for proto3 optional field
5508
+ Object.defineProperty(BamlTyMetadata.prototype, "_docstring", {
5509
+ get: $util.oneOfGetter($oneOfFields = ["docstring"]),
5510
+ set: $util.oneOfSetter($oneOfFields)
5511
+ });
5512
+
5513
+ /**
5514
+ * Creates a new BamlTyMetadata instance using the specified properties.
5515
+ * @function create
5516
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5517
+ * @static
5518
+ * @param {baml_bridge.cffi.v1.IBamlTyMetadata=} [properties] Properties to set
5519
+ * @returns {baml_bridge.cffi.v1.BamlTyMetadata} BamlTyMetadata instance
5520
+ */
5521
+ BamlTyMetadata.create = function create(properties) {
5522
+ return new BamlTyMetadata(properties);
5523
+ };
5524
+
5525
+ /**
5526
+ * Encodes the specified BamlTyMetadata message. Does not implicitly {@link baml_bridge.cffi.v1.BamlTyMetadata.verify|verify} messages.
5527
+ * @function encode
5528
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5529
+ * @static
5530
+ * @param {baml_bridge.cffi.v1.IBamlTyMetadata} message BamlTyMetadata message or plain object to encode
5531
+ * @param {$protobuf.Writer} [writer] Writer to encode to
5532
+ * @returns {$protobuf.Writer} Writer
5533
+ */
5534
+ BamlTyMetadata.encode = function encode(message, writer, q) {
5535
+ if (!writer)
5536
+ writer = $Writer.create();
5537
+ if (q === undefined)
5538
+ q = 0;
5539
+ if (q > $util.recursionLimit)
5540
+ throw Error("max depth exceeded");
5541
+ if (message.description != null && Object.hasOwnProperty.call(message, "description"))
5542
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.description);
5543
+ if (message.alias != null && Object.hasOwnProperty.call(message, "alias"))
5544
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.alias);
5545
+ if (message.docstring != null && Object.hasOwnProperty.call(message, "docstring"))
5546
+ writer.uint32(/* id 3, wireType 2 =*/26).string(message.docstring);
5547
+ if (message.other != null && Object.hasOwnProperty.call(message, "other"))
5548
+ for (let keys = Object.keys(message.other), i = 0; i < keys.length; ++i)
5549
+ writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.other[keys[i]]).ldelim();
5550
+ return writer;
5551
+ };
5552
+
5553
+ /**
5554
+ * Encodes the specified BamlTyMetadata message, length delimited. Does not implicitly {@link baml_bridge.cffi.v1.BamlTyMetadata.verify|verify} messages.
5555
+ * @function encodeDelimited
5556
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5557
+ * @static
5558
+ * @param {baml_bridge.cffi.v1.IBamlTyMetadata} message BamlTyMetadata message or plain object to encode
5559
+ * @param {$protobuf.Writer} [writer] Writer to encode to
5560
+ * @returns {$protobuf.Writer} Writer
5561
+ */
5562
+ BamlTyMetadata.encodeDelimited = function encodeDelimited(message, writer) {
5563
+ return this.encode(message, writer).ldelim();
5564
+ };
5565
+
5566
+ /**
5567
+ * Decodes a BamlTyMetadata message from the specified reader or buffer.
5568
+ * @function decode
5569
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5570
+ * @static
5571
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5572
+ * @param {number} [length] Message length if known beforehand
5573
+ * @returns {baml_bridge.cffi.v1.BamlTyMetadata} BamlTyMetadata
5574
+ * @throws {Error} If the payload is not a reader or valid buffer
5575
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
5576
+ */
5577
+ BamlTyMetadata.decode = function decode(reader, length, error, long) {
5578
+ if (!(reader instanceof $Reader))
5579
+ reader = $Reader.create(reader);
5580
+ if (long === undefined)
5581
+ long = 0;
5582
+ if (long > $Reader.recursionLimit)
5583
+ throw Error("maximum nesting depth exceeded");
5584
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.baml_bridge.cffi.v1.BamlTyMetadata(), key, value;
5585
+ while (reader.pos < end) {
5586
+ let tag = reader.uint32();
5587
+ if (tag === error)
5588
+ break;
5589
+ switch (tag >>> 3) {
5590
+ case 1: {
5591
+ message.description = reader.string();
5592
+ break;
5593
+ }
5594
+ case 2: {
5595
+ message.alias = reader.string();
5596
+ break;
5597
+ }
5598
+ case 3: {
5599
+ message.docstring = reader.string();
5600
+ break;
5601
+ }
5602
+ case 4: {
5603
+ if (message.other === $util.emptyObject)
5604
+ message.other = {};
5605
+ let end2 = reader.uint32() + reader.pos;
5606
+ key = "";
5607
+ value = "";
5608
+ while (reader.pos < end2) {
5609
+ let tag2 = reader.uint32();
5610
+ switch (tag2 >>> 3) {
5611
+ case 1:
5612
+ key = reader.string();
5613
+ break;
5614
+ case 2:
5615
+ value = reader.string();
5616
+ break;
5617
+ default:
5618
+ reader.skipType(tag2 & 7, long);
5619
+ break;
5620
+ }
5621
+ }
5622
+ if (key === "__proto__")
5623
+ $util.makeProp(message.other, key);
5624
+ message.other[key] = value;
5625
+ break;
5626
+ }
5627
+ default:
5628
+ reader.skipType(tag & 7, long);
5629
+ break;
5630
+ }
5631
+ }
5632
+ return message;
5633
+ };
5634
+
5635
+ /**
5636
+ * Decodes a BamlTyMetadata message from the specified reader or buffer, length delimited.
5637
+ * @function decodeDelimited
5638
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5639
+ * @static
5640
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5641
+ * @returns {baml_bridge.cffi.v1.BamlTyMetadata} BamlTyMetadata
5642
+ * @throws {Error} If the payload is not a reader or valid buffer
5643
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
5644
+ */
5645
+ BamlTyMetadata.decodeDelimited = function decodeDelimited(reader) {
5646
+ if (!(reader instanceof $Reader))
5647
+ reader = new $Reader(reader);
5648
+ return this.decode(reader, reader.uint32());
5649
+ };
5650
+
5651
+ /**
5652
+ * Verifies a BamlTyMetadata message.
5653
+ * @function verify
5654
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5655
+ * @static
5656
+ * @param {Object.<string,*>} message Plain object to verify
5657
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
5658
+ */
5659
+ BamlTyMetadata.verify = function verify(message, long) {
5660
+ if (typeof message !== "object" || message === null)
5661
+ return "object expected";
5662
+ if (long === undefined)
5663
+ long = 0;
5664
+ if (long > $util.recursionLimit)
5665
+ return "maximum nesting depth exceeded";
5666
+ let properties = {};
5667
+ if (message.description != null && message.hasOwnProperty("description")) {
5668
+ properties._description = 1;
5669
+ if (!$util.isString(message.description))
5670
+ return "description: string expected";
5671
+ }
5672
+ if (message.alias != null && message.hasOwnProperty("alias")) {
5673
+ properties._alias = 1;
5674
+ if (!$util.isString(message.alias))
5675
+ return "alias: string expected";
5676
+ }
5677
+ if (message.docstring != null && message.hasOwnProperty("docstring")) {
5678
+ properties._docstring = 1;
5679
+ if (!$util.isString(message.docstring))
5680
+ return "docstring: string expected";
5681
+ }
5682
+ if (message.other != null && message.hasOwnProperty("other")) {
5683
+ if (!$util.isObject(message.other))
5684
+ return "other: object expected";
5685
+ let key = Object.keys(message.other);
5686
+ for (let i = 0; i < key.length; ++i)
5687
+ if (!$util.isString(message.other[key[i]]))
5688
+ return "other: string{k:string} expected";
5689
+ }
5690
+ return null;
5691
+ };
5692
+
5693
+ /**
5694
+ * Creates a BamlTyMetadata message from a plain object. Also converts values to their respective internal types.
5695
+ * @function fromObject
5696
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5697
+ * @static
5698
+ * @param {Object.<string,*>} object Plain object
5699
+ * @returns {baml_bridge.cffi.v1.BamlTyMetadata} BamlTyMetadata
5700
+ */
5701
+ BamlTyMetadata.fromObject = function fromObject(object, long) {
5702
+ if (object instanceof $root.baml_bridge.cffi.v1.BamlTyMetadata)
5703
+ return object;
5704
+ if (!$util.isObject(object))
5705
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyMetadata: object expected");
5706
+ if (long === undefined)
5707
+ long = 0;
5708
+ if (long > $util.recursionLimit)
5709
+ throw Error("maximum nesting depth exceeded");
5710
+ let message = new $root.baml_bridge.cffi.v1.BamlTyMetadata();
5711
+ if (object.description != null)
5712
+ message.description = String(object.description);
5713
+ if (object.alias != null)
5714
+ message.alias = String(object.alias);
5715
+ if (object.docstring != null)
5716
+ message.docstring = String(object.docstring);
5717
+ if (object.other) {
5718
+ if (!$util.isObject(object.other))
5719
+ throw TypeError(".baml_bridge.cffi.v1.BamlTyMetadata.other: object expected");
5720
+ message.other = {};
5721
+ for (let keys = Object.keys(object.other), i = 0; i < keys.length; ++i) {
5722
+ if (keys[i] === "__proto__")
5723
+ $util.makeProp(message.other, keys[i]);
5724
+ message.other[keys[i]] = String(object.other[keys[i]]);
5725
+ }
5726
+ }
5727
+ return message;
5728
+ };
5729
+
5730
+ /**
5731
+ * Creates a plain object from a BamlTyMetadata message. Also converts values to other types if specified.
5732
+ * @function toObject
5733
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5734
+ * @static
5735
+ * @param {baml_bridge.cffi.v1.BamlTyMetadata} message BamlTyMetadata
5736
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
5737
+ * @returns {Object.<string,*>} Plain object
5738
+ */
5739
+ BamlTyMetadata.toObject = function toObject(message, options, q) {
5740
+ if (!options)
5741
+ options = {};
5742
+ if (q === undefined)
5743
+ q = 0;
5744
+ if (q > $util.recursionLimit)
5745
+ throw Error("max depth exceeded");
5746
+ let object = {};
5747
+ if (options.objects || options.defaults)
5748
+ object.other = {};
5749
+ if (message.description != null && message.hasOwnProperty("description")) {
5750
+ object.description = message.description;
5751
+ if (options.oneofs)
5752
+ object._description = "description";
5753
+ }
5754
+ if (message.alias != null && message.hasOwnProperty("alias")) {
5755
+ object.alias = message.alias;
5756
+ if (options.oneofs)
5757
+ object._alias = "alias";
5758
+ }
5759
+ if (message.docstring != null && message.hasOwnProperty("docstring")) {
5760
+ object.docstring = message.docstring;
5761
+ if (options.oneofs)
5762
+ object._docstring = "docstring";
5763
+ }
5764
+ let keys2;
5765
+ if (message.other && (keys2 = Object.keys(message.other)).length) {
5766
+ object.other = {};
5767
+ for (let j = 0; j < keys2.length; ++j) {
5768
+ if (keys2[j] === "__proto__")
5769
+ $util.makeProp(object.other, keys2[j]);
5770
+ object.other[keys2[j]] = message.other[keys2[j]];
5771
+ }
5772
+ }
5773
+ return object;
5774
+ };
5775
+
5776
+ /**
5777
+ * Converts this BamlTyMetadata to JSON.
5778
+ * @function toJSON
5779
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5780
+ * @instance
5781
+ * @returns {Object.<string,*>} JSON object
5782
+ */
5783
+ BamlTyMetadata.prototype.toJSON = function toJSON() {
5784
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
5785
+ };
5786
+
5787
+ /**
5788
+ * Gets the default type url for BamlTyMetadata
5789
+ * @function getTypeUrl
5790
+ * @memberof baml_bridge.cffi.v1.BamlTyMetadata
5791
+ * @static
5792
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
5793
+ * @returns {string} The default type url
5794
+ */
5795
+ BamlTyMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
5796
+ if (typeUrlPrefix === undefined) {
5797
+ typeUrlPrefix = "type.googleapis.com";
5798
+ }
5799
+ return typeUrlPrefix + "/baml_bridge.cffi.v1.BamlTyMetadata";
5800
+ };
5801
+
5802
+ return BamlTyMetadata;
5803
+ })();
5804
+
5805
+ v1.BamlClassDef = (function() {
5806
+
5807
+ /**
5808
+ * Properties of a BamlClassDef.
5809
+ * @memberof baml_bridge.cffi.v1
5810
+ * @interface IBamlClassDef
5811
+ * @property {string|null} [name] BamlClassDef name
5812
+ * @property {Array.<baml_bridge.cffi.v1.IBamlClassFieldDef>|null} [fields] BamlClassDef fields
5813
+ * @property {baml_bridge.cffi.v1.IBamlTyMetadata|null} [metadata] BamlClassDef metadata
5814
+ * @property {number|null} [genericParamCount] BamlClassDef genericParamCount
5815
+ */
5816
+
5817
+ /**
5818
+ * Constructs a new BamlClassDef.
5819
+ * @memberof baml_bridge.cffi.v1
5820
+ * @classdesc Represents a BamlClassDef.
5821
+ * @implements IBamlClassDef
5822
+ * @constructor
5823
+ * @param {baml_bridge.cffi.v1.IBamlClassDef=} [properties] Properties to set
5824
+ */
5825
+ function BamlClassDef(properties) {
5826
+ this.fields = [];
5827
+ if (properties)
5828
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
5829
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
5830
+ this[keys[i]] = properties[keys[i]];
5831
+ }
5832
+
5833
+ /**
5834
+ * BamlClassDef name.
5835
+ * @member {string} name
5836
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
5837
+ * @instance
5838
+ */
5839
+ BamlClassDef.prototype.name = "";
5840
+
5841
+ /**
5842
+ * BamlClassDef fields.
5843
+ * @member {Array.<baml_bridge.cffi.v1.IBamlClassFieldDef>} fields
5844
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
5845
+ * @instance
5846
+ */
5847
+ BamlClassDef.prototype.fields = $util.emptyArray;
5848
+
5849
+ /**
5850
+ * BamlClassDef metadata.
5851
+ * @member {baml_bridge.cffi.v1.IBamlTyMetadata|null|undefined} metadata
5852
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
5853
+ * @instance
5854
+ */
5855
+ BamlClassDef.prototype.metadata = null;
5856
+
5857
+ /**
5858
+ * BamlClassDef genericParamCount.
5859
+ * @member {number} genericParamCount
5860
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
5861
+ * @instance
5862
+ */
5863
+ BamlClassDef.prototype.genericParamCount = 0;
5864
+
5865
+ /**
5866
+ * Creates a new BamlClassDef instance using the specified properties.
5867
+ * @function create
5868
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
5869
+ * @static
5870
+ * @param {baml_bridge.cffi.v1.IBamlClassDef=} [properties] Properties to set
5871
+ * @returns {baml_bridge.cffi.v1.BamlClassDef} BamlClassDef instance
5872
+ */
5873
+ BamlClassDef.create = function create(properties) {
5874
+ return new BamlClassDef(properties);
5875
+ };
5876
+
5877
+ /**
5878
+ * Encodes the specified BamlClassDef message. Does not implicitly {@link baml_bridge.cffi.v1.BamlClassDef.verify|verify} messages.
5879
+ * @function encode
5880
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
5881
+ * @static
5882
+ * @param {baml_bridge.cffi.v1.IBamlClassDef} message BamlClassDef message or plain object to encode
5883
+ * @param {$protobuf.Writer} [writer] Writer to encode to
5884
+ * @returns {$protobuf.Writer} Writer
5885
+ */
5886
+ BamlClassDef.encode = function encode(message, writer, q) {
5887
+ if (!writer)
5888
+ writer = $Writer.create();
5889
+ if (q === undefined)
5890
+ q = 0;
5891
+ if (q > $util.recursionLimit)
5892
+ throw Error("max depth exceeded");
5893
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
5894
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
5895
+ if (message.fields != null && message.fields.length)
5896
+ for (let i = 0; i < message.fields.length; ++i)
5897
+ $root.baml_bridge.cffi.v1.BamlClassFieldDef.encode(message.fields[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim();
5898
+ if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata"))
5899
+ $root.baml_bridge.cffi.v1.BamlTyMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim();
5900
+ if (message.genericParamCount != null && Object.hasOwnProperty.call(message, "genericParamCount"))
5901
+ writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.genericParamCount);
5902
+ return writer;
5903
+ };
5904
+
5905
+ /**
5906
+ * Encodes the specified BamlClassDef message, length delimited. Does not implicitly {@link baml_bridge.cffi.v1.BamlClassDef.verify|verify} messages.
5907
+ * @function encodeDelimited
5908
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
5909
+ * @static
5910
+ * @param {baml_bridge.cffi.v1.IBamlClassDef} message BamlClassDef message or plain object to encode
5911
+ * @param {$protobuf.Writer} [writer] Writer to encode to
5912
+ * @returns {$protobuf.Writer} Writer
5913
+ */
5914
+ BamlClassDef.encodeDelimited = function encodeDelimited(message, writer) {
5915
+ return this.encode(message, writer).ldelim();
5916
+ };
5917
+
5918
+ /**
5919
+ * Decodes a BamlClassDef message from the specified reader or buffer.
5920
+ * @function decode
5921
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
5922
+ * @static
5923
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5924
+ * @param {number} [length] Message length if known beforehand
5925
+ * @returns {baml_bridge.cffi.v1.BamlClassDef} BamlClassDef
5926
+ * @throws {Error} If the payload is not a reader or valid buffer
5927
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
5928
+ */
5929
+ BamlClassDef.decode = function decode(reader, length, error, long) {
5930
+ if (!(reader instanceof $Reader))
5931
+ reader = $Reader.create(reader);
5932
+ if (long === undefined)
5933
+ long = 0;
5934
+ if (long > $Reader.recursionLimit)
5935
+ throw Error("maximum nesting depth exceeded");
5936
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.baml_bridge.cffi.v1.BamlClassDef();
5937
+ while (reader.pos < end) {
5938
+ let tag = reader.uint32();
5939
+ if (tag === error)
5940
+ break;
5941
+ switch (tag >>> 3) {
5942
+ case 1: {
5943
+ message.name = reader.string();
5944
+ break;
5945
+ }
5946
+ case 2: {
5947
+ if (!(message.fields && message.fields.length))
5948
+ message.fields = [];
5949
+ message.fields.push($root.baml_bridge.cffi.v1.BamlClassFieldDef.decode(reader, reader.uint32(), undefined, long + 1));
5950
+ break;
5951
+ }
5952
+ case 3: {
5953
+ message.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.decode(reader, reader.uint32(), undefined, long + 1);
5954
+ break;
5955
+ }
5956
+ case 4: {
5957
+ message.genericParamCount = reader.uint32();
5958
+ break;
5959
+ }
5960
+ default:
5961
+ reader.skipType(tag & 7, long);
5962
+ break;
5963
+ }
5964
+ }
5965
+ return message;
5966
+ };
5967
+
5968
+ /**
5969
+ * Decodes a BamlClassDef message from the specified reader or buffer, length delimited.
5970
+ * @function decodeDelimited
5971
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
5972
+ * @static
5973
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5974
+ * @returns {baml_bridge.cffi.v1.BamlClassDef} BamlClassDef
5975
+ * @throws {Error} If the payload is not a reader or valid buffer
5976
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
5977
+ */
5978
+ BamlClassDef.decodeDelimited = function decodeDelimited(reader) {
5979
+ if (!(reader instanceof $Reader))
5980
+ reader = new $Reader(reader);
5981
+ return this.decode(reader, reader.uint32());
5982
+ };
5983
+
5984
+ /**
5985
+ * Verifies a BamlClassDef message.
5986
+ * @function verify
5987
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
5988
+ * @static
5989
+ * @param {Object.<string,*>} message Plain object to verify
5990
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
5991
+ */
5992
+ BamlClassDef.verify = function verify(message, long) {
5993
+ if (typeof message !== "object" || message === null)
5994
+ return "object expected";
5995
+ if (long === undefined)
5996
+ long = 0;
5997
+ if (long > $util.recursionLimit)
5998
+ return "maximum nesting depth exceeded";
5999
+ if (message.name != null && message.hasOwnProperty("name"))
6000
+ if (!$util.isString(message.name))
6001
+ return "name: string expected";
6002
+ if (message.fields != null && message.hasOwnProperty("fields")) {
6003
+ if (!Array.isArray(message.fields))
6004
+ return "fields: array expected";
6005
+ for (let i = 0; i < message.fields.length; ++i) {
6006
+ let error = $root.baml_bridge.cffi.v1.BamlClassFieldDef.verify(message.fields[i], long + 1);
6007
+ if (error)
6008
+ return "fields." + error;
6009
+ }
6010
+ }
6011
+ if (message.metadata != null && message.hasOwnProperty("metadata")) {
6012
+ let error = $root.baml_bridge.cffi.v1.BamlTyMetadata.verify(message.metadata, long + 1);
6013
+ if (error)
6014
+ return "metadata." + error;
6015
+ }
6016
+ if (message.genericParamCount != null && message.hasOwnProperty("genericParamCount"))
6017
+ if (!$util.isInteger(message.genericParamCount))
6018
+ return "genericParamCount: integer expected";
6019
+ return null;
6020
+ };
6021
+
6022
+ /**
6023
+ * Creates a BamlClassDef message from a plain object. Also converts values to their respective internal types.
6024
+ * @function fromObject
6025
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
6026
+ * @static
6027
+ * @param {Object.<string,*>} object Plain object
6028
+ * @returns {baml_bridge.cffi.v1.BamlClassDef} BamlClassDef
6029
+ */
6030
+ BamlClassDef.fromObject = function fromObject(object, long) {
6031
+ if (object instanceof $root.baml_bridge.cffi.v1.BamlClassDef)
6032
+ return object;
6033
+ if (!$util.isObject(object))
6034
+ throw TypeError(".baml_bridge.cffi.v1.BamlClassDef: object expected");
6035
+ if (long === undefined)
6036
+ long = 0;
6037
+ if (long > $util.recursionLimit)
6038
+ throw Error("maximum nesting depth exceeded");
6039
+ let message = new $root.baml_bridge.cffi.v1.BamlClassDef();
6040
+ if (object.name != null)
6041
+ message.name = String(object.name);
6042
+ if (object.fields) {
6043
+ if (!Array.isArray(object.fields))
6044
+ throw TypeError(".baml_bridge.cffi.v1.BamlClassDef.fields: array expected");
6045
+ message.fields = [];
6046
+ for (let i = 0; i < object.fields.length; ++i) {
6047
+ if (!$util.isObject(object.fields[i]))
6048
+ throw TypeError(".baml_bridge.cffi.v1.BamlClassDef.fields: object expected");
6049
+ message.fields[i] = $root.baml_bridge.cffi.v1.BamlClassFieldDef.fromObject(object.fields[i], long + 1);
6050
+ }
6051
+ }
6052
+ if (object.metadata != null) {
6053
+ if (!$util.isObject(object.metadata))
6054
+ throw TypeError(".baml_bridge.cffi.v1.BamlClassDef.metadata: object expected");
6055
+ message.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.fromObject(object.metadata, long + 1);
6056
+ }
6057
+ if (object.genericParamCount != null)
6058
+ message.genericParamCount = object.genericParamCount >>> 0;
6059
+ return message;
6060
+ };
6061
+
6062
+ /**
6063
+ * Creates a plain object from a BamlClassDef message. Also converts values to other types if specified.
6064
+ * @function toObject
6065
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
6066
+ * @static
6067
+ * @param {baml_bridge.cffi.v1.BamlClassDef} message BamlClassDef
6068
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
6069
+ * @returns {Object.<string,*>} Plain object
6070
+ */
6071
+ BamlClassDef.toObject = function toObject(message, options, q) {
6072
+ if (!options)
6073
+ options = {};
6074
+ if (q === undefined)
6075
+ q = 0;
6076
+ if (q > $util.recursionLimit)
6077
+ throw Error("max depth exceeded");
6078
+ let object = {};
6079
+ if (options.arrays || options.defaults)
6080
+ object.fields = [];
6081
+ if (options.defaults) {
6082
+ object.name = "";
6083
+ object.metadata = null;
6084
+ object.genericParamCount = 0;
6085
+ }
6086
+ if (message.name != null && message.hasOwnProperty("name"))
6087
+ object.name = message.name;
6088
+ if (message.fields && message.fields.length) {
6089
+ object.fields = [];
6090
+ for (let j = 0; j < message.fields.length; ++j)
6091
+ object.fields[j] = $root.baml_bridge.cffi.v1.BamlClassFieldDef.toObject(message.fields[j], options, q + 1);
6092
+ }
6093
+ if (message.metadata != null && message.hasOwnProperty("metadata"))
6094
+ object.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.toObject(message.metadata, options, q + 1);
6095
+ if (message.genericParamCount != null && message.hasOwnProperty("genericParamCount"))
6096
+ object.genericParamCount = message.genericParamCount;
6097
+ return object;
6098
+ };
6099
+
6100
+ /**
6101
+ * Converts this BamlClassDef to JSON.
6102
+ * @function toJSON
6103
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
6104
+ * @instance
6105
+ * @returns {Object.<string,*>} JSON object
6106
+ */
6107
+ BamlClassDef.prototype.toJSON = function toJSON() {
6108
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
6109
+ };
6110
+
6111
+ /**
6112
+ * Gets the default type url for BamlClassDef
6113
+ * @function getTypeUrl
6114
+ * @memberof baml_bridge.cffi.v1.BamlClassDef
6115
+ * @static
6116
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
6117
+ * @returns {string} The default type url
6118
+ */
6119
+ BamlClassDef.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
6120
+ if (typeUrlPrefix === undefined) {
6121
+ typeUrlPrefix = "type.googleapis.com";
6122
+ }
6123
+ return typeUrlPrefix + "/baml_bridge.cffi.v1.BamlClassDef";
6124
+ };
6125
+
6126
+ return BamlClassDef;
6127
+ })();
6128
+
6129
+ v1.BamlClassFieldDef = (function() {
6130
+
6131
+ /**
6132
+ * Properties of a BamlClassFieldDef.
6133
+ * @memberof baml_bridge.cffi.v1
6134
+ * @interface IBamlClassFieldDef
6135
+ * @property {string|null} [name] BamlClassFieldDef name
6136
+ * @property {baml_bridge.cffi.v1.IBamlTy|null} [ty] BamlClassFieldDef ty
6137
+ * @property {baml_bridge.cffi.v1.IBamlTyMetadata|null} [metadata] BamlClassFieldDef metadata
6138
+ * @property {boolean|null} [skip] BamlClassFieldDef skip
6139
+ */
6140
+
6141
+ /**
6142
+ * Constructs a new BamlClassFieldDef.
6143
+ * @memberof baml_bridge.cffi.v1
6144
+ * @classdesc Represents a BamlClassFieldDef.
6145
+ * @implements IBamlClassFieldDef
6146
+ * @constructor
6147
+ * @param {baml_bridge.cffi.v1.IBamlClassFieldDef=} [properties] Properties to set
6148
+ */
6149
+ function BamlClassFieldDef(properties) {
6150
+ if (properties)
6151
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
6152
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
6153
+ this[keys[i]] = properties[keys[i]];
6154
+ }
6155
+
6156
+ /**
6157
+ * BamlClassFieldDef name.
6158
+ * @member {string} name
6159
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6160
+ * @instance
6161
+ */
6162
+ BamlClassFieldDef.prototype.name = "";
6163
+
6164
+ /**
6165
+ * BamlClassFieldDef ty.
6166
+ * @member {baml_bridge.cffi.v1.IBamlTy|null|undefined} ty
6167
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6168
+ * @instance
6169
+ */
6170
+ BamlClassFieldDef.prototype.ty = null;
6171
+
6172
+ /**
6173
+ * BamlClassFieldDef metadata.
6174
+ * @member {baml_bridge.cffi.v1.IBamlTyMetadata|null|undefined} metadata
6175
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6176
+ * @instance
6177
+ */
6178
+ BamlClassFieldDef.prototype.metadata = null;
6179
+
6180
+ /**
6181
+ * BamlClassFieldDef skip.
6182
+ * @member {boolean} skip
6183
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6184
+ * @instance
6185
+ */
6186
+ BamlClassFieldDef.prototype.skip = false;
6187
+
6188
+ /**
6189
+ * Creates a new BamlClassFieldDef instance using the specified properties.
6190
+ * @function create
6191
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6192
+ * @static
6193
+ * @param {baml_bridge.cffi.v1.IBamlClassFieldDef=} [properties] Properties to set
6194
+ * @returns {baml_bridge.cffi.v1.BamlClassFieldDef} BamlClassFieldDef instance
6195
+ */
6196
+ BamlClassFieldDef.create = function create(properties) {
6197
+ return new BamlClassFieldDef(properties);
6198
+ };
6199
+
6200
+ /**
6201
+ * Encodes the specified BamlClassFieldDef message. Does not implicitly {@link baml_bridge.cffi.v1.BamlClassFieldDef.verify|verify} messages.
6202
+ * @function encode
6203
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6204
+ * @static
6205
+ * @param {baml_bridge.cffi.v1.IBamlClassFieldDef} message BamlClassFieldDef message or plain object to encode
6206
+ * @param {$protobuf.Writer} [writer] Writer to encode to
6207
+ * @returns {$protobuf.Writer} Writer
6208
+ */
6209
+ BamlClassFieldDef.encode = function encode(message, writer, q) {
6210
+ if (!writer)
6211
+ writer = $Writer.create();
6212
+ if (q === undefined)
6213
+ q = 0;
6214
+ if (q > $util.recursionLimit)
6215
+ throw Error("max depth exceeded");
6216
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
6217
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
6218
+ if (message.ty != null && Object.hasOwnProperty.call(message, "ty"))
6219
+ $root.baml_bridge.cffi.v1.BamlTy.encode(message.ty, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim();
6220
+ if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata"))
6221
+ $root.baml_bridge.cffi.v1.BamlTyMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim();
6222
+ if (message.skip != null && Object.hasOwnProperty.call(message, "skip"))
6223
+ writer.uint32(/* id 4, wireType 0 =*/32).bool(message.skip);
6224
+ return writer;
6225
+ };
6226
+
6227
+ /**
6228
+ * Encodes the specified BamlClassFieldDef message, length delimited. Does not implicitly {@link baml_bridge.cffi.v1.BamlClassFieldDef.verify|verify} messages.
6229
+ * @function encodeDelimited
6230
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6231
+ * @static
6232
+ * @param {baml_bridge.cffi.v1.IBamlClassFieldDef} message BamlClassFieldDef message or plain object to encode
6233
+ * @param {$protobuf.Writer} [writer] Writer to encode to
6234
+ * @returns {$protobuf.Writer} Writer
6235
+ */
6236
+ BamlClassFieldDef.encodeDelimited = function encodeDelimited(message, writer) {
6237
+ return this.encode(message, writer).ldelim();
6238
+ };
6239
+
6240
+ /**
6241
+ * Decodes a BamlClassFieldDef message from the specified reader or buffer.
6242
+ * @function decode
6243
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6244
+ * @static
6245
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6246
+ * @param {number} [length] Message length if known beforehand
6247
+ * @returns {baml_bridge.cffi.v1.BamlClassFieldDef} BamlClassFieldDef
6248
+ * @throws {Error} If the payload is not a reader or valid buffer
6249
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
6250
+ */
6251
+ BamlClassFieldDef.decode = function decode(reader, length, error, long) {
6252
+ if (!(reader instanceof $Reader))
6253
+ reader = $Reader.create(reader);
6254
+ if (long === undefined)
6255
+ long = 0;
6256
+ if (long > $Reader.recursionLimit)
6257
+ throw Error("maximum nesting depth exceeded");
6258
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.baml_bridge.cffi.v1.BamlClassFieldDef();
6259
+ while (reader.pos < end) {
6260
+ let tag = reader.uint32();
6261
+ if (tag === error)
6262
+ break;
6263
+ switch (tag >>> 3) {
6264
+ case 1: {
6265
+ message.name = reader.string();
6266
+ break;
6267
+ }
6268
+ case 2: {
6269
+ message.ty = $root.baml_bridge.cffi.v1.BamlTy.decode(reader, reader.uint32(), undefined, long + 1);
6270
+ break;
6271
+ }
6272
+ case 3: {
6273
+ message.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.decode(reader, reader.uint32(), undefined, long + 1);
6274
+ break;
6275
+ }
6276
+ case 4: {
6277
+ message.skip = reader.bool();
6278
+ break;
6279
+ }
6280
+ default:
6281
+ reader.skipType(tag & 7, long);
6282
+ break;
6283
+ }
6284
+ }
6285
+ return message;
6286
+ };
6287
+
6288
+ /**
6289
+ * Decodes a BamlClassFieldDef message from the specified reader or buffer, length delimited.
6290
+ * @function decodeDelimited
6291
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6292
+ * @static
6293
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6294
+ * @returns {baml_bridge.cffi.v1.BamlClassFieldDef} BamlClassFieldDef
6295
+ * @throws {Error} If the payload is not a reader or valid buffer
6296
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
6297
+ */
6298
+ BamlClassFieldDef.decodeDelimited = function decodeDelimited(reader) {
6299
+ if (!(reader instanceof $Reader))
6300
+ reader = new $Reader(reader);
6301
+ return this.decode(reader, reader.uint32());
6302
+ };
6303
+
6304
+ /**
6305
+ * Verifies a BamlClassFieldDef message.
6306
+ * @function verify
6307
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6308
+ * @static
6309
+ * @param {Object.<string,*>} message Plain object to verify
6310
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
6311
+ */
6312
+ BamlClassFieldDef.verify = function verify(message, long) {
6313
+ if (typeof message !== "object" || message === null)
6314
+ return "object expected";
6315
+ if (long === undefined)
6316
+ long = 0;
6317
+ if (long > $util.recursionLimit)
6318
+ return "maximum nesting depth exceeded";
6319
+ if (message.name != null && message.hasOwnProperty("name"))
6320
+ if (!$util.isString(message.name))
6321
+ return "name: string expected";
6322
+ if (message.ty != null && message.hasOwnProperty("ty")) {
6323
+ let error = $root.baml_bridge.cffi.v1.BamlTy.verify(message.ty, long + 1);
6324
+ if (error)
6325
+ return "ty." + error;
6326
+ }
6327
+ if (message.metadata != null && message.hasOwnProperty("metadata")) {
6328
+ let error = $root.baml_bridge.cffi.v1.BamlTyMetadata.verify(message.metadata, long + 1);
6329
+ if (error)
6330
+ return "metadata." + error;
6331
+ }
6332
+ if (message.skip != null && message.hasOwnProperty("skip"))
6333
+ if (typeof message.skip !== "boolean")
6334
+ return "skip: boolean expected";
6335
+ return null;
6336
+ };
6337
+
6338
+ /**
6339
+ * Creates a BamlClassFieldDef message from a plain object. Also converts values to their respective internal types.
6340
+ * @function fromObject
6341
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6342
+ * @static
6343
+ * @param {Object.<string,*>} object Plain object
6344
+ * @returns {baml_bridge.cffi.v1.BamlClassFieldDef} BamlClassFieldDef
6345
+ */
6346
+ BamlClassFieldDef.fromObject = function fromObject(object, long) {
6347
+ if (object instanceof $root.baml_bridge.cffi.v1.BamlClassFieldDef)
6348
+ return object;
6349
+ if (!$util.isObject(object))
6350
+ throw TypeError(".baml_bridge.cffi.v1.BamlClassFieldDef: object expected");
6351
+ if (long === undefined)
6352
+ long = 0;
6353
+ if (long > $util.recursionLimit)
6354
+ throw Error("maximum nesting depth exceeded");
6355
+ let message = new $root.baml_bridge.cffi.v1.BamlClassFieldDef();
6356
+ if (object.name != null)
6357
+ message.name = String(object.name);
6358
+ if (object.ty != null) {
6359
+ if (!$util.isObject(object.ty))
6360
+ throw TypeError(".baml_bridge.cffi.v1.BamlClassFieldDef.ty: object expected");
6361
+ message.ty = $root.baml_bridge.cffi.v1.BamlTy.fromObject(object.ty, long + 1);
6362
+ }
6363
+ if (object.metadata != null) {
6364
+ if (!$util.isObject(object.metadata))
6365
+ throw TypeError(".baml_bridge.cffi.v1.BamlClassFieldDef.metadata: object expected");
6366
+ message.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.fromObject(object.metadata, long + 1);
6367
+ }
6368
+ if (object.skip != null)
6369
+ message.skip = Boolean(object.skip);
6370
+ return message;
6371
+ };
6372
+
6373
+ /**
6374
+ * Creates a plain object from a BamlClassFieldDef message. Also converts values to other types if specified.
6375
+ * @function toObject
6376
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6377
+ * @static
6378
+ * @param {baml_bridge.cffi.v1.BamlClassFieldDef} message BamlClassFieldDef
6379
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
6380
+ * @returns {Object.<string,*>} Plain object
6381
+ */
6382
+ BamlClassFieldDef.toObject = function toObject(message, options, q) {
6383
+ if (!options)
6384
+ options = {};
6385
+ if (q === undefined)
6386
+ q = 0;
6387
+ if (q > $util.recursionLimit)
6388
+ throw Error("max depth exceeded");
6389
+ let object = {};
6390
+ if (options.defaults) {
6391
+ object.name = "";
6392
+ object.ty = null;
6393
+ object.metadata = null;
6394
+ object.skip = false;
6395
+ }
6396
+ if (message.name != null && message.hasOwnProperty("name"))
6397
+ object.name = message.name;
6398
+ if (message.ty != null && message.hasOwnProperty("ty"))
6399
+ object.ty = $root.baml_bridge.cffi.v1.BamlTy.toObject(message.ty, options, q + 1);
6400
+ if (message.metadata != null && message.hasOwnProperty("metadata"))
6401
+ object.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.toObject(message.metadata, options, q + 1);
6402
+ if (message.skip != null && message.hasOwnProperty("skip"))
6403
+ object.skip = message.skip;
6404
+ return object;
6405
+ };
6406
+
6407
+ /**
6408
+ * Converts this BamlClassFieldDef to JSON.
6409
+ * @function toJSON
6410
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6411
+ * @instance
6412
+ * @returns {Object.<string,*>} JSON object
6413
+ */
6414
+ BamlClassFieldDef.prototype.toJSON = function toJSON() {
6415
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
6416
+ };
6417
+
6418
+ /**
6419
+ * Gets the default type url for BamlClassFieldDef
6420
+ * @function getTypeUrl
6421
+ * @memberof baml_bridge.cffi.v1.BamlClassFieldDef
6422
+ * @static
6423
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
6424
+ * @returns {string} The default type url
6425
+ */
6426
+ BamlClassFieldDef.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
6427
+ if (typeUrlPrefix === undefined) {
6428
+ typeUrlPrefix = "type.googleapis.com";
6429
+ }
6430
+ return typeUrlPrefix + "/baml_bridge.cffi.v1.BamlClassFieldDef";
6431
+ };
6432
+
6433
+ return BamlClassFieldDef;
6434
+ })();
6435
+
6436
+ v1.BamlEnumDef = (function() {
6437
+
6438
+ /**
6439
+ * Properties of a BamlEnumDef.
6440
+ * @memberof baml_bridge.cffi.v1
6441
+ * @interface IBamlEnumDef
6442
+ * @property {string|null} [name] BamlEnumDef name
6443
+ * @property {Array.<baml_bridge.cffi.v1.IBamlEnumVariantDef>|null} [variants] BamlEnumDef variants
6444
+ * @property {baml_bridge.cffi.v1.IBamlTyMetadata|null} [metadata] BamlEnumDef metadata
6445
+ */
6446
+
6447
+ /**
6448
+ * Constructs a new BamlEnumDef.
6449
+ * @memberof baml_bridge.cffi.v1
6450
+ * @classdesc Represents a BamlEnumDef.
6451
+ * @implements IBamlEnumDef
6452
+ * @constructor
6453
+ * @param {baml_bridge.cffi.v1.IBamlEnumDef=} [properties] Properties to set
6454
+ */
6455
+ function BamlEnumDef(properties) {
6456
+ this.variants = [];
6457
+ if (properties)
6458
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
6459
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
6460
+ this[keys[i]] = properties[keys[i]];
6461
+ }
6462
+
6463
+ /**
6464
+ * BamlEnumDef name.
6465
+ * @member {string} name
6466
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6467
+ * @instance
6468
+ */
6469
+ BamlEnumDef.prototype.name = "";
6470
+
6471
+ /**
6472
+ * BamlEnumDef variants.
6473
+ * @member {Array.<baml_bridge.cffi.v1.IBamlEnumVariantDef>} variants
6474
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6475
+ * @instance
6476
+ */
6477
+ BamlEnumDef.prototype.variants = $util.emptyArray;
6478
+
6479
+ /**
6480
+ * BamlEnumDef metadata.
6481
+ * @member {baml_bridge.cffi.v1.IBamlTyMetadata|null|undefined} metadata
6482
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6483
+ * @instance
6484
+ */
6485
+ BamlEnumDef.prototype.metadata = null;
6486
+
6487
+ /**
6488
+ * Creates a new BamlEnumDef instance using the specified properties.
6489
+ * @function create
6490
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6491
+ * @static
6492
+ * @param {baml_bridge.cffi.v1.IBamlEnumDef=} [properties] Properties to set
6493
+ * @returns {baml_bridge.cffi.v1.BamlEnumDef} BamlEnumDef instance
6494
+ */
6495
+ BamlEnumDef.create = function create(properties) {
6496
+ return new BamlEnumDef(properties);
6497
+ };
6498
+
6499
+ /**
6500
+ * Encodes the specified BamlEnumDef message. Does not implicitly {@link baml_bridge.cffi.v1.BamlEnumDef.verify|verify} messages.
6501
+ * @function encode
6502
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6503
+ * @static
6504
+ * @param {baml_bridge.cffi.v1.IBamlEnumDef} message BamlEnumDef message or plain object to encode
6505
+ * @param {$protobuf.Writer} [writer] Writer to encode to
6506
+ * @returns {$protobuf.Writer} Writer
6507
+ */
6508
+ BamlEnumDef.encode = function encode(message, writer, q) {
6509
+ if (!writer)
6510
+ writer = $Writer.create();
6511
+ if (q === undefined)
6512
+ q = 0;
6513
+ if (q > $util.recursionLimit)
6514
+ throw Error("max depth exceeded");
6515
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
6516
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
6517
+ if (message.variants != null && message.variants.length)
6518
+ for (let i = 0; i < message.variants.length; ++i)
6519
+ $root.baml_bridge.cffi.v1.BamlEnumVariantDef.encode(message.variants[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim();
6520
+ if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata"))
6521
+ $root.baml_bridge.cffi.v1.BamlTyMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim();
6522
+ return writer;
6523
+ };
6524
+
6525
+ /**
6526
+ * Encodes the specified BamlEnumDef message, length delimited. Does not implicitly {@link baml_bridge.cffi.v1.BamlEnumDef.verify|verify} messages.
6527
+ * @function encodeDelimited
6528
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6529
+ * @static
6530
+ * @param {baml_bridge.cffi.v1.IBamlEnumDef} message BamlEnumDef message or plain object to encode
6531
+ * @param {$protobuf.Writer} [writer] Writer to encode to
6532
+ * @returns {$protobuf.Writer} Writer
6533
+ */
6534
+ BamlEnumDef.encodeDelimited = function encodeDelimited(message, writer) {
6535
+ return this.encode(message, writer).ldelim();
6536
+ };
6537
+
6538
+ /**
6539
+ * Decodes a BamlEnumDef message from the specified reader or buffer.
6540
+ * @function decode
6541
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6542
+ * @static
6543
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6544
+ * @param {number} [length] Message length if known beforehand
6545
+ * @returns {baml_bridge.cffi.v1.BamlEnumDef} BamlEnumDef
6546
+ * @throws {Error} If the payload is not a reader or valid buffer
6547
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
6548
+ */
6549
+ BamlEnumDef.decode = function decode(reader, length, error, long) {
6550
+ if (!(reader instanceof $Reader))
6551
+ reader = $Reader.create(reader);
6552
+ if (long === undefined)
6553
+ long = 0;
6554
+ if (long > $Reader.recursionLimit)
6555
+ throw Error("maximum nesting depth exceeded");
6556
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.baml_bridge.cffi.v1.BamlEnumDef();
6557
+ while (reader.pos < end) {
6558
+ let tag = reader.uint32();
6559
+ if (tag === error)
6560
+ break;
6561
+ switch (tag >>> 3) {
6562
+ case 1: {
6563
+ message.name = reader.string();
6564
+ break;
6565
+ }
6566
+ case 2: {
6567
+ if (!(message.variants && message.variants.length))
6568
+ message.variants = [];
6569
+ message.variants.push($root.baml_bridge.cffi.v1.BamlEnumVariantDef.decode(reader, reader.uint32(), undefined, long + 1));
6570
+ break;
6571
+ }
6572
+ case 3: {
6573
+ message.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.decode(reader, reader.uint32(), undefined, long + 1);
6574
+ break;
6575
+ }
6576
+ default:
6577
+ reader.skipType(tag & 7, long);
6578
+ break;
6579
+ }
6580
+ }
6581
+ return message;
6582
+ };
6583
+
6584
+ /**
6585
+ * Decodes a BamlEnumDef message from the specified reader or buffer, length delimited.
6586
+ * @function decodeDelimited
6587
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6588
+ * @static
6589
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6590
+ * @returns {baml_bridge.cffi.v1.BamlEnumDef} BamlEnumDef
6591
+ * @throws {Error} If the payload is not a reader or valid buffer
6592
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
6593
+ */
6594
+ BamlEnumDef.decodeDelimited = function decodeDelimited(reader) {
6595
+ if (!(reader instanceof $Reader))
6596
+ reader = new $Reader(reader);
6597
+ return this.decode(reader, reader.uint32());
6598
+ };
6599
+
6600
+ /**
6601
+ * Verifies a BamlEnumDef message.
6602
+ * @function verify
6603
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6604
+ * @static
6605
+ * @param {Object.<string,*>} message Plain object to verify
6606
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
6607
+ */
6608
+ BamlEnumDef.verify = function verify(message, long) {
6609
+ if (typeof message !== "object" || message === null)
6610
+ return "object expected";
6611
+ if (long === undefined)
6612
+ long = 0;
6613
+ if (long > $util.recursionLimit)
6614
+ return "maximum nesting depth exceeded";
6615
+ if (message.name != null && message.hasOwnProperty("name"))
6616
+ if (!$util.isString(message.name))
6617
+ return "name: string expected";
6618
+ if (message.variants != null && message.hasOwnProperty("variants")) {
6619
+ if (!Array.isArray(message.variants))
6620
+ return "variants: array expected";
6621
+ for (let i = 0; i < message.variants.length; ++i) {
6622
+ let error = $root.baml_bridge.cffi.v1.BamlEnumVariantDef.verify(message.variants[i], long + 1);
6623
+ if (error)
6624
+ return "variants." + error;
6625
+ }
6626
+ }
6627
+ if (message.metadata != null && message.hasOwnProperty("metadata")) {
6628
+ let error = $root.baml_bridge.cffi.v1.BamlTyMetadata.verify(message.metadata, long + 1);
6629
+ if (error)
6630
+ return "metadata." + error;
6631
+ }
6632
+ return null;
6633
+ };
6634
+
6635
+ /**
6636
+ * Creates a BamlEnumDef message from a plain object. Also converts values to their respective internal types.
6637
+ * @function fromObject
6638
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6639
+ * @static
6640
+ * @param {Object.<string,*>} object Plain object
6641
+ * @returns {baml_bridge.cffi.v1.BamlEnumDef} BamlEnumDef
6642
+ */
6643
+ BamlEnumDef.fromObject = function fromObject(object, long) {
6644
+ if (object instanceof $root.baml_bridge.cffi.v1.BamlEnumDef)
6645
+ return object;
6646
+ if (!$util.isObject(object))
6647
+ throw TypeError(".baml_bridge.cffi.v1.BamlEnumDef: object expected");
6648
+ if (long === undefined)
6649
+ long = 0;
6650
+ if (long > $util.recursionLimit)
6651
+ throw Error("maximum nesting depth exceeded");
6652
+ let message = new $root.baml_bridge.cffi.v1.BamlEnumDef();
6653
+ if (object.name != null)
6654
+ message.name = String(object.name);
6655
+ if (object.variants) {
6656
+ if (!Array.isArray(object.variants))
6657
+ throw TypeError(".baml_bridge.cffi.v1.BamlEnumDef.variants: array expected");
6658
+ message.variants = [];
6659
+ for (let i = 0; i < object.variants.length; ++i) {
6660
+ if (!$util.isObject(object.variants[i]))
6661
+ throw TypeError(".baml_bridge.cffi.v1.BamlEnumDef.variants: object expected");
6662
+ message.variants[i] = $root.baml_bridge.cffi.v1.BamlEnumVariantDef.fromObject(object.variants[i], long + 1);
6663
+ }
6664
+ }
6665
+ if (object.metadata != null) {
6666
+ if (!$util.isObject(object.metadata))
6667
+ throw TypeError(".baml_bridge.cffi.v1.BamlEnumDef.metadata: object expected");
6668
+ message.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.fromObject(object.metadata, long + 1);
6669
+ }
6670
+ return message;
6671
+ };
6672
+
6673
+ /**
6674
+ * Creates a plain object from a BamlEnumDef message. Also converts values to other types if specified.
6675
+ * @function toObject
6676
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6677
+ * @static
6678
+ * @param {baml_bridge.cffi.v1.BamlEnumDef} message BamlEnumDef
6679
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
6680
+ * @returns {Object.<string,*>} Plain object
6681
+ */
6682
+ BamlEnumDef.toObject = function toObject(message, options, q) {
6683
+ if (!options)
6684
+ options = {};
6685
+ if (q === undefined)
6686
+ q = 0;
6687
+ if (q > $util.recursionLimit)
6688
+ throw Error("max depth exceeded");
6689
+ let object = {};
6690
+ if (options.arrays || options.defaults)
6691
+ object.variants = [];
6692
+ if (options.defaults) {
6693
+ object.name = "";
6694
+ object.metadata = null;
6695
+ }
6696
+ if (message.name != null && message.hasOwnProperty("name"))
6697
+ object.name = message.name;
6698
+ if (message.variants && message.variants.length) {
6699
+ object.variants = [];
6700
+ for (let j = 0; j < message.variants.length; ++j)
6701
+ object.variants[j] = $root.baml_bridge.cffi.v1.BamlEnumVariantDef.toObject(message.variants[j], options, q + 1);
6702
+ }
6703
+ if (message.metadata != null && message.hasOwnProperty("metadata"))
6704
+ object.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.toObject(message.metadata, options, q + 1);
6705
+ return object;
6706
+ };
6707
+
6708
+ /**
6709
+ * Converts this BamlEnumDef to JSON.
6710
+ * @function toJSON
6711
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6712
+ * @instance
6713
+ * @returns {Object.<string,*>} JSON object
6714
+ */
6715
+ BamlEnumDef.prototype.toJSON = function toJSON() {
6716
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
6717
+ };
6718
+
6719
+ /**
6720
+ * Gets the default type url for BamlEnumDef
6721
+ * @function getTypeUrl
6722
+ * @memberof baml_bridge.cffi.v1.BamlEnumDef
6723
+ * @static
6724
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
6725
+ * @returns {string} The default type url
6726
+ */
6727
+ BamlEnumDef.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
6728
+ if (typeUrlPrefix === undefined) {
6729
+ typeUrlPrefix = "type.googleapis.com";
6730
+ }
6731
+ return typeUrlPrefix + "/baml_bridge.cffi.v1.BamlEnumDef";
6732
+ };
6733
+
6734
+ return BamlEnumDef;
6735
+ })();
6736
+
6737
+ v1.BamlEnumVariantDef = (function() {
6738
+
6739
+ /**
6740
+ * Properties of a BamlEnumVariantDef.
6741
+ * @memberof baml_bridge.cffi.v1
6742
+ * @interface IBamlEnumVariantDef
6743
+ * @property {string|null} [name] BamlEnumVariantDef name
6744
+ * @property {baml_bridge.cffi.v1.IBamlTyMetadata|null} [metadata] BamlEnumVariantDef metadata
6745
+ * @property {boolean|null} [skip] BamlEnumVariantDef skip
6746
+ */
6747
+
6748
+ /**
6749
+ * Constructs a new BamlEnumVariantDef.
6750
+ * @memberof baml_bridge.cffi.v1
6751
+ * @classdesc Represents a BamlEnumVariantDef.
6752
+ * @implements IBamlEnumVariantDef
6753
+ * @constructor
6754
+ * @param {baml_bridge.cffi.v1.IBamlEnumVariantDef=} [properties] Properties to set
6755
+ */
6756
+ function BamlEnumVariantDef(properties) {
6757
+ if (properties)
6758
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
6759
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
6760
+ this[keys[i]] = properties[keys[i]];
6761
+ }
6762
+
6763
+ /**
6764
+ * BamlEnumVariantDef name.
6765
+ * @member {string} name
6766
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
6767
+ * @instance
6768
+ */
6769
+ BamlEnumVariantDef.prototype.name = "";
6770
+
6771
+ /**
6772
+ * BamlEnumVariantDef metadata.
6773
+ * @member {baml_bridge.cffi.v1.IBamlTyMetadata|null|undefined} metadata
6774
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
6775
+ * @instance
6776
+ */
6777
+ BamlEnumVariantDef.prototype.metadata = null;
6778
+
6779
+ /**
6780
+ * BamlEnumVariantDef skip.
6781
+ * @member {boolean} skip
6782
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
6783
+ * @instance
6784
+ */
6785
+ BamlEnumVariantDef.prototype.skip = false;
6786
+
6787
+ /**
6788
+ * Creates a new BamlEnumVariantDef instance using the specified properties.
6789
+ * @function create
6790
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
6791
+ * @static
6792
+ * @param {baml_bridge.cffi.v1.IBamlEnumVariantDef=} [properties] Properties to set
6793
+ * @returns {baml_bridge.cffi.v1.BamlEnumVariantDef} BamlEnumVariantDef instance
6794
+ */
6795
+ BamlEnumVariantDef.create = function create(properties) {
6796
+ return new BamlEnumVariantDef(properties);
6797
+ };
6798
+
6799
+ /**
6800
+ * Encodes the specified BamlEnumVariantDef message. Does not implicitly {@link baml_bridge.cffi.v1.BamlEnumVariantDef.verify|verify} messages.
6801
+ * @function encode
6802
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
6803
+ * @static
6804
+ * @param {baml_bridge.cffi.v1.IBamlEnumVariantDef} message BamlEnumVariantDef message or plain object to encode
6805
+ * @param {$protobuf.Writer} [writer] Writer to encode to
6806
+ * @returns {$protobuf.Writer} Writer
6807
+ */
6808
+ BamlEnumVariantDef.encode = function encode(message, writer, q) {
6809
+ if (!writer)
6810
+ writer = $Writer.create();
6811
+ if (q === undefined)
6812
+ q = 0;
6813
+ if (q > $util.recursionLimit)
6814
+ throw Error("max depth exceeded");
6815
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
6816
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
6817
+ if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata"))
6818
+ $root.baml_bridge.cffi.v1.BamlTyMetadata.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim();
6819
+ if (message.skip != null && Object.hasOwnProperty.call(message, "skip"))
6820
+ writer.uint32(/* id 3, wireType 0 =*/24).bool(message.skip);
6821
+ return writer;
6822
+ };
6823
+
6824
+ /**
6825
+ * Encodes the specified BamlEnumVariantDef message, length delimited. Does not implicitly {@link baml_bridge.cffi.v1.BamlEnumVariantDef.verify|verify} messages.
6826
+ * @function encodeDelimited
6827
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
6828
+ * @static
6829
+ * @param {baml_bridge.cffi.v1.IBamlEnumVariantDef} message BamlEnumVariantDef message or plain object to encode
6830
+ * @param {$protobuf.Writer} [writer] Writer to encode to
6831
+ * @returns {$protobuf.Writer} Writer
6832
+ */
6833
+ BamlEnumVariantDef.encodeDelimited = function encodeDelimited(message, writer) {
6834
+ return this.encode(message, writer).ldelim();
6835
+ };
6836
+
6837
+ /**
6838
+ * Decodes a BamlEnumVariantDef message from the specified reader or buffer.
6839
+ * @function decode
6840
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
6841
+ * @static
6842
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6843
+ * @param {number} [length] Message length if known beforehand
6844
+ * @returns {baml_bridge.cffi.v1.BamlEnumVariantDef} BamlEnumVariantDef
6845
+ * @throws {Error} If the payload is not a reader or valid buffer
6846
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
6847
+ */
6848
+ BamlEnumVariantDef.decode = function decode(reader, length, error, long) {
6849
+ if (!(reader instanceof $Reader))
6850
+ reader = $Reader.create(reader);
6851
+ if (long === undefined)
6852
+ long = 0;
6853
+ if (long > $Reader.recursionLimit)
6854
+ throw Error("maximum nesting depth exceeded");
6855
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.baml_bridge.cffi.v1.BamlEnumVariantDef();
6856
+ while (reader.pos < end) {
6857
+ let tag = reader.uint32();
6858
+ if (tag === error)
6859
+ break;
6860
+ switch (tag >>> 3) {
6861
+ case 1: {
6862
+ message.name = reader.string();
6863
+ break;
6864
+ }
6865
+ case 2: {
6866
+ message.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.decode(reader, reader.uint32(), undefined, long + 1);
6867
+ break;
6868
+ }
6869
+ case 3: {
6870
+ message.skip = reader.bool();
6871
+ break;
6872
+ }
6873
+ default:
6874
+ reader.skipType(tag & 7, long);
6875
+ break;
6876
+ }
6877
+ }
6878
+ return message;
6879
+ };
6880
+
6881
+ /**
6882
+ * Decodes a BamlEnumVariantDef message from the specified reader or buffer, length delimited.
6883
+ * @function decodeDelimited
6884
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
6885
+ * @static
6886
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6887
+ * @returns {baml_bridge.cffi.v1.BamlEnumVariantDef} BamlEnumVariantDef
6888
+ * @throws {Error} If the payload is not a reader or valid buffer
6889
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
6890
+ */
6891
+ BamlEnumVariantDef.decodeDelimited = function decodeDelimited(reader) {
6892
+ if (!(reader instanceof $Reader))
6893
+ reader = new $Reader(reader);
6894
+ return this.decode(reader, reader.uint32());
6895
+ };
6896
+
6897
+ /**
6898
+ * Verifies a BamlEnumVariantDef message.
6899
+ * @function verify
6900
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
6901
+ * @static
6902
+ * @param {Object.<string,*>} message Plain object to verify
6903
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
6904
+ */
6905
+ BamlEnumVariantDef.verify = function verify(message, long) {
6906
+ if (typeof message !== "object" || message === null)
6907
+ return "object expected";
6908
+ if (long === undefined)
6909
+ long = 0;
6910
+ if (long > $util.recursionLimit)
6911
+ return "maximum nesting depth exceeded";
6912
+ if (message.name != null && message.hasOwnProperty("name"))
6913
+ if (!$util.isString(message.name))
6914
+ return "name: string expected";
6915
+ if (message.metadata != null && message.hasOwnProperty("metadata")) {
6916
+ let error = $root.baml_bridge.cffi.v1.BamlTyMetadata.verify(message.metadata, long + 1);
6917
+ if (error)
6918
+ return "metadata." + error;
4218
6919
  }
4219
- if (object.never != null) {
4220
- if (!$util.isObject(object.never))
4221
- throw TypeError(".baml_bridge.cffi.v1.BamlTy.never: object expected");
4222
- message.never = $root.baml_bridge.cffi.v1.BamlTyNever.fromObject(object.never, long + 1);
6920
+ if (message.skip != null && message.hasOwnProperty("skip"))
6921
+ if (typeof message.skip !== "boolean")
6922
+ return "skip: boolean expected";
6923
+ return null;
6924
+ };
6925
+
6926
+ /**
6927
+ * Creates a BamlEnumVariantDef message from a plain object. Also converts values to their respective internal types.
6928
+ * @function fromObject
6929
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
6930
+ * @static
6931
+ * @param {Object.<string,*>} object Plain object
6932
+ * @returns {baml_bridge.cffi.v1.BamlEnumVariantDef} BamlEnumVariantDef
6933
+ */
6934
+ BamlEnumVariantDef.fromObject = function fromObject(object, long) {
6935
+ if (object instanceof $root.baml_bridge.cffi.v1.BamlEnumVariantDef)
6936
+ return object;
6937
+ if (!$util.isObject(object))
6938
+ throw TypeError(".baml_bridge.cffi.v1.BamlEnumVariantDef: object expected");
6939
+ if (long === undefined)
6940
+ long = 0;
6941
+ if (long > $util.recursionLimit)
6942
+ throw Error("maximum nesting depth exceeded");
6943
+ let message = new $root.baml_bridge.cffi.v1.BamlEnumVariantDef();
6944
+ if (object.name != null)
6945
+ message.name = String(object.name);
6946
+ if (object.metadata != null) {
6947
+ if (!$util.isObject(object.metadata))
6948
+ throw TypeError(".baml_bridge.cffi.v1.BamlEnumVariantDef.metadata: object expected");
6949
+ message.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.fromObject(object.metadata, long + 1);
4223
6950
  }
6951
+ if (object.skip != null)
6952
+ message.skip = Boolean(object.skip);
4224
6953
  return message;
4225
6954
  };
4226
6955
 
4227
6956
  /**
4228
- * Creates a plain object from a BamlTy message. Also converts values to other types if specified.
6957
+ * Creates a plain object from a BamlEnumVariantDef message. Also converts values to other types if specified.
4229
6958
  * @function toObject
4230
- * @memberof baml_bridge.cffi.v1.BamlTy
6959
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
4231
6960
  * @static
4232
- * @param {baml_bridge.cffi.v1.BamlTy} message BamlTy
6961
+ * @param {baml_bridge.cffi.v1.BamlEnumVariantDef} message BamlEnumVariantDef
4233
6962
  * @param {$protobuf.IConversionOptions} [options] Conversion options
4234
6963
  * @returns {Object.<string,*>} Plain object
4235
6964
  */
4236
- BamlTy.toObject = function toObject(message, options, q) {
6965
+ BamlEnumVariantDef.toObject = function toObject(message, options, q) {
4237
6966
  if (!options)
4238
6967
  options = {};
4239
6968
  if (q === undefined)
@@ -4241,151 +6970,47 @@ export const baml_bridge = $root.baml_bridge = (() => {
4241
6970
  if (q > $util.recursionLimit)
4242
6971
  throw Error("max depth exceeded");
4243
6972
  let object = {};
4244
- if (message.primitive != null && message.hasOwnProperty("primitive")) {
4245
- object.primitive = $root.baml_bridge.cffi.v1.BamlTyPrimitive.toObject(message.primitive, options, q + 1);
4246
- if (options.oneofs)
4247
- object.ty = "primitive";
4248
- }
4249
- if (message.classTy != null && message.hasOwnProperty("classTy")) {
4250
- object.classTy = $root.baml_bridge.cffi.v1.BamlTyClass.toObject(message.classTy, options, q + 1);
4251
- if (options.oneofs)
4252
- object.ty = "classTy";
4253
- }
4254
- if (message["enum"] != null && message.hasOwnProperty("enum")) {
4255
- object["enum"] = $root.baml_bridge.cffi.v1.BamlTyEnum.toObject(message["enum"], options, q + 1);
4256
- if (options.oneofs)
4257
- object.ty = "enum";
4258
- }
4259
- if (message.list != null && message.hasOwnProperty("list")) {
4260
- object.list = $root.baml_bridge.cffi.v1.BamlTyList.toObject(message.list, options, q + 1);
4261
- if (options.oneofs)
4262
- object.ty = "list";
4263
- }
4264
- if (message.map != null && message.hasOwnProperty("map")) {
4265
- object.map = $root.baml_bridge.cffi.v1.BamlTyMap.toObject(message.map, options, q + 1);
4266
- if (options.oneofs)
4267
- object.ty = "map";
4268
- }
4269
- if (message.optional != null && message.hasOwnProperty("optional")) {
4270
- object.optional = $root.baml_bridge.cffi.v1.BamlTyOptional.toObject(message.optional, options, q + 1);
4271
- if (options.oneofs)
4272
- object.ty = "optional";
4273
- }
4274
- if (message.union != null && message.hasOwnProperty("union")) {
4275
- object.union = $root.baml_bridge.cffi.v1.BamlTyUnion.toObject(message.union, options, q + 1);
4276
- if (options.oneofs)
4277
- object.ty = "union";
4278
- }
4279
- if (message.literal != null && message.hasOwnProperty("literal")) {
4280
- object.literal = $root.baml_bridge.cffi.v1.BamlTyLiteral.toObject(message.literal, options, q + 1);
4281
- if (options.oneofs)
4282
- object.ty = "literal";
4283
- }
4284
- if (message.typeAlias != null && message.hasOwnProperty("typeAlias")) {
4285
- object.typeAlias = $root.baml_bridge.cffi.v1.BamlTyTypeAlias.toObject(message.typeAlias, options, q + 1);
4286
- if (options.oneofs)
4287
- object.ty = "typeAlias";
4288
- }
4289
- if (message.unknown != null && message.hasOwnProperty("unknown")) {
4290
- object.unknown = $root.baml_bridge.cffi.v1.BamlTyUnknown.toObject(message.unknown, options, q + 1);
4291
- if (options.oneofs)
4292
- object.ty = "unknown";
4293
- }
4294
- if (message.media != null && message.hasOwnProperty("media")) {
4295
- object.media = $root.baml_bridge.cffi.v1.BamlTyMedia.toObject(message.media, options, q + 1);
4296
- if (options.oneofs)
4297
- object.ty = "media";
4298
- }
4299
- if (message["interface"] != null && message.hasOwnProperty("interface")) {
4300
- object["interface"] = $root.baml_bridge.cffi.v1.BamlTyInterface.toObject(message["interface"], options, q + 1);
4301
- if (options.oneofs)
4302
- object.ty = "interface";
4303
- }
4304
- if (message.enumVariant != null && message.hasOwnProperty("enumVariant")) {
4305
- object.enumVariant = $root.baml_bridge.cffi.v1.BamlTyEnumVariant.toObject(message.enumVariant, options, q + 1);
4306
- if (options.oneofs)
4307
- object.ty = "enumVariant";
4308
- }
4309
- if (message["function"] != null && message.hasOwnProperty("function")) {
4310
- object["function"] = $root.baml_bridge.cffi.v1.BamlTyFunction.toObject(message["function"], options, q + 1);
4311
- if (options.oneofs)
4312
- object.ty = "function";
4313
- }
4314
- if (message.future != null && message.hasOwnProperty("future")) {
4315
- object.future = $root.baml_bridge.cffi.v1.BamlTyFuture.toObject(message.future, options, q + 1);
4316
- if (options.oneofs)
4317
- object.ty = "future";
4318
- }
4319
- if (message.rustType != null && message.hasOwnProperty("rustType")) {
4320
- object.rustType = $root.baml_bridge.cffi.v1.BamlTyRustType.toObject(message.rustType, options, q + 1);
4321
- if (options.oneofs)
4322
- object.ty = "rustType";
4323
- }
4324
- if (message.metaType != null && message.hasOwnProperty("metaType")) {
4325
- object.metaType = $root.baml_bridge.cffi.v1.BamlTyMetaType.toObject(message.metaType, options, q + 1);
4326
- if (options.oneofs)
4327
- object.ty = "metaType";
4328
- }
4329
- if (message.resource != null && message.hasOwnProperty("resource")) {
4330
- object.resource = $root.baml_bridge.cffi.v1.BamlTyResource.toObject(message.resource, options, q + 1);
4331
- if (options.oneofs)
4332
- object.ty = "resource";
4333
- }
4334
- if (message.promptAst != null && message.hasOwnProperty("promptAst")) {
4335
- object.promptAst = $root.baml_bridge.cffi.v1.BamlTyPromptAst.toObject(message.promptAst, options, q + 1);
4336
- if (options.oneofs)
4337
- object.ty = "promptAst";
4338
- }
4339
- if (message["void"] != null && message.hasOwnProperty("void")) {
4340
- object["void"] = $root.baml_bridge.cffi.v1.BamlTyVoid.toObject(message["void"], options, q + 1);
4341
- if (options.oneofs)
4342
- object.ty = "void";
4343
- }
4344
- if (message.typeVar != null && message.hasOwnProperty("typeVar")) {
4345
- object.typeVar = $root.baml_bridge.cffi.v1.BamlTyTypeVar.toObject(message.typeVar, options, q + 1);
4346
- if (options.oneofs)
4347
- object.ty = "typeVar";
4348
- }
4349
- if (message.associatedTypeProjection != null && message.hasOwnProperty("associatedTypeProjection")) {
4350
- object.associatedTypeProjection = $root.baml_bridge.cffi.v1.BamlTyAssociatedTypeProjection.toObject(message.associatedTypeProjection, options, q + 1);
4351
- if (options.oneofs)
4352
- object.ty = "associatedTypeProjection";
4353
- }
4354
- if (message.never != null && message.hasOwnProperty("never")) {
4355
- object.never = $root.baml_bridge.cffi.v1.BamlTyNever.toObject(message.never, options, q + 1);
4356
- if (options.oneofs)
4357
- object.ty = "never";
6973
+ if (options.defaults) {
6974
+ object.name = "";
6975
+ object.metadata = null;
6976
+ object.skip = false;
4358
6977
  }
6978
+ if (message.name != null && message.hasOwnProperty("name"))
6979
+ object.name = message.name;
6980
+ if (message.metadata != null && message.hasOwnProperty("metadata"))
6981
+ object.metadata = $root.baml_bridge.cffi.v1.BamlTyMetadata.toObject(message.metadata, options, q + 1);
6982
+ if (message.skip != null && message.hasOwnProperty("skip"))
6983
+ object.skip = message.skip;
4359
6984
  return object;
4360
6985
  };
4361
6986
 
4362
6987
  /**
4363
- * Converts this BamlTy to JSON.
6988
+ * Converts this BamlEnumVariantDef to JSON.
4364
6989
  * @function toJSON
4365
- * @memberof baml_bridge.cffi.v1.BamlTy
6990
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
4366
6991
  * @instance
4367
6992
  * @returns {Object.<string,*>} JSON object
4368
6993
  */
4369
- BamlTy.prototype.toJSON = function toJSON() {
6994
+ BamlEnumVariantDef.prototype.toJSON = function toJSON() {
4370
6995
  return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4371
6996
  };
4372
6997
 
4373
6998
  /**
4374
- * Gets the default type url for BamlTy
6999
+ * Gets the default type url for BamlEnumVariantDef
4375
7000
  * @function getTypeUrl
4376
- * @memberof baml_bridge.cffi.v1.BamlTy
7001
+ * @memberof baml_bridge.cffi.v1.BamlEnumVariantDef
4377
7002
  * @static
4378
7003
  * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4379
7004
  * @returns {string} The default type url
4380
7005
  */
4381
- BamlTy.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
7006
+ BamlEnumVariantDef.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4382
7007
  if (typeUrlPrefix === undefined) {
4383
7008
  typeUrlPrefix = "type.googleapis.com";
4384
7009
  }
4385
- return typeUrlPrefix + "/baml_bridge.cffi.v1.BamlTy";
7010
+ return typeUrlPrefix + "/baml_bridge.cffi.v1.BamlEnumVariantDef";
4386
7011
  };
4387
7012
 
4388
- return BamlTy;
7013
+ return BamlEnumVariantDef;
4389
7014
  })();
4390
7015
 
4391
7016
  /**
@@ -11710,6 +14335,7 @@ export const baml_bridge = $root.baml_bridge = (() => {
11710
14335
  * @property {Uint8Array|null} [uint8arrayValue] BamlOutboundValue uint8arrayValue
11711
14336
  * @property {string|null} [bigintValue] BamlOutboundValue bigintValue
11712
14337
  * @property {baml_bridge.cffi.v1.IBamlTy|null} [tyValue] BamlOutboundValue tyValue
14338
+ * @property {baml_bridge.cffi.v1.IBamlTyDef|null} [tyDefValue] BamlOutboundValue tyDefValue
11713
14339
  */
11714
14340
 
11715
14341
  /**
@@ -11863,17 +14489,25 @@ export const baml_bridge = $root.baml_bridge = (() => {
11863
14489
  */
11864
14490
  BamlOutboundValue.prototype.tyValue = null;
11865
14491
 
14492
+ /**
14493
+ * BamlOutboundValue tyDefValue.
14494
+ * @member {baml_bridge.cffi.v1.IBamlTyDef|null|undefined} tyDefValue
14495
+ * @memberof baml_bridge.cffi.v1.BamlOutboundValue
14496
+ * @instance
14497
+ */
14498
+ BamlOutboundValue.prototype.tyDefValue = null;
14499
+
11866
14500
  // OneOf field names bound to virtual getters and setters
11867
14501
  let $oneOfFields;
11868
14502
 
11869
14503
  /**
11870
14504
  * BamlOutboundValue value.
11871
- * @member {"nullValue"|"stringValue"|"intValue"|"floatValue"|"boolValue"|"classValue"|"enumValue"|"literalValue"|"listValue"|"mapValue"|"unionVariantValue"|"handleValue"|"mediaValue"|"promptAstValue"|"uint8arrayValue"|"bigintValue"|"tyValue"|undefined} value
14505
+ * @member {"nullValue"|"stringValue"|"intValue"|"floatValue"|"boolValue"|"classValue"|"enumValue"|"literalValue"|"listValue"|"mapValue"|"unionVariantValue"|"handleValue"|"mediaValue"|"promptAstValue"|"uint8arrayValue"|"bigintValue"|"tyValue"|"tyDefValue"|undefined} value
11872
14506
  * @memberof baml_bridge.cffi.v1.BamlOutboundValue
11873
14507
  * @instance
11874
14508
  */
11875
14509
  Object.defineProperty(BamlOutboundValue.prototype, "value", {
11876
- get: $util.oneOfGetter($oneOfFields = ["nullValue", "stringValue", "intValue", "floatValue", "boolValue", "classValue", "enumValue", "literalValue", "listValue", "mapValue", "unionVariantValue", "handleValue", "mediaValue", "promptAstValue", "uint8arrayValue", "bigintValue", "tyValue"]),
14510
+ get: $util.oneOfGetter($oneOfFields = ["nullValue", "stringValue", "intValue", "floatValue", "boolValue", "classValue", "enumValue", "literalValue", "listValue", "mapValue", "unionVariantValue", "handleValue", "mediaValue", "promptAstValue", "uint8arrayValue", "bigintValue", "tyValue", "tyDefValue"]),
11877
14511
  set: $util.oneOfSetter($oneOfFields)
11878
14512
  });
11879
14513
 
@@ -11939,6 +14573,8 @@ export const baml_bridge = $root.baml_bridge = (() => {
11939
14573
  writer.uint32(/* id 20, wireType 2 =*/162).string(message.bigintValue);
11940
14574
  if (message.tyValue != null && Object.hasOwnProperty.call(message, "tyValue"))
11941
14575
  $root.baml_bridge.cffi.v1.BamlTy.encode(message.tyValue, writer.uint32(/* id 21, wireType 2 =*/170).fork(), q + 1).ldelim();
14576
+ if (message.tyDefValue != null && Object.hasOwnProperty.call(message, "tyDefValue"))
14577
+ $root.baml_bridge.cffi.v1.BamlTyDef.encode(message.tyDefValue, writer.uint32(/* id 22, wireType 2 =*/178).fork(), q + 1).ldelim();
11942
14578
  return writer;
11943
14579
  };
11944
14580
 
@@ -12047,6 +14683,10 @@ export const baml_bridge = $root.baml_bridge = (() => {
12047
14683
  message.tyValue = $root.baml_bridge.cffi.v1.BamlTy.decode(reader, reader.uint32(), undefined, long + 1);
12048
14684
  break;
12049
14685
  }
14686
+ case 22: {
14687
+ message.tyDefValue = $root.baml_bridge.cffi.v1.BamlTyDef.decode(reader, reader.uint32(), undefined, long + 1);
14688
+ break;
14689
+ }
12050
14690
  default:
12051
14691
  reader.skipType(tag & 7, long);
12052
14692
  break;
@@ -12237,6 +14877,16 @@ export const baml_bridge = $root.baml_bridge = (() => {
12237
14877
  return "tyValue." + error;
12238
14878
  }
12239
14879
  }
14880
+ if (message.tyDefValue != null && message.hasOwnProperty("tyDefValue")) {
14881
+ if (properties.value === 1)
14882
+ return "value: multiple values";
14883
+ properties.value = 1;
14884
+ {
14885
+ let error = $root.baml_bridge.cffi.v1.BamlTyDef.verify(message.tyDefValue, long + 1);
14886
+ if (error)
14887
+ return "tyDefValue." + error;
14888
+ }
14889
+ }
12240
14890
  return null;
12241
14891
  };
12242
14892
 
@@ -12335,6 +14985,11 @@ export const baml_bridge = $root.baml_bridge = (() => {
12335
14985
  throw TypeError(".baml_bridge.cffi.v1.BamlOutboundValue.tyValue: object expected");
12336
14986
  message.tyValue = $root.baml_bridge.cffi.v1.BamlTy.fromObject(object.tyValue, long + 1);
12337
14987
  }
14988
+ if (object.tyDefValue != null) {
14989
+ if (!$util.isObject(object.tyDefValue))
14990
+ throw TypeError(".baml_bridge.cffi.v1.BamlOutboundValue.tyDefValue: object expected");
14991
+ message.tyDefValue = $root.baml_bridge.cffi.v1.BamlTyDef.fromObject(object.tyDefValue, long + 1);
14992
+ }
12338
14993
  return message;
12339
14994
  };
12340
14995
 
@@ -12445,6 +15100,11 @@ export const baml_bridge = $root.baml_bridge = (() => {
12445
15100
  if (options.oneofs)
12446
15101
  object.value = "tyValue";
12447
15102
  }
15103
+ if (message.tyDefValue != null && message.hasOwnProperty("tyDefValue")) {
15104
+ object.tyDefValue = $root.baml_bridge.cffi.v1.BamlTyDef.toObject(message.tyDefValue, options, q + 1);
15105
+ if (options.oneofs)
15106
+ object.value = "tyDefValue";
15107
+ }
12448
15108
  return object;
12449
15109
  };
12450
15110