@spotify-confidence/openfeature-server-provider-local 0.1.1 → 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 +32 -0
- package/README.md +89 -54
- package/dist/confidence_resolver.wasm +0 -0
- package/dist/index.browser.d.ts +88 -20
- package/dist/index.browser.js +221 -625
- package/dist/index.node.d.ts +88 -20
- package/dist/index.node.js +221 -625
- package/dist/messages-Bw39oRlC.js +524 -0
- package/dist/messages-CvypvyG4.js +2 -0
- package/package.json +9 -5
package/dist/index.node.js
CHANGED
|
@@ -1,127 +1,149 @@
|
|
|
1
|
+
import { Request, Response as Response$1, SetResolverStateRequest, Struct, Void } from "./messages-Bw39oRlC.js";
|
|
1
2
|
import { createRequire } from "node:module";
|
|
2
3
|
import fs from "node:fs/promises";
|
|
3
4
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
4
5
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
let SdkId = /* @__PURE__ */ function(SdkId$1) {
|
|
7
|
+
SdkId$1[SdkId$1["SDK_ID_UNSPECIFIED"] = 0] = "SDK_ID_UNSPECIFIED";
|
|
8
|
+
SdkId$1[SdkId$1["SDK_ID_JAVA_PROVIDER"] = 1] = "SDK_ID_JAVA_PROVIDER";
|
|
9
|
+
SdkId$1[SdkId$1["SDK_ID_KOTLIN_PROVIDER"] = 2] = "SDK_ID_KOTLIN_PROVIDER";
|
|
10
|
+
SdkId$1[SdkId$1["SDK_ID_SWIFT_PROVIDER"] = 3] = "SDK_ID_SWIFT_PROVIDER";
|
|
11
|
+
SdkId$1[SdkId$1["SDK_ID_JS_WEB_PROVIDER"] = 4] = "SDK_ID_JS_WEB_PROVIDER";
|
|
12
|
+
SdkId$1[SdkId$1["SDK_ID_JS_SERVER_PROVIDER"] = 5] = "SDK_ID_JS_SERVER_PROVIDER";
|
|
13
|
+
SdkId$1[SdkId$1["SDK_ID_PYTHON_PROVIDER"] = 6] = "SDK_ID_PYTHON_PROVIDER";
|
|
14
|
+
SdkId$1[SdkId$1["SDK_ID_GO_PROVIDER"] = 7] = "SDK_ID_GO_PROVIDER";
|
|
15
|
+
SdkId$1[SdkId$1["SDK_ID_RUBY_PROVIDER"] = 8] = "SDK_ID_RUBY_PROVIDER";
|
|
16
|
+
SdkId$1[SdkId$1["SDK_ID_RUST_PROVIDER"] = 9] = "SDK_ID_RUST_PROVIDER";
|
|
17
|
+
SdkId$1[SdkId$1["SDK_ID_JAVA_CONFIDENCE"] = 10] = "SDK_ID_JAVA_CONFIDENCE";
|
|
18
|
+
SdkId$1[SdkId$1["SDK_ID_KOTLIN_CONFIDENCE"] = 11] = "SDK_ID_KOTLIN_CONFIDENCE";
|
|
19
|
+
SdkId$1[SdkId$1["SDK_ID_SWIFT_CONFIDENCE"] = 12] = "SDK_ID_SWIFT_CONFIDENCE";
|
|
20
|
+
SdkId$1[SdkId$1["SDK_ID_JS_CONFIDENCE"] = 13] = "SDK_ID_JS_CONFIDENCE";
|
|
21
|
+
SdkId$1[SdkId$1["SDK_ID_PYTHON_CONFIDENCE"] = 14] = "SDK_ID_PYTHON_CONFIDENCE";
|
|
22
|
+
SdkId$1[SdkId$1["SDK_ID_GO_CONFIDENCE"] = 15] = "SDK_ID_GO_CONFIDENCE";
|
|
23
|
+
SdkId$1[SdkId$1["SDK_ID_RUST_CONFIDENCE"] = 16] = "SDK_ID_RUST_CONFIDENCE";
|
|
24
|
+
SdkId$1[SdkId$1["SDK_ID_FLUTTER_IOS_CONFIDENCE"] = 17] = "SDK_ID_FLUTTER_IOS_CONFIDENCE";
|
|
25
|
+
SdkId$1[SdkId$1["SDK_ID_FLUTTER_ANDROID_CONFIDENCE"] = 18] = "SDK_ID_FLUTTER_ANDROID_CONFIDENCE";
|
|
26
|
+
SdkId$1[SdkId$1["SDK_ID_DOTNET_CONFIDENCE"] = 19] = "SDK_ID_DOTNET_CONFIDENCE";
|
|
27
|
+
SdkId$1[SdkId$1["SDK_ID_GO_LOCAL_PROVIDER"] = 20] = "SDK_ID_GO_LOCAL_PROVIDER";
|
|
28
|
+
SdkId$1[SdkId$1["SDK_ID_JAVA_LOCAL_PROVIDER"] = 21] = "SDK_ID_JAVA_LOCAL_PROVIDER";
|
|
29
|
+
SdkId$1[SdkId$1["SDK_ID_JS_LOCAL_SERVER_PROVIDER"] = 22] = "SDK_ID_JS_LOCAL_SERVER_PROVIDER";
|
|
30
|
+
SdkId$1[SdkId$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
31
|
+
return SdkId$1;
|
|
9
32
|
}({});
|
|
10
|
-
function
|
|
33
|
+
function sdkIdFromJSON(object) {
|
|
11
34
|
switch (object) {
|
|
12
35
|
case 0:
|
|
13
|
-
case "
|
|
36
|
+
case "SDK_ID_UNSPECIFIED": return SdkId.SDK_ID_UNSPECIFIED;
|
|
37
|
+
case 1:
|
|
38
|
+
case "SDK_ID_JAVA_PROVIDER": return SdkId.SDK_ID_JAVA_PROVIDER;
|
|
39
|
+
case 2:
|
|
40
|
+
case "SDK_ID_KOTLIN_PROVIDER": return SdkId.SDK_ID_KOTLIN_PROVIDER;
|
|
41
|
+
case 3:
|
|
42
|
+
case "SDK_ID_SWIFT_PROVIDER": return SdkId.SDK_ID_SWIFT_PROVIDER;
|
|
43
|
+
case 4:
|
|
44
|
+
case "SDK_ID_JS_WEB_PROVIDER": return SdkId.SDK_ID_JS_WEB_PROVIDER;
|
|
45
|
+
case 5:
|
|
46
|
+
case "SDK_ID_JS_SERVER_PROVIDER": return SdkId.SDK_ID_JS_SERVER_PROVIDER;
|
|
47
|
+
case 6:
|
|
48
|
+
case "SDK_ID_PYTHON_PROVIDER": return SdkId.SDK_ID_PYTHON_PROVIDER;
|
|
49
|
+
case 7:
|
|
50
|
+
case "SDK_ID_GO_PROVIDER": return SdkId.SDK_ID_GO_PROVIDER;
|
|
51
|
+
case 8:
|
|
52
|
+
case "SDK_ID_RUBY_PROVIDER": return SdkId.SDK_ID_RUBY_PROVIDER;
|
|
53
|
+
case 9:
|
|
54
|
+
case "SDK_ID_RUST_PROVIDER": return SdkId.SDK_ID_RUST_PROVIDER;
|
|
55
|
+
case 10:
|
|
56
|
+
case "SDK_ID_JAVA_CONFIDENCE": return SdkId.SDK_ID_JAVA_CONFIDENCE;
|
|
57
|
+
case 11:
|
|
58
|
+
case "SDK_ID_KOTLIN_CONFIDENCE": return SdkId.SDK_ID_KOTLIN_CONFIDENCE;
|
|
59
|
+
case 12:
|
|
60
|
+
case "SDK_ID_SWIFT_CONFIDENCE": return SdkId.SDK_ID_SWIFT_CONFIDENCE;
|
|
61
|
+
case 13:
|
|
62
|
+
case "SDK_ID_JS_CONFIDENCE": return SdkId.SDK_ID_JS_CONFIDENCE;
|
|
63
|
+
case 14:
|
|
64
|
+
case "SDK_ID_PYTHON_CONFIDENCE": return SdkId.SDK_ID_PYTHON_CONFIDENCE;
|
|
65
|
+
case 15:
|
|
66
|
+
case "SDK_ID_GO_CONFIDENCE": return SdkId.SDK_ID_GO_CONFIDENCE;
|
|
67
|
+
case 16:
|
|
68
|
+
case "SDK_ID_RUST_CONFIDENCE": return SdkId.SDK_ID_RUST_CONFIDENCE;
|
|
69
|
+
case 17:
|
|
70
|
+
case "SDK_ID_FLUTTER_IOS_CONFIDENCE": return SdkId.SDK_ID_FLUTTER_IOS_CONFIDENCE;
|
|
71
|
+
case 18:
|
|
72
|
+
case "SDK_ID_FLUTTER_ANDROID_CONFIDENCE": return SdkId.SDK_ID_FLUTTER_ANDROID_CONFIDENCE;
|
|
73
|
+
case 19:
|
|
74
|
+
case "SDK_ID_DOTNET_CONFIDENCE": return SdkId.SDK_ID_DOTNET_CONFIDENCE;
|
|
75
|
+
case 20:
|
|
76
|
+
case "SDK_ID_GO_LOCAL_PROVIDER": return SdkId.SDK_ID_GO_LOCAL_PROVIDER;
|
|
77
|
+
case 21:
|
|
78
|
+
case "SDK_ID_JAVA_LOCAL_PROVIDER": return SdkId.SDK_ID_JAVA_LOCAL_PROVIDER;
|
|
79
|
+
case 22:
|
|
80
|
+
case "SDK_ID_JS_LOCAL_SERVER_PROVIDER": return SdkId.SDK_ID_JS_LOCAL_SERVER_PROVIDER;
|
|
14
81
|
case -1:
|
|
15
82
|
case "UNRECOGNIZED":
|
|
16
|
-
default: return
|
|
83
|
+
default: return SdkId.UNRECOGNIZED;
|
|
17
84
|
}
|
|
18
85
|
}
|
|
19
|
-
function
|
|
86
|
+
function sdkIdToJSON(object) {
|
|
20
87
|
switch (object) {
|
|
21
|
-
case
|
|
22
|
-
case
|
|
88
|
+
case SdkId.SDK_ID_UNSPECIFIED: return "SDK_ID_UNSPECIFIED";
|
|
89
|
+
case SdkId.SDK_ID_JAVA_PROVIDER: return "SDK_ID_JAVA_PROVIDER";
|
|
90
|
+
case SdkId.SDK_ID_KOTLIN_PROVIDER: return "SDK_ID_KOTLIN_PROVIDER";
|
|
91
|
+
case SdkId.SDK_ID_SWIFT_PROVIDER: return "SDK_ID_SWIFT_PROVIDER";
|
|
92
|
+
case SdkId.SDK_ID_JS_WEB_PROVIDER: return "SDK_ID_JS_WEB_PROVIDER";
|
|
93
|
+
case SdkId.SDK_ID_JS_SERVER_PROVIDER: return "SDK_ID_JS_SERVER_PROVIDER";
|
|
94
|
+
case SdkId.SDK_ID_PYTHON_PROVIDER: return "SDK_ID_PYTHON_PROVIDER";
|
|
95
|
+
case SdkId.SDK_ID_GO_PROVIDER: return "SDK_ID_GO_PROVIDER";
|
|
96
|
+
case SdkId.SDK_ID_RUBY_PROVIDER: return "SDK_ID_RUBY_PROVIDER";
|
|
97
|
+
case SdkId.SDK_ID_RUST_PROVIDER: return "SDK_ID_RUST_PROVIDER";
|
|
98
|
+
case SdkId.SDK_ID_JAVA_CONFIDENCE: return "SDK_ID_JAVA_CONFIDENCE";
|
|
99
|
+
case SdkId.SDK_ID_KOTLIN_CONFIDENCE: return "SDK_ID_KOTLIN_CONFIDENCE";
|
|
100
|
+
case SdkId.SDK_ID_SWIFT_CONFIDENCE: return "SDK_ID_SWIFT_CONFIDENCE";
|
|
101
|
+
case SdkId.SDK_ID_JS_CONFIDENCE: return "SDK_ID_JS_CONFIDENCE";
|
|
102
|
+
case SdkId.SDK_ID_PYTHON_CONFIDENCE: return "SDK_ID_PYTHON_CONFIDENCE";
|
|
103
|
+
case SdkId.SDK_ID_GO_CONFIDENCE: return "SDK_ID_GO_CONFIDENCE";
|
|
104
|
+
case SdkId.SDK_ID_RUST_CONFIDENCE: return "SDK_ID_RUST_CONFIDENCE";
|
|
105
|
+
case SdkId.SDK_ID_FLUTTER_IOS_CONFIDENCE: return "SDK_ID_FLUTTER_IOS_CONFIDENCE";
|
|
106
|
+
case SdkId.SDK_ID_FLUTTER_ANDROID_CONFIDENCE: return "SDK_ID_FLUTTER_ANDROID_CONFIDENCE";
|
|
107
|
+
case SdkId.SDK_ID_DOTNET_CONFIDENCE: return "SDK_ID_DOTNET_CONFIDENCE";
|
|
108
|
+
case SdkId.SDK_ID_GO_LOCAL_PROVIDER: return "SDK_ID_GO_LOCAL_PROVIDER";
|
|
109
|
+
case SdkId.SDK_ID_JAVA_LOCAL_PROVIDER: return "SDK_ID_JAVA_LOCAL_PROVIDER";
|
|
110
|
+
case SdkId.SDK_ID_JS_LOCAL_SERVER_PROVIDER: return "SDK_ID_JS_LOCAL_SERVER_PROVIDER";
|
|
111
|
+
case SdkId.UNRECOGNIZED:
|
|
23
112
|
default: return "UNRECOGNIZED";
|
|
24
113
|
}
|
|
25
114
|
}
|
|
26
|
-
function
|
|
27
|
-
return { fields: {} };
|
|
28
|
-
}
|
|
29
|
-
const Struct = {
|
|
30
|
-
encode(message, writer = new BinaryWriter()) {
|
|
31
|
-
Object.entries(message.fields).forEach(([key, value]) => {
|
|
32
|
-
if (value !== void 0) Struct_FieldsEntry.encode({
|
|
33
|
-
key,
|
|
34
|
-
value
|
|
35
|
-
}, writer.uint32(10).fork()).join();
|
|
36
|
-
});
|
|
37
|
-
return writer;
|
|
38
|
-
},
|
|
39
|
-
decode(input, length) {
|
|
40
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
41
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
42
|
-
const message = createBaseStruct();
|
|
43
|
-
while (reader.pos < end) {
|
|
44
|
-
const tag = reader.uint32();
|
|
45
|
-
switch (tag >>> 3) {
|
|
46
|
-
case 1: {
|
|
47
|
-
if (tag !== 10) break;
|
|
48
|
-
const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32());
|
|
49
|
-
if (entry1.value !== void 0) message.fields[entry1.key] = entry1.value;
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if ((tag & 7) === 4 || tag === 0) break;
|
|
54
|
-
reader.skip(tag & 7);
|
|
55
|
-
}
|
|
56
|
-
return message;
|
|
57
|
-
},
|
|
58
|
-
fromJSON(object) {
|
|
59
|
-
return { fields: isObject$1(object.fields) ? Object.entries(object.fields).reduce((acc, [key, value]) => {
|
|
60
|
-
acc[key] = value;
|
|
61
|
-
return acc;
|
|
62
|
-
}, {}) : {} };
|
|
63
|
-
},
|
|
64
|
-
toJSON(message) {
|
|
65
|
-
const obj = {};
|
|
66
|
-
if (message.fields) {
|
|
67
|
-
const entries = Object.entries(message.fields);
|
|
68
|
-
if (entries.length > 0) {
|
|
69
|
-
obj.fields = {};
|
|
70
|
-
entries.forEach(([k, v]) => {
|
|
71
|
-
obj.fields[k] = v;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return obj;
|
|
76
|
-
},
|
|
77
|
-
create(base) {
|
|
78
|
-
return Struct.fromPartial(base ?? {});
|
|
79
|
-
},
|
|
80
|
-
fromPartial(object) {
|
|
81
|
-
const message = createBaseStruct();
|
|
82
|
-
message.fields = Object.entries(object.fields ?? {}).reduce((acc, [key, value]) => {
|
|
83
|
-
if (value !== void 0) acc[key] = value;
|
|
84
|
-
return acc;
|
|
85
|
-
}, {});
|
|
86
|
-
return message;
|
|
87
|
-
},
|
|
88
|
-
wrap(object) {
|
|
89
|
-
const struct = createBaseStruct();
|
|
90
|
-
if (object !== void 0) for (const key of Object.keys(object)) struct.fields[key] = object[key];
|
|
91
|
-
return struct;
|
|
92
|
-
},
|
|
93
|
-
unwrap(message) {
|
|
94
|
-
const object = {};
|
|
95
|
-
if (message.fields) for (const key of Object.keys(message.fields)) object[key] = message.fields[key];
|
|
96
|
-
return object;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
function createBaseStruct_FieldsEntry() {
|
|
115
|
+
function createBaseSdk() {
|
|
100
116
|
return {
|
|
101
|
-
|
|
102
|
-
|
|
117
|
+
id: void 0,
|
|
118
|
+
customId: void 0,
|
|
119
|
+
version: ""
|
|
103
120
|
};
|
|
104
121
|
}
|
|
105
|
-
const
|
|
122
|
+
const Sdk = {
|
|
106
123
|
encode(message, writer = new BinaryWriter()) {
|
|
107
|
-
if (message.
|
|
108
|
-
if (message.
|
|
124
|
+
if (message.id !== void 0) writer.uint32(8).int32(message.id);
|
|
125
|
+
if (message.customId !== void 0) writer.uint32(18).string(message.customId);
|
|
126
|
+
if (message.version !== "") writer.uint32(26).string(message.version);
|
|
109
127
|
return writer;
|
|
110
128
|
},
|
|
111
129
|
decode(input, length) {
|
|
112
130
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
113
131
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
114
|
-
const message =
|
|
132
|
+
const message = createBaseSdk();
|
|
115
133
|
while (reader.pos < end) {
|
|
116
134
|
const tag = reader.uint32();
|
|
117
135
|
switch (tag >>> 3) {
|
|
118
136
|
case 1:
|
|
119
|
-
if (tag !==
|
|
120
|
-
message.
|
|
137
|
+
if (tag !== 8) break;
|
|
138
|
+
message.id = reader.int32();
|
|
121
139
|
continue;
|
|
122
140
|
case 2:
|
|
123
141
|
if (tag !== 18) break;
|
|
124
|
-
message.
|
|
142
|
+
message.customId = reader.string();
|
|
143
|
+
continue;
|
|
144
|
+
case 3:
|
|
145
|
+
if (tag !== 26) break;
|
|
146
|
+
message.version = reader.string();
|
|
125
147
|
continue;
|
|
126
148
|
}
|
|
127
149
|
if ((tag & 7) === 4 || tag === 0) break;
|
|
@@ -131,76 +153,58 @@ const Struct_FieldsEntry = {
|
|
|
131
153
|
},
|
|
132
154
|
fromJSON(object) {
|
|
133
155
|
return {
|
|
134
|
-
|
|
135
|
-
|
|
156
|
+
id: isSet$2(object.id) ? sdkIdFromJSON(object.id) : void 0,
|
|
157
|
+
customId: isSet$2(object.customId) ? globalThis.String(object.customId) : void 0,
|
|
158
|
+
version: isSet$2(object.version) ? globalThis.String(object.version) : ""
|
|
136
159
|
};
|
|
137
160
|
},
|
|
138
161
|
toJSON(message) {
|
|
139
162
|
const obj = {};
|
|
140
|
-
if (message.
|
|
141
|
-
if (message.
|
|
163
|
+
if (message.id !== void 0) obj.id = sdkIdToJSON(message.id);
|
|
164
|
+
if (message.customId !== void 0) obj.customId = message.customId;
|
|
165
|
+
if (message.version !== "") obj.version = message.version;
|
|
142
166
|
return obj;
|
|
143
167
|
},
|
|
144
168
|
create(base) {
|
|
145
|
-
return
|
|
169
|
+
return Sdk.fromPartial(base ?? {});
|
|
146
170
|
},
|
|
147
171
|
fromPartial(object) {
|
|
148
|
-
const message =
|
|
149
|
-
message.
|
|
150
|
-
message.
|
|
172
|
+
const message = createBaseSdk();
|
|
173
|
+
message.id = object.id ?? void 0;
|
|
174
|
+
message.customId = object.customId ?? void 0;
|
|
175
|
+
message.version = object.version ?? "";
|
|
151
176
|
return message;
|
|
152
177
|
}
|
|
153
178
|
};
|
|
154
|
-
function
|
|
179
|
+
function isSet$2(value) {
|
|
180
|
+
return value !== null && value !== void 0;
|
|
181
|
+
}
|
|
182
|
+
function createBaseTimestamp() {
|
|
155
183
|
return {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
stringValue: void 0,
|
|
159
|
-
boolValue: void 0,
|
|
160
|
-
structValue: void 0,
|
|
161
|
-
listValue: void 0
|
|
184
|
+
seconds: 0,
|
|
185
|
+
nanos: 0
|
|
162
186
|
};
|
|
163
187
|
}
|
|
164
|
-
const
|
|
188
|
+
const Timestamp = {
|
|
165
189
|
encode(message, writer = new BinaryWriter()) {
|
|
166
|
-
if (message.
|
|
167
|
-
if (message.
|
|
168
|
-
if (message.stringValue !== void 0) writer.uint32(26).string(message.stringValue);
|
|
169
|
-
if (message.boolValue !== void 0) writer.uint32(32).bool(message.boolValue);
|
|
170
|
-
if (message.structValue !== void 0) Struct.encode(Struct.wrap(message.structValue), writer.uint32(42).fork()).join();
|
|
171
|
-
if (message.listValue !== void 0) ListValue.encode(ListValue.wrap(message.listValue), writer.uint32(50).fork()).join();
|
|
190
|
+
if (message.seconds !== 0) writer.uint32(8).int64(message.seconds);
|
|
191
|
+
if (message.nanos !== 0) writer.uint32(16).int32(message.nanos);
|
|
172
192
|
return writer;
|
|
173
193
|
},
|
|
174
194
|
decode(input, length) {
|
|
175
195
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
176
196
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
177
|
-
const message =
|
|
197
|
+
const message = createBaseTimestamp();
|
|
178
198
|
while (reader.pos < end) {
|
|
179
199
|
const tag = reader.uint32();
|
|
180
200
|
switch (tag >>> 3) {
|
|
181
201
|
case 1:
|
|
182
202
|
if (tag !== 8) break;
|
|
183
|
-
message.
|
|
203
|
+
message.seconds = longToNumber(reader.int64());
|
|
184
204
|
continue;
|
|
185
205
|
case 2:
|
|
186
|
-
if (tag !==
|
|
187
|
-
message.
|
|
188
|
-
continue;
|
|
189
|
-
case 3:
|
|
190
|
-
if (tag !== 26) break;
|
|
191
|
-
message.stringValue = reader.string();
|
|
192
|
-
continue;
|
|
193
|
-
case 4:
|
|
194
|
-
if (tag !== 32) break;
|
|
195
|
-
message.boolValue = reader.bool();
|
|
196
|
-
continue;
|
|
197
|
-
case 5:
|
|
198
|
-
if (tag !== 42) break;
|
|
199
|
-
message.structValue = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
200
|
-
continue;
|
|
201
|
-
case 6:
|
|
202
|
-
if (tag !== 50) break;
|
|
203
|
-
message.listValue = ListValue.unwrap(ListValue.decode(reader, reader.uint32()));
|
|
206
|
+
if (tag !== 16) break;
|
|
207
|
+
message.nanos = reader.int32();
|
|
204
208
|
continue;
|
|
205
209
|
}
|
|
206
210
|
if ((tag & 7) === 4 || tag === 0) break;
|
|
@@ -210,112 +214,33 @@ const Value = {
|
|
|
210
214
|
},
|
|
211
215
|
fromJSON(object) {
|
|
212
216
|
return {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
stringValue: isSet$3(object.stringValue) ? globalThis.String(object.stringValue) : void 0,
|
|
216
|
-
boolValue: isSet$3(object.boolValue) ? globalThis.Boolean(object.boolValue) : void 0,
|
|
217
|
-
structValue: isObject$1(object.structValue) ? object.structValue : void 0,
|
|
218
|
-
listValue: globalThis.Array.isArray(object.listValue) ? [...object.listValue] : void 0
|
|
217
|
+
seconds: isSet$1(object.seconds) ? globalThis.Number(object.seconds) : 0,
|
|
218
|
+
nanos: isSet$1(object.nanos) ? globalThis.Number(object.nanos) : 0
|
|
219
219
|
};
|
|
220
220
|
},
|
|
221
221
|
toJSON(message) {
|
|
222
222
|
const obj = {};
|
|
223
|
-
if (message.
|
|
224
|
-
if (message.
|
|
225
|
-
if (message.stringValue !== void 0) obj.stringValue = message.stringValue;
|
|
226
|
-
if (message.boolValue !== void 0) obj.boolValue = message.boolValue;
|
|
227
|
-
if (message.structValue !== void 0) obj.structValue = message.structValue;
|
|
228
|
-
if (message.listValue !== void 0) obj.listValue = message.listValue;
|
|
229
|
-
return obj;
|
|
230
|
-
},
|
|
231
|
-
create(base) {
|
|
232
|
-
return Value.fromPartial(base ?? {});
|
|
233
|
-
},
|
|
234
|
-
fromPartial(object) {
|
|
235
|
-
const message = createBaseValue();
|
|
236
|
-
message.nullValue = object.nullValue ?? void 0;
|
|
237
|
-
message.numberValue = object.numberValue ?? void 0;
|
|
238
|
-
message.stringValue = object.stringValue ?? void 0;
|
|
239
|
-
message.boolValue = object.boolValue ?? void 0;
|
|
240
|
-
message.structValue = object.structValue ?? void 0;
|
|
241
|
-
message.listValue = object.listValue ?? void 0;
|
|
242
|
-
return message;
|
|
243
|
-
},
|
|
244
|
-
wrap(value) {
|
|
245
|
-
const result = createBaseValue();
|
|
246
|
-
if (value === null) result.nullValue = NullValue.NULL_VALUE;
|
|
247
|
-
else if (typeof value === "boolean") result.boolValue = value;
|
|
248
|
-
else if (typeof value === "number") result.numberValue = value;
|
|
249
|
-
else if (typeof value === "string") result.stringValue = value;
|
|
250
|
-
else if (globalThis.Array.isArray(value)) result.listValue = value;
|
|
251
|
-
else if (typeof value === "object") result.structValue = value;
|
|
252
|
-
else if (typeof value !== "undefined") throw new globalThis.Error("Unsupported any value type: " + typeof value);
|
|
253
|
-
return result;
|
|
254
|
-
},
|
|
255
|
-
unwrap(message) {
|
|
256
|
-
if (message.stringValue !== void 0) return message.stringValue;
|
|
257
|
-
else if (message?.numberValue !== void 0) return message.numberValue;
|
|
258
|
-
else if (message?.boolValue !== void 0) return message.boolValue;
|
|
259
|
-
else if (message?.structValue !== void 0) return message.structValue;
|
|
260
|
-
else if (message?.listValue !== void 0) return message.listValue;
|
|
261
|
-
else if (message?.nullValue !== void 0) return null;
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
function createBaseListValue() {
|
|
265
|
-
return { values: [] };
|
|
266
|
-
}
|
|
267
|
-
const ListValue = {
|
|
268
|
-
encode(message, writer = new BinaryWriter()) {
|
|
269
|
-
for (const v of message.values) Value.encode(Value.wrap(v), writer.uint32(10).fork()).join();
|
|
270
|
-
return writer;
|
|
271
|
-
},
|
|
272
|
-
decode(input, length) {
|
|
273
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
274
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
275
|
-
const message = createBaseListValue();
|
|
276
|
-
while (reader.pos < end) {
|
|
277
|
-
const tag = reader.uint32();
|
|
278
|
-
switch (tag >>> 3) {
|
|
279
|
-
case 1:
|
|
280
|
-
if (tag !== 10) break;
|
|
281
|
-
message.values.push(Value.unwrap(Value.decode(reader, reader.uint32())));
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
if ((tag & 7) === 4 || tag === 0) break;
|
|
285
|
-
reader.skip(tag & 7);
|
|
286
|
-
}
|
|
287
|
-
return message;
|
|
288
|
-
},
|
|
289
|
-
fromJSON(object) {
|
|
290
|
-
return { values: globalThis.Array.isArray(object?.values) ? [...object.values] : [] };
|
|
291
|
-
},
|
|
292
|
-
toJSON(message) {
|
|
293
|
-
const obj = {};
|
|
294
|
-
if (message.values?.length) obj.values = message.values;
|
|
223
|
+
if (message.seconds !== 0) obj.seconds = Math.round(message.seconds);
|
|
224
|
+
if (message.nanos !== 0) obj.nanos = Math.round(message.nanos);
|
|
295
225
|
return obj;
|
|
296
226
|
},
|
|
297
227
|
create(base) {
|
|
298
|
-
return
|
|
228
|
+
return Timestamp.fromPartial(base ?? {});
|
|
299
229
|
},
|
|
300
230
|
fromPartial(object) {
|
|
301
|
-
const message =
|
|
302
|
-
message.
|
|
231
|
+
const message = createBaseTimestamp();
|
|
232
|
+
message.seconds = object.seconds ?? 0;
|
|
233
|
+
message.nanos = object.nanos ?? 0;
|
|
303
234
|
return message;
|
|
304
|
-
},
|
|
305
|
-
wrap(array) {
|
|
306
|
-
const result = createBaseListValue();
|
|
307
|
-
result.values = array ?? [];
|
|
308
|
-
return result;
|
|
309
|
-
},
|
|
310
|
-
unwrap(message) {
|
|
311
|
-
if (message?.hasOwnProperty("values") && globalThis.Array.isArray(message.values)) return message.values;
|
|
312
|
-
else return message;
|
|
313
235
|
}
|
|
314
236
|
};
|
|
315
|
-
function
|
|
316
|
-
|
|
237
|
+
function longToNumber(int64) {
|
|
238
|
+
const num = globalThis.Number(int64.toString());
|
|
239
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
240
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
241
|
+
return num;
|
|
317
242
|
}
|
|
318
|
-
function isSet$
|
|
243
|
+
function isSet$1(value) {
|
|
319
244
|
return value !== null && value !== void 0;
|
|
320
245
|
}
|
|
321
246
|
let ResolveReason = /* @__PURE__ */ function(ResolveReason$1) {
|
|
@@ -368,7 +293,8 @@ function createBaseResolveFlagsRequest() {
|
|
|
368
293
|
flags: [],
|
|
369
294
|
evaluationContext: void 0,
|
|
370
295
|
clientSecret: "",
|
|
371
|
-
apply: false
|
|
296
|
+
apply: false,
|
|
297
|
+
sdk: void 0
|
|
372
298
|
};
|
|
373
299
|
}
|
|
374
300
|
const ResolveFlagsRequest = {
|
|
@@ -377,6 +303,7 @@ const ResolveFlagsRequest = {
|
|
|
377
303
|
if (message.evaluationContext !== void 0) Struct.encode(Struct.wrap(message.evaluationContext), writer.uint32(18).fork()).join();
|
|
378
304
|
if (message.clientSecret !== "") writer.uint32(26).string(message.clientSecret);
|
|
379
305
|
if (message.apply !== false) writer.uint32(32).bool(message.apply);
|
|
306
|
+
if (message.sdk !== void 0) Sdk.encode(message.sdk, writer.uint32(42).fork()).join();
|
|
380
307
|
return writer;
|
|
381
308
|
},
|
|
382
309
|
decode(input, length) {
|
|
@@ -402,6 +329,10 @@ const ResolveFlagsRequest = {
|
|
|
402
329
|
if (tag !== 32) break;
|
|
403
330
|
message.apply = reader.bool();
|
|
404
331
|
continue;
|
|
332
|
+
case 5:
|
|
333
|
+
if (tag !== 42) break;
|
|
334
|
+
message.sdk = Sdk.decode(reader, reader.uint32());
|
|
335
|
+
continue;
|
|
405
336
|
}
|
|
406
337
|
if ((tag & 7) === 4 || tag === 0) break;
|
|
407
338
|
reader.skip(tag & 7);
|
|
@@ -412,8 +343,9 @@ const ResolveFlagsRequest = {
|
|
|
412
343
|
return {
|
|
413
344
|
flags: globalThis.Array.isArray(object?.flags) ? object.flags.map((e) => globalThis.String(e)) : [],
|
|
414
345
|
evaluationContext: isObject(object.evaluationContext) ? object.evaluationContext : void 0,
|
|
415
|
-
clientSecret: isSet
|
|
416
|
-
apply: isSet
|
|
346
|
+
clientSecret: isSet(object.clientSecret) ? globalThis.String(object.clientSecret) : "",
|
|
347
|
+
apply: isSet(object.apply) ? globalThis.Boolean(object.apply) : false,
|
|
348
|
+
sdk: isSet(object.sdk) ? Sdk.fromJSON(object.sdk) : void 0
|
|
417
349
|
};
|
|
418
350
|
},
|
|
419
351
|
toJSON(message) {
|
|
@@ -422,6 +354,7 @@ const ResolveFlagsRequest = {
|
|
|
422
354
|
if (message.evaluationContext !== void 0) obj.evaluationContext = message.evaluationContext;
|
|
423
355
|
if (message.clientSecret !== "") obj.clientSecret = message.clientSecret;
|
|
424
356
|
if (message.apply !== false) obj.apply = message.apply;
|
|
357
|
+
if (message.sdk !== void 0) obj.sdk = Sdk.toJSON(message.sdk);
|
|
425
358
|
return obj;
|
|
426
359
|
},
|
|
427
360
|
create(base) {
|
|
@@ -433,6 +366,7 @@ const ResolveFlagsRequest = {
|
|
|
433
366
|
message.evaluationContext = object.evaluationContext ?? void 0;
|
|
434
367
|
message.clientSecret = object.clientSecret ?? "";
|
|
435
368
|
message.apply = object.apply ?? false;
|
|
369
|
+
message.sdk = object.sdk !== void 0 && object.sdk !== null ? Sdk.fromPartial(object.sdk) : void 0;
|
|
436
370
|
return message;
|
|
437
371
|
}
|
|
438
372
|
};
|
|
@@ -478,14 +412,14 @@ const ResolveFlagsResponse = {
|
|
|
478
412
|
fromJSON(object) {
|
|
479
413
|
return {
|
|
480
414
|
resolvedFlags: globalThis.Array.isArray(object?.resolvedFlags) ? object.resolvedFlags.map((e) => ResolvedFlag.fromJSON(e)) : [],
|
|
481
|
-
resolveToken: isSet
|
|
482
|
-
resolveId: isSet
|
|
415
|
+
resolveToken: isSet(object.resolveToken) ? bytesFromBase64(object.resolveToken) : new Uint8Array(0),
|
|
416
|
+
resolveId: isSet(object.resolveId) ? globalThis.String(object.resolveId) : ""
|
|
483
417
|
};
|
|
484
418
|
},
|
|
485
419
|
toJSON(message) {
|
|
486
420
|
const obj = {};
|
|
487
421
|
if (message.resolvedFlags?.length) obj.resolvedFlags = message.resolvedFlags.map((e) => ResolvedFlag.toJSON(e));
|
|
488
|
-
if (message.resolveToken.length !== 0) obj.resolveToken = base64FromBytes
|
|
422
|
+
if (message.resolveToken.length !== 0) obj.resolveToken = base64FromBytes(message.resolveToken);
|
|
489
423
|
if (message.resolveId !== "") obj.resolveId = message.resolveId;
|
|
490
424
|
return obj;
|
|
491
425
|
},
|
|
@@ -547,10 +481,10 @@ const ResolvedFlag = {
|
|
|
547
481
|
},
|
|
548
482
|
fromJSON(object) {
|
|
549
483
|
return {
|
|
550
|
-
flag: isSet
|
|
551
|
-
variant: isSet
|
|
484
|
+
flag: isSet(object.flag) ? globalThis.String(object.flag) : "",
|
|
485
|
+
variant: isSet(object.variant) ? globalThis.String(object.variant) : "",
|
|
552
486
|
value: isObject(object.value) ? object.value : void 0,
|
|
553
|
-
reason: isSet
|
|
487
|
+
reason: isSet(object.reason) ? resolveReasonFromJSON(object.reason) : 0
|
|
554
488
|
};
|
|
555
489
|
},
|
|
556
490
|
toJSON(message) {
|
|
@@ -573,61 +507,6 @@ const ResolvedFlag = {
|
|
|
573
507
|
return message;
|
|
574
508
|
}
|
|
575
509
|
};
|
|
576
|
-
function createBaseSetResolverStateRequest() {
|
|
577
|
-
return {
|
|
578
|
-
state: new Uint8Array(0),
|
|
579
|
-
accountId: ""
|
|
580
|
-
};
|
|
581
|
-
}
|
|
582
|
-
const SetResolverStateRequest = {
|
|
583
|
-
encode(message, writer = new BinaryWriter()) {
|
|
584
|
-
if (message.state.length !== 0) writer.uint32(10).bytes(message.state);
|
|
585
|
-
if (message.accountId !== "") writer.uint32(18).string(message.accountId);
|
|
586
|
-
return writer;
|
|
587
|
-
},
|
|
588
|
-
decode(input, length) {
|
|
589
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
590
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
591
|
-
const message = createBaseSetResolverStateRequest();
|
|
592
|
-
while (reader.pos < end) {
|
|
593
|
-
const tag = reader.uint32();
|
|
594
|
-
switch (tag >>> 3) {
|
|
595
|
-
case 1:
|
|
596
|
-
if (tag !== 10) break;
|
|
597
|
-
message.state = reader.bytes();
|
|
598
|
-
continue;
|
|
599
|
-
case 2:
|
|
600
|
-
if (tag !== 18) break;
|
|
601
|
-
message.accountId = reader.string();
|
|
602
|
-
continue;
|
|
603
|
-
}
|
|
604
|
-
if ((tag & 7) === 4 || tag === 0) break;
|
|
605
|
-
reader.skip(tag & 7);
|
|
606
|
-
}
|
|
607
|
-
return message;
|
|
608
|
-
},
|
|
609
|
-
fromJSON(object) {
|
|
610
|
-
return {
|
|
611
|
-
state: isSet$2(object.state) ? bytesFromBase64$1(object.state) : new Uint8Array(0),
|
|
612
|
-
accountId: isSet$2(object.accountId) ? globalThis.String(object.accountId) : ""
|
|
613
|
-
};
|
|
614
|
-
},
|
|
615
|
-
toJSON(message) {
|
|
616
|
-
const obj = {};
|
|
617
|
-
if (message.state.length !== 0) obj.state = base64FromBytes$1(message.state);
|
|
618
|
-
if (message.accountId !== "") obj.accountId = message.accountId;
|
|
619
|
-
return obj;
|
|
620
|
-
},
|
|
621
|
-
create(base) {
|
|
622
|
-
return SetResolverStateRequest.fromPartial(base ?? {});
|
|
623
|
-
},
|
|
624
|
-
fromPartial(object) {
|
|
625
|
-
const message = createBaseSetResolverStateRequest();
|
|
626
|
-
message.state = object.state ?? new Uint8Array(0);
|
|
627
|
-
message.accountId = object.accountId ?? "";
|
|
628
|
-
return message;
|
|
629
|
-
}
|
|
630
|
-
};
|
|
631
510
|
function createBaseResolveWithStickyRequest() {
|
|
632
511
|
return {
|
|
633
512
|
resolveRequest: void 0,
|
|
@@ -676,12 +555,12 @@ const ResolveWithStickyRequest = {
|
|
|
676
555
|
},
|
|
677
556
|
fromJSON(object) {
|
|
678
557
|
return {
|
|
679
|
-
resolveRequest: isSet
|
|
558
|
+
resolveRequest: isSet(object.resolveRequest) ? ResolveFlagsRequest.fromJSON(object.resolveRequest) : void 0,
|
|
680
559
|
materializationsPerUnit: isObject(object.materializationsPerUnit) ? Object.entries(object.materializationsPerUnit).reduce((acc, [key, value]) => {
|
|
681
560
|
acc[key] = MaterializationMap.fromJSON(value);
|
|
682
561
|
return acc;
|
|
683
562
|
}, {}) : {},
|
|
684
|
-
failFastOnSticky: isSet
|
|
563
|
+
failFastOnSticky: isSet(object.failFastOnSticky) ? globalThis.Boolean(object.failFastOnSticky) : false
|
|
685
564
|
};
|
|
686
565
|
},
|
|
687
566
|
toJSON(message) {
|
|
@@ -748,8 +627,8 @@ const ResolveWithStickyRequest_MaterializationsPerUnitEntry = {
|
|
|
748
627
|
},
|
|
749
628
|
fromJSON(object) {
|
|
750
629
|
return {
|
|
751
|
-
key: isSet
|
|
752
|
-
value: isSet
|
|
630
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
631
|
+
value: isSet(object.value) ? MaterializationMap.fromJSON(object.value) : void 0
|
|
753
632
|
};
|
|
754
633
|
},
|
|
755
634
|
toJSON(message) {
|
|
@@ -866,8 +745,8 @@ const MaterializationMap_InfoMapEntry = {
|
|
|
866
745
|
},
|
|
867
746
|
fromJSON(object) {
|
|
868
747
|
return {
|
|
869
|
-
key: isSet
|
|
870
|
-
value: isSet
|
|
748
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
749
|
+
value: isSet(object.value) ? MaterializationInfo.fromJSON(object.value) : void 0
|
|
871
750
|
};
|
|
872
751
|
},
|
|
873
752
|
toJSON(message) {
|
|
@@ -928,7 +807,7 @@ const MaterializationInfo = {
|
|
|
928
807
|
},
|
|
929
808
|
fromJSON(object) {
|
|
930
809
|
return {
|
|
931
|
-
unitInInfo: isSet
|
|
810
|
+
unitInInfo: isSet(object.unitInInfo) ? globalThis.Boolean(object.unitInInfo) : false,
|
|
932
811
|
ruleToVariant: isObject(object.ruleToVariant) ? Object.entries(object.ruleToVariant).reduce((acc, [key, value]) => {
|
|
933
812
|
acc[key] = String(value);
|
|
934
813
|
return acc;
|
|
@@ -997,8 +876,8 @@ const MaterializationInfo_RuleToVariantEntry = {
|
|
|
997
876
|
},
|
|
998
877
|
fromJSON(object) {
|
|
999
878
|
return {
|
|
1000
|
-
key: isSet
|
|
1001
|
-
value: isSet
|
|
879
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
880
|
+
value: isSet(object.value) ? globalThis.String(object.value) : ""
|
|
1002
881
|
};
|
|
1003
882
|
},
|
|
1004
883
|
toJSON(message) {
|
|
@@ -1052,8 +931,8 @@ const ResolveWithStickyResponse = {
|
|
|
1052
931
|
},
|
|
1053
932
|
fromJSON(object) {
|
|
1054
933
|
return {
|
|
1055
|
-
success: isSet
|
|
1056
|
-
missingMaterializations: isSet
|
|
934
|
+
success: isSet(object.success) ? ResolveWithStickyResponse_Success.fromJSON(object.success) : void 0,
|
|
935
|
+
missingMaterializations: isSet(object.missingMaterializations) ? ResolveWithStickyResponse_MissingMaterializations.fromJSON(object.missingMaterializations) : void 0
|
|
1057
936
|
};
|
|
1058
937
|
},
|
|
1059
938
|
toJSON(message) {
|
|
@@ -1107,7 +986,7 @@ const ResolveWithStickyResponse_Success = {
|
|
|
1107
986
|
},
|
|
1108
987
|
fromJSON(object) {
|
|
1109
988
|
return {
|
|
1110
|
-
response: isSet
|
|
989
|
+
response: isSet(object.response) ? ResolveFlagsResponse.fromJSON(object.response) : void 0,
|
|
1111
990
|
updates: globalThis.Array.isArray(object?.updates) ? object.updates.map((e) => ResolveWithStickyResponse_MaterializationUpdate.fromJSON(e)) : []
|
|
1112
991
|
};
|
|
1113
992
|
},
|
|
@@ -1210,9 +1089,9 @@ const ResolveWithStickyResponse_MissingMaterializationItem = {
|
|
|
1210
1089
|
},
|
|
1211
1090
|
fromJSON(object) {
|
|
1212
1091
|
return {
|
|
1213
|
-
unit: isSet
|
|
1214
|
-
rule: isSet
|
|
1215
|
-
readMaterialization: isSet
|
|
1092
|
+
unit: isSet(object.unit) ? globalThis.String(object.unit) : "",
|
|
1093
|
+
rule: isSet(object.rule) ? globalThis.String(object.rule) : "",
|
|
1094
|
+
readMaterialization: isSet(object.readMaterialization) ? globalThis.String(object.readMaterialization) : ""
|
|
1216
1095
|
};
|
|
1217
1096
|
},
|
|
1218
1097
|
toJSON(message) {
|
|
@@ -1280,10 +1159,10 @@ const ResolveWithStickyResponse_MaterializationUpdate = {
|
|
|
1280
1159
|
},
|
|
1281
1160
|
fromJSON(object) {
|
|
1282
1161
|
return {
|
|
1283
|
-
unit: isSet
|
|
1284
|
-
writeMaterialization: isSet
|
|
1285
|
-
rule: isSet
|
|
1286
|
-
variant: isSet
|
|
1162
|
+
unit: isSet(object.unit) ? globalThis.String(object.unit) : "",
|
|
1163
|
+
writeMaterialization: isSet(object.writeMaterialization) ? globalThis.String(object.writeMaterialization) : "",
|
|
1164
|
+
rule: isSet(object.rule) ? globalThis.String(object.rule) : "",
|
|
1165
|
+
variant: isSet(object.variant) ? globalThis.String(object.variant) : ""
|
|
1287
1166
|
};
|
|
1288
1167
|
},
|
|
1289
1168
|
toJSON(message) {
|
|
@@ -1306,7 +1185,7 @@ const ResolveWithStickyResponse_MaterializationUpdate = {
|
|
|
1306
1185
|
return message;
|
|
1307
1186
|
}
|
|
1308
1187
|
};
|
|
1309
|
-
function bytesFromBase64
|
|
1188
|
+
function bytesFromBase64(b64) {
|
|
1310
1189
|
if (globalThis.Buffer) return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
1311
1190
|
else {
|
|
1312
1191
|
const bin = globalThis.atob(b64);
|
|
@@ -1315,7 +1194,7 @@ function bytesFromBase64$1(b64) {
|
|
|
1315
1194
|
return arr;
|
|
1316
1195
|
}
|
|
1317
1196
|
}
|
|
1318
|
-
function base64FromBytes
|
|
1197
|
+
function base64FromBytes(arr) {
|
|
1319
1198
|
if (globalThis.Buffer) return globalThis.Buffer.from(arr).toString("base64");
|
|
1320
1199
|
else {
|
|
1321
1200
|
const bin = [];
|
|
@@ -1328,10 +1207,11 @@ function base64FromBytes$1(arr) {
|
|
|
1328
1207
|
function isObject(value) {
|
|
1329
1208
|
return typeof value === "object" && value !== null;
|
|
1330
1209
|
}
|
|
1331
|
-
function isSet
|
|
1210
|
+
function isSet(value) {
|
|
1332
1211
|
return value !== null && value !== void 0;
|
|
1333
1212
|
}
|
|
1334
|
-
const
|
|
1213
|
+
const VERSION = "0.3.0";
|
|
1214
|
+
const NOOP_LOG_FN = Object.assign(() => {}, { enabled: false });
|
|
1335
1215
|
const debugBackend = loadDebug();
|
|
1336
1216
|
const logger$1 = new class LoggerImpl {
|
|
1337
1217
|
childLoggers = /* @__PURE__ */ new Map();
|
|
@@ -1343,8 +1223,8 @@ const logger$1 = new class LoggerImpl {
|
|
|
1343
1223
|
this.name = name;
|
|
1344
1224
|
this.configure();
|
|
1345
1225
|
}
|
|
1346
|
-
async configure() {
|
|
1347
|
-
const debug = await
|
|
1226
|
+
async configure(backend = debugBackend) {
|
|
1227
|
+
const debug = await backend;
|
|
1348
1228
|
if (!debug) return;
|
|
1349
1229
|
const debugFn = this.debug = (debug(this.name + ":debug"));
|
|
1350
1230
|
const infoFn = this.info = (debug(this.name + ":info"));
|
|
@@ -1454,9 +1334,6 @@ function promiseSignal(signal) {
|
|
|
1454
1334
|
}, { once: true });
|
|
1455
1335
|
});
|
|
1456
1336
|
}
|
|
1457
|
-
function abortablePromise(promise, signal) {
|
|
1458
|
-
return signal ? Promise.race([promise, promiseSignal(signal)]) : promise;
|
|
1459
|
-
}
|
|
1460
1337
|
const logger$2 = logger$1.getLogger("fetch");
|
|
1461
1338
|
let Fetch;
|
|
1462
1339
|
(function(_Fetch) {
|
|
@@ -1553,54 +1430,6 @@ function withRetry(opts) {
|
|
|
1553
1430
|
return doTry();
|
|
1554
1431
|
};
|
|
1555
1432
|
}
|
|
1556
|
-
function withAuth(tokenProvider, signal) {
|
|
1557
|
-
let renewTimeout = 0;
|
|
1558
|
-
let current = null;
|
|
1559
|
-
signal?.addEventListener("abort", () => {
|
|
1560
|
-
clearTimeout(renewTimeout);
|
|
1561
|
-
});
|
|
1562
|
-
const renewToken = () => {
|
|
1563
|
-
logger$2.debug("withAuth renewing token");
|
|
1564
|
-
clearTimeout(renewTimeout);
|
|
1565
|
-
current = tokenProvider().then(([token, expiry]) => {
|
|
1566
|
-
logger$2.debug("withAuth renew success %s", expiry && expiry.valueOf() - Date.now());
|
|
1567
|
-
if (expiry) {
|
|
1568
|
-
const ttl = expiry.valueOf() - Date.now();
|
|
1569
|
-
renewTimeout = portableSetTimeout(renewToken, .8 * ttl);
|
|
1570
|
-
}
|
|
1571
|
-
return token;
|
|
1572
|
-
}).catch((e) => {
|
|
1573
|
-
current = null;
|
|
1574
|
-
throw e;
|
|
1575
|
-
});
|
|
1576
|
-
};
|
|
1577
|
-
const fetchWithToken = async (fetch$1, url, init) => {
|
|
1578
|
-
const token = await abortablePromise(current, init.signal);
|
|
1579
|
-
const headers = new Headers(init.headers);
|
|
1580
|
-
headers.set("Authorization", `Bearer ${token}`);
|
|
1581
|
-
return fetch$1(url, {
|
|
1582
|
-
...init,
|
|
1583
|
-
headers
|
|
1584
|
-
});
|
|
1585
|
-
};
|
|
1586
|
-
return (next) => async (url, init = {}) => {
|
|
1587
|
-
const bodyClone = await bodyRepeater(init.body);
|
|
1588
|
-
if (!current) renewToken();
|
|
1589
|
-
const currentBeforeFetch = current;
|
|
1590
|
-
let resp = await fetchWithToken(next, url, {
|
|
1591
|
-
...init,
|
|
1592
|
-
body: bodyClone()
|
|
1593
|
-
});
|
|
1594
|
-
if (resp.status === 401) {
|
|
1595
|
-
if (current === currentBeforeFetch) renewToken();
|
|
1596
|
-
resp = await fetchWithToken(next, url, {
|
|
1597
|
-
...init,
|
|
1598
|
-
body: bodyClone()
|
|
1599
|
-
});
|
|
1600
|
-
}
|
|
1601
|
-
return resp;
|
|
1602
|
-
};
|
|
1603
|
-
}
|
|
1604
1433
|
function withRouter(routes) {
|
|
1605
1434
|
const hasOnlyOneStar = (s) => s.split("*").length - 1 === 1;
|
|
1606
1435
|
const compile = (pattern) => {
|
|
@@ -1674,6 +1503,11 @@ function timeoutSignal$1(delay, signal) {
|
|
|
1674
1503
|
portableSetTimeout(() => ac.abort(/* @__PURE__ */ new Error(`Operation timed out after ${delay}ms`)), delay);
|
|
1675
1504
|
return signal ? AbortSignal.any([signal, ac.signal]) : ac.signal;
|
|
1676
1505
|
}
|
|
1506
|
+
async function sha256Hex(input) {
|
|
1507
|
+
const data = new TextEncoder().encode(input);
|
|
1508
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
1509
|
+
return Array.from(new Uint8Array(hashBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1510
|
+
}
|
|
1677
1511
|
const DEFAULT_STATE_INTERVAL = 3e4;
|
|
1678
1512
|
const DEFAULT_FLUSH_INTERVAL = 1e4;
|
|
1679
1513
|
var ConfidenceServerProviderLocal = class ConfidenceServerProviderLocal {
|
|
@@ -1687,29 +1521,18 @@ var ConfidenceServerProviderLocal = class ConfidenceServerProviderLocal {
|
|
|
1687
1521
|
this.resolver = resolver$1;
|
|
1688
1522
|
this.options = options;
|
|
1689
1523
|
this.flushInterval = options.flushInterval ?? DEFAULT_FLUSH_INTERVAL;
|
|
1690
|
-
const withConfidenceAuth = withAuth(async () => {
|
|
1691
|
-
const { accessToken, expiresIn } = await this.fetchToken();
|
|
1692
|
-
return [accessToken, new Date(Date.now() + 1e3 * expiresIn)];
|
|
1693
|
-
}, this.main.signal);
|
|
1694
|
-
const withFastRetry = FetchMiddleware.compose(withRetry({
|
|
1695
|
-
maxAttempts: Infinity,
|
|
1696
|
-
baseInterval: 300,
|
|
1697
|
-
maxInterval: 5 * TimeUnit.SECOND
|
|
1698
|
-
}), withTimeout(5 * TimeUnit.SECOND));
|
|
1699
1524
|
this.fetch = Fetch.create([withRouter({
|
|
1700
|
-
"https://
|
|
1701
|
-
"https://storage.googleapis.com/*": [withRetry({
|
|
1525
|
+
"https://confidence-resolver-state-cdn.spotifycdn.com/*": [withRetry({
|
|
1702
1526
|
maxAttempts: Infinity,
|
|
1703
1527
|
baseInterval: 500,
|
|
1704
1528
|
maxInterval: DEFAULT_STATE_INTERVAL
|
|
1705
1529
|
}), withStallTimeout(500)],
|
|
1706
|
-
"https://
|
|
1707
|
-
"*/v1/resolverState:resolverStateUri": [withFastRetry],
|
|
1530
|
+
"https://resolver.confidence.dev/*": [withRouter({
|
|
1708
1531
|
"*/v1/flags:resolve": [withRetry({
|
|
1709
1532
|
maxAttempts: 3,
|
|
1710
1533
|
baseInterval: 100
|
|
1711
1534
|
}), withTimeout(3 * TimeUnit.SECOND)],
|
|
1712
|
-
"*/v1/
|
|
1535
|
+
"*/v1/clientFlagLogs:write": [withRetry({
|
|
1713
1536
|
maxAttempts: 3,
|
|
1714
1537
|
baseInterval: 500
|
|
1715
1538
|
}), withTimeout(5 * TimeUnit.SECOND)]
|
|
@@ -1746,7 +1569,11 @@ var ConfidenceServerProviderLocal = class ConfidenceServerProviderLocal {
|
|
|
1746
1569
|
flags: [`flags/${flagName}`],
|
|
1747
1570
|
evaluationContext: ConfidenceServerProviderLocal.convertEvaluationContext(context),
|
|
1748
1571
|
apply: true,
|
|
1749
|
-
clientSecret: this.options.flagClientSecret
|
|
1572
|
+
clientSecret: this.options.flagClientSecret,
|
|
1573
|
+
sdk: {
|
|
1574
|
+
id: SdkId.SDK_ID_JS_LOCAL_SERVER_PROVIDER,
|
|
1575
|
+
version: VERSION
|
|
1576
|
+
}
|
|
1750
1577
|
},
|
|
1751
1578
|
materializationsPerUnit: {},
|
|
1752
1579
|
failFastOnSticky: true
|
|
@@ -1804,49 +1631,33 @@ var ConfidenceServerProviderLocal = class ConfidenceServerProviderLocal {
|
|
|
1804
1631
|
};
|
|
1805
1632
|
}
|
|
1806
1633
|
async updateState(signal) {
|
|
1807
|
-
const
|
|
1634
|
+
const cdnUrl = `https://confidence-resolver-state-cdn.spotifycdn.com/${await sha256Hex(this.options.flagClientSecret)}`;
|
|
1808
1635
|
const headers = new Headers();
|
|
1809
1636
|
if (this.stateEtag) headers.set("If-None-Match", this.stateEtag);
|
|
1810
|
-
const resp = await this.fetch(
|
|
1637
|
+
const resp = await this.fetch(cdnUrl, {
|
|
1811
1638
|
headers,
|
|
1812
1639
|
signal
|
|
1813
1640
|
});
|
|
1814
1641
|
if (resp.status === 304) return;
|
|
1815
1642
|
if (!resp.ok) throw new Error(`Failed to fetch state: ${resp.status} ${resp.statusText}`);
|
|
1816
1643
|
this.stateEtag = resp.headers.get("etag");
|
|
1817
|
-
const
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
state
|
|
1821
|
-
});
|
|
1644
|
+
const bytes = new Uint8Array(await resp.arrayBuffer());
|
|
1645
|
+
const { SetResolverStateRequest: SetResolverStateRequest$1 } = await import("./messages-CvypvyG4.js");
|
|
1646
|
+
this.resolver.setResolverState(SetResolverStateRequest$1.decode(bytes));
|
|
1822
1647
|
}
|
|
1823
1648
|
async flush(signal) {
|
|
1824
1649
|
const writeFlagLogRequest = this.resolver.flushLogs();
|
|
1825
1650
|
if (writeFlagLogRequest.length == 0) return;
|
|
1826
|
-
await this.fetch("https://resolver.confidence.dev/v1/
|
|
1651
|
+
const response = await this.fetch("https://resolver.confidence.dev/v1/clientFlagLogs:write", {
|
|
1827
1652
|
method: "post",
|
|
1828
1653
|
signal,
|
|
1829
|
-
headers: {
|
|
1654
|
+
headers: {
|
|
1655
|
+
"Content-Type": "application/x-protobuf",
|
|
1656
|
+
Authorization: `ClientSecret ${this.options.flagClientSecret}`
|
|
1657
|
+
},
|
|
1830
1658
|
body: writeFlagLogRequest
|
|
1831
1659
|
});
|
|
1832
|
-
|
|
1833
|
-
async fetchResolveStateUri(signal) {
|
|
1834
|
-
const resp = await this.fetch("https://flags.confidence.dev/v1/resolverState:resolverStateUri", { signal });
|
|
1835
|
-
if (!resp.ok) throw new Error("Failed to get resolve state url");
|
|
1836
|
-
return resp.json();
|
|
1837
|
-
}
|
|
1838
|
-
async fetchToken() {
|
|
1839
|
-
const resp = await this.fetch("https://iam.confidence.dev/v1/oauth/token", {
|
|
1840
|
-
method: "POST",
|
|
1841
|
-
headers: { "Content-Type": "application/json" },
|
|
1842
|
-
body: JSON.stringify({
|
|
1843
|
-
clientId: this.options.apiClientId,
|
|
1844
|
-
clientSecret: this.options.apiClientSecret,
|
|
1845
|
-
grantType: "client_credentials"
|
|
1846
|
-
})
|
|
1847
|
-
});
|
|
1848
|
-
if (!resp.ok) throw new Error("Failed to fetch access token");
|
|
1849
|
-
return resp.json();
|
|
1660
|
+
if (!response.ok) logger$1.error(`Failed to write flag logs: ${response.status} ${response.statusText} - ${await response.text()}`);
|
|
1850
1661
|
}
|
|
1851
1662
|
static convertReason(reason) {
|
|
1852
1663
|
switch (reason) {
|
|
@@ -1897,221 +1708,6 @@ function isAssignableTo(value, schema) {
|
|
|
1897
1708
|
}
|
|
1898
1709
|
return true;
|
|
1899
1710
|
}
|
|
1900
|
-
function createBaseVoid() {
|
|
1901
|
-
return {};
|
|
1902
|
-
}
|
|
1903
|
-
const Void = {
|
|
1904
|
-
encode(_, writer = new BinaryWriter()) {
|
|
1905
|
-
return writer;
|
|
1906
|
-
},
|
|
1907
|
-
decode(input, length) {
|
|
1908
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1909
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1910
|
-
const message = createBaseVoid();
|
|
1911
|
-
while (reader.pos < end) {
|
|
1912
|
-
const tag = reader.uint32();
|
|
1913
|
-
switch (tag >>> 3) {}
|
|
1914
|
-
if ((tag & 7) === 4 || tag === 0) break;
|
|
1915
|
-
reader.skip(tag & 7);
|
|
1916
|
-
}
|
|
1917
|
-
return message;
|
|
1918
|
-
},
|
|
1919
|
-
fromJSON(_) {
|
|
1920
|
-
return {};
|
|
1921
|
-
},
|
|
1922
|
-
toJSON(_) {
|
|
1923
|
-
return {};
|
|
1924
|
-
},
|
|
1925
|
-
create(base) {
|
|
1926
|
-
return Void.fromPartial(base ?? {});
|
|
1927
|
-
},
|
|
1928
|
-
fromPartial(_) {
|
|
1929
|
-
return createBaseVoid();
|
|
1930
|
-
}
|
|
1931
|
-
};
|
|
1932
|
-
function createBaseRequest() {
|
|
1933
|
-
return { data: new Uint8Array(0) };
|
|
1934
|
-
}
|
|
1935
|
-
const Request = {
|
|
1936
|
-
encode(message, writer = new BinaryWriter()) {
|
|
1937
|
-
if (message.data.length !== 0) writer.uint32(10).bytes(message.data);
|
|
1938
|
-
return writer;
|
|
1939
|
-
},
|
|
1940
|
-
decode(input, length) {
|
|
1941
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1942
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1943
|
-
const message = createBaseRequest();
|
|
1944
|
-
while (reader.pos < end) {
|
|
1945
|
-
const tag = reader.uint32();
|
|
1946
|
-
switch (tag >>> 3) {
|
|
1947
|
-
case 1:
|
|
1948
|
-
if (tag !== 10) break;
|
|
1949
|
-
message.data = reader.bytes();
|
|
1950
|
-
continue;
|
|
1951
|
-
}
|
|
1952
|
-
if ((tag & 7) === 4 || tag === 0) break;
|
|
1953
|
-
reader.skip(tag & 7);
|
|
1954
|
-
}
|
|
1955
|
-
return message;
|
|
1956
|
-
},
|
|
1957
|
-
fromJSON(object) {
|
|
1958
|
-
return { data: isSet$1(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0) };
|
|
1959
|
-
},
|
|
1960
|
-
toJSON(message) {
|
|
1961
|
-
const obj = {};
|
|
1962
|
-
if (message.data.length !== 0) obj.data = base64FromBytes(message.data);
|
|
1963
|
-
return obj;
|
|
1964
|
-
},
|
|
1965
|
-
create(base) {
|
|
1966
|
-
return Request.fromPartial(base ?? {});
|
|
1967
|
-
},
|
|
1968
|
-
fromPartial(object) {
|
|
1969
|
-
const message = createBaseRequest();
|
|
1970
|
-
message.data = object.data ?? new Uint8Array(0);
|
|
1971
|
-
return message;
|
|
1972
|
-
}
|
|
1973
|
-
};
|
|
1974
|
-
function createBaseResponse() {
|
|
1975
|
-
return {
|
|
1976
|
-
data: void 0,
|
|
1977
|
-
error: void 0
|
|
1978
|
-
};
|
|
1979
|
-
}
|
|
1980
|
-
const Response$1 = {
|
|
1981
|
-
encode(message, writer = new BinaryWriter()) {
|
|
1982
|
-
if (message.data !== void 0) writer.uint32(10).bytes(message.data);
|
|
1983
|
-
if (message.error !== void 0) writer.uint32(18).string(message.error);
|
|
1984
|
-
return writer;
|
|
1985
|
-
},
|
|
1986
|
-
decode(input, length) {
|
|
1987
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1988
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1989
|
-
const message = createBaseResponse();
|
|
1990
|
-
while (reader.pos < end) {
|
|
1991
|
-
const tag = reader.uint32();
|
|
1992
|
-
switch (tag >>> 3) {
|
|
1993
|
-
case 1:
|
|
1994
|
-
if (tag !== 10) break;
|
|
1995
|
-
message.data = reader.bytes();
|
|
1996
|
-
continue;
|
|
1997
|
-
case 2:
|
|
1998
|
-
if (tag !== 18) break;
|
|
1999
|
-
message.error = reader.string();
|
|
2000
|
-
continue;
|
|
2001
|
-
}
|
|
2002
|
-
if ((tag & 7) === 4 || tag === 0) break;
|
|
2003
|
-
reader.skip(tag & 7);
|
|
2004
|
-
}
|
|
2005
|
-
return message;
|
|
2006
|
-
},
|
|
2007
|
-
fromJSON(object) {
|
|
2008
|
-
return {
|
|
2009
|
-
data: isSet$1(object.data) ? bytesFromBase64(object.data) : void 0,
|
|
2010
|
-
error: isSet$1(object.error) ? globalThis.String(object.error) : void 0
|
|
2011
|
-
};
|
|
2012
|
-
},
|
|
2013
|
-
toJSON(message) {
|
|
2014
|
-
const obj = {};
|
|
2015
|
-
if (message.data !== void 0) obj.data = base64FromBytes(message.data);
|
|
2016
|
-
if (message.error !== void 0) obj.error = message.error;
|
|
2017
|
-
return obj;
|
|
2018
|
-
},
|
|
2019
|
-
create(base) {
|
|
2020
|
-
return Response$1.fromPartial(base ?? {});
|
|
2021
|
-
},
|
|
2022
|
-
fromPartial(object) {
|
|
2023
|
-
const message = createBaseResponse();
|
|
2024
|
-
message.data = object.data ?? void 0;
|
|
2025
|
-
message.error = object.error ?? void 0;
|
|
2026
|
-
return message;
|
|
2027
|
-
}
|
|
2028
|
-
};
|
|
2029
|
-
function bytesFromBase64(b64) {
|
|
2030
|
-
if (globalThis.Buffer) return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
2031
|
-
else {
|
|
2032
|
-
const bin = globalThis.atob(b64);
|
|
2033
|
-
const arr = new Uint8Array(bin.length);
|
|
2034
|
-
for (let i = 0; i < bin.length; ++i) arr[i] = bin.charCodeAt(i);
|
|
2035
|
-
return arr;
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
function base64FromBytes(arr) {
|
|
2039
|
-
if (globalThis.Buffer) return globalThis.Buffer.from(arr).toString("base64");
|
|
2040
|
-
else {
|
|
2041
|
-
const bin = [];
|
|
2042
|
-
arr.forEach((byte) => {
|
|
2043
|
-
bin.push(globalThis.String.fromCharCode(byte));
|
|
2044
|
-
});
|
|
2045
|
-
return globalThis.btoa(bin.join(""));
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
function isSet$1(value) {
|
|
2049
|
-
return value !== null && value !== void 0;
|
|
2050
|
-
}
|
|
2051
|
-
function createBaseTimestamp() {
|
|
2052
|
-
return {
|
|
2053
|
-
seconds: 0,
|
|
2054
|
-
nanos: 0
|
|
2055
|
-
};
|
|
2056
|
-
}
|
|
2057
|
-
const Timestamp = {
|
|
2058
|
-
encode(message, writer = new BinaryWriter()) {
|
|
2059
|
-
if (message.seconds !== 0) writer.uint32(8).int64(message.seconds);
|
|
2060
|
-
if (message.nanos !== 0) writer.uint32(16).int32(message.nanos);
|
|
2061
|
-
return writer;
|
|
2062
|
-
},
|
|
2063
|
-
decode(input, length) {
|
|
2064
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2065
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2066
|
-
const message = createBaseTimestamp();
|
|
2067
|
-
while (reader.pos < end) {
|
|
2068
|
-
const tag = reader.uint32();
|
|
2069
|
-
switch (tag >>> 3) {
|
|
2070
|
-
case 1:
|
|
2071
|
-
if (tag !== 8) break;
|
|
2072
|
-
message.seconds = longToNumber(reader.int64());
|
|
2073
|
-
continue;
|
|
2074
|
-
case 2:
|
|
2075
|
-
if (tag !== 16) break;
|
|
2076
|
-
message.nanos = reader.int32();
|
|
2077
|
-
continue;
|
|
2078
|
-
}
|
|
2079
|
-
if ((tag & 7) === 4 || tag === 0) break;
|
|
2080
|
-
reader.skip(tag & 7);
|
|
2081
|
-
}
|
|
2082
|
-
return message;
|
|
2083
|
-
},
|
|
2084
|
-
fromJSON(object) {
|
|
2085
|
-
return {
|
|
2086
|
-
seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
|
|
2087
|
-
nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0
|
|
2088
|
-
};
|
|
2089
|
-
},
|
|
2090
|
-
toJSON(message) {
|
|
2091
|
-
const obj = {};
|
|
2092
|
-
if (message.seconds !== 0) obj.seconds = Math.round(message.seconds);
|
|
2093
|
-
if (message.nanos !== 0) obj.nanos = Math.round(message.nanos);
|
|
2094
|
-
return obj;
|
|
2095
|
-
},
|
|
2096
|
-
create(base) {
|
|
2097
|
-
return Timestamp.fromPartial(base ?? {});
|
|
2098
|
-
},
|
|
2099
|
-
fromPartial(object) {
|
|
2100
|
-
const message = createBaseTimestamp();
|
|
2101
|
-
message.seconds = object.seconds ?? 0;
|
|
2102
|
-
message.nanos = object.nanos ?? 0;
|
|
2103
|
-
return message;
|
|
2104
|
-
}
|
|
2105
|
-
};
|
|
2106
|
-
function longToNumber(int64) {
|
|
2107
|
-
const num = globalThis.Number(int64.toString());
|
|
2108
|
-
if (num > globalThis.Number.MAX_SAFE_INTEGER) throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
2109
|
-
if (num < globalThis.Number.MIN_SAFE_INTEGER) throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
2110
|
-
return num;
|
|
2111
|
-
}
|
|
2112
|
-
function isSet(value) {
|
|
2113
|
-
return value !== null && value !== void 0;
|
|
2114
|
-
}
|
|
2115
1711
|
const logger = getLogger("wasm-resolver");
|
|
2116
1712
|
const EXPORT_FN_NAMES = [
|
|
2117
1713
|
"wasm_msg_alloc",
|