@openfeature/flagd-provider 0.10.5 → 0.11.1
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/index.cjs.js
CHANGED
|
@@ -4153,7 +4153,7 @@ const Struct = {
|
|
|
4153
4153
|
},
|
|
4154
4154
|
fromJSON(object) {
|
|
4155
4155
|
return {
|
|
4156
|
-
fields: isObject$
|
|
4156
|
+
fields: isObject$2(object.fields)
|
|
4157
4157
|
? Object.entries(object.fields).reduce((acc, [key, value]) => {
|
|
4158
4158
|
acc[key] = value;
|
|
4159
4159
|
return acc;
|
|
@@ -4360,7 +4360,7 @@ const Value = {
|
|
|
4360
4360
|
numberValue: isSet$2(object.numberValue) ? Number(object.numberValue) : undefined,
|
|
4361
4361
|
stringValue: isSet$2(object.stringValue) ? String(object.stringValue) : undefined,
|
|
4362
4362
|
boolValue: isSet$2(object.boolValue) ? Boolean(object.boolValue) : undefined,
|
|
4363
|
-
structValue: isObject$
|
|
4363
|
+
structValue: isObject$2(object.structValue) ? object.structValue : undefined,
|
|
4364
4364
|
listValue: Array.isArray(object.listValue) ? [...object.listValue] : undefined,
|
|
4365
4365
|
};
|
|
4366
4366
|
},
|
|
@@ -4512,7 +4512,7 @@ const ListValue = {
|
|
|
4512
4512
|
}
|
|
4513
4513
|
},
|
|
4514
4514
|
};
|
|
4515
|
-
function isObject$
|
|
4515
|
+
function isObject$2(value) {
|
|
4516
4516
|
return typeof value === "object" && value !== null;
|
|
4517
4517
|
}
|
|
4518
4518
|
function isSet$2(value) {
|
|
@@ -4552,7 +4552,7 @@ const ResolveAllRequest = {
|
|
|
4552
4552
|
return message;
|
|
4553
4553
|
},
|
|
4554
4554
|
fromJSON(object) {
|
|
4555
|
-
return { context: isObject(object.context) ? object.context : undefined };
|
|
4555
|
+
return { context: isObject$1(object.context) ? object.context : undefined };
|
|
4556
4556
|
},
|
|
4557
4557
|
toJSON(message) {
|
|
4558
4558
|
const obj = {};
|
|
@@ -4607,7 +4607,7 @@ const ResolveAllResponse = {
|
|
|
4607
4607
|
},
|
|
4608
4608
|
fromJSON(object) {
|
|
4609
4609
|
return {
|
|
4610
|
-
flags: isObject(object.flags)
|
|
4610
|
+
flags: isObject$1(object.flags)
|
|
4611
4611
|
? Object.entries(object.flags).reduce((acc, [key, value]) => {
|
|
4612
4612
|
acc[key] = AnyFlag.fromJSON(value);
|
|
4613
4613
|
return acc;
|
|
@@ -4802,7 +4802,7 @@ const AnyFlag = {
|
|
|
4802
4802
|
boolValue: isSet$1(object.boolValue) ? Boolean(object.boolValue) : undefined,
|
|
4803
4803
|
stringValue: isSet$1(object.stringValue) ? String(object.stringValue) : undefined,
|
|
4804
4804
|
doubleValue: isSet$1(object.doubleValue) ? Number(object.doubleValue) : undefined,
|
|
4805
|
-
objectValue: isObject(object.objectValue) ? object.objectValue : undefined,
|
|
4805
|
+
objectValue: isObject$1(object.objectValue) ? object.objectValue : undefined,
|
|
4806
4806
|
};
|
|
4807
4807
|
},
|
|
4808
4808
|
toJSON(message) {
|
|
@@ -4885,7 +4885,7 @@ const ResolveBooleanRequest = {
|
|
|
4885
4885
|
fromJSON(object) {
|
|
4886
4886
|
return {
|
|
4887
4887
|
flagKey: isSet$1(object.flagKey) ? String(object.flagKey) : "",
|
|
4888
|
-
context: isObject(object.context) ? object.context : undefined,
|
|
4888
|
+
context: isObject$1(object.context) ? object.context : undefined,
|
|
4889
4889
|
};
|
|
4890
4890
|
},
|
|
4891
4891
|
toJSON(message) {
|
|
@@ -4972,7 +4972,7 @@ const ResolveBooleanResponse = {
|
|
|
4972
4972
|
value: isSet$1(object.value) ? Boolean(object.value) : false,
|
|
4973
4973
|
reason: isSet$1(object.reason) ? String(object.reason) : "",
|
|
4974
4974
|
variant: isSet$1(object.variant) ? String(object.variant) : "",
|
|
4975
|
-
metadata: isObject(object.metadata) ? object.metadata : undefined,
|
|
4975
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
4976
4976
|
};
|
|
4977
4977
|
},
|
|
4978
4978
|
toJSON(message) {
|
|
@@ -5047,7 +5047,7 @@ const ResolveStringRequest = {
|
|
|
5047
5047
|
fromJSON(object) {
|
|
5048
5048
|
return {
|
|
5049
5049
|
flagKey: isSet$1(object.flagKey) ? String(object.flagKey) : "",
|
|
5050
|
-
context: isObject(object.context) ? object.context : undefined,
|
|
5050
|
+
context: isObject$1(object.context) ? object.context : undefined,
|
|
5051
5051
|
};
|
|
5052
5052
|
},
|
|
5053
5053
|
toJSON(message) {
|
|
@@ -5134,7 +5134,7 @@ const ResolveStringResponse = {
|
|
|
5134
5134
|
value: isSet$1(object.value) ? String(object.value) : "",
|
|
5135
5135
|
reason: isSet$1(object.reason) ? String(object.reason) : "",
|
|
5136
5136
|
variant: isSet$1(object.variant) ? String(object.variant) : "",
|
|
5137
|
-
metadata: isObject(object.metadata) ? object.metadata : undefined,
|
|
5137
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
5138
5138
|
};
|
|
5139
5139
|
},
|
|
5140
5140
|
toJSON(message) {
|
|
@@ -5209,7 +5209,7 @@ const ResolveFloatRequest = {
|
|
|
5209
5209
|
fromJSON(object) {
|
|
5210
5210
|
return {
|
|
5211
5211
|
flagKey: isSet$1(object.flagKey) ? String(object.flagKey) : "",
|
|
5212
|
-
context: isObject(object.context) ? object.context : undefined,
|
|
5212
|
+
context: isObject$1(object.context) ? object.context : undefined,
|
|
5213
5213
|
};
|
|
5214
5214
|
},
|
|
5215
5215
|
toJSON(message) {
|
|
@@ -5296,7 +5296,7 @@ const ResolveFloatResponse = {
|
|
|
5296
5296
|
value: isSet$1(object.value) ? Number(object.value) : 0,
|
|
5297
5297
|
reason: isSet$1(object.reason) ? String(object.reason) : "",
|
|
5298
5298
|
variant: isSet$1(object.variant) ? String(object.variant) : "",
|
|
5299
|
-
metadata: isObject(object.metadata) ? object.metadata : undefined,
|
|
5299
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
5300
5300
|
};
|
|
5301
5301
|
},
|
|
5302
5302
|
toJSON(message) {
|
|
@@ -5371,7 +5371,7 @@ const ResolveIntRequest = {
|
|
|
5371
5371
|
fromJSON(object) {
|
|
5372
5372
|
return {
|
|
5373
5373
|
flagKey: isSet$1(object.flagKey) ? String(object.flagKey) : "",
|
|
5374
|
-
context: isObject(object.context) ? object.context : undefined,
|
|
5374
|
+
context: isObject$1(object.context) ? object.context : undefined,
|
|
5375
5375
|
};
|
|
5376
5376
|
},
|
|
5377
5377
|
toJSON(message) {
|
|
@@ -5458,7 +5458,7 @@ const ResolveIntResponse = {
|
|
|
5458
5458
|
value: isSet$1(object.value) ? String(object.value) : "0",
|
|
5459
5459
|
reason: isSet$1(object.reason) ? String(object.reason) : "",
|
|
5460
5460
|
variant: isSet$1(object.variant) ? String(object.variant) : "",
|
|
5461
|
-
metadata: isObject(object.metadata) ? object.metadata : undefined,
|
|
5461
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
5462
5462
|
};
|
|
5463
5463
|
},
|
|
5464
5464
|
toJSON(message) {
|
|
@@ -5533,7 +5533,7 @@ const ResolveObjectRequest = {
|
|
|
5533
5533
|
fromJSON(object) {
|
|
5534
5534
|
return {
|
|
5535
5535
|
flagKey: isSet$1(object.flagKey) ? String(object.flagKey) : "",
|
|
5536
|
-
context: isObject(object.context) ? object.context : undefined,
|
|
5536
|
+
context: isObject$1(object.context) ? object.context : undefined,
|
|
5537
5537
|
};
|
|
5538
5538
|
},
|
|
5539
5539
|
toJSON(message) {
|
|
@@ -5617,10 +5617,10 @@ const ResolveObjectResponse = {
|
|
|
5617
5617
|
},
|
|
5618
5618
|
fromJSON(object) {
|
|
5619
5619
|
return {
|
|
5620
|
-
value: isObject(object.value) ? object.value : undefined,
|
|
5620
|
+
value: isObject$1(object.value) ? object.value : undefined,
|
|
5621
5621
|
reason: isSet$1(object.reason) ? String(object.reason) : "",
|
|
5622
5622
|
variant: isSet$1(object.variant) ? String(object.variant) : "",
|
|
5623
|
-
metadata: isObject(object.metadata) ? object.metadata : undefined,
|
|
5623
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
5624
5624
|
};
|
|
5625
5625
|
},
|
|
5626
5626
|
toJSON(message) {
|
|
@@ -5695,7 +5695,7 @@ const EventStreamResponse = {
|
|
|
5695
5695
|
fromJSON(object) {
|
|
5696
5696
|
return {
|
|
5697
5697
|
type: isSet$1(object.type) ? String(object.type) : "",
|
|
5698
|
-
data: isObject(object.data) ? object.data : undefined,
|
|
5698
|
+
data: isObject$1(object.data) ? object.data : undefined,
|
|
5699
5699
|
};
|
|
5700
5700
|
},
|
|
5701
5701
|
toJSON(message) {
|
|
@@ -5756,7 +5756,7 @@ const EventStreamRequest = {
|
|
|
5756
5756
|
};
|
|
5757
5757
|
const ServiceService = {
|
|
5758
5758
|
resolveAll: {
|
|
5759
|
-
path: "/
|
|
5759
|
+
path: "/flagd.evaluation.v1.Service/ResolveAll",
|
|
5760
5760
|
requestStream: false,
|
|
5761
5761
|
responseStream: false,
|
|
5762
5762
|
requestSerialize: (value) => Buffer.from(ResolveAllRequest.encode(value).finish()),
|
|
@@ -5765,7 +5765,7 @@ const ServiceService = {
|
|
|
5765
5765
|
responseDeserialize: (value) => ResolveAllResponse.decode(value),
|
|
5766
5766
|
},
|
|
5767
5767
|
resolveBoolean: {
|
|
5768
|
-
path: "/
|
|
5768
|
+
path: "/flagd.evaluation.v1.Service/ResolveBoolean",
|
|
5769
5769
|
requestStream: false,
|
|
5770
5770
|
responseStream: false,
|
|
5771
5771
|
requestSerialize: (value) => Buffer.from(ResolveBooleanRequest.encode(value).finish()),
|
|
@@ -5774,7 +5774,7 @@ const ServiceService = {
|
|
|
5774
5774
|
responseDeserialize: (value) => ResolveBooleanResponse.decode(value),
|
|
5775
5775
|
},
|
|
5776
5776
|
resolveString: {
|
|
5777
|
-
path: "/
|
|
5777
|
+
path: "/flagd.evaluation.v1.Service/ResolveString",
|
|
5778
5778
|
requestStream: false,
|
|
5779
5779
|
responseStream: false,
|
|
5780
5780
|
requestSerialize: (value) => Buffer.from(ResolveStringRequest.encode(value).finish()),
|
|
@@ -5783,7 +5783,7 @@ const ServiceService = {
|
|
|
5783
5783
|
responseDeserialize: (value) => ResolveStringResponse.decode(value),
|
|
5784
5784
|
},
|
|
5785
5785
|
resolveFloat: {
|
|
5786
|
-
path: "/
|
|
5786
|
+
path: "/flagd.evaluation.v1.Service/ResolveFloat",
|
|
5787
5787
|
requestStream: false,
|
|
5788
5788
|
responseStream: false,
|
|
5789
5789
|
requestSerialize: (value) => Buffer.from(ResolveFloatRequest.encode(value).finish()),
|
|
@@ -5792,7 +5792,7 @@ const ServiceService = {
|
|
|
5792
5792
|
responseDeserialize: (value) => ResolveFloatResponse.decode(value),
|
|
5793
5793
|
},
|
|
5794
5794
|
resolveInt: {
|
|
5795
|
-
path: "/
|
|
5795
|
+
path: "/flagd.evaluation.v1.Service/ResolveInt",
|
|
5796
5796
|
requestStream: false,
|
|
5797
5797
|
responseStream: false,
|
|
5798
5798
|
requestSerialize: (value) => Buffer.from(ResolveIntRequest.encode(value).finish()),
|
|
@@ -5801,7 +5801,7 @@ const ServiceService = {
|
|
|
5801
5801
|
responseDeserialize: (value) => ResolveIntResponse.decode(value),
|
|
5802
5802
|
},
|
|
5803
5803
|
resolveObject: {
|
|
5804
|
-
path: "/
|
|
5804
|
+
path: "/flagd.evaluation.v1.Service/ResolveObject",
|
|
5805
5805
|
requestStream: false,
|
|
5806
5806
|
responseStream: false,
|
|
5807
5807
|
requestSerialize: (value) => Buffer.from(ResolveObjectRequest.encode(value).finish()),
|
|
@@ -5810,7 +5810,7 @@ const ServiceService = {
|
|
|
5810
5810
|
responseDeserialize: (value) => ResolveObjectResponse.decode(value),
|
|
5811
5811
|
},
|
|
5812
5812
|
eventStream: {
|
|
5813
|
-
path: "/
|
|
5813
|
+
path: "/flagd.evaluation.v1.Service/EventStream",
|
|
5814
5814
|
requestStream: false,
|
|
5815
5815
|
responseStream: true,
|
|
5816
5816
|
requestSerialize: (value) => Buffer.from(EventStreamRequest.encode(value).finish()),
|
|
@@ -5819,7 +5819,7 @@ const ServiceService = {
|
|
|
5819
5819
|
responseDeserialize: (value) => EventStreamResponse.decode(value),
|
|
5820
5820
|
},
|
|
5821
5821
|
};
|
|
5822
|
-
const ServiceClient = grpcJs.makeGenericClientConstructor(ServiceService, "
|
|
5822
|
+
const ServiceClient = grpcJs.makeGenericClientConstructor(ServiceService, "flagd.evaluation.v1.Service");
|
|
5823
5823
|
function longToString(long) {
|
|
5824
5824
|
return long.toString();
|
|
5825
5825
|
}
|
|
@@ -5827,7 +5827,7 @@ if (minimal.util.Long !== long) {
|
|
|
5827
5827
|
minimal.util.Long = long;
|
|
5828
5828
|
minimal.configure();
|
|
5829
5829
|
}
|
|
5830
|
-
function isObject(value) {
|
|
5830
|
+
function isObject$1(value) {
|
|
5831
5831
|
return typeof value === "object" && value !== null;
|
|
5832
5832
|
}
|
|
5833
5833
|
function isSet$1(value) {
|
|
@@ -6004,83 +6004,6 @@ class GRPCService {
|
|
|
6004
6004
|
}
|
|
6005
6005
|
|
|
6006
6006
|
/* eslint-disable */
|
|
6007
|
-
/**
|
|
6008
|
-
* Flag definition sync API
|
|
6009
|
-
*
|
|
6010
|
-
* This proto defines a simple API to synchronize a feature flag definition.
|
|
6011
|
-
* It supports establishing a stream for getting notifications about changes in a flag definition.
|
|
6012
|
-
*/
|
|
6013
|
-
/**
|
|
6014
|
-
* SyncState conveys the state of the payload. These states are related to flagd isync.go type definitions but
|
|
6015
|
-
* contains extras to optimize grpc use case. Refer - https://github.com/open-feature/flagd/blob/main/pkg/sync/isync.go
|
|
6016
|
-
*/
|
|
6017
|
-
var SyncState;
|
|
6018
|
-
(function (SyncState) {
|
|
6019
|
-
/** SYNC_STATE_UNSPECIFIED - Value is ignored by the listening flagd */
|
|
6020
|
-
SyncState[SyncState["SYNC_STATE_UNSPECIFIED"] = 0] = "SYNC_STATE_UNSPECIFIED";
|
|
6021
|
-
/**
|
|
6022
|
-
* SYNC_STATE_ALL - All the flags matching the request. This is the default response and other states can be ignored
|
|
6023
|
-
* by the implementation. Flagd internally replaces all existing flags for this response state.
|
|
6024
|
-
*/
|
|
6025
|
-
SyncState[SyncState["SYNC_STATE_ALL"] = 1] = "SYNC_STATE_ALL";
|
|
6026
|
-
/** SYNC_STATE_ADD - Convey an addition of a flag. Flagd internally handles this by combining new flags with existing ones */
|
|
6027
|
-
SyncState[SyncState["SYNC_STATE_ADD"] = 2] = "SYNC_STATE_ADD";
|
|
6028
|
-
/**
|
|
6029
|
-
* SYNC_STATE_UPDATE - Convey an update of a flag. Flagd internally attempts to update if the updated flag already exist OR if it does not,
|
|
6030
|
-
* it will get added
|
|
6031
|
-
*/
|
|
6032
|
-
SyncState[SyncState["SYNC_STATE_UPDATE"] = 3] = "SYNC_STATE_UPDATE";
|
|
6033
|
-
/** SYNC_STATE_DELETE - Convey a deletion of a flag. Flagd internally removes the flag */
|
|
6034
|
-
SyncState[SyncState["SYNC_STATE_DELETE"] = 4] = "SYNC_STATE_DELETE";
|
|
6035
|
-
/** SYNC_STATE_PING - Optional server ping to check client connectivity. Handling is ignored by flagd and is to merely support live check */
|
|
6036
|
-
SyncState[SyncState["SYNC_STATE_PING"] = 5] = "SYNC_STATE_PING";
|
|
6037
|
-
SyncState[SyncState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
6038
|
-
})(SyncState || (SyncState = {}));
|
|
6039
|
-
function syncStateFromJSON(object) {
|
|
6040
|
-
switch (object) {
|
|
6041
|
-
case 0:
|
|
6042
|
-
case "SYNC_STATE_UNSPECIFIED":
|
|
6043
|
-
return SyncState.SYNC_STATE_UNSPECIFIED;
|
|
6044
|
-
case 1:
|
|
6045
|
-
case "SYNC_STATE_ALL":
|
|
6046
|
-
return SyncState.SYNC_STATE_ALL;
|
|
6047
|
-
case 2:
|
|
6048
|
-
case "SYNC_STATE_ADD":
|
|
6049
|
-
return SyncState.SYNC_STATE_ADD;
|
|
6050
|
-
case 3:
|
|
6051
|
-
case "SYNC_STATE_UPDATE":
|
|
6052
|
-
return SyncState.SYNC_STATE_UPDATE;
|
|
6053
|
-
case 4:
|
|
6054
|
-
case "SYNC_STATE_DELETE":
|
|
6055
|
-
return SyncState.SYNC_STATE_DELETE;
|
|
6056
|
-
case 5:
|
|
6057
|
-
case "SYNC_STATE_PING":
|
|
6058
|
-
return SyncState.SYNC_STATE_PING;
|
|
6059
|
-
case -1:
|
|
6060
|
-
case "UNRECOGNIZED":
|
|
6061
|
-
default:
|
|
6062
|
-
return SyncState.UNRECOGNIZED;
|
|
6063
|
-
}
|
|
6064
|
-
}
|
|
6065
|
-
function syncStateToJSON(object) {
|
|
6066
|
-
switch (object) {
|
|
6067
|
-
case SyncState.SYNC_STATE_UNSPECIFIED:
|
|
6068
|
-
return "SYNC_STATE_UNSPECIFIED";
|
|
6069
|
-
case SyncState.SYNC_STATE_ALL:
|
|
6070
|
-
return "SYNC_STATE_ALL";
|
|
6071
|
-
case SyncState.SYNC_STATE_ADD:
|
|
6072
|
-
return "SYNC_STATE_ADD";
|
|
6073
|
-
case SyncState.SYNC_STATE_UPDATE:
|
|
6074
|
-
return "SYNC_STATE_UPDATE";
|
|
6075
|
-
case SyncState.SYNC_STATE_DELETE:
|
|
6076
|
-
return "SYNC_STATE_DELETE";
|
|
6077
|
-
case SyncState.SYNC_STATE_PING:
|
|
6078
|
-
return "SYNC_STATE_PING";
|
|
6079
|
-
case SyncState.UNRECOGNIZED:
|
|
6080
|
-
default:
|
|
6081
|
-
return "UNRECOGNIZED";
|
|
6082
|
-
}
|
|
6083
|
-
}
|
|
6084
6007
|
function createBaseSyncFlagsRequest() {
|
|
6085
6008
|
return { providerId: "", selector: "" };
|
|
6086
6009
|
}
|
|
@@ -6149,16 +6072,13 @@ const SyncFlagsRequest = {
|
|
|
6149
6072
|
},
|
|
6150
6073
|
};
|
|
6151
6074
|
function createBaseSyncFlagsResponse() {
|
|
6152
|
-
return { flagConfiguration: ""
|
|
6075
|
+
return { flagConfiguration: "" };
|
|
6153
6076
|
}
|
|
6154
6077
|
const SyncFlagsResponse = {
|
|
6155
6078
|
encode(message, writer = minimal.Writer.create()) {
|
|
6156
6079
|
if (message.flagConfiguration !== "") {
|
|
6157
6080
|
writer.uint32(10).string(message.flagConfiguration);
|
|
6158
6081
|
}
|
|
6159
|
-
if (message.state !== 0) {
|
|
6160
|
-
writer.uint32(16).int32(message.state);
|
|
6161
|
-
}
|
|
6162
6082
|
return writer;
|
|
6163
6083
|
},
|
|
6164
6084
|
decode(input, length) {
|
|
@@ -6174,12 +6094,6 @@ const SyncFlagsResponse = {
|
|
|
6174
6094
|
}
|
|
6175
6095
|
message.flagConfiguration = reader.string();
|
|
6176
6096
|
continue;
|
|
6177
|
-
case 2:
|
|
6178
|
-
if (tag !== 16) {
|
|
6179
|
-
break;
|
|
6180
|
-
}
|
|
6181
|
-
message.state = reader.int32();
|
|
6182
|
-
continue;
|
|
6183
6097
|
}
|
|
6184
6098
|
if ((tag & 7) === 4 || tag === 0) {
|
|
6185
6099
|
break;
|
|
@@ -6189,29 +6103,22 @@ const SyncFlagsResponse = {
|
|
|
6189
6103
|
return message;
|
|
6190
6104
|
},
|
|
6191
6105
|
fromJSON(object) {
|
|
6192
|
-
return {
|
|
6193
|
-
flagConfiguration: isSet(object.flagConfiguration) ? String(object.flagConfiguration) : "",
|
|
6194
|
-
state: isSet(object.state) ? syncStateFromJSON(object.state) : 0,
|
|
6195
|
-
};
|
|
6106
|
+
return { flagConfiguration: isSet(object.flagConfiguration) ? String(object.flagConfiguration) : "" };
|
|
6196
6107
|
},
|
|
6197
6108
|
toJSON(message) {
|
|
6198
6109
|
const obj = {};
|
|
6199
6110
|
if (message.flagConfiguration !== "") {
|
|
6200
6111
|
obj.flagConfiguration = message.flagConfiguration;
|
|
6201
6112
|
}
|
|
6202
|
-
if (message.state !== 0) {
|
|
6203
|
-
obj.state = syncStateToJSON(message.state);
|
|
6204
|
-
}
|
|
6205
6113
|
return obj;
|
|
6206
6114
|
},
|
|
6207
6115
|
create(base) {
|
|
6208
6116
|
return SyncFlagsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
6209
6117
|
},
|
|
6210
6118
|
fromPartial(object) {
|
|
6211
|
-
var _a
|
|
6119
|
+
var _a;
|
|
6212
6120
|
const message = createBaseSyncFlagsResponse();
|
|
6213
6121
|
message.flagConfiguration = (_a = object.flagConfiguration) !== null && _a !== void 0 ? _a : "";
|
|
6214
|
-
message.state = (_b = object.state) !== null && _b !== void 0 ? _b : 0;
|
|
6215
6122
|
return message;
|
|
6216
6123
|
},
|
|
6217
6124
|
};
|
|
@@ -6333,9 +6240,95 @@ const FetchAllFlagsResponse = {
|
|
|
6333
6240
|
return message;
|
|
6334
6241
|
},
|
|
6335
6242
|
};
|
|
6243
|
+
function createBaseGetMetadataRequest() {
|
|
6244
|
+
return {};
|
|
6245
|
+
}
|
|
6246
|
+
const GetMetadataRequest = {
|
|
6247
|
+
encode(_, writer = minimal.Writer.create()) {
|
|
6248
|
+
return writer;
|
|
6249
|
+
},
|
|
6250
|
+
decode(input, length) {
|
|
6251
|
+
const reader = input instanceof minimal.Reader ? input : minimal.Reader.create(input);
|
|
6252
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
6253
|
+
const message = createBaseGetMetadataRequest();
|
|
6254
|
+
while (reader.pos < end) {
|
|
6255
|
+
const tag = reader.uint32();
|
|
6256
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6257
|
+
break;
|
|
6258
|
+
}
|
|
6259
|
+
reader.skipType(tag & 7);
|
|
6260
|
+
}
|
|
6261
|
+
return message;
|
|
6262
|
+
},
|
|
6263
|
+
fromJSON(_) {
|
|
6264
|
+
return {};
|
|
6265
|
+
},
|
|
6266
|
+
toJSON(_) {
|
|
6267
|
+
const obj = {};
|
|
6268
|
+
return obj;
|
|
6269
|
+
},
|
|
6270
|
+
create(base) {
|
|
6271
|
+
return GetMetadataRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
6272
|
+
},
|
|
6273
|
+
fromPartial(_) {
|
|
6274
|
+
const message = createBaseGetMetadataRequest();
|
|
6275
|
+
return message;
|
|
6276
|
+
},
|
|
6277
|
+
};
|
|
6278
|
+
function createBaseGetMetadataResponse() {
|
|
6279
|
+
return { metadata: undefined };
|
|
6280
|
+
}
|
|
6281
|
+
const GetMetadataResponse = {
|
|
6282
|
+
encode(message, writer = minimal.Writer.create()) {
|
|
6283
|
+
if (message.metadata !== undefined) {
|
|
6284
|
+
Struct.encode(Struct.wrap(message.metadata), writer.uint32(18).fork()).ldelim();
|
|
6285
|
+
}
|
|
6286
|
+
return writer;
|
|
6287
|
+
},
|
|
6288
|
+
decode(input, length) {
|
|
6289
|
+
const reader = input instanceof minimal.Reader ? input : minimal.Reader.create(input);
|
|
6290
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
6291
|
+
const message = createBaseGetMetadataResponse();
|
|
6292
|
+
while (reader.pos < end) {
|
|
6293
|
+
const tag = reader.uint32();
|
|
6294
|
+
switch (tag >>> 3) {
|
|
6295
|
+
case 2:
|
|
6296
|
+
if (tag !== 18) {
|
|
6297
|
+
break;
|
|
6298
|
+
}
|
|
6299
|
+
message.metadata = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
6300
|
+
continue;
|
|
6301
|
+
}
|
|
6302
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6303
|
+
break;
|
|
6304
|
+
}
|
|
6305
|
+
reader.skipType(tag & 7);
|
|
6306
|
+
}
|
|
6307
|
+
return message;
|
|
6308
|
+
},
|
|
6309
|
+
fromJSON(object) {
|
|
6310
|
+
return { metadata: isObject(object.metadata) ? object.metadata : undefined };
|
|
6311
|
+
},
|
|
6312
|
+
toJSON(message) {
|
|
6313
|
+
const obj = {};
|
|
6314
|
+
if (message.metadata !== undefined) {
|
|
6315
|
+
obj.metadata = message.metadata;
|
|
6316
|
+
}
|
|
6317
|
+
return obj;
|
|
6318
|
+
},
|
|
6319
|
+
create(base) {
|
|
6320
|
+
return GetMetadataResponse.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
6321
|
+
},
|
|
6322
|
+
fromPartial(object) {
|
|
6323
|
+
var _a;
|
|
6324
|
+
const message = createBaseGetMetadataResponse();
|
|
6325
|
+
message.metadata = (_a = object.metadata) !== null && _a !== void 0 ? _a : undefined;
|
|
6326
|
+
return message;
|
|
6327
|
+
},
|
|
6328
|
+
};
|
|
6336
6329
|
const FlagSyncServiceService = {
|
|
6337
6330
|
syncFlags: {
|
|
6338
|
-
path: "/sync.v1.FlagSyncService/SyncFlags",
|
|
6331
|
+
path: "/flagd.sync.v1.FlagSyncService/SyncFlags",
|
|
6339
6332
|
requestStream: false,
|
|
6340
6333
|
responseStream: true,
|
|
6341
6334
|
requestSerialize: (value) => Buffer.from(SyncFlagsRequest.encode(value).finish()),
|
|
@@ -6344,7 +6337,7 @@ const FlagSyncServiceService = {
|
|
|
6344
6337
|
responseDeserialize: (value) => SyncFlagsResponse.decode(value),
|
|
6345
6338
|
},
|
|
6346
6339
|
fetchAllFlags: {
|
|
6347
|
-
path: "/sync.v1.FlagSyncService/FetchAllFlags",
|
|
6340
|
+
path: "/flagd.sync.v1.FlagSyncService/FetchAllFlags",
|
|
6348
6341
|
requestStream: false,
|
|
6349
6342
|
responseStream: false,
|
|
6350
6343
|
requestSerialize: (value) => Buffer.from(FetchAllFlagsRequest.encode(value).finish()),
|
|
@@ -6352,8 +6345,20 @@ const FlagSyncServiceService = {
|
|
|
6352
6345
|
responseSerialize: (value) => Buffer.from(FetchAllFlagsResponse.encode(value).finish()),
|
|
6353
6346
|
responseDeserialize: (value) => FetchAllFlagsResponse.decode(value),
|
|
6354
6347
|
},
|
|
6348
|
+
getMetadata: {
|
|
6349
|
+
path: "/flagd.sync.v1.FlagSyncService/GetMetadata",
|
|
6350
|
+
requestStream: false,
|
|
6351
|
+
responseStream: false,
|
|
6352
|
+
requestSerialize: (value) => Buffer.from(GetMetadataRequest.encode(value).finish()),
|
|
6353
|
+
requestDeserialize: (value) => GetMetadataRequest.decode(value),
|
|
6354
|
+
responseSerialize: (value) => Buffer.from(GetMetadataResponse.encode(value).finish()),
|
|
6355
|
+
responseDeserialize: (value) => GetMetadataResponse.decode(value),
|
|
6356
|
+
},
|
|
6355
6357
|
};
|
|
6356
|
-
const FlagSyncServiceClient = grpcJs.makeGenericClientConstructor(FlagSyncServiceService, "sync.v1.FlagSyncService");
|
|
6358
|
+
const FlagSyncServiceClient = grpcJs.makeGenericClientConstructor(FlagSyncServiceService, "flagd.sync.v1.FlagSyncService");
|
|
6359
|
+
function isObject(value) {
|
|
6360
|
+
return typeof value === "object" && value !== null;
|
|
6361
|
+
}
|
|
6357
6362
|
function isSet(value) {
|
|
6358
6363
|
return value !== null && value !== undefined;
|
|
6359
6364
|
}
|
|
@@ -6399,39 +6404,47 @@ class GrpcFetch {
|
|
|
6399
6404
|
var _a;
|
|
6400
6405
|
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.debug('Starting gRPC sync connection');
|
|
6401
6406
|
closeStreamIfDefined(this._syncStream);
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6407
|
+
try {
|
|
6408
|
+
this._syncStream = this._syncClient.syncFlags(this._request);
|
|
6409
|
+
this._syncStream.on('data', (data) => {
|
|
6410
|
+
var _a, _b, _c, _d;
|
|
6411
|
+
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.debug(`Received sync payload`);
|
|
6412
|
+
try {
|
|
6413
|
+
const changes = dataCallback(data.flagConfiguration);
|
|
6414
|
+
if (this._initialized && changes.length > 0) {
|
|
6415
|
+
changedCallback(changes);
|
|
6416
|
+
}
|
|
6410
6417
|
}
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
this.
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6418
|
+
catch (err) {
|
|
6419
|
+
(_b = this._logger) === null || _b === void 0 ? void 0 : _b.debug('Error processing sync payload: ', (_c = err === null || err === void 0 ? void 0 : err.message) !== null && _c !== void 0 ? _c : 'unknown error');
|
|
6420
|
+
}
|
|
6421
|
+
if (resolveConnect) {
|
|
6422
|
+
resolveConnect();
|
|
6423
|
+
}
|
|
6424
|
+
else if (!this._isConnected) {
|
|
6425
|
+
// Not the first connection and there's no active connection.
|
|
6426
|
+
(_d = this._logger) === null || _d === void 0 ? void 0 : _d.debug('Reconnected to gRPC sync');
|
|
6427
|
+
reconnectCallback();
|
|
6428
|
+
}
|
|
6429
|
+
this._isConnected = true;
|
|
6430
|
+
});
|
|
6431
|
+
this._syncStream.on('error', (err) => {
|
|
6432
|
+
this.handleError(err, dataCallback, reconnectCallback, changedCallback, disconnectCallback, rejectConnect);
|
|
6433
|
+
});
|
|
6434
|
+
}
|
|
6435
|
+
catch (err) {
|
|
6436
|
+
this.handleError(err, dataCallback, reconnectCallback, changedCallback, disconnectCallback, rejectConnect);
|
|
6437
|
+
}
|
|
6438
|
+
}
|
|
6439
|
+
handleError(err, dataCallback, reconnectCallback, changedCallback, disconnectCallback, rejectConnect) {
|
|
6440
|
+
var _a, _b, _c;
|
|
6441
|
+
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.error('Connection error, attempting to reconnect');
|
|
6442
|
+
(_b = this._logger) === null || _b === void 0 ? void 0 : _b.debug(err);
|
|
6443
|
+
this._isConnected = false;
|
|
6444
|
+
const errorMessage = (_c = err === null || err === void 0 ? void 0 : err.message) !== null && _c !== void 0 ? _c : 'Failed to connect to syncFlags stream';
|
|
6445
|
+
disconnectCallback(errorMessage);
|
|
6446
|
+
rejectConnect === null || rejectConnect === void 0 ? void 0 : rejectConnect(new serverSdk.GeneralError(errorMessage));
|
|
6447
|
+
this.reconnect(dataCallback, reconnectCallback, changedCallback, disconnectCallback);
|
|
6435
6448
|
}
|
|
6436
6449
|
reconnect(dataCallback, reconnectCallback, changedCallback, disconnectCallback) {
|
|
6437
6450
|
const channel = this._syncClient.getChannel();
|
package/index.esm.js
CHANGED
|
@@ -4149,7 +4149,7 @@ const Struct = {
|
|
|
4149
4149
|
},
|
|
4150
4150
|
fromJSON(object) {
|
|
4151
4151
|
return {
|
|
4152
|
-
fields: isObject$
|
|
4152
|
+
fields: isObject$2(object.fields)
|
|
4153
4153
|
? Object.entries(object.fields).reduce((acc, [key, value]) => {
|
|
4154
4154
|
acc[key] = value;
|
|
4155
4155
|
return acc;
|
|
@@ -4356,7 +4356,7 @@ const Value = {
|
|
|
4356
4356
|
numberValue: isSet$2(object.numberValue) ? Number(object.numberValue) : undefined,
|
|
4357
4357
|
stringValue: isSet$2(object.stringValue) ? String(object.stringValue) : undefined,
|
|
4358
4358
|
boolValue: isSet$2(object.boolValue) ? Boolean(object.boolValue) : undefined,
|
|
4359
|
-
structValue: isObject$
|
|
4359
|
+
structValue: isObject$2(object.structValue) ? object.structValue : undefined,
|
|
4360
4360
|
listValue: Array.isArray(object.listValue) ? [...object.listValue] : undefined,
|
|
4361
4361
|
};
|
|
4362
4362
|
},
|
|
@@ -4508,7 +4508,7 @@ const ListValue = {
|
|
|
4508
4508
|
}
|
|
4509
4509
|
},
|
|
4510
4510
|
};
|
|
4511
|
-
function isObject$
|
|
4511
|
+
function isObject$2(value) {
|
|
4512
4512
|
return typeof value === "object" && value !== null;
|
|
4513
4513
|
}
|
|
4514
4514
|
function isSet$2(value) {
|
|
@@ -4548,7 +4548,7 @@ const ResolveAllRequest = {
|
|
|
4548
4548
|
return message;
|
|
4549
4549
|
},
|
|
4550
4550
|
fromJSON(object) {
|
|
4551
|
-
return { context: isObject(object.context) ? object.context : undefined };
|
|
4551
|
+
return { context: isObject$1(object.context) ? object.context : undefined };
|
|
4552
4552
|
},
|
|
4553
4553
|
toJSON(message) {
|
|
4554
4554
|
const obj = {};
|
|
@@ -4603,7 +4603,7 @@ const ResolveAllResponse = {
|
|
|
4603
4603
|
},
|
|
4604
4604
|
fromJSON(object) {
|
|
4605
4605
|
return {
|
|
4606
|
-
flags: isObject(object.flags)
|
|
4606
|
+
flags: isObject$1(object.flags)
|
|
4607
4607
|
? Object.entries(object.flags).reduce((acc, [key, value]) => {
|
|
4608
4608
|
acc[key] = AnyFlag.fromJSON(value);
|
|
4609
4609
|
return acc;
|
|
@@ -4798,7 +4798,7 @@ const AnyFlag = {
|
|
|
4798
4798
|
boolValue: isSet$1(object.boolValue) ? Boolean(object.boolValue) : undefined,
|
|
4799
4799
|
stringValue: isSet$1(object.stringValue) ? String(object.stringValue) : undefined,
|
|
4800
4800
|
doubleValue: isSet$1(object.doubleValue) ? Number(object.doubleValue) : undefined,
|
|
4801
|
-
objectValue: isObject(object.objectValue) ? object.objectValue : undefined,
|
|
4801
|
+
objectValue: isObject$1(object.objectValue) ? object.objectValue : undefined,
|
|
4802
4802
|
};
|
|
4803
4803
|
},
|
|
4804
4804
|
toJSON(message) {
|
|
@@ -4881,7 +4881,7 @@ const ResolveBooleanRequest = {
|
|
|
4881
4881
|
fromJSON(object) {
|
|
4882
4882
|
return {
|
|
4883
4883
|
flagKey: isSet$1(object.flagKey) ? String(object.flagKey) : "",
|
|
4884
|
-
context: isObject(object.context) ? object.context : undefined,
|
|
4884
|
+
context: isObject$1(object.context) ? object.context : undefined,
|
|
4885
4885
|
};
|
|
4886
4886
|
},
|
|
4887
4887
|
toJSON(message) {
|
|
@@ -4968,7 +4968,7 @@ const ResolveBooleanResponse = {
|
|
|
4968
4968
|
value: isSet$1(object.value) ? Boolean(object.value) : false,
|
|
4969
4969
|
reason: isSet$1(object.reason) ? String(object.reason) : "",
|
|
4970
4970
|
variant: isSet$1(object.variant) ? String(object.variant) : "",
|
|
4971
|
-
metadata: isObject(object.metadata) ? object.metadata : undefined,
|
|
4971
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
4972
4972
|
};
|
|
4973
4973
|
},
|
|
4974
4974
|
toJSON(message) {
|
|
@@ -5043,7 +5043,7 @@ const ResolveStringRequest = {
|
|
|
5043
5043
|
fromJSON(object) {
|
|
5044
5044
|
return {
|
|
5045
5045
|
flagKey: isSet$1(object.flagKey) ? String(object.flagKey) : "",
|
|
5046
|
-
context: isObject(object.context) ? object.context : undefined,
|
|
5046
|
+
context: isObject$1(object.context) ? object.context : undefined,
|
|
5047
5047
|
};
|
|
5048
5048
|
},
|
|
5049
5049
|
toJSON(message) {
|
|
@@ -5130,7 +5130,7 @@ const ResolveStringResponse = {
|
|
|
5130
5130
|
value: isSet$1(object.value) ? String(object.value) : "",
|
|
5131
5131
|
reason: isSet$1(object.reason) ? String(object.reason) : "",
|
|
5132
5132
|
variant: isSet$1(object.variant) ? String(object.variant) : "",
|
|
5133
|
-
metadata: isObject(object.metadata) ? object.metadata : undefined,
|
|
5133
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
5134
5134
|
};
|
|
5135
5135
|
},
|
|
5136
5136
|
toJSON(message) {
|
|
@@ -5205,7 +5205,7 @@ const ResolveFloatRequest = {
|
|
|
5205
5205
|
fromJSON(object) {
|
|
5206
5206
|
return {
|
|
5207
5207
|
flagKey: isSet$1(object.flagKey) ? String(object.flagKey) : "",
|
|
5208
|
-
context: isObject(object.context) ? object.context : undefined,
|
|
5208
|
+
context: isObject$1(object.context) ? object.context : undefined,
|
|
5209
5209
|
};
|
|
5210
5210
|
},
|
|
5211
5211
|
toJSON(message) {
|
|
@@ -5292,7 +5292,7 @@ const ResolveFloatResponse = {
|
|
|
5292
5292
|
value: isSet$1(object.value) ? Number(object.value) : 0,
|
|
5293
5293
|
reason: isSet$1(object.reason) ? String(object.reason) : "",
|
|
5294
5294
|
variant: isSet$1(object.variant) ? String(object.variant) : "",
|
|
5295
|
-
metadata: isObject(object.metadata) ? object.metadata : undefined,
|
|
5295
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
5296
5296
|
};
|
|
5297
5297
|
},
|
|
5298
5298
|
toJSON(message) {
|
|
@@ -5367,7 +5367,7 @@ const ResolveIntRequest = {
|
|
|
5367
5367
|
fromJSON(object) {
|
|
5368
5368
|
return {
|
|
5369
5369
|
flagKey: isSet$1(object.flagKey) ? String(object.flagKey) : "",
|
|
5370
|
-
context: isObject(object.context) ? object.context : undefined,
|
|
5370
|
+
context: isObject$1(object.context) ? object.context : undefined,
|
|
5371
5371
|
};
|
|
5372
5372
|
},
|
|
5373
5373
|
toJSON(message) {
|
|
@@ -5454,7 +5454,7 @@ const ResolveIntResponse = {
|
|
|
5454
5454
|
value: isSet$1(object.value) ? String(object.value) : "0",
|
|
5455
5455
|
reason: isSet$1(object.reason) ? String(object.reason) : "",
|
|
5456
5456
|
variant: isSet$1(object.variant) ? String(object.variant) : "",
|
|
5457
|
-
metadata: isObject(object.metadata) ? object.metadata : undefined,
|
|
5457
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
5458
5458
|
};
|
|
5459
5459
|
},
|
|
5460
5460
|
toJSON(message) {
|
|
@@ -5529,7 +5529,7 @@ const ResolveObjectRequest = {
|
|
|
5529
5529
|
fromJSON(object) {
|
|
5530
5530
|
return {
|
|
5531
5531
|
flagKey: isSet$1(object.flagKey) ? String(object.flagKey) : "",
|
|
5532
|
-
context: isObject(object.context) ? object.context : undefined,
|
|
5532
|
+
context: isObject$1(object.context) ? object.context : undefined,
|
|
5533
5533
|
};
|
|
5534
5534
|
},
|
|
5535
5535
|
toJSON(message) {
|
|
@@ -5613,10 +5613,10 @@ const ResolveObjectResponse = {
|
|
|
5613
5613
|
},
|
|
5614
5614
|
fromJSON(object) {
|
|
5615
5615
|
return {
|
|
5616
|
-
value: isObject(object.value) ? object.value : undefined,
|
|
5616
|
+
value: isObject$1(object.value) ? object.value : undefined,
|
|
5617
5617
|
reason: isSet$1(object.reason) ? String(object.reason) : "",
|
|
5618
5618
|
variant: isSet$1(object.variant) ? String(object.variant) : "",
|
|
5619
|
-
metadata: isObject(object.metadata) ? object.metadata : undefined,
|
|
5619
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
5620
5620
|
};
|
|
5621
5621
|
},
|
|
5622
5622
|
toJSON(message) {
|
|
@@ -5691,7 +5691,7 @@ const EventStreamResponse = {
|
|
|
5691
5691
|
fromJSON(object) {
|
|
5692
5692
|
return {
|
|
5693
5693
|
type: isSet$1(object.type) ? String(object.type) : "",
|
|
5694
|
-
data: isObject(object.data) ? object.data : undefined,
|
|
5694
|
+
data: isObject$1(object.data) ? object.data : undefined,
|
|
5695
5695
|
};
|
|
5696
5696
|
},
|
|
5697
5697
|
toJSON(message) {
|
|
@@ -5752,7 +5752,7 @@ const EventStreamRequest = {
|
|
|
5752
5752
|
};
|
|
5753
5753
|
const ServiceService = {
|
|
5754
5754
|
resolveAll: {
|
|
5755
|
-
path: "/
|
|
5755
|
+
path: "/flagd.evaluation.v1.Service/ResolveAll",
|
|
5756
5756
|
requestStream: false,
|
|
5757
5757
|
responseStream: false,
|
|
5758
5758
|
requestSerialize: (value) => Buffer.from(ResolveAllRequest.encode(value).finish()),
|
|
@@ -5761,7 +5761,7 @@ const ServiceService = {
|
|
|
5761
5761
|
responseDeserialize: (value) => ResolveAllResponse.decode(value),
|
|
5762
5762
|
},
|
|
5763
5763
|
resolveBoolean: {
|
|
5764
|
-
path: "/
|
|
5764
|
+
path: "/flagd.evaluation.v1.Service/ResolveBoolean",
|
|
5765
5765
|
requestStream: false,
|
|
5766
5766
|
responseStream: false,
|
|
5767
5767
|
requestSerialize: (value) => Buffer.from(ResolveBooleanRequest.encode(value).finish()),
|
|
@@ -5770,7 +5770,7 @@ const ServiceService = {
|
|
|
5770
5770
|
responseDeserialize: (value) => ResolveBooleanResponse.decode(value),
|
|
5771
5771
|
},
|
|
5772
5772
|
resolveString: {
|
|
5773
|
-
path: "/
|
|
5773
|
+
path: "/flagd.evaluation.v1.Service/ResolveString",
|
|
5774
5774
|
requestStream: false,
|
|
5775
5775
|
responseStream: false,
|
|
5776
5776
|
requestSerialize: (value) => Buffer.from(ResolveStringRequest.encode(value).finish()),
|
|
@@ -5779,7 +5779,7 @@ const ServiceService = {
|
|
|
5779
5779
|
responseDeserialize: (value) => ResolveStringResponse.decode(value),
|
|
5780
5780
|
},
|
|
5781
5781
|
resolveFloat: {
|
|
5782
|
-
path: "/
|
|
5782
|
+
path: "/flagd.evaluation.v1.Service/ResolveFloat",
|
|
5783
5783
|
requestStream: false,
|
|
5784
5784
|
responseStream: false,
|
|
5785
5785
|
requestSerialize: (value) => Buffer.from(ResolveFloatRequest.encode(value).finish()),
|
|
@@ -5788,7 +5788,7 @@ const ServiceService = {
|
|
|
5788
5788
|
responseDeserialize: (value) => ResolveFloatResponse.decode(value),
|
|
5789
5789
|
},
|
|
5790
5790
|
resolveInt: {
|
|
5791
|
-
path: "/
|
|
5791
|
+
path: "/flagd.evaluation.v1.Service/ResolveInt",
|
|
5792
5792
|
requestStream: false,
|
|
5793
5793
|
responseStream: false,
|
|
5794
5794
|
requestSerialize: (value) => Buffer.from(ResolveIntRequest.encode(value).finish()),
|
|
@@ -5797,7 +5797,7 @@ const ServiceService = {
|
|
|
5797
5797
|
responseDeserialize: (value) => ResolveIntResponse.decode(value),
|
|
5798
5798
|
},
|
|
5799
5799
|
resolveObject: {
|
|
5800
|
-
path: "/
|
|
5800
|
+
path: "/flagd.evaluation.v1.Service/ResolveObject",
|
|
5801
5801
|
requestStream: false,
|
|
5802
5802
|
responseStream: false,
|
|
5803
5803
|
requestSerialize: (value) => Buffer.from(ResolveObjectRequest.encode(value).finish()),
|
|
@@ -5806,7 +5806,7 @@ const ServiceService = {
|
|
|
5806
5806
|
responseDeserialize: (value) => ResolveObjectResponse.decode(value),
|
|
5807
5807
|
},
|
|
5808
5808
|
eventStream: {
|
|
5809
|
-
path: "/
|
|
5809
|
+
path: "/flagd.evaluation.v1.Service/EventStream",
|
|
5810
5810
|
requestStream: false,
|
|
5811
5811
|
responseStream: true,
|
|
5812
5812
|
requestSerialize: (value) => Buffer.from(EventStreamRequest.encode(value).finish()),
|
|
@@ -5815,7 +5815,7 @@ const ServiceService = {
|
|
|
5815
5815
|
responseDeserialize: (value) => EventStreamResponse.decode(value),
|
|
5816
5816
|
},
|
|
5817
5817
|
};
|
|
5818
|
-
const ServiceClient = makeGenericClientConstructor(ServiceService, "
|
|
5818
|
+
const ServiceClient = makeGenericClientConstructor(ServiceService, "flagd.evaluation.v1.Service");
|
|
5819
5819
|
function longToString(long) {
|
|
5820
5820
|
return long.toString();
|
|
5821
5821
|
}
|
|
@@ -5823,7 +5823,7 @@ if (minimal.util.Long !== long) {
|
|
|
5823
5823
|
minimal.util.Long = long;
|
|
5824
5824
|
minimal.configure();
|
|
5825
5825
|
}
|
|
5826
|
-
function isObject(value) {
|
|
5826
|
+
function isObject$1(value) {
|
|
5827
5827
|
return typeof value === "object" && value !== null;
|
|
5828
5828
|
}
|
|
5829
5829
|
function isSet$1(value) {
|
|
@@ -6000,83 +6000,6 @@ class GRPCService {
|
|
|
6000
6000
|
}
|
|
6001
6001
|
|
|
6002
6002
|
/* eslint-disable */
|
|
6003
|
-
/**
|
|
6004
|
-
* Flag definition sync API
|
|
6005
|
-
*
|
|
6006
|
-
* This proto defines a simple API to synchronize a feature flag definition.
|
|
6007
|
-
* It supports establishing a stream for getting notifications about changes in a flag definition.
|
|
6008
|
-
*/
|
|
6009
|
-
/**
|
|
6010
|
-
* SyncState conveys the state of the payload. These states are related to flagd isync.go type definitions but
|
|
6011
|
-
* contains extras to optimize grpc use case. Refer - https://github.com/open-feature/flagd/blob/main/pkg/sync/isync.go
|
|
6012
|
-
*/
|
|
6013
|
-
var SyncState;
|
|
6014
|
-
(function (SyncState) {
|
|
6015
|
-
/** SYNC_STATE_UNSPECIFIED - Value is ignored by the listening flagd */
|
|
6016
|
-
SyncState[SyncState["SYNC_STATE_UNSPECIFIED"] = 0] = "SYNC_STATE_UNSPECIFIED";
|
|
6017
|
-
/**
|
|
6018
|
-
* SYNC_STATE_ALL - All the flags matching the request. This is the default response and other states can be ignored
|
|
6019
|
-
* by the implementation. Flagd internally replaces all existing flags for this response state.
|
|
6020
|
-
*/
|
|
6021
|
-
SyncState[SyncState["SYNC_STATE_ALL"] = 1] = "SYNC_STATE_ALL";
|
|
6022
|
-
/** SYNC_STATE_ADD - Convey an addition of a flag. Flagd internally handles this by combining new flags with existing ones */
|
|
6023
|
-
SyncState[SyncState["SYNC_STATE_ADD"] = 2] = "SYNC_STATE_ADD";
|
|
6024
|
-
/**
|
|
6025
|
-
* SYNC_STATE_UPDATE - Convey an update of a flag. Flagd internally attempts to update if the updated flag already exist OR if it does not,
|
|
6026
|
-
* it will get added
|
|
6027
|
-
*/
|
|
6028
|
-
SyncState[SyncState["SYNC_STATE_UPDATE"] = 3] = "SYNC_STATE_UPDATE";
|
|
6029
|
-
/** SYNC_STATE_DELETE - Convey a deletion of a flag. Flagd internally removes the flag */
|
|
6030
|
-
SyncState[SyncState["SYNC_STATE_DELETE"] = 4] = "SYNC_STATE_DELETE";
|
|
6031
|
-
/** SYNC_STATE_PING - Optional server ping to check client connectivity. Handling is ignored by flagd and is to merely support live check */
|
|
6032
|
-
SyncState[SyncState["SYNC_STATE_PING"] = 5] = "SYNC_STATE_PING";
|
|
6033
|
-
SyncState[SyncState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
6034
|
-
})(SyncState || (SyncState = {}));
|
|
6035
|
-
function syncStateFromJSON(object) {
|
|
6036
|
-
switch (object) {
|
|
6037
|
-
case 0:
|
|
6038
|
-
case "SYNC_STATE_UNSPECIFIED":
|
|
6039
|
-
return SyncState.SYNC_STATE_UNSPECIFIED;
|
|
6040
|
-
case 1:
|
|
6041
|
-
case "SYNC_STATE_ALL":
|
|
6042
|
-
return SyncState.SYNC_STATE_ALL;
|
|
6043
|
-
case 2:
|
|
6044
|
-
case "SYNC_STATE_ADD":
|
|
6045
|
-
return SyncState.SYNC_STATE_ADD;
|
|
6046
|
-
case 3:
|
|
6047
|
-
case "SYNC_STATE_UPDATE":
|
|
6048
|
-
return SyncState.SYNC_STATE_UPDATE;
|
|
6049
|
-
case 4:
|
|
6050
|
-
case "SYNC_STATE_DELETE":
|
|
6051
|
-
return SyncState.SYNC_STATE_DELETE;
|
|
6052
|
-
case 5:
|
|
6053
|
-
case "SYNC_STATE_PING":
|
|
6054
|
-
return SyncState.SYNC_STATE_PING;
|
|
6055
|
-
case -1:
|
|
6056
|
-
case "UNRECOGNIZED":
|
|
6057
|
-
default:
|
|
6058
|
-
return SyncState.UNRECOGNIZED;
|
|
6059
|
-
}
|
|
6060
|
-
}
|
|
6061
|
-
function syncStateToJSON(object) {
|
|
6062
|
-
switch (object) {
|
|
6063
|
-
case SyncState.SYNC_STATE_UNSPECIFIED:
|
|
6064
|
-
return "SYNC_STATE_UNSPECIFIED";
|
|
6065
|
-
case SyncState.SYNC_STATE_ALL:
|
|
6066
|
-
return "SYNC_STATE_ALL";
|
|
6067
|
-
case SyncState.SYNC_STATE_ADD:
|
|
6068
|
-
return "SYNC_STATE_ADD";
|
|
6069
|
-
case SyncState.SYNC_STATE_UPDATE:
|
|
6070
|
-
return "SYNC_STATE_UPDATE";
|
|
6071
|
-
case SyncState.SYNC_STATE_DELETE:
|
|
6072
|
-
return "SYNC_STATE_DELETE";
|
|
6073
|
-
case SyncState.SYNC_STATE_PING:
|
|
6074
|
-
return "SYNC_STATE_PING";
|
|
6075
|
-
case SyncState.UNRECOGNIZED:
|
|
6076
|
-
default:
|
|
6077
|
-
return "UNRECOGNIZED";
|
|
6078
|
-
}
|
|
6079
|
-
}
|
|
6080
6003
|
function createBaseSyncFlagsRequest() {
|
|
6081
6004
|
return { providerId: "", selector: "" };
|
|
6082
6005
|
}
|
|
@@ -6145,16 +6068,13 @@ const SyncFlagsRequest = {
|
|
|
6145
6068
|
},
|
|
6146
6069
|
};
|
|
6147
6070
|
function createBaseSyncFlagsResponse() {
|
|
6148
|
-
return { flagConfiguration: ""
|
|
6071
|
+
return { flagConfiguration: "" };
|
|
6149
6072
|
}
|
|
6150
6073
|
const SyncFlagsResponse = {
|
|
6151
6074
|
encode(message, writer = minimal.Writer.create()) {
|
|
6152
6075
|
if (message.flagConfiguration !== "") {
|
|
6153
6076
|
writer.uint32(10).string(message.flagConfiguration);
|
|
6154
6077
|
}
|
|
6155
|
-
if (message.state !== 0) {
|
|
6156
|
-
writer.uint32(16).int32(message.state);
|
|
6157
|
-
}
|
|
6158
6078
|
return writer;
|
|
6159
6079
|
},
|
|
6160
6080
|
decode(input, length) {
|
|
@@ -6170,12 +6090,6 @@ const SyncFlagsResponse = {
|
|
|
6170
6090
|
}
|
|
6171
6091
|
message.flagConfiguration = reader.string();
|
|
6172
6092
|
continue;
|
|
6173
|
-
case 2:
|
|
6174
|
-
if (tag !== 16) {
|
|
6175
|
-
break;
|
|
6176
|
-
}
|
|
6177
|
-
message.state = reader.int32();
|
|
6178
|
-
continue;
|
|
6179
6093
|
}
|
|
6180
6094
|
if ((tag & 7) === 4 || tag === 0) {
|
|
6181
6095
|
break;
|
|
@@ -6185,29 +6099,22 @@ const SyncFlagsResponse = {
|
|
|
6185
6099
|
return message;
|
|
6186
6100
|
},
|
|
6187
6101
|
fromJSON(object) {
|
|
6188
|
-
return {
|
|
6189
|
-
flagConfiguration: isSet(object.flagConfiguration) ? String(object.flagConfiguration) : "",
|
|
6190
|
-
state: isSet(object.state) ? syncStateFromJSON(object.state) : 0,
|
|
6191
|
-
};
|
|
6102
|
+
return { flagConfiguration: isSet(object.flagConfiguration) ? String(object.flagConfiguration) : "" };
|
|
6192
6103
|
},
|
|
6193
6104
|
toJSON(message) {
|
|
6194
6105
|
const obj = {};
|
|
6195
6106
|
if (message.flagConfiguration !== "") {
|
|
6196
6107
|
obj.flagConfiguration = message.flagConfiguration;
|
|
6197
6108
|
}
|
|
6198
|
-
if (message.state !== 0) {
|
|
6199
|
-
obj.state = syncStateToJSON(message.state);
|
|
6200
|
-
}
|
|
6201
6109
|
return obj;
|
|
6202
6110
|
},
|
|
6203
6111
|
create(base) {
|
|
6204
6112
|
return SyncFlagsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
6205
6113
|
},
|
|
6206
6114
|
fromPartial(object) {
|
|
6207
|
-
var _a
|
|
6115
|
+
var _a;
|
|
6208
6116
|
const message = createBaseSyncFlagsResponse();
|
|
6209
6117
|
message.flagConfiguration = (_a = object.flagConfiguration) !== null && _a !== void 0 ? _a : "";
|
|
6210
|
-
message.state = (_b = object.state) !== null && _b !== void 0 ? _b : 0;
|
|
6211
6118
|
return message;
|
|
6212
6119
|
},
|
|
6213
6120
|
};
|
|
@@ -6329,9 +6236,95 @@ const FetchAllFlagsResponse = {
|
|
|
6329
6236
|
return message;
|
|
6330
6237
|
},
|
|
6331
6238
|
};
|
|
6239
|
+
function createBaseGetMetadataRequest() {
|
|
6240
|
+
return {};
|
|
6241
|
+
}
|
|
6242
|
+
const GetMetadataRequest = {
|
|
6243
|
+
encode(_, writer = minimal.Writer.create()) {
|
|
6244
|
+
return writer;
|
|
6245
|
+
},
|
|
6246
|
+
decode(input, length) {
|
|
6247
|
+
const reader = input instanceof minimal.Reader ? input : minimal.Reader.create(input);
|
|
6248
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
6249
|
+
const message = createBaseGetMetadataRequest();
|
|
6250
|
+
while (reader.pos < end) {
|
|
6251
|
+
const tag = reader.uint32();
|
|
6252
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6253
|
+
break;
|
|
6254
|
+
}
|
|
6255
|
+
reader.skipType(tag & 7);
|
|
6256
|
+
}
|
|
6257
|
+
return message;
|
|
6258
|
+
},
|
|
6259
|
+
fromJSON(_) {
|
|
6260
|
+
return {};
|
|
6261
|
+
},
|
|
6262
|
+
toJSON(_) {
|
|
6263
|
+
const obj = {};
|
|
6264
|
+
return obj;
|
|
6265
|
+
},
|
|
6266
|
+
create(base) {
|
|
6267
|
+
return GetMetadataRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
6268
|
+
},
|
|
6269
|
+
fromPartial(_) {
|
|
6270
|
+
const message = createBaseGetMetadataRequest();
|
|
6271
|
+
return message;
|
|
6272
|
+
},
|
|
6273
|
+
};
|
|
6274
|
+
function createBaseGetMetadataResponse() {
|
|
6275
|
+
return { metadata: undefined };
|
|
6276
|
+
}
|
|
6277
|
+
const GetMetadataResponse = {
|
|
6278
|
+
encode(message, writer = minimal.Writer.create()) {
|
|
6279
|
+
if (message.metadata !== undefined) {
|
|
6280
|
+
Struct.encode(Struct.wrap(message.metadata), writer.uint32(18).fork()).ldelim();
|
|
6281
|
+
}
|
|
6282
|
+
return writer;
|
|
6283
|
+
},
|
|
6284
|
+
decode(input, length) {
|
|
6285
|
+
const reader = input instanceof minimal.Reader ? input : minimal.Reader.create(input);
|
|
6286
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
6287
|
+
const message = createBaseGetMetadataResponse();
|
|
6288
|
+
while (reader.pos < end) {
|
|
6289
|
+
const tag = reader.uint32();
|
|
6290
|
+
switch (tag >>> 3) {
|
|
6291
|
+
case 2:
|
|
6292
|
+
if (tag !== 18) {
|
|
6293
|
+
break;
|
|
6294
|
+
}
|
|
6295
|
+
message.metadata = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
6296
|
+
continue;
|
|
6297
|
+
}
|
|
6298
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6299
|
+
break;
|
|
6300
|
+
}
|
|
6301
|
+
reader.skipType(tag & 7);
|
|
6302
|
+
}
|
|
6303
|
+
return message;
|
|
6304
|
+
},
|
|
6305
|
+
fromJSON(object) {
|
|
6306
|
+
return { metadata: isObject(object.metadata) ? object.metadata : undefined };
|
|
6307
|
+
},
|
|
6308
|
+
toJSON(message) {
|
|
6309
|
+
const obj = {};
|
|
6310
|
+
if (message.metadata !== undefined) {
|
|
6311
|
+
obj.metadata = message.metadata;
|
|
6312
|
+
}
|
|
6313
|
+
return obj;
|
|
6314
|
+
},
|
|
6315
|
+
create(base) {
|
|
6316
|
+
return GetMetadataResponse.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
6317
|
+
},
|
|
6318
|
+
fromPartial(object) {
|
|
6319
|
+
var _a;
|
|
6320
|
+
const message = createBaseGetMetadataResponse();
|
|
6321
|
+
message.metadata = (_a = object.metadata) !== null && _a !== void 0 ? _a : undefined;
|
|
6322
|
+
return message;
|
|
6323
|
+
},
|
|
6324
|
+
};
|
|
6332
6325
|
const FlagSyncServiceService = {
|
|
6333
6326
|
syncFlags: {
|
|
6334
|
-
path: "/sync.v1.FlagSyncService/SyncFlags",
|
|
6327
|
+
path: "/flagd.sync.v1.FlagSyncService/SyncFlags",
|
|
6335
6328
|
requestStream: false,
|
|
6336
6329
|
responseStream: true,
|
|
6337
6330
|
requestSerialize: (value) => Buffer.from(SyncFlagsRequest.encode(value).finish()),
|
|
@@ -6340,7 +6333,7 @@ const FlagSyncServiceService = {
|
|
|
6340
6333
|
responseDeserialize: (value) => SyncFlagsResponse.decode(value),
|
|
6341
6334
|
},
|
|
6342
6335
|
fetchAllFlags: {
|
|
6343
|
-
path: "/sync.v1.FlagSyncService/FetchAllFlags",
|
|
6336
|
+
path: "/flagd.sync.v1.FlagSyncService/FetchAllFlags",
|
|
6344
6337
|
requestStream: false,
|
|
6345
6338
|
responseStream: false,
|
|
6346
6339
|
requestSerialize: (value) => Buffer.from(FetchAllFlagsRequest.encode(value).finish()),
|
|
@@ -6348,8 +6341,20 @@ const FlagSyncServiceService = {
|
|
|
6348
6341
|
responseSerialize: (value) => Buffer.from(FetchAllFlagsResponse.encode(value).finish()),
|
|
6349
6342
|
responseDeserialize: (value) => FetchAllFlagsResponse.decode(value),
|
|
6350
6343
|
},
|
|
6344
|
+
getMetadata: {
|
|
6345
|
+
path: "/flagd.sync.v1.FlagSyncService/GetMetadata",
|
|
6346
|
+
requestStream: false,
|
|
6347
|
+
responseStream: false,
|
|
6348
|
+
requestSerialize: (value) => Buffer.from(GetMetadataRequest.encode(value).finish()),
|
|
6349
|
+
requestDeserialize: (value) => GetMetadataRequest.decode(value),
|
|
6350
|
+
responseSerialize: (value) => Buffer.from(GetMetadataResponse.encode(value).finish()),
|
|
6351
|
+
responseDeserialize: (value) => GetMetadataResponse.decode(value),
|
|
6352
|
+
},
|
|
6351
6353
|
};
|
|
6352
|
-
const FlagSyncServiceClient = makeGenericClientConstructor(FlagSyncServiceService, "sync.v1.FlagSyncService");
|
|
6354
|
+
const FlagSyncServiceClient = makeGenericClientConstructor(FlagSyncServiceService, "flagd.sync.v1.FlagSyncService");
|
|
6355
|
+
function isObject(value) {
|
|
6356
|
+
return typeof value === "object" && value !== null;
|
|
6357
|
+
}
|
|
6353
6358
|
function isSet(value) {
|
|
6354
6359
|
return value !== null && value !== undefined;
|
|
6355
6360
|
}
|
|
@@ -6395,39 +6400,47 @@ class GrpcFetch {
|
|
|
6395
6400
|
var _a;
|
|
6396
6401
|
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.debug('Starting gRPC sync connection');
|
|
6397
6402
|
closeStreamIfDefined(this._syncStream);
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6403
|
+
try {
|
|
6404
|
+
this._syncStream = this._syncClient.syncFlags(this._request);
|
|
6405
|
+
this._syncStream.on('data', (data) => {
|
|
6406
|
+
var _a, _b, _c, _d;
|
|
6407
|
+
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.debug(`Received sync payload`);
|
|
6408
|
+
try {
|
|
6409
|
+
const changes = dataCallback(data.flagConfiguration);
|
|
6410
|
+
if (this._initialized && changes.length > 0) {
|
|
6411
|
+
changedCallback(changes);
|
|
6412
|
+
}
|
|
6406
6413
|
}
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
this.
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6414
|
+
catch (err) {
|
|
6415
|
+
(_b = this._logger) === null || _b === void 0 ? void 0 : _b.debug('Error processing sync payload: ', (_c = err === null || err === void 0 ? void 0 : err.message) !== null && _c !== void 0 ? _c : 'unknown error');
|
|
6416
|
+
}
|
|
6417
|
+
if (resolveConnect) {
|
|
6418
|
+
resolveConnect();
|
|
6419
|
+
}
|
|
6420
|
+
else if (!this._isConnected) {
|
|
6421
|
+
// Not the first connection and there's no active connection.
|
|
6422
|
+
(_d = this._logger) === null || _d === void 0 ? void 0 : _d.debug('Reconnected to gRPC sync');
|
|
6423
|
+
reconnectCallback();
|
|
6424
|
+
}
|
|
6425
|
+
this._isConnected = true;
|
|
6426
|
+
});
|
|
6427
|
+
this._syncStream.on('error', (err) => {
|
|
6428
|
+
this.handleError(err, dataCallback, reconnectCallback, changedCallback, disconnectCallback, rejectConnect);
|
|
6429
|
+
});
|
|
6430
|
+
}
|
|
6431
|
+
catch (err) {
|
|
6432
|
+
this.handleError(err, dataCallback, reconnectCallback, changedCallback, disconnectCallback, rejectConnect);
|
|
6433
|
+
}
|
|
6434
|
+
}
|
|
6435
|
+
handleError(err, dataCallback, reconnectCallback, changedCallback, disconnectCallback, rejectConnect) {
|
|
6436
|
+
var _a, _b, _c;
|
|
6437
|
+
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.error('Connection error, attempting to reconnect');
|
|
6438
|
+
(_b = this._logger) === null || _b === void 0 ? void 0 : _b.debug(err);
|
|
6439
|
+
this._isConnected = false;
|
|
6440
|
+
const errorMessage = (_c = err === null || err === void 0 ? void 0 : err.message) !== null && _c !== void 0 ? _c : 'Failed to connect to syncFlags stream';
|
|
6441
|
+
disconnectCallback(errorMessage);
|
|
6442
|
+
rejectConnect === null || rejectConnect === void 0 ? void 0 : rejectConnect(new GeneralError(errorMessage));
|
|
6443
|
+
this.reconnect(dataCallback, reconnectCallback, changedCallback, disconnectCallback);
|
|
6431
6444
|
}
|
|
6432
6445
|
reconnect(dataCallback, reconnectCallback, changedCallback, disconnectCallback) {
|
|
6433
6446
|
const channel = this._syncClient.getChannel();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfeature/flagd-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi",
|
|
6
6
|
"current-version": "echo $npm_package_version"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"util": "0.12.5"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@grpc/grpc-js": "~1.8.0 || ~1.9.0",
|
|
15
|
+
"@grpc/grpc-js": "~1.8.0 || ~1.9.0 || ~1.10.0",
|
|
16
16
|
"@openfeature/server-sdk": ">=1.8.0"
|
|
17
17
|
},
|
|
18
18
|
"exports": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EvaluationContext, JsonValue, Logger, ResolutionDetails } from '@openfeature/server-sdk';
|
|
2
|
-
import { ServiceClient } from '../../../proto/ts/
|
|
2
|
+
import { ServiceClient } from '../../../proto/ts/flagd/evaluation/v1/evaluation';
|
|
3
3
|
import { Config } from '../../configuration';
|
|
4
4
|
import { Service } from '../service';
|
|
5
5
|
interface FlagChange {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Logger } from '@openfeature/core';
|
|
2
|
-
import { FlagSyncServiceClient } from '../../../../proto/ts/sync/v1/
|
|
2
|
+
import { FlagSyncServiceClient } from '../../../../proto/ts/flagd/sync/v1/sync';
|
|
3
3
|
import { Config } from '../../../configuration';
|
|
4
4
|
import { DataFetch } from '../data-fetch';
|
|
5
5
|
/**
|
|
@@ -26,5 +26,6 @@ export declare class GrpcFetch implements DataFetch {
|
|
|
26
26
|
connect(dataCallback: (flags: string) => string[], reconnectCallback: () => void, changedCallback: (flagsChanged: string[]) => void, disconnectCallback: (message: string) => void): Promise<void>;
|
|
27
27
|
disconnect(): Promise<void>;
|
|
28
28
|
private listen;
|
|
29
|
+
private handleError;
|
|
29
30
|
private reconnect;
|
|
30
31
|
}
|
|
@@ -62,12 +62,9 @@ export interface GetMetadataRequest {
|
|
|
62
62
|
}
|
|
63
63
|
/** GetMetadataResponse contains metadata from the sync service */
|
|
64
64
|
export interface GetMetadataResponse {
|
|
65
|
-
metadata:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
export interface KeyValue {
|
|
69
|
-
key: string;
|
|
70
|
-
value: string;
|
|
65
|
+
metadata: {
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
} | undefined;
|
|
71
68
|
}
|
|
72
69
|
export declare const SyncFlagsRequest: {
|
|
73
70
|
encode(message: SyncFlagsRequest, writer?: _m0.Writer): _m0.Writer;
|
|
@@ -156,64 +153,26 @@ export declare const GetMetadataResponse: {
|
|
|
156
153
|
toJSON(message: GetMetadataResponse): unknown;
|
|
157
154
|
create<I extends {
|
|
158
155
|
metadata?: {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}[] | undefined;
|
|
156
|
+
[x: string]: any;
|
|
157
|
+
} | undefined;
|
|
162
158
|
} & {
|
|
163
159
|
metadata?: ({
|
|
164
|
-
|
|
165
|
-
value?: string | undefined;
|
|
166
|
-
}[] & ({
|
|
167
|
-
key?: string | undefined;
|
|
168
|
-
value?: string | undefined;
|
|
160
|
+
[x: string]: any;
|
|
169
161
|
} & {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
key?: string | undefined;
|
|
174
|
-
value?: string | undefined;
|
|
175
|
-
}[]>]: never; }) | undefined;
|
|
176
|
-
} & { [K_2 in Exclude<keyof I, "metadata">]: never; }>(base?: I | undefined): GetMetadataResponse;
|
|
162
|
+
[x: string]: any;
|
|
163
|
+
} & { [K in Exclude<keyof I["metadata"], string | number>]: never; }) | undefined;
|
|
164
|
+
} & { [K_1 in Exclude<keyof I, "metadata">]: never; }>(base?: I | undefined): GetMetadataResponse;
|
|
177
165
|
fromPartial<I_1 extends {
|
|
178
166
|
metadata?: {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}[] | undefined;
|
|
167
|
+
[x: string]: any;
|
|
168
|
+
} | undefined;
|
|
182
169
|
} & {
|
|
183
170
|
metadata?: ({
|
|
184
|
-
|
|
185
|
-
value?: string | undefined;
|
|
186
|
-
}[] & ({
|
|
187
|
-
key?: string | undefined;
|
|
188
|
-
value?: string | undefined;
|
|
171
|
+
[x: string]: any;
|
|
189
172
|
} & {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
key?: string | undefined;
|
|
194
|
-
value?: string | undefined;
|
|
195
|
-
}[]>]: never; }) | undefined;
|
|
196
|
-
} & { [K_5 in Exclude<keyof I_1, "metadata">]: never; }>(object: I_1): GetMetadataResponse;
|
|
197
|
-
};
|
|
198
|
-
export declare const KeyValue: {
|
|
199
|
-
encode(message: KeyValue, writer?: _m0.Writer): _m0.Writer;
|
|
200
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): KeyValue;
|
|
201
|
-
fromJSON(object: any): KeyValue;
|
|
202
|
-
toJSON(message: KeyValue): unknown;
|
|
203
|
-
create<I extends {
|
|
204
|
-
key?: string | undefined;
|
|
205
|
-
value?: string | undefined;
|
|
206
|
-
} & {
|
|
207
|
-
key?: string | undefined;
|
|
208
|
-
value?: string | undefined;
|
|
209
|
-
} & { [K in Exclude<keyof I, keyof KeyValue>]: never; }>(base?: I | undefined): KeyValue;
|
|
210
|
-
fromPartial<I_1 extends {
|
|
211
|
-
key?: string | undefined;
|
|
212
|
-
value?: string | undefined;
|
|
213
|
-
} & {
|
|
214
|
-
key?: string | undefined;
|
|
215
|
-
value?: string | undefined;
|
|
216
|
-
} & { [K_1 in Exclude<keyof I_1, keyof KeyValue>]: never; }>(object: I_1): KeyValue;
|
|
173
|
+
[x: string]: any;
|
|
174
|
+
} & { [K_2 in Exclude<keyof I_1["metadata"], string | number>]: never; }) | undefined;
|
|
175
|
+
} & { [K_3 in Exclude<keyof I_1, "metadata">]: never; }>(object: I_1): GetMetadataResponse;
|
|
217
176
|
};
|
|
218
177
|
/** FlagService implements a server streaming to provide realtime flag configurations */
|
|
219
178
|
export type FlagSyncServiceService = typeof FlagSyncServiceService;
|