@spotify-confidence/openfeature-server-provider-local 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +80 -58
- package/dist/confidence_resolver.wasm +0 -0
- package/dist/index.browser.d.ts +60 -26
- package/dist/index.browser.js +168 -759
- package/dist/index.node.d.ts +60 -26
- package/dist/index.node.js +168 -759
- package/dist/messages-Bw39oRlC.js +524 -0
- package/dist/messages-CvypvyG4.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
let NullValue = /* @__PURE__ */ function(NullValue$1) {
|
|
3
|
+
NullValue$1[NullValue$1["NULL_VALUE"] = 0] = "NULL_VALUE";
|
|
4
|
+
NullValue$1[NullValue$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
5
|
+
return NullValue$1;
|
|
6
|
+
}({});
|
|
7
|
+
function nullValueFromJSON(object) {
|
|
8
|
+
switch (object) {
|
|
9
|
+
case 0:
|
|
10
|
+
case "NULL_VALUE": return NullValue.NULL_VALUE;
|
|
11
|
+
case -1:
|
|
12
|
+
case "UNRECOGNIZED":
|
|
13
|
+
default: return NullValue.UNRECOGNIZED;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function nullValueToJSON(object) {
|
|
17
|
+
switch (object) {
|
|
18
|
+
case NullValue.NULL_VALUE: return "NULL_VALUE";
|
|
19
|
+
case NullValue.UNRECOGNIZED:
|
|
20
|
+
default: return "UNRECOGNIZED";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function createBaseStruct() {
|
|
24
|
+
return { fields: {} };
|
|
25
|
+
}
|
|
26
|
+
const Struct = {
|
|
27
|
+
encode(message, writer = new BinaryWriter()) {
|
|
28
|
+
Object.entries(message.fields).forEach(([key, value]) => {
|
|
29
|
+
if (value !== void 0) Struct_FieldsEntry.encode({
|
|
30
|
+
key,
|
|
31
|
+
value
|
|
32
|
+
}, writer.uint32(10).fork()).join();
|
|
33
|
+
});
|
|
34
|
+
return writer;
|
|
35
|
+
},
|
|
36
|
+
decode(input, length) {
|
|
37
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
38
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
39
|
+
const message = createBaseStruct();
|
|
40
|
+
while (reader.pos < end) {
|
|
41
|
+
const tag = reader.uint32();
|
|
42
|
+
switch (tag >>> 3) {
|
|
43
|
+
case 1: {
|
|
44
|
+
if (tag !== 10) break;
|
|
45
|
+
const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32());
|
|
46
|
+
if (entry1.value !== void 0) message.fields[entry1.key] = entry1.value;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
51
|
+
reader.skip(tag & 7);
|
|
52
|
+
}
|
|
53
|
+
return message;
|
|
54
|
+
},
|
|
55
|
+
fromJSON(object) {
|
|
56
|
+
return { fields: isObject(object.fields) ? Object.entries(object.fields).reduce((acc, [key, value]) => {
|
|
57
|
+
acc[key] = value;
|
|
58
|
+
return acc;
|
|
59
|
+
}, {}) : {} };
|
|
60
|
+
},
|
|
61
|
+
toJSON(message) {
|
|
62
|
+
const obj = {};
|
|
63
|
+
if (message.fields) {
|
|
64
|
+
const entries = Object.entries(message.fields);
|
|
65
|
+
if (entries.length > 0) {
|
|
66
|
+
obj.fields = {};
|
|
67
|
+
entries.forEach(([k, v]) => {
|
|
68
|
+
obj.fields[k] = v;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return obj;
|
|
73
|
+
},
|
|
74
|
+
create(base) {
|
|
75
|
+
return Struct.fromPartial(base ?? {});
|
|
76
|
+
},
|
|
77
|
+
fromPartial(object) {
|
|
78
|
+
const message = createBaseStruct();
|
|
79
|
+
message.fields = Object.entries(object.fields ?? {}).reduce((acc, [key, value]) => {
|
|
80
|
+
if (value !== void 0) acc[key] = value;
|
|
81
|
+
return acc;
|
|
82
|
+
}, {});
|
|
83
|
+
return message;
|
|
84
|
+
},
|
|
85
|
+
wrap(object) {
|
|
86
|
+
const struct = createBaseStruct();
|
|
87
|
+
if (object !== void 0) for (const key of Object.keys(object)) struct.fields[key] = object[key];
|
|
88
|
+
return struct;
|
|
89
|
+
},
|
|
90
|
+
unwrap(message) {
|
|
91
|
+
const object = {};
|
|
92
|
+
if (message.fields) for (const key of Object.keys(message.fields)) object[key] = message.fields[key];
|
|
93
|
+
return object;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
function createBaseStruct_FieldsEntry() {
|
|
97
|
+
return {
|
|
98
|
+
key: "",
|
|
99
|
+
value: void 0
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const Struct_FieldsEntry = {
|
|
103
|
+
encode(message, writer = new BinaryWriter()) {
|
|
104
|
+
if (message.key !== "") writer.uint32(10).string(message.key);
|
|
105
|
+
if (message.value !== void 0) Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).join();
|
|
106
|
+
return writer;
|
|
107
|
+
},
|
|
108
|
+
decode(input, length) {
|
|
109
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
110
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
111
|
+
const message = createBaseStruct_FieldsEntry();
|
|
112
|
+
while (reader.pos < end) {
|
|
113
|
+
const tag = reader.uint32();
|
|
114
|
+
switch (tag >>> 3) {
|
|
115
|
+
case 1:
|
|
116
|
+
if (tag !== 10) break;
|
|
117
|
+
message.key = reader.string();
|
|
118
|
+
continue;
|
|
119
|
+
case 2:
|
|
120
|
+
if (tag !== 18) break;
|
|
121
|
+
message.value = Value.unwrap(Value.decode(reader, reader.uint32()));
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
125
|
+
reader.skip(tag & 7);
|
|
126
|
+
}
|
|
127
|
+
return message;
|
|
128
|
+
},
|
|
129
|
+
fromJSON(object) {
|
|
130
|
+
return {
|
|
131
|
+
key: isSet$1(object.key) ? globalThis.String(object.key) : "",
|
|
132
|
+
value: isSet$1(object?.value) ? object.value : void 0
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
toJSON(message) {
|
|
136
|
+
const obj = {};
|
|
137
|
+
if (message.key !== "") obj.key = message.key;
|
|
138
|
+
if (message.value !== void 0) obj.value = message.value;
|
|
139
|
+
return obj;
|
|
140
|
+
},
|
|
141
|
+
create(base) {
|
|
142
|
+
return Struct_FieldsEntry.fromPartial(base ?? {});
|
|
143
|
+
},
|
|
144
|
+
fromPartial(object) {
|
|
145
|
+
const message = createBaseStruct_FieldsEntry();
|
|
146
|
+
message.key = object.key ?? "";
|
|
147
|
+
message.value = object.value ?? void 0;
|
|
148
|
+
return message;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
function createBaseValue() {
|
|
152
|
+
return {
|
|
153
|
+
nullValue: void 0,
|
|
154
|
+
numberValue: void 0,
|
|
155
|
+
stringValue: void 0,
|
|
156
|
+
boolValue: void 0,
|
|
157
|
+
structValue: void 0,
|
|
158
|
+
listValue: void 0
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const Value = {
|
|
162
|
+
encode(message, writer = new BinaryWriter()) {
|
|
163
|
+
if (message.nullValue !== void 0) writer.uint32(8).int32(message.nullValue);
|
|
164
|
+
if (message.numberValue !== void 0) writer.uint32(17).double(message.numberValue);
|
|
165
|
+
if (message.stringValue !== void 0) writer.uint32(26).string(message.stringValue);
|
|
166
|
+
if (message.boolValue !== void 0) writer.uint32(32).bool(message.boolValue);
|
|
167
|
+
if (message.structValue !== void 0) Struct.encode(Struct.wrap(message.structValue), writer.uint32(42).fork()).join();
|
|
168
|
+
if (message.listValue !== void 0) ListValue.encode(ListValue.wrap(message.listValue), writer.uint32(50).fork()).join();
|
|
169
|
+
return writer;
|
|
170
|
+
},
|
|
171
|
+
decode(input, length) {
|
|
172
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
173
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
174
|
+
const message = createBaseValue();
|
|
175
|
+
while (reader.pos < end) {
|
|
176
|
+
const tag = reader.uint32();
|
|
177
|
+
switch (tag >>> 3) {
|
|
178
|
+
case 1:
|
|
179
|
+
if (tag !== 8) break;
|
|
180
|
+
message.nullValue = reader.int32();
|
|
181
|
+
continue;
|
|
182
|
+
case 2:
|
|
183
|
+
if (tag !== 17) break;
|
|
184
|
+
message.numberValue = reader.double();
|
|
185
|
+
continue;
|
|
186
|
+
case 3:
|
|
187
|
+
if (tag !== 26) break;
|
|
188
|
+
message.stringValue = reader.string();
|
|
189
|
+
continue;
|
|
190
|
+
case 4:
|
|
191
|
+
if (tag !== 32) break;
|
|
192
|
+
message.boolValue = reader.bool();
|
|
193
|
+
continue;
|
|
194
|
+
case 5:
|
|
195
|
+
if (tag !== 42) break;
|
|
196
|
+
message.structValue = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
197
|
+
continue;
|
|
198
|
+
case 6:
|
|
199
|
+
if (tag !== 50) break;
|
|
200
|
+
message.listValue = ListValue.unwrap(ListValue.decode(reader, reader.uint32()));
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
204
|
+
reader.skip(tag & 7);
|
|
205
|
+
}
|
|
206
|
+
return message;
|
|
207
|
+
},
|
|
208
|
+
fromJSON(object) {
|
|
209
|
+
return {
|
|
210
|
+
nullValue: isSet$1(object.nullValue) ? nullValueFromJSON(object.nullValue) : void 0,
|
|
211
|
+
numberValue: isSet$1(object.numberValue) ? globalThis.Number(object.numberValue) : void 0,
|
|
212
|
+
stringValue: isSet$1(object.stringValue) ? globalThis.String(object.stringValue) : void 0,
|
|
213
|
+
boolValue: isSet$1(object.boolValue) ? globalThis.Boolean(object.boolValue) : void 0,
|
|
214
|
+
structValue: isObject(object.structValue) ? object.structValue : void 0,
|
|
215
|
+
listValue: globalThis.Array.isArray(object.listValue) ? [...object.listValue] : void 0
|
|
216
|
+
};
|
|
217
|
+
},
|
|
218
|
+
toJSON(message) {
|
|
219
|
+
const obj = {};
|
|
220
|
+
if (message.nullValue !== void 0) obj.nullValue = nullValueToJSON(message.nullValue);
|
|
221
|
+
if (message.numberValue !== void 0) obj.numberValue = message.numberValue;
|
|
222
|
+
if (message.stringValue !== void 0) obj.stringValue = message.stringValue;
|
|
223
|
+
if (message.boolValue !== void 0) obj.boolValue = message.boolValue;
|
|
224
|
+
if (message.structValue !== void 0) obj.structValue = message.structValue;
|
|
225
|
+
if (message.listValue !== void 0) obj.listValue = message.listValue;
|
|
226
|
+
return obj;
|
|
227
|
+
},
|
|
228
|
+
create(base) {
|
|
229
|
+
return Value.fromPartial(base ?? {});
|
|
230
|
+
},
|
|
231
|
+
fromPartial(object) {
|
|
232
|
+
const message = createBaseValue();
|
|
233
|
+
message.nullValue = object.nullValue ?? void 0;
|
|
234
|
+
message.numberValue = object.numberValue ?? void 0;
|
|
235
|
+
message.stringValue = object.stringValue ?? void 0;
|
|
236
|
+
message.boolValue = object.boolValue ?? void 0;
|
|
237
|
+
message.structValue = object.structValue ?? void 0;
|
|
238
|
+
message.listValue = object.listValue ?? void 0;
|
|
239
|
+
return message;
|
|
240
|
+
},
|
|
241
|
+
wrap(value) {
|
|
242
|
+
const result = createBaseValue();
|
|
243
|
+
if (value === null) result.nullValue = NullValue.NULL_VALUE;
|
|
244
|
+
else if (typeof value === "boolean") result.boolValue = value;
|
|
245
|
+
else if (typeof value === "number") result.numberValue = value;
|
|
246
|
+
else if (typeof value === "string") result.stringValue = value;
|
|
247
|
+
else if (globalThis.Array.isArray(value)) result.listValue = value;
|
|
248
|
+
else if (typeof value === "object") result.structValue = value;
|
|
249
|
+
else if (typeof value !== "undefined") throw new globalThis.Error("Unsupported any value type: " + typeof value);
|
|
250
|
+
return result;
|
|
251
|
+
},
|
|
252
|
+
unwrap(message) {
|
|
253
|
+
if (message.stringValue !== void 0) return message.stringValue;
|
|
254
|
+
else if (message?.numberValue !== void 0) return message.numberValue;
|
|
255
|
+
else if (message?.boolValue !== void 0) return message.boolValue;
|
|
256
|
+
else if (message?.structValue !== void 0) return message.structValue;
|
|
257
|
+
else if (message?.listValue !== void 0) return message.listValue;
|
|
258
|
+
else if (message?.nullValue !== void 0) return null;
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
function createBaseListValue() {
|
|
262
|
+
return { values: [] };
|
|
263
|
+
}
|
|
264
|
+
const ListValue = {
|
|
265
|
+
encode(message, writer = new BinaryWriter()) {
|
|
266
|
+
for (const v of message.values) Value.encode(Value.wrap(v), writer.uint32(10).fork()).join();
|
|
267
|
+
return writer;
|
|
268
|
+
},
|
|
269
|
+
decode(input, length) {
|
|
270
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
271
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
272
|
+
const message = createBaseListValue();
|
|
273
|
+
while (reader.pos < end) {
|
|
274
|
+
const tag = reader.uint32();
|
|
275
|
+
switch (tag >>> 3) {
|
|
276
|
+
case 1:
|
|
277
|
+
if (tag !== 10) break;
|
|
278
|
+
message.values.push(Value.unwrap(Value.decode(reader, reader.uint32())));
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
282
|
+
reader.skip(tag & 7);
|
|
283
|
+
}
|
|
284
|
+
return message;
|
|
285
|
+
},
|
|
286
|
+
fromJSON(object) {
|
|
287
|
+
return { values: globalThis.Array.isArray(object?.values) ? [...object.values] : [] };
|
|
288
|
+
},
|
|
289
|
+
toJSON(message) {
|
|
290
|
+
const obj = {};
|
|
291
|
+
if (message.values?.length) obj.values = message.values;
|
|
292
|
+
return obj;
|
|
293
|
+
},
|
|
294
|
+
create(base) {
|
|
295
|
+
return ListValue.fromPartial(base ?? {});
|
|
296
|
+
},
|
|
297
|
+
fromPartial(object) {
|
|
298
|
+
const message = createBaseListValue();
|
|
299
|
+
message.values = object.values?.map((e) => e) || [];
|
|
300
|
+
return message;
|
|
301
|
+
},
|
|
302
|
+
wrap(array) {
|
|
303
|
+
const result = createBaseListValue();
|
|
304
|
+
result.values = array ?? [];
|
|
305
|
+
return result;
|
|
306
|
+
},
|
|
307
|
+
unwrap(message) {
|
|
308
|
+
if (message?.hasOwnProperty("values") && globalThis.Array.isArray(message.values)) return message.values;
|
|
309
|
+
else return message;
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
function isObject(value) {
|
|
313
|
+
return typeof value === "object" && value !== null;
|
|
314
|
+
}
|
|
315
|
+
function isSet$1(value) {
|
|
316
|
+
return value !== null && value !== void 0;
|
|
317
|
+
}
|
|
318
|
+
function createBaseVoid() {
|
|
319
|
+
return {};
|
|
320
|
+
}
|
|
321
|
+
const Void = {
|
|
322
|
+
encode(_, writer = new BinaryWriter()) {
|
|
323
|
+
return writer;
|
|
324
|
+
},
|
|
325
|
+
decode(input, length) {
|
|
326
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
327
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
328
|
+
const message = createBaseVoid();
|
|
329
|
+
while (reader.pos < end) {
|
|
330
|
+
const tag = reader.uint32();
|
|
331
|
+
switch (tag >>> 3) {}
|
|
332
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
333
|
+
reader.skip(tag & 7);
|
|
334
|
+
}
|
|
335
|
+
return message;
|
|
336
|
+
},
|
|
337
|
+
fromJSON(_) {
|
|
338
|
+
return {};
|
|
339
|
+
},
|
|
340
|
+
toJSON(_) {
|
|
341
|
+
return {};
|
|
342
|
+
},
|
|
343
|
+
create(base) {
|
|
344
|
+
return Void.fromPartial(base ?? {});
|
|
345
|
+
},
|
|
346
|
+
fromPartial(_) {
|
|
347
|
+
return createBaseVoid();
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
function createBaseSetResolverStateRequest() {
|
|
351
|
+
return {
|
|
352
|
+
state: new Uint8Array(0),
|
|
353
|
+
accountId: ""
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
const SetResolverStateRequest = {
|
|
357
|
+
encode(message, writer = new BinaryWriter()) {
|
|
358
|
+
if (message.state.length !== 0) writer.uint32(10).bytes(message.state);
|
|
359
|
+
if (message.accountId !== "") writer.uint32(18).string(message.accountId);
|
|
360
|
+
return writer;
|
|
361
|
+
},
|
|
362
|
+
decode(input, length) {
|
|
363
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
364
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
365
|
+
const message = createBaseSetResolverStateRequest();
|
|
366
|
+
while (reader.pos < end) {
|
|
367
|
+
const tag = reader.uint32();
|
|
368
|
+
switch (tag >>> 3) {
|
|
369
|
+
case 1:
|
|
370
|
+
if (tag !== 10) break;
|
|
371
|
+
message.state = reader.bytes();
|
|
372
|
+
continue;
|
|
373
|
+
case 2:
|
|
374
|
+
if (tag !== 18) break;
|
|
375
|
+
message.accountId = reader.string();
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
379
|
+
reader.skip(tag & 7);
|
|
380
|
+
}
|
|
381
|
+
return message;
|
|
382
|
+
},
|
|
383
|
+
fromJSON(object) {
|
|
384
|
+
return {
|
|
385
|
+
state: isSet(object.state) ? bytesFromBase64(object.state) : new Uint8Array(0),
|
|
386
|
+
accountId: isSet(object.accountId) ? globalThis.String(object.accountId) : ""
|
|
387
|
+
};
|
|
388
|
+
},
|
|
389
|
+
toJSON(message) {
|
|
390
|
+
const obj = {};
|
|
391
|
+
if (message.state.length !== 0) obj.state = base64FromBytes(message.state);
|
|
392
|
+
if (message.accountId !== "") obj.accountId = message.accountId;
|
|
393
|
+
return obj;
|
|
394
|
+
},
|
|
395
|
+
create(base) {
|
|
396
|
+
return SetResolverStateRequest.fromPartial(base ?? {});
|
|
397
|
+
},
|
|
398
|
+
fromPartial(object) {
|
|
399
|
+
const message = createBaseSetResolverStateRequest();
|
|
400
|
+
message.state = object.state ?? new Uint8Array(0);
|
|
401
|
+
message.accountId = object.accountId ?? "";
|
|
402
|
+
return message;
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
function createBaseRequest() {
|
|
406
|
+
return { data: new Uint8Array(0) };
|
|
407
|
+
}
|
|
408
|
+
const Request = {
|
|
409
|
+
encode(message, writer = new BinaryWriter()) {
|
|
410
|
+
if (message.data.length !== 0) writer.uint32(10).bytes(message.data);
|
|
411
|
+
return writer;
|
|
412
|
+
},
|
|
413
|
+
decode(input, length) {
|
|
414
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
415
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
416
|
+
const message = createBaseRequest();
|
|
417
|
+
while (reader.pos < end) {
|
|
418
|
+
const tag = reader.uint32();
|
|
419
|
+
switch (tag >>> 3) {
|
|
420
|
+
case 1:
|
|
421
|
+
if (tag !== 10) break;
|
|
422
|
+
message.data = reader.bytes();
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
426
|
+
reader.skip(tag & 7);
|
|
427
|
+
}
|
|
428
|
+
return message;
|
|
429
|
+
},
|
|
430
|
+
fromJSON(object) {
|
|
431
|
+
return { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0) };
|
|
432
|
+
},
|
|
433
|
+
toJSON(message) {
|
|
434
|
+
const obj = {};
|
|
435
|
+
if (message.data.length !== 0) obj.data = base64FromBytes(message.data);
|
|
436
|
+
return obj;
|
|
437
|
+
},
|
|
438
|
+
create(base) {
|
|
439
|
+
return Request.fromPartial(base ?? {});
|
|
440
|
+
},
|
|
441
|
+
fromPartial(object) {
|
|
442
|
+
const message = createBaseRequest();
|
|
443
|
+
message.data = object.data ?? new Uint8Array(0);
|
|
444
|
+
return message;
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
function createBaseResponse() {
|
|
448
|
+
return {
|
|
449
|
+
data: void 0,
|
|
450
|
+
error: void 0
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
const Response = {
|
|
454
|
+
encode(message, writer = new BinaryWriter()) {
|
|
455
|
+
if (message.data !== void 0) writer.uint32(10).bytes(message.data);
|
|
456
|
+
if (message.error !== void 0) writer.uint32(18).string(message.error);
|
|
457
|
+
return writer;
|
|
458
|
+
},
|
|
459
|
+
decode(input, length) {
|
|
460
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
461
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
462
|
+
const message = createBaseResponse();
|
|
463
|
+
while (reader.pos < end) {
|
|
464
|
+
const tag = reader.uint32();
|
|
465
|
+
switch (tag >>> 3) {
|
|
466
|
+
case 1:
|
|
467
|
+
if (tag !== 10) break;
|
|
468
|
+
message.data = reader.bytes();
|
|
469
|
+
continue;
|
|
470
|
+
case 2:
|
|
471
|
+
if (tag !== 18) break;
|
|
472
|
+
message.error = reader.string();
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
476
|
+
reader.skip(tag & 7);
|
|
477
|
+
}
|
|
478
|
+
return message;
|
|
479
|
+
},
|
|
480
|
+
fromJSON(object) {
|
|
481
|
+
return {
|
|
482
|
+
data: isSet(object.data) ? bytesFromBase64(object.data) : void 0,
|
|
483
|
+
error: isSet(object.error) ? globalThis.String(object.error) : void 0
|
|
484
|
+
};
|
|
485
|
+
},
|
|
486
|
+
toJSON(message) {
|
|
487
|
+
const obj = {};
|
|
488
|
+
if (message.data !== void 0) obj.data = base64FromBytes(message.data);
|
|
489
|
+
if (message.error !== void 0) obj.error = message.error;
|
|
490
|
+
return obj;
|
|
491
|
+
},
|
|
492
|
+
create(base) {
|
|
493
|
+
return Response.fromPartial(base ?? {});
|
|
494
|
+
},
|
|
495
|
+
fromPartial(object) {
|
|
496
|
+
const message = createBaseResponse();
|
|
497
|
+
message.data = object.data ?? void 0;
|
|
498
|
+
message.error = object.error ?? void 0;
|
|
499
|
+
return message;
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
function bytesFromBase64(b64) {
|
|
503
|
+
if (globalThis.Buffer) return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
504
|
+
else {
|
|
505
|
+
const bin = globalThis.atob(b64);
|
|
506
|
+
const arr = new Uint8Array(bin.length);
|
|
507
|
+
for (let i = 0; i < bin.length; ++i) arr[i] = bin.charCodeAt(i);
|
|
508
|
+
return arr;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function base64FromBytes(arr) {
|
|
512
|
+
if (globalThis.Buffer) return globalThis.Buffer.from(arr).toString("base64");
|
|
513
|
+
else {
|
|
514
|
+
const bin = [];
|
|
515
|
+
arr.forEach((byte) => {
|
|
516
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
517
|
+
});
|
|
518
|
+
return globalThis.btoa(bin.join(""));
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
function isSet(value) {
|
|
522
|
+
return value !== null && value !== void 0;
|
|
523
|
+
}
|
|
524
|
+
export { Request, Response, SetResolverStateRequest, Struct, Void };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotify-confidence/openfeature-server-provider-local",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Spotify Confidence Open Feature provider",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"format": "prettier --config prettier.config.cjs -w .",
|
|
36
36
|
"format:check": "prettier --config prettier.config.cjs -c .",
|
|
37
37
|
"test": "vitest",
|
|
38
|
-
"proto:gen": "rm -rf src/proto && mkdir -p src/proto && protoc --plugin=node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt useOptionals=messages --ts_proto_opt esModuleInterop=true --ts_proto_out src/proto -Iproto
|
|
38
|
+
"proto:gen": "rm -rf src/proto && mkdir -p src/proto && protoc --plugin=node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt useOptionals=messages --ts_proto_opt esModuleInterop=true --ts_proto_out src/proto -Iproto -I../../wasm/proto -I../../confidence-resolver/protos test-only.proto ../../wasm/proto/messages.proto ../../wasm/proto/resolver/api.proto ../../wasm/proto/types.proto ../../confidence-resolver/protos/confidence/flags/resolver/v1/types.proto"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@bufbuild/protobuf": "^2.9.0"
|