diff --git a/CHANGELOG.md b/CHANGELOG.md index 3058b8f..799eeb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v1.0.0-alpha.17 + +- (bug) Return id when upserting data + # v1.0.0-alpha.16 - (feature) Specify correlation and causation ids diff --git a/delivery/upsert_projection_data.proto b/delivery/upsert_projection_data.proto index 02f11bf..3795fa2 100644 --- a/delivery/upsert_projection_data.proto +++ b/delivery/upsert_projection_data.proto @@ -12,8 +12,9 @@ message UpsertProjectionDataRequest { message UpsertProjectionDataResponse { map newData = 1; - repeated string validationErrors = 2; - map fieldValidationErrors = 3; + string id = 2; + repeated string validationErrors = 3; + map fieldValidationErrors = 4; } diff --git a/go/deliverypb/upsert_projection_data.pb.go b/go/deliverypb/upsert_projection_data.pb.go index cc57417..3916dff 100644 --- a/go/deliverypb/upsert_projection_data.pb.go +++ b/go/deliverypb/upsert_projection_data.pb.go @@ -105,8 +105,9 @@ type UpsertProjectionDataResponse struct { unknownFields protoimpl.UnknownFields NewData map[string]string `protobuf:"bytes,1,rep,name=newData,proto3" json:"newData,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - ValidationErrors []string `protobuf:"bytes,2,rep,name=validationErrors,proto3" json:"validationErrors,omitempty"` - FieldValidationErrors map[string]string `protobuf:"bytes,3,rep,name=fieldValidationErrors,proto3" json:"fieldValidationErrors,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + ValidationErrors []string `protobuf:"bytes,3,rep,name=validationErrors,proto3" json:"validationErrors,omitempty"` + FieldValidationErrors map[string]string `protobuf:"bytes,4,rep,name=fieldValidationErrors,proto3" json:"fieldValidationErrors,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *UpsertProjectionDataResponse) Reset() { @@ -148,6 +149,13 @@ func (x *UpsertProjectionDataResponse) GetNewData() map[string]string { return nil } +func (x *UpsertProjectionDataResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + func (x *UpsertProjectionDataResponse) GetValidationErrors() []string { if x != nil { return x.ValidationErrors @@ -190,18 +198,19 @@ var file_delivery_upsert_projection_data_proto_rawDesc = []byte{ 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0x98, 0x03, 0x0a, 0x1c, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x50, 0x72, 0x6f, + 0x38, 0x01, 0x22, 0xa8, 0x03, 0x0a, 0x1c, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x07, 0x6e, 0x65, 0x77, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4e, 0x65, 0x77, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x44, 0x61, - 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x76, 0x61, + 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12, 0x77, 0x0a, 0x15, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, + 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x56, 0x61, 0x6c, 0x69, 0x64, diff --git a/nodejs/src/delivery/upsert_projection_data.ts b/nodejs/src/delivery/upsert_projection_data.ts index d0248af..cd13051 100644 --- a/nodejs/src/delivery/upsert_projection_data.ts +++ b/nodejs/src/delivery/upsert_projection_data.ts @@ -19,6 +19,7 @@ export interface UpsertProjectionDataRequest_PayloadEntry { export interface UpsertProjectionDataResponse { newData: { [key: string]: string }; + id: string; validationErrors: string[]; fieldValidationErrors: { [key: string]: string }; } @@ -203,7 +204,7 @@ export const UpsertProjectionDataRequest_PayloadEntry = { }; function createBaseUpsertProjectionDataResponse(): UpsertProjectionDataResponse { - return { newData: {}, validationErrors: [], fieldValidationErrors: {} }; + return { newData: {}, id: "", validationErrors: [], fieldValidationErrors: {} }; } export const UpsertProjectionDataResponse = { @@ -211,13 +212,16 @@ export const UpsertProjectionDataResponse = { Object.entries(message.newData).forEach(([key, value]) => { UpsertProjectionDataResponse_NewDataEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).ldelim(); }); + if (message.id !== "") { + writer.uint32(18).string(message.id); + } for (const v of message.validationErrors) { - writer.uint32(18).string(v!); + writer.uint32(26).string(v!); } Object.entries(message.fieldValidationErrors).forEach(([key, value]) => { UpsertProjectionDataResponse_FieldValidationErrorsEntry.encode( { key: key as any, value }, - writer.uint32(26).fork(), + writer.uint32(34).fork(), ).ldelim(); }); return writer; @@ -237,12 +241,15 @@ export const UpsertProjectionDataResponse = { } break; case 2: - message.validationErrors.push(reader.string()); + message.id = reader.string(); break; case 3: - const entry3 = UpsertProjectionDataResponse_FieldValidationErrorsEntry.decode(reader, reader.uint32()); - if (entry3.value !== undefined) { - message.fieldValidationErrors[entry3.key] = entry3.value; + message.validationErrors.push(reader.string()); + break; + case 4: + const entry4 = UpsertProjectionDataResponse_FieldValidationErrorsEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.fieldValidationErrors[entry4.key] = entry4.value; } break; default: @@ -261,6 +268,7 @@ export const UpsertProjectionDataResponse = { return acc; }, {}) : {}, + id: isSet(object.id) ? String(object.id) : "", validationErrors: Array.isArray(object?.validationErrors) ? object.validationErrors.map((e: any) => String(e)) : [], @@ -281,6 +289,7 @@ export const UpsertProjectionDataResponse = { obj.newData[k] = v; }); } + message.id !== undefined && (obj.id = message.id); if (message.validationErrors) { obj.validationErrors = message.validationErrors.map((e) => e); } else { @@ -307,6 +316,7 @@ export const UpsertProjectionDataResponse = { } return acc; }, {}); + message.id = object.id ?? ""; message.validationErrors = object.validationErrors?.map((e) => e) || []; message.fieldValidationErrors = Object.entries(object.fieldValidationErrors ?? {}).reduce< { [key: string]: string }