@miradorlabs/web-grpc 2.11.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miradorlabs/web-grpc",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "Generated gRPC (grpc-js) client stubs for the Mirador web gateway.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1770,6 +1770,12 @@ export interface TraceEventEnvelope {
1770
1770
  spanId: string;
1771
1771
  /** Parent of this event's span ("" = root / trace-level) */
1772
1772
  parentSpanId: string;
1773
+ /**
1774
+ * Per-event annotations, rendered to strings server-side. Distinct from trace attributes
1775
+ * (TraceStarted/AttributesUpdated) and span attributes (SpanStarted) — this bag belongs to
1776
+ * this one event occurrence.
1777
+ */
1778
+ attributes: { [key: string]: string };
1773
1779
  traceStarted?: TraceStarted | undefined;
1774
1780
  traceFinished?: TraceFinished | undefined;
1775
1781
  infoEventAdded?: InfoEventAdded | undefined;
@@ -1823,6 +1829,11 @@ export interface TraceEventEnvelope {
1823
1829
  safeTxSuperseded?: SafeTxSuperseded | undefined;
1824
1830
  }
1825
1831
 
1832
+ export interface TraceEventEnvelope_AttributesEntry {
1833
+ key: string;
1834
+ value: string;
1835
+ }
1836
+
1826
1837
  /** SpanStarted is emitted when a span opens. */
1827
1838
  export interface SpanStarted {
1828
1839
  /** the span that opened; same value as the envelope span_id (field 13) */
@@ -6758,6 +6769,7 @@ function createBaseTraceEventEnvelope(): TraceEventEnvelope {
6758
6769
  category: 0,
6759
6770
  spanId: "",
6760
6771
  parentSpanId: "",
6772
+ attributes: {},
6761
6773
  traceStarted: undefined,
6762
6774
  traceFinished: undefined,
6763
6775
  infoEventAdded: undefined,
@@ -6850,6 +6862,9 @@ export const TraceEventEnvelope: MessageFns<TraceEventEnvelope> = {
6850
6862
  if (message.parentSpanId !== "") {
6851
6863
  writer.uint32(114).string(message.parentSpanId);
6852
6864
  }
6865
+ globalThis.Object.entries(message.attributes).forEach(([key, value]: [string, string]) => {
6866
+ TraceEventEnvelope_AttributesEntry.encode({ key: key as any, value }, writer.uint32(122).fork()).join();
6867
+ });
6853
6868
  if (message.traceStarted !== undefined) {
6854
6869
  TraceStarted.encode(message.traceStarted, writer.uint32(162).fork()).join();
6855
6870
  }
@@ -7109,6 +7124,17 @@ export const TraceEventEnvelope: MessageFns<TraceEventEnvelope> = {
7109
7124
  message.parentSpanId = reader.string();
7110
7125
  continue;
7111
7126
  }
7127
+ case 15: {
7128
+ if (tag !== 122) {
7129
+ break;
7130
+ }
7131
+
7132
+ const entry15 = TraceEventEnvelope_AttributesEntry.decode(reader, reader.uint32());
7133
+ if (entry15.value !== undefined) {
7134
+ message.attributes[entry15.key] = entry15.value;
7135
+ }
7136
+ continue;
7137
+ }
7112
7138
  case 20: {
7113
7139
  if (tag !== 162) {
7114
7140
  break;
@@ -7572,6 +7598,15 @@ export const TraceEventEnvelope: MessageFns<TraceEventEnvelope> = {
7572
7598
  : isSet(object.parent_span_id)
7573
7599
  ? globalThis.String(object.parent_span_id)
7574
7600
  : "",
7601
+ attributes: isObject(object.attributes)
7602
+ ? (globalThis.Object.entries(object.attributes) as [string, any][]).reduce(
7603
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
7604
+ acc[key] = globalThis.String(value);
7605
+ return acc;
7606
+ },
7607
+ {},
7608
+ )
7609
+ : {},
7575
7610
  traceStarted: isSet(object.traceStarted)
7576
7611
  ? TraceStarted.fromJSON(object.traceStarted)
7577
7612
  : isSet(object.trace_started)
@@ -7868,6 +7903,15 @@ export const TraceEventEnvelope: MessageFns<TraceEventEnvelope> = {
7868
7903
  if (message.parentSpanId !== "") {
7869
7904
  obj.parentSpanId = message.parentSpanId;
7870
7905
  }
7906
+ if (message.attributes) {
7907
+ const entries = globalThis.Object.entries(message.attributes) as [string, string][];
7908
+ if (entries.length > 0) {
7909
+ obj.attributes = {};
7910
+ entries.forEach(([k, v]) => {
7911
+ obj.attributes[k] = v;
7912
+ });
7913
+ }
7914
+ }
7871
7915
  if (message.traceStarted !== undefined) {
7872
7916
  obj.traceStarted = TraceStarted.toJSON(message.traceStarted);
7873
7917
  }
@@ -8041,6 +8085,15 @@ export const TraceEventEnvelope: MessageFns<TraceEventEnvelope> = {
8041
8085
  message.category = object.category ?? 0;
8042
8086
  message.spanId = object.spanId ?? "";
8043
8087
  message.parentSpanId = object.parentSpanId ?? "";
8088
+ message.attributes = (globalThis.Object.entries(object.attributes ?? {}) as [string, string][]).reduce(
8089
+ (acc: { [key: string]: string }, [key, value]: [string, string]) => {
8090
+ if (value !== undefined) {
8091
+ acc[key] = globalThis.String(value);
8092
+ }
8093
+ return acc;
8094
+ },
8095
+ {},
8096
+ );
8044
8097
  message.traceStarted = (object.traceStarted !== undefined && object.traceStarted !== null)
8045
8098
  ? TraceStarted.fromPartial(object.traceStarted)
8046
8099
  : undefined;
@@ -8207,6 +8260,86 @@ export const TraceEventEnvelope: MessageFns<TraceEventEnvelope> = {
8207
8260
  },
8208
8261
  };
8209
8262
 
8263
+ function createBaseTraceEventEnvelope_AttributesEntry(): TraceEventEnvelope_AttributesEntry {
8264
+ return { key: "", value: "" };
8265
+ }
8266
+
8267
+ export const TraceEventEnvelope_AttributesEntry: MessageFns<TraceEventEnvelope_AttributesEntry> = {
8268
+ encode(message: TraceEventEnvelope_AttributesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
8269
+ if (message.key !== "") {
8270
+ writer.uint32(10).string(message.key);
8271
+ }
8272
+ if (message.value !== "") {
8273
+ writer.uint32(18).string(message.value);
8274
+ }
8275
+ return writer;
8276
+ },
8277
+
8278
+ decode(input: BinaryReader | Uint8Array, length?: number): TraceEventEnvelope_AttributesEntry {
8279
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
8280
+ const end = length === undefined ? reader.len : reader.pos + length;
8281
+ const message = createBaseTraceEventEnvelope_AttributesEntry();
8282
+ while (reader.pos < end) {
8283
+ const tag = reader.uint32();
8284
+ switch (tag >>> 3) {
8285
+ case 1: {
8286
+ if (tag !== 10) {
8287
+ break;
8288
+ }
8289
+
8290
+ message.key = reader.string();
8291
+ continue;
8292
+ }
8293
+ case 2: {
8294
+ if (tag !== 18) {
8295
+ break;
8296
+ }
8297
+
8298
+ message.value = reader.string();
8299
+ continue;
8300
+ }
8301
+ }
8302
+ if ((tag & 7) === 4 || tag === 0) {
8303
+ break;
8304
+ }
8305
+ reader.skip(tag & 7);
8306
+ }
8307
+ return message;
8308
+ },
8309
+
8310
+ fromJSON(object: any): TraceEventEnvelope_AttributesEntry {
8311
+ return {
8312
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
8313
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
8314
+ };
8315
+ },
8316
+
8317
+ toJSON(message: TraceEventEnvelope_AttributesEntry): unknown {
8318
+ const obj: any = {};
8319
+ if (message.key !== "") {
8320
+ obj.key = message.key;
8321
+ }
8322
+ if (message.value !== "") {
8323
+ obj.value = message.value;
8324
+ }
8325
+ return obj;
8326
+ },
8327
+
8328
+ create<I extends Exact<DeepPartial<TraceEventEnvelope_AttributesEntry>, I>>(
8329
+ base?: I,
8330
+ ): TraceEventEnvelope_AttributesEntry {
8331
+ return TraceEventEnvelope_AttributesEntry.fromPartial(base ?? ({} as any));
8332
+ },
8333
+ fromPartial<I extends Exact<DeepPartial<TraceEventEnvelope_AttributesEntry>, I>>(
8334
+ object: I,
8335
+ ): TraceEventEnvelope_AttributesEntry {
8336
+ const message = createBaseTraceEventEnvelope_AttributesEntry();
8337
+ message.key = object.key ?? "";
8338
+ message.value = object.value ?? "";
8339
+ return message;
8340
+ },
8341
+ };
8342
+
8210
8343
  function createBaseSpanStarted(): SpanStarted {
8211
8344
  return { spanId: "", parentSpanId: undefined, name: "", startTime: undefined, attributes: {} };
8212
8345
  }
@@ -9751,6 +9751,7 @@ source: jspb.Message.getFieldWithDefault(msg, 9, 0),
9751
9751
  category: jspb.Message.getFieldWithDefault(msg, 11, 0),
9752
9752
  spanId: jspb.Message.getFieldWithDefault(msg, 13, ""),
9753
9753
  parentSpanId: jspb.Message.getFieldWithDefault(msg, 14, ""),
9754
+ attributesMap: (f = msg.getAttributesMap()) ? f.toObject(includeInstance, undefined) : [],
9754
9755
  traceStarted: (f = msg.getTraceStarted()) && proto.gateway.web.v1.TraceStarted.toObject(includeInstance, f),
9755
9756
  traceFinished: (f = msg.getTraceFinished()) && proto.gateway.web.v1.TraceFinished.toObject(includeInstance, f),
9756
9757
  infoEventAdded: (f = msg.getInfoEventAdded()) && proto.gateway.web.v1.InfoEventAdded.toObject(includeInstance, f),
@@ -9888,6 +9889,12 @@ proto.gateway.web.v1.TraceEventEnvelope.deserializeBinaryFromReader = function(m
9888
9889
  var value = /** @type {string} */ (reader.readString());
9889
9890
  msg.setParentSpanId(value);
9890
9891
  break;
9892
+ case 15:
9893
+ var value = msg.getAttributesMap();
9894
+ reader.readMessage(value, function(message, reader) {
9895
+ jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
9896
+ });
9897
+ break;
9891
9898
  case 20:
9892
9899
  var value = new proto.gateway.web.v1.TraceStarted;
9893
9900
  reader.readMessage(value,proto.gateway.web.v1.TraceStarted.deserializeBinaryFromReader);
@@ -10258,6 +10265,10 @@ proto.gateway.web.v1.TraceEventEnvelope.serializeBinaryToWriter = function(messa
10258
10265
  f
10259
10266
  );
10260
10267
  }
10268
+ f = message.getAttributesMap(true);
10269
+ if (f && f.getLength() > 0) {
10270
+ f.serializeBinary(15, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
10271
+ }
10261
10272
  f = message.getTraceStarted();
10262
10273
  if (f != null) {
10263
10274
  writer.writeMessage(
@@ -10923,6 +10934,29 @@ proto.gateway.web.v1.TraceEventEnvelope.prototype.setParentSpanId = function(val
10923
10934
  };
10924
10935
 
10925
10936
 
10937
+ /**
10938
+ * map<string, string> attributes = 15;
10939
+ * @param {boolean=} opt_noLazyCreate Do not create the map if
10940
+ * empty, instead returning `undefined`
10941
+ * @return {!jspb.Map<string,string>}
10942
+ */
10943
+ proto.gateway.web.v1.TraceEventEnvelope.prototype.getAttributesMap = function(opt_noLazyCreate) {
10944
+ return /** @type {!jspb.Map<string,string>} */ (
10945
+ jspb.Message.getMapField(this, 15, opt_noLazyCreate,
10946
+ null));
10947
+ };
10948
+
10949
+
10950
+ /**
10951
+ * Clears values from the map. The map will be non-null.
10952
+ * @return {!proto.gateway.web.v1.TraceEventEnvelope} returns this
10953
+ */
10954
+ proto.gateway.web.v1.TraceEventEnvelope.prototype.clearAttributesMap = function() {
10955
+ this.getAttributesMap().clear();
10956
+ return this;
10957
+ };
10958
+
10959
+
10926
10960
  /**
10927
10961
  * optional TraceStarted trace_started = 20;
10928
10962
  * @return {?proto.gateway.web.v1.TraceStarted}