From 72e3aa935d40774d1d1a696d0ede1f03199d43bc Mon Sep 17 00:00:00 2001 From: Antoine Grondin Date: Fri, 29 Aug 2025 17:02:06 +0900 Subject: [PATCH 1/2] api: evaluating the query's data type requires access to the dataset --- go/svc/query/v1/service.pb.go | 36 ++++++++++++++++++++++++-------- js/svc/query/v1/service_pb.ts | 16 ++++++++++++-- proto/svc/query/v1/service.proto | 7 ++++++- 3 files changed, 47 insertions(+), 12 deletions(-) diff --git a/go/svc/query/v1/service.pb.go b/go/svc/query/v1/service.pb.go index c79fac7..580d803 100644 --- a/go/svc/query/v1/service.pb.go +++ b/go/svc/query/v1/service.pb.go @@ -145,8 +145,12 @@ func (x *SummarizeEventsResponse) GetBuckets() []*SummarizeEventsResponse_Bucket } type ParseRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + // if provided, the query's data type will be evaluated for the environment + // this requires looking up the environment, so the user must be logged in + // and have access to the environment to request this information + EnvironmentId *int64 `protobuf:"varint,2,opt,name=environment_id,json=environmentId,proto3,oneof" json:"environment_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -188,10 +192,18 @@ func (x *ParseRequest) GetQuery() string { return "" } +func (x *ParseRequest) GetEnvironmentId() int64 { + if x != nil && x.EnvironmentId != nil { + return *x.EnvironmentId + } + return 0 +} + type ParseResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Query *v1.Query `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` - DataType *v1.DataStreamType `protobuf:"bytes,2,opt,name=data_type,json=dataType,proto3" json:"data_type,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Query *v1.Query `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + // will be populated if user is logged in and `environment_id` is specified + DataType *v1.DataStreamType `protobuf:"bytes,2,opt,name=data_type,json=dataType,proto3,oneof" json:"data_type,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -831,12 +843,16 @@ const file_svc_query_v1_service_proto_rawDesc = "" + "\x06Bucket\x12*\n" + "\x02ts\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\x02ts\x12\x1f\n" + "\vevent_count\x18\x02 \x01(\x04R\n" + - "eventCount\"$\n" + + "eventCount\"c\n" + "\fParseRequest\x12\x14\n" + - "\x05query\x18\x01 \x01(\tR\x05query\"m\n" + + "\x05query\x18\x01 \x01(\tR\x05query\x12*\n" + + "\x0eenvironment_id\x18\x02 \x01(\x03H\x00R\renvironmentId\x88\x01\x01B\x11\n" + + "\x0f_environment_id\"\x80\x01\n" + "\rParseResponse\x12%\n" + - "\x05query\x18\x01 \x01(\v2\x0f.types.v1.QueryR\x05query\x125\n" + - "\tdata_type\x18\x02 \x01(\v2\x18.types.v1.DataStreamTypeR\bdataType\"W\n" + + "\x05query\x18\x01 \x01(\v2\x0f.types.v1.QueryR\x05query\x12:\n" + + "\tdata_type\x18\x02 \x01(\v2\x18.types.v1.DataStreamTypeH\x00R\bdataType\x88\x01\x01B\f\n" + + "\n" + + "_data_type\"W\n" + "\rFormatRequest\x12\x12\n" + "\x03raw\x18\x01 \x01(\tH\x00R\x03raw\x12)\n" + "\x06parsed\x18\x02 \x01(\v2\x0f.types.v1.QueryH\x00R\x06parsedB\a\n" + @@ -957,6 +973,8 @@ func file_svc_query_v1_service_proto_init() { return } file_svc_query_v1_service_proto_msgTypes[0].OneofWrappers = []any{} + file_svc_query_v1_service_proto_msgTypes[2].OneofWrappers = []any{} + file_svc_query_v1_service_proto_msgTypes[3].OneofWrappers = []any{} file_svc_query_v1_service_proto_msgTypes[4].OneofWrappers = []any{ (*FormatRequest_Raw)(nil), (*FormatRequest_Parsed)(nil), diff --git a/js/svc/query/v1/service_pb.ts b/js/svc/query/v1/service_pb.ts index 6a9f778..56cbf98 100644 --- a/js/svc/query/v1/service_pb.ts +++ b/js/svc/query/v1/service_pb.ts @@ -161,6 +161,15 @@ export class ParseRequest extends Message { */ query = ""; + /** + * if provided, the query's data type will be evaluated for the environment + * this requires looking up the environment, so the user must be logged in + * and have access to the environment to request this information + * + * @generated from field: optional int64 environment_id = 2; + */ + environmentId?: bigint; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -170,6 +179,7 @@ export class ParseRequest extends Message { static readonly typeName = "svc.query.v1.ParseRequest"; static readonly fields: FieldList = proto3.util.newFieldList(() => [ { no: 1, name: "query", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "environment_id", kind: "scalar", T: 3 /* ScalarType.INT64 */, opt: true }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): ParseRequest { @@ -199,7 +209,9 @@ export class ParseResponse extends Message { query?: Query; /** - * @generated from field: types.v1.DataStreamType data_type = 2; + * will be populated if user is logged in and `environment_id` is specified + * + * @generated from field: optional types.v1.DataStreamType data_type = 2; */ dataType?: DataStreamType; @@ -212,7 +224,7 @@ export class ParseResponse extends Message { static readonly typeName = "svc.query.v1.ParseResponse"; static readonly fields: FieldList = proto3.util.newFieldList(() => [ { no: 1, name: "query", kind: "message", T: Query }, - { no: 2, name: "data_type", kind: "message", T: DataStreamType }, + { no: 2, name: "data_type", kind: "message", T: DataStreamType, opt: true }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): ParseResponse { diff --git a/proto/svc/query/v1/service.proto b/proto/svc/query/v1/service.proto index 6c1c788..25f4ac2 100644 --- a/proto/svc/query/v1/service.proto +++ b/proto/svc/query/v1/service.proto @@ -48,11 +48,16 @@ message SummarizeEventsResponse { message ParseRequest { string query = 1; + // if provided, the query's data type will be evaluated for the environment + // this requires looking up the environment, so the user must be logged in + // and have access to the environment to request this information + optional int64 environment_id = 2; } message ParseResponse { types.v1.Query query = 1; - types.v1.DataStreamType data_type = 2; + // will be populated if user is logged in and `environment_id` is specified + optional types.v1.DataStreamType data_type = 2; } message FormatRequest { From 91005f9a35ae53a3b0c3b00216ebd5bb4d75486c Mon Sep 17 00:00:00 2001 From: Antoine Grondin Date: Fri, 29 Aug 2025 17:06:22 +0900 Subject: [PATCH 2/2] bump deps --- package-lock.json | 64 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index affc08c..bc85018 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "typescript": "^4.5.2" }, "devDependencies": { - "@bufbuild/buf": "^1.56.0", + "@bufbuild/buf": "^1.57.0", "@bufbuild/protoc-gen-es": "^1.10.1", "@connectrpc/connect": "^1.6.1", "@connectrpc/connect-query": "^1.4.2", @@ -24,9 +24,9 @@ } }, "node_modules/@bufbuild/buf": { - "version": "1.56.0", - "resolved": "https://registry.npmjs.org/@bufbuild/buf/-/buf-1.56.0.tgz", - "integrity": "sha512-1xQWOf3FCDDTi+5B/VScQ73EP6ACwQPCP4ODvCq2L6IVgFtvYX49ur6cQ2qCM8yFitIHESm/Nbff93sh+V/Iog==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf/-/buf-1.57.0.tgz", + "integrity": "sha512-dQgrxSh+3gilB3fJam+Dn39ve/3YU8IPt03WvKqQdldwC5GhGHRHgl7tivVLOP+RyBHs1jnDK7lknXFGLGV65g==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", @@ -39,19 +39,19 @@ "node": ">=12" }, "optionalDependencies": { - "@bufbuild/buf-darwin-arm64": "1.56.0", - "@bufbuild/buf-darwin-x64": "1.56.0", - "@bufbuild/buf-linux-aarch64": "1.56.0", - "@bufbuild/buf-linux-armv7": "1.56.0", - "@bufbuild/buf-linux-x64": "1.56.0", - "@bufbuild/buf-win32-arm64": "1.56.0", - "@bufbuild/buf-win32-x64": "1.56.0" + "@bufbuild/buf-darwin-arm64": "1.57.0", + "@bufbuild/buf-darwin-x64": "1.57.0", + "@bufbuild/buf-linux-aarch64": "1.57.0", + "@bufbuild/buf-linux-armv7": "1.57.0", + "@bufbuild/buf-linux-x64": "1.57.0", + "@bufbuild/buf-win32-arm64": "1.57.0", + "@bufbuild/buf-win32-x64": "1.57.0" } }, "node_modules/@bufbuild/buf-darwin-arm64": { - "version": "1.56.0", - "resolved": "https://registry.npmjs.org/@bufbuild/buf-darwin-arm64/-/buf-darwin-arm64-1.56.0.tgz", - "integrity": "sha512-9neaI9gx1sxOGl9xrL7kw6H+0WmVAFlIQTIDc3vt1qRhfgOt/8AWOHSOWppGTRjNiB0qh6Xie1LYHv/jgDVN0g==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-darwin-arm64/-/buf-darwin-arm64-1.57.0.tgz", + "integrity": "sha512-XKmb6cb1n23+5cgiwHqNRuGnrDv4yTBAsakjw3b/wP5WahIdloS/6ixoC1FdxuLt79fDqdhXbvCCeM0QOBAmRg==", "cpu": [ "arm64" ], @@ -66,9 +66,9 @@ } }, "node_modules/@bufbuild/buf-darwin-x64": { - "version": "1.56.0", - "resolved": "https://registry.npmjs.org/@bufbuild/buf-darwin-x64/-/buf-darwin-x64-1.56.0.tgz", - "integrity": "sha512-nRHPMXV8fr/lqU+u/1GGsUg7OvNcxJuCJoJpfRoRg38b+NPzOz2FkQAs5OEJzzprQB5aftn5//cl8YXjgvTuFA==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-darwin-x64/-/buf-darwin-x64-1.57.0.tgz", + "integrity": "sha512-lCu5DJ63VfzTsoKz8iA8ZJMUTECaJABHEoQdlWnhh9MpoPr5Sd1l+uZvh0m1eBO9sVrKPAZFmYsjLGc/tpmbPA==", "cpu": [ "x64" ], @@ -83,9 +83,9 @@ } }, "node_modules/@bufbuild/buf-linux-aarch64": { - "version": "1.56.0", - "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-aarch64/-/buf-linux-aarch64-1.56.0.tgz", - "integrity": "sha512-+td559RuKNwYDnq49NrIDGJ4F73Ra4QzVVbsC+UeveA0HMnIGRzFbchGjHtNJyaZsI57sXJ7dCHH0iFV3jcYwQ==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-aarch64/-/buf-linux-aarch64-1.57.0.tgz", + "integrity": "sha512-LjFsPinUzvJ7BiHzlzQm1Dv5EQLUCFPtsxROVgluhX9iQOxxDtwbjsv0E/toKsJk35PQXwAsVKJlswR1CZ9bFQ==", "cpu": [ "arm64" ], @@ -100,9 +100,9 @@ } }, "node_modules/@bufbuild/buf-linux-armv7": { - "version": "1.56.0", - "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-armv7/-/buf-linux-armv7-1.56.0.tgz", - "integrity": "sha512-9v3zmos6wRTBc4QeIg4rfDmPzmTgtUTRCbhr87qws/yddIT8cFtHHhy1whnozBNqtmYOdwZNBNx/QXqGGcRuKw==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-armv7/-/buf-linux-armv7-1.57.0.tgz", + "integrity": "sha512-sHThZvZgXiyQtAZEviZG4EDuc4MhZhrBrRmGR3uLRWiZ1BTVr6LCtOto3AWoXvcyORTfmEpAMLSFb/XfoO7NIg==", "cpu": [ "arm" ], @@ -117,9 +117,9 @@ } }, "node_modules/@bufbuild/buf-linux-x64": { - "version": "1.56.0", - "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-x64/-/buf-linux-x64-1.56.0.tgz", - "integrity": "sha512-3jZHHBol1fuichNke7LJtHJUdw314XBj6OuJHY6IufsaaVIj1mtM2DPbGiDhYB453J7FiV/buadctKBxAAHclg==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-x64/-/buf-linux-x64-1.57.0.tgz", + "integrity": "sha512-QdrvXX2JNMf0385egPSsOJZkOsOBca7LDFll1doC7Fo2W8cP//KXvVqPIMNA1Blq/sHyx7J8sbbf0w/iQo7kVw==", "cpu": [ "x64" ], @@ -134,9 +134,9 @@ } }, "node_modules/@bufbuild/buf-win32-arm64": { - "version": "1.56.0", - "resolved": "https://registry.npmjs.org/@bufbuild/buf-win32-arm64/-/buf-win32-arm64-1.56.0.tgz", - "integrity": "sha512-KMGzSf9rIbT01Jb2685JovwRRYEdL7Zbs6ZrjyhIHBgKK6cBwz1AJvEaDrWMEzCdv+opQwjgM6UdtA4e9BWP1A==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-win32-arm64/-/buf-win32-arm64-1.57.0.tgz", + "integrity": "sha512-TRPzAiSwlQHwJmb3BD1Yzn7dREjbkebnMJ9R/AAn8uB4dE4eJqo8vG4L5t5laARkaCvt7EwlUghwXLdJvXHoQQ==", "cpu": [ "arm64" ], @@ -151,9 +151,9 @@ } }, "node_modules/@bufbuild/buf-win32-x64": { - "version": "1.56.0", - "resolved": "https://registry.npmjs.org/@bufbuild/buf-win32-x64/-/buf-win32-x64-1.56.0.tgz", - "integrity": "sha512-19LFOCyFFVTaaqNGtYTpiF67fcpneWZFlm8UNU+Xs87Kh+N5i/LjDjNytnpFT6snwU4/S+UUkq7WgS6UPjqXIg==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-win32-x64/-/buf-win32-x64-1.57.0.tgz", + "integrity": "sha512-2yGkSo4ei/IIeh1wkzJo0JIoZhn0KdrhlTUlcJbqgvaJ5UXZsGQFE3pZ2zh2gmcx2qSRUthzrBs2c5PL8lvl7g==", "cpu": [ "x64" ], diff --git a/package.json b/package.json index 08b039a..a93eff2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "devDependencies": { - "@bufbuild/buf": "^1.56.0", + "@bufbuild/buf": "^1.57.0", "@bufbuild/protoc-gen-es": "^1.10.1", "@connectrpc/connect": "^1.6.1", "@connectrpc/connect-query": "^1.4.2",