@openfeature/flagd-provider 0.6.0 → 0.7.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/package.json CHANGED
@@ -1,26 +1,19 @@
1
1
  {
2
2
  "name": "@openfeature/flagd-provider",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "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",
7
7
  "current-version": "echo $npm_package_version"
8
8
  },
9
9
  "peerDependencies": {
10
- "@openfeature/js-sdk": "~0.5.0"
10
+ "@openfeature/js-sdk": "^1.0.0"
11
11
  },
12
12
  "module": "./index.js",
13
13
  "main": "./index.cjs",
14
- "types": "./index.d.ts",
15
- "exports": {
16
- ".": {
17
- "types": "./index.d.ts",
18
- "import": "./index.js",
19
- "require": "./index.cjs"
20
- }
21
- },
14
+ "types": "./src/index.d.ts",
22
15
  "dependencies": {
23
- "@protobuf-ts/grpc-transport": "^2.7.0",
24
- "@grpc/grpc-js": "^1.6.7"
16
+ "@protobuf-ts/runtime-rpc": "2.8.2",
17
+ "@grpc/grpc-js": "1.8.0"
25
18
  }
26
19
  }
File without changes
@@ -24,7 +24,7 @@ export interface Config {
24
24
  */
25
25
  socketPath?: string;
26
26
  }
27
- export declare type FlagdProviderOptions = Partial<Config>;
27
+ export type FlagdProviderOptions = Partial<Config>;
28
28
  export declare function getConfig(options?: FlagdProviderOptions): {
29
29
  host: string;
30
30
  port: number;
File without changes
File without changes
File without changes
@@ -1,5 +1,8 @@
1
1
  import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
2
2
  import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
3
+ import type { EventStreamResponse } from "./schema";
4
+ import type { EventStreamRequest } from "./schema";
5
+ import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
3
6
  import type { ResolveObjectResponse } from "./schema";
4
7
  import type { ResolveObjectRequest } from "./schema";
5
8
  import type { ResolveIntResponse } from "./schema";
@@ -13,6 +16,8 @@ import type { ResolveBooleanRequest } from "./schema";
13
16
  import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
14
17
  import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
15
18
  /**
19
+ * Service defines the exposed rpcs of flagd
20
+ *
16
21
  * @generated from protobuf service schema.v1.Service
17
22
  */
18
23
  export interface IServiceClient {
@@ -36,8 +41,14 @@ export interface IServiceClient {
36
41
  * @generated from protobuf rpc: ResolveObject(schema.v1.ResolveObjectRequest) returns (schema.v1.ResolveObjectResponse);
37
42
  */
38
43
  resolveObject(input: ResolveObjectRequest, options?: RpcOptions): UnaryCall<ResolveObjectRequest, ResolveObjectResponse>;
44
+ /**
45
+ * @generated from protobuf rpc: EventStream(schema.v1.EventStreamRequest) returns (stream schema.v1.EventStreamResponse);
46
+ */
47
+ eventStream(input: EventStreamRequest, options?: RpcOptions): ServerStreamingCall<EventStreamRequest, EventStreamResponse>;
39
48
  }
40
49
  /**
50
+ * Service defines the exposed rpcs of flagd
51
+ *
41
52
  * @generated from protobuf service schema.v1.Service
42
53
  */
43
54
  export declare class ServiceClient implements IServiceClient, ServiceInfo {
@@ -68,4 +79,8 @@ export declare class ServiceClient implements IServiceClient, ServiceInfo {
68
79
  * @generated from protobuf rpc: ResolveObject(schema.v1.ResolveObjectRequest) returns (schema.v1.ResolveObjectResponse);
69
80
  */
70
81
  resolveObject(input: ResolveObjectRequest, options?: RpcOptions): UnaryCall<ResolveObjectRequest, ResolveObjectResponse>;
82
+ /**
83
+ * @generated from protobuf rpc: EventStream(schema.v1.EventStreamRequest) returns (stream schema.v1.EventStreamResponse);
84
+ */
85
+ eventStream(input: EventStreamRequest, options?: RpcOptions): ServerStreamingCall<EventStreamRequest, EventStreamResponse>;
71
86
  }
@@ -7,178 +7,254 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
7
7
  import { MessageType } from "@protobuf-ts/runtime";
8
8
  import { Struct } from "../../google/protobuf/struct";
9
9
  /**
10
- * @generated from protobuf message schema.v1.ErrorResponse
11
- */
12
- export interface ErrorResponse {
13
- /**
14
- * @generated from protobuf field: string error_code = 1;
15
- */
16
- errorCode: string;
17
- /**
18
- * @generated from protobuf field: string reason = 2;
19
- */
20
- reason: string;
21
- }
22
- /**
10
+ * Request body for boolean flag evaluation, used by the ResolveBoolean rpc.
11
+ *
23
12
  * @generated from protobuf message schema.v1.ResolveBooleanRequest
24
13
  */
25
14
  export interface ResolveBooleanRequest {
26
15
  /**
16
+ * Flag key of the requested flag.
17
+ *
27
18
  * @generated from protobuf field: string flag_key = 1;
28
19
  */
29
20
  flagKey: string;
30
21
  /**
22
+ * Object structure describing the EvaluationContext used in the flag evaluation, see https://docs.openfeature.dev/docs/reference/concepts/evaluation-context
23
+ *
31
24
  * @generated from protobuf field: google.protobuf.Struct context = 2;
32
25
  */
33
26
  context?: Struct;
34
27
  }
35
28
  /**
29
+ * Response body for boolean flag evaluation. used by the ResolveBoolean rpc.
30
+ *
36
31
  * @generated from protobuf message schema.v1.ResolveBooleanResponse
37
32
  */
38
33
  export interface ResolveBooleanResponse {
39
34
  /**
35
+ * The response value of the boolean flag evaluation, will be unset in the case of error.
36
+ *
40
37
  * @generated from protobuf field: bool value = 1;
41
38
  */
42
39
  value: boolean;
43
40
  /**
41
+ * The reason for the given return value, see https://docs.openfeature.dev/docs/specification/types#resolution-details
42
+ *
44
43
  * @generated from protobuf field: string reason = 2;
45
44
  */
46
45
  reason: string;
47
46
  /**
47
+ * The variant name of the returned flag value.
48
+ *
48
49
  * @generated from protobuf field: string variant = 3;
49
50
  */
50
51
  variant: string;
51
52
  }
52
53
  /**
54
+ * Request body for string flag evaluation, used by the ResolveString rpc.
55
+ *
53
56
  * @generated from protobuf message schema.v1.ResolveStringRequest
54
57
  */
55
58
  export interface ResolveStringRequest {
56
59
  /**
60
+ * Flag key of the requested flag.
61
+ *
57
62
  * @generated from protobuf field: string flag_key = 1;
58
63
  */
59
64
  flagKey: string;
60
65
  /**
66
+ * Object structure describing the EvaluationContext used in the flag evaluation, see https://docs.openfeature.dev/docs/reference/concepts/evaluation-context
67
+ *
61
68
  * @generated from protobuf field: google.protobuf.Struct context = 2;
62
69
  */
63
70
  context?: Struct;
64
71
  }
65
72
  /**
73
+ * Response body for string flag evaluation. used by the ResolveString rpc.
74
+ *
66
75
  * @generated from protobuf message schema.v1.ResolveStringResponse
67
76
  */
68
77
  export interface ResolveStringResponse {
69
78
  /**
79
+ * The response value of the string flag evaluation, will be unset in the case of error.
80
+ *
70
81
  * @generated from protobuf field: string value = 1;
71
82
  */
72
83
  value: string;
73
84
  /**
85
+ * The reason for the given return value, see https://docs.openfeature.dev/docs/specification/types#resolution-details
86
+ *
74
87
  * @generated from protobuf field: string reason = 2;
75
88
  */
76
89
  reason: string;
77
90
  /**
91
+ * The variant name of the returned flag value.
92
+ *
78
93
  * @generated from protobuf field: string variant = 3;
79
94
  */
80
95
  variant: string;
81
96
  }
82
97
  /**
98
+ * Request body for float flag evaluation, used by the ResolveFloat rpc.
99
+ *
83
100
  * @generated from protobuf message schema.v1.ResolveFloatRequest
84
101
  */
85
102
  export interface ResolveFloatRequest {
86
103
  /**
104
+ * Flag key of the requested flag.
105
+ *
87
106
  * @generated from protobuf field: string flag_key = 1;
88
107
  */
89
108
  flagKey: string;
90
109
  /**
110
+ * Object structure describing the EvaluationContext used in the flag evaluation, see https://docs.openfeature.dev/docs/reference/concepts/evaluation-context
111
+ *
91
112
  * @generated from protobuf field: google.protobuf.Struct context = 2;
92
113
  */
93
114
  context?: Struct;
94
115
  }
95
116
  /**
117
+ * Response body for float flag evaluation. used by the ResolveFloat rpc.
118
+ *
96
119
  * @generated from protobuf message schema.v1.ResolveFloatResponse
97
120
  */
98
121
  export interface ResolveFloatResponse {
99
122
  /**
123
+ * The response value of the float flag evaluation, will be empty in the case of error.
124
+ *
100
125
  * @generated from protobuf field: double value = 1;
101
126
  */
102
127
  value: number;
103
128
  /**
129
+ * The reason for the given return value, see https://docs.openfeature.dev/docs/specification/types#resolution-details
130
+ *
104
131
  * @generated from protobuf field: string reason = 2;
105
132
  */
106
133
  reason: string;
107
134
  /**
135
+ * The variant name of the returned flag value.
136
+ *
108
137
  * @generated from protobuf field: string variant = 3;
109
138
  */
110
139
  variant: string;
111
140
  }
112
141
  /**
142
+ * Request body for int flag evaluation, used by the ResolveInt rpc.
143
+ *
113
144
  * @generated from protobuf message schema.v1.ResolveIntRequest
114
145
  */
115
146
  export interface ResolveIntRequest {
116
147
  /**
148
+ * Flag key of the requested flag.
149
+ *
117
150
  * @generated from protobuf field: string flag_key = 1;
118
151
  */
119
152
  flagKey: string;
120
153
  /**
154
+ * Object structure describing the EvaluationContext used in the flag evaluation, see https://docs.openfeature.dev/docs/reference/concepts/evaluation-context
155
+ *
121
156
  * @generated from protobuf field: google.protobuf.Struct context = 2;
122
157
  */
123
158
  context?: Struct;
124
159
  }
125
160
  /**
161
+ * Response body for int flag evaluation. used by the ResolveInt rpc.
162
+ *
126
163
  * @generated from protobuf message schema.v1.ResolveIntResponse
127
164
  */
128
165
  export interface ResolveIntResponse {
129
166
  /**
167
+ * The response value of the int flag evaluation, will be unset in the case of error.
168
+ *
130
169
  * @generated from protobuf field: int64 value = 1;
131
170
  */
132
171
  value: string;
133
172
  /**
173
+ * The reason for the given return value, see https://docs.openfeature.dev/docs/specification/types#resolution-details
174
+ *
134
175
  * @generated from protobuf field: string reason = 2;
135
176
  */
136
177
  reason: string;
137
178
  /**
179
+ * The variant name of the returned flag value.
180
+ *
138
181
  * @generated from protobuf field: string variant = 3;
139
182
  */
140
183
  variant: string;
141
184
  }
142
185
  /**
186
+ * Request body for object flag evaluation, used by the ResolveObject rpc.
187
+ *
143
188
  * @generated from protobuf message schema.v1.ResolveObjectRequest
144
189
  */
145
190
  export interface ResolveObjectRequest {
146
191
  /**
192
+ * Flag key of the requested flag.
193
+ *
147
194
  * @generated from protobuf field: string flag_key = 1;
148
195
  */
149
196
  flagKey: string;
150
197
  /**
198
+ * Object structure describing the EvaluationContext used in the flag evaluation, see https://docs.openfeature.dev/docs/reference/concepts/evaluation-context
199
+ *
151
200
  * @generated from protobuf field: google.protobuf.Struct context = 2;
152
201
  */
153
202
  context?: Struct;
154
203
  }
155
204
  /**
205
+ * Response body for object flag evaluation. used by the ResolveObject rpc.
206
+ *
156
207
  * @generated from protobuf message schema.v1.ResolveObjectResponse
157
208
  */
158
209
  export interface ResolveObjectResponse {
159
210
  /**
211
+ * The response value of the object flag evaluation, will be unset in the case of error.
212
+ *
213
+ * NOTE: This structure will need to be decoded from google/protobuf/struct.proto before it is returned to the SDK
214
+ *
160
215
  * @generated from protobuf field: google.protobuf.Struct value = 1;
161
216
  */
162
217
  value?: Struct;
163
218
  /**
219
+ * The reason for the given return value, see https://docs.openfeature.dev/docs/specification/types#resolution-details
220
+ *
164
221
  * @generated from protobuf field: string reason = 2;
165
222
  */
166
223
  reason: string;
167
224
  /**
225
+ * The variant name of the returned flag value.
226
+ *
168
227
  * @generated from protobuf field: string variant = 3;
169
228
  */
170
229
  variant: string;
171
230
  }
172
- declare class ErrorResponse$Type extends MessageType<ErrorResponse> {
173
- constructor();
174
- create(value?: PartialMessage<ErrorResponse>): ErrorResponse;
175
- internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ErrorResponse): ErrorResponse;
176
- internalBinaryWrite(message: ErrorResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
231
+ /**
232
+ * Response body for the EventStream stream response
233
+ *
234
+ * @generated from protobuf message schema.v1.EventStreamResponse
235
+ */
236
+ export interface EventStreamResponse {
237
+ /**
238
+ * String key indicating the type of event that is being received, for example, provider_ready or configuration_change
239
+ *
240
+ * @generated from protobuf field: string type = 1;
241
+ */
242
+ type: string;
243
+ /**
244
+ * Object structure for use when sending relevant metadata to provide context to the event.
245
+ * Can be left unset when it is not required.
246
+ *
247
+ * @generated from protobuf field: google.protobuf.Struct data = 2;
248
+ */
249
+ data?: Struct;
177
250
  }
178
251
  /**
179
- * @generated MessageType for protobuf message schema.v1.ErrorResponse
252
+ * Empty stream request body
253
+ *
254
+ * @generated from protobuf message schema.v1.EventStreamRequest
180
255
  */
181
- export declare const ErrorResponse: ErrorResponse$Type;
256
+ export interface EventStreamRequest {
257
+ }
182
258
  declare class ResolveBooleanRequest$Type extends MessageType<ResolveBooleanRequest> {
183
259
  constructor();
184
260
  create(value?: PartialMessage<ResolveBooleanRequest>): ResolveBooleanRequest;
@@ -279,6 +355,26 @@ declare class ResolveObjectResponse$Type extends MessageType<ResolveObjectRespon
279
355
  * @generated MessageType for protobuf message schema.v1.ResolveObjectResponse
280
356
  */
281
357
  export declare const ResolveObjectResponse: ResolveObjectResponse$Type;
358
+ declare class EventStreamResponse$Type extends MessageType<EventStreamResponse> {
359
+ constructor();
360
+ create(value?: PartialMessage<EventStreamResponse>): EventStreamResponse;
361
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EventStreamResponse): EventStreamResponse;
362
+ internalBinaryWrite(message: EventStreamResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
363
+ }
364
+ /**
365
+ * @generated MessageType for protobuf message schema.v1.EventStreamResponse
366
+ */
367
+ export declare const EventStreamResponse: EventStreamResponse$Type;
368
+ declare class EventStreamRequest$Type extends MessageType<EventStreamRequest> {
369
+ constructor();
370
+ create(value?: PartialMessage<EventStreamRequest>): EventStreamRequest;
371
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EventStreamRequest): EventStreamRequest;
372
+ internalBinaryWrite(message: EventStreamRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
373
+ }
374
+ /**
375
+ * @generated MessageType for protobuf message schema.v1.EventStreamRequest
376
+ */
377
+ export declare const EventStreamRequest: EventStreamRequest$Type;
282
378
  /**
283
379
  * @generated ServiceType for protobuf service schema.v1.Service
284
380
  */