@0xsequence/userdata 3.0.0-beta.9 → 3.0.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/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +5 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +81 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -21
- package/dist/userdata.gen.d.ts +363 -6
- package/dist/userdata.gen.d.ts.map +1 -1
- package/dist/userdata.gen.js +360 -81
- package/eslint.config.js +4 -0
- package/package.json +8 -5
- package/src/index.ts +3 -3
- package/src/userdata.gen.ts +1050 -7
package/dist/userdata.gen.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* eslint-disable */
|
|
3
|
-
// userdata v0.1.0
|
|
2
|
+
// userdata v0.1.0 88764bb5f99353e11d849a1aa8f8a998501ffedb
|
|
4
3
|
// --
|
|
5
4
|
// Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT.
|
|
6
5
|
//
|
|
7
6
|
// webrpc-gen -schema=userdata.ridl -target=typescript -client -out=./clients/userdata.gen.ts
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.WebrpcHeaderValue = exports.WebrpcHeader = exports.webrpcErrorByCode = exports.WebrpcErrorCodes = exports.errors = exports.UnsupportedNetworkError = exports.NotFoundError = exports.QueryFailedError = exports.UnavailableError = exports.InvalidArgumentError = exports.ProjectNotFoundError = exports.RateLimitedError = exports.GeoblockedError = exports.AbortedError = exports.RequestConflictError = exports.MethodNotFoundError = exports.SessionExpiredError = exports.PermissionDeniedError = exports.UnauthorizedError = exports.WebrpcStreamFinishedError = exports.WebrpcStreamLostError = exports.WebrpcClientAbortedError = exports.WebrpcInternalErrorError = exports.WebrpcServerPanicError = exports.WebrpcBadResponseError = exports.WebrpcBadRequestError = exports.WebrpcBadMethodError = exports.WebrpcBadRouteError = exports.WebrpcRequestFailedError = exports.WebrpcEndpointError = exports.WebrpcError = exports.JsonDecode = exports.JsonEncode = exports.UserData = exports.WebrpcSchemaHash = exports.WebrpcSchemaVersion = exports.WebrpcVersion = void 0;
|
|
10
|
-
exports.VersionFromHeader = VersionFromHeader;
|
|
11
7
|
// Webrpc description and code-gen version
|
|
12
|
-
|
|
8
|
+
export const WebrpcVersion = 'v1';
|
|
13
9
|
// Schema version of your RIDL schema
|
|
14
|
-
|
|
10
|
+
export const WebrpcSchemaVersion = 'v0.1.0';
|
|
15
11
|
// Schema hash generated from your RIDL schema
|
|
16
|
-
|
|
12
|
+
export const WebrpcSchemaHash = '88764bb5f99353e11d849a1aa8f8a998501ffedb';
|
|
17
13
|
//
|
|
18
14
|
// Client
|
|
19
15
|
//
|
|
20
|
-
class UserData {
|
|
16
|
+
export class UserData {
|
|
21
17
|
hostname;
|
|
22
18
|
fetch;
|
|
23
19
|
path = '/rpc/UserData/';
|
|
@@ -32,11 +28,37 @@ class UserData {
|
|
|
32
28
|
getCapabilities: () => ['UserData', 'getCapabilities'],
|
|
33
29
|
getAccessToken: (req) => ['UserData', 'getAccessToken', req],
|
|
34
30
|
getIdentityToken: (req) => ['UserData', 'getIdentityToken', req],
|
|
31
|
+
getWalletPreferences: (req) => ['UserData', 'getWalletPreferences', req],
|
|
32
|
+
putWalletPreferences: (req) => ['UserData', 'putWalletPreferences', req],
|
|
33
|
+
listWalletSigners: (req) => ['UserData', 'listWalletSigners', req],
|
|
34
|
+
putWalletSigner: (req) => ['UserData', 'putWalletSigner', req],
|
|
35
|
+
deleteWalletSigner: (req) => ['UserData', 'deleteWalletSigner', req],
|
|
36
|
+
listSessions: (req) => ['UserData', 'listSessions', req],
|
|
37
|
+
putSession: (req) => ['UserData', 'putSession', req],
|
|
38
|
+
deleteSession: (req) => ['UserData', 'deleteSession', req],
|
|
39
|
+
listContacts: (req) => ['UserData', 'listContacts', req],
|
|
40
|
+
putContact: (req) => ['UserData', 'putContact', req],
|
|
41
|
+
deleteContact: (req) => ['UserData', 'deleteContact', req],
|
|
42
|
+
listWatchedWallets: (req) => ['UserData', 'listWatchedWallets', req],
|
|
43
|
+
putWatchedWallet: (req) => ['UserData', 'putWatchedWallet', req],
|
|
44
|
+
deleteWatchedWallet: (req) => ['UserData', 'deleteWatchedWallet', req],
|
|
45
|
+
listDiscoverFavorites: (req) => ['UserData', 'listDiscoverFavorites', req],
|
|
46
|
+
putDiscoverFavorite: (req) => ['UserData', 'putDiscoverFavorite', req],
|
|
47
|
+
deleteDiscoverFavorite: (req) => ['UserData', 'deleteDiscoverFavorite', req],
|
|
48
|
+
listDiscoverHistory: (req) => ['UserData', 'listDiscoverHistory', req],
|
|
49
|
+
putDiscoverHistory: (req) => ['UserData', 'putDiscoverHistory', req],
|
|
50
|
+
deleteDiscoverHistory: (req) => ['UserData', 'deleteDiscoverHistory', req],
|
|
51
|
+
listTokenFavorites: (req) => ['UserData', 'listTokenFavorites', req],
|
|
52
|
+
putTokenFavorite: (req) => ['UserData', 'putTokenFavorite', req],
|
|
53
|
+
deleteTokenFavorite: (req) => ['UserData', 'deleteTokenFavorite', req],
|
|
54
|
+
listHiddenTokens: (req) => ['UserData', 'listHiddenTokens', req],
|
|
55
|
+
putHiddenToken: (req) => ['UserData', 'putHiddenToken', req],
|
|
56
|
+
deleteHiddenToken: (req) => ['UserData', 'deleteHiddenToken', req],
|
|
35
57
|
};
|
|
36
58
|
getCapabilities = (headers, signal) => {
|
|
37
59
|
return this.fetch(this.url('GetCapabilities'), createHttpRequest('{}', headers, signal)).then((res) => {
|
|
38
60
|
return buildResponse(res).then((_data) => {
|
|
39
|
-
return
|
|
61
|
+
return JsonDecode(_data, 'GetCapabilitiesResponse');
|
|
40
62
|
});
|
|
41
63
|
}, (error) => {
|
|
42
64
|
throw WebrpcRequestFailedError.new({
|
|
@@ -45,9 +67,9 @@ class UserData {
|
|
|
45
67
|
});
|
|
46
68
|
};
|
|
47
69
|
getAccessToken = (req, headers, signal) => {
|
|
48
|
-
return this.fetch(this.url('GetAccessToken'), createHttpRequest(
|
|
70
|
+
return this.fetch(this.url('GetAccessToken'), createHttpRequest(JsonEncode(req, 'GetAccessTokenRequest'), headers, signal)).then((res) => {
|
|
49
71
|
return buildResponse(res).then((_data) => {
|
|
50
|
-
return
|
|
72
|
+
return JsonDecode(_data, 'GetAccessTokenResponse');
|
|
51
73
|
});
|
|
52
74
|
}, (error) => {
|
|
53
75
|
throw WebrpcRequestFailedError.new({
|
|
@@ -56,9 +78,295 @@ class UserData {
|
|
|
56
78
|
});
|
|
57
79
|
};
|
|
58
80
|
getIdentityToken = (req, headers, signal) => {
|
|
59
|
-
return this.fetch(this.url('GetIdentityToken'), createHttpRequest(
|
|
81
|
+
return this.fetch(this.url('GetIdentityToken'), createHttpRequest(JsonEncode(req, 'GetIdentityTokenRequest'), headers, signal)).then((res) => {
|
|
60
82
|
return buildResponse(res).then((_data) => {
|
|
61
|
-
return
|
|
83
|
+
return JsonDecode(_data, 'GetIdentityTokenResponse');
|
|
84
|
+
});
|
|
85
|
+
}, (error) => {
|
|
86
|
+
throw WebrpcRequestFailedError.new({
|
|
87
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
getWalletPreferences = (req, headers, signal) => {
|
|
92
|
+
return this.fetch(this.url('GetWalletPreferences'), createHttpRequest(JsonEncode(req, 'GetWalletPreferencesRequest'), headers, signal)).then((res) => {
|
|
93
|
+
return buildResponse(res).then((_data) => {
|
|
94
|
+
return JsonDecode(_data, 'GetWalletPreferencesResponse');
|
|
95
|
+
});
|
|
96
|
+
}, (error) => {
|
|
97
|
+
throw WebrpcRequestFailedError.new({
|
|
98
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
putWalletPreferences = (req, headers, signal) => {
|
|
103
|
+
return this.fetch(this.url('PutWalletPreferences'), createHttpRequest(JsonEncode(req, 'PutWalletPreferencesRequest'), headers, signal)).then((res) => {
|
|
104
|
+
return buildResponse(res).then((_data) => {
|
|
105
|
+
return JsonDecode(_data, 'PutWalletPreferencesResponse');
|
|
106
|
+
});
|
|
107
|
+
}, (error) => {
|
|
108
|
+
throw WebrpcRequestFailedError.new({
|
|
109
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
listWalletSigners = (req, headers, signal) => {
|
|
114
|
+
return this.fetch(this.url('ListWalletSigners'), createHttpRequest(JsonEncode(req, 'ListWalletSignersRequest'), headers, signal)).then((res) => {
|
|
115
|
+
return buildResponse(res).then((_data) => {
|
|
116
|
+
return JsonDecode(_data, 'ListWalletSignersResponse');
|
|
117
|
+
});
|
|
118
|
+
}, (error) => {
|
|
119
|
+
throw WebrpcRequestFailedError.new({
|
|
120
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
putWalletSigner = (req, headers, signal) => {
|
|
125
|
+
return this.fetch(this.url('PutWalletSigner'), createHttpRequest(JsonEncode(req, 'PutWalletSignerRequest'), headers, signal)).then((res) => {
|
|
126
|
+
return buildResponse(res).then((_data) => {
|
|
127
|
+
return JsonDecode(_data, 'PutWalletSignerResponse');
|
|
128
|
+
});
|
|
129
|
+
}, (error) => {
|
|
130
|
+
throw WebrpcRequestFailedError.new({
|
|
131
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
deleteWalletSigner = (req, headers, signal) => {
|
|
136
|
+
return this.fetch(this.url('DeleteWalletSigner'), createHttpRequest(JsonEncode(req, 'DeleteWalletSignerRequest'), headers, signal)).then((res) => {
|
|
137
|
+
return buildResponse(res).then((_data) => {
|
|
138
|
+
return JsonDecode(_data, 'DeleteWalletSignerResponse');
|
|
139
|
+
});
|
|
140
|
+
}, (error) => {
|
|
141
|
+
throw WebrpcRequestFailedError.new({
|
|
142
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
listSessions = (req, headers, signal) => {
|
|
147
|
+
return this.fetch(this.url('ListSessions'), createHttpRequest(JsonEncode(req, 'ListSessionsRequest'), headers, signal)).then((res) => {
|
|
148
|
+
return buildResponse(res).then((_data) => {
|
|
149
|
+
return JsonDecode(_data, 'ListSessionsResponse');
|
|
150
|
+
});
|
|
151
|
+
}, (error) => {
|
|
152
|
+
throw WebrpcRequestFailedError.new({
|
|
153
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
putSession = (req, headers, signal) => {
|
|
158
|
+
return this.fetch(this.url('PutSession'), createHttpRequest(JsonEncode(req, 'PutSessionRequest'), headers, signal)).then((res) => {
|
|
159
|
+
return buildResponse(res).then((_data) => {
|
|
160
|
+
return JsonDecode(_data, 'PutSessionResponse');
|
|
161
|
+
});
|
|
162
|
+
}, (error) => {
|
|
163
|
+
throw WebrpcRequestFailedError.new({
|
|
164
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
deleteSession = (req, headers, signal) => {
|
|
169
|
+
return this.fetch(this.url('DeleteSession'), createHttpRequest(JsonEncode(req, 'DeleteSessionRequest'), headers, signal)).then((res) => {
|
|
170
|
+
return buildResponse(res).then((_data) => {
|
|
171
|
+
return JsonDecode(_data, 'DeleteSessionResponse');
|
|
172
|
+
});
|
|
173
|
+
}, (error) => {
|
|
174
|
+
throw WebrpcRequestFailedError.new({
|
|
175
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
listContacts = (req, headers, signal) => {
|
|
180
|
+
return this.fetch(this.url('ListContacts'), createHttpRequest(JsonEncode(req, 'ListContactsRequest'), headers, signal)).then((res) => {
|
|
181
|
+
return buildResponse(res).then((_data) => {
|
|
182
|
+
return JsonDecode(_data, 'ListContactsResponse');
|
|
183
|
+
});
|
|
184
|
+
}, (error) => {
|
|
185
|
+
throw WebrpcRequestFailedError.new({
|
|
186
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
putContact = (req, headers, signal) => {
|
|
191
|
+
return this.fetch(this.url('PutContact'), createHttpRequest(JsonEncode(req, 'PutContactRequest'), headers, signal)).then((res) => {
|
|
192
|
+
return buildResponse(res).then((_data) => {
|
|
193
|
+
return JsonDecode(_data, 'PutContactResponse');
|
|
194
|
+
});
|
|
195
|
+
}, (error) => {
|
|
196
|
+
throw WebrpcRequestFailedError.new({
|
|
197
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
deleteContact = (req, headers, signal) => {
|
|
202
|
+
return this.fetch(this.url('DeleteContact'), createHttpRequest(JsonEncode(req, 'DeleteContactRequest'), headers, signal)).then((res) => {
|
|
203
|
+
return buildResponse(res).then((_data) => {
|
|
204
|
+
return JsonDecode(_data, 'DeleteContactResponse');
|
|
205
|
+
});
|
|
206
|
+
}, (error) => {
|
|
207
|
+
throw WebrpcRequestFailedError.new({
|
|
208
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
listWatchedWallets = (req, headers, signal) => {
|
|
213
|
+
return this.fetch(this.url('ListWatchedWallets'), createHttpRequest(JsonEncode(req, 'ListWatchedWalletsRequest'), headers, signal)).then((res) => {
|
|
214
|
+
return buildResponse(res).then((_data) => {
|
|
215
|
+
return JsonDecode(_data, 'ListWatchedWalletsResponse');
|
|
216
|
+
});
|
|
217
|
+
}, (error) => {
|
|
218
|
+
throw WebrpcRequestFailedError.new({
|
|
219
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
putWatchedWallet = (req, headers, signal) => {
|
|
224
|
+
return this.fetch(this.url('PutWatchedWallet'), createHttpRequest(JsonEncode(req, 'PutWatchedWalletRequest'), headers, signal)).then((res) => {
|
|
225
|
+
return buildResponse(res).then((_data) => {
|
|
226
|
+
return JsonDecode(_data, 'PutWatchedWalletResponse');
|
|
227
|
+
});
|
|
228
|
+
}, (error) => {
|
|
229
|
+
throw WebrpcRequestFailedError.new({
|
|
230
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
deleteWatchedWallet = (req, headers, signal) => {
|
|
235
|
+
return this.fetch(this.url('DeleteWatchedWallet'), createHttpRequest(JsonEncode(req, 'DeleteWatchedWalletRequest'), headers, signal)).then((res) => {
|
|
236
|
+
return buildResponse(res).then((_data) => {
|
|
237
|
+
return JsonDecode(_data, 'DeleteWatchedWalletResponse');
|
|
238
|
+
});
|
|
239
|
+
}, (error) => {
|
|
240
|
+
throw WebrpcRequestFailedError.new({
|
|
241
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
listDiscoverFavorites = (req, headers, signal) => {
|
|
246
|
+
return this.fetch(this.url('ListDiscoverFavorites'), createHttpRequest(JsonEncode(req, 'ListDiscoverFavoritesRequest'), headers, signal)).then((res) => {
|
|
247
|
+
return buildResponse(res).then((_data) => {
|
|
248
|
+
return JsonDecode(_data, 'ListDiscoverFavoritesResponse');
|
|
249
|
+
});
|
|
250
|
+
}, (error) => {
|
|
251
|
+
throw WebrpcRequestFailedError.new({
|
|
252
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
putDiscoverFavorite = (req, headers, signal) => {
|
|
257
|
+
return this.fetch(this.url('PutDiscoverFavorite'), createHttpRequest(JsonEncode(req, 'PutDiscoverFavoriteRequest'), headers, signal)).then((res) => {
|
|
258
|
+
return buildResponse(res).then((_data) => {
|
|
259
|
+
return JsonDecode(_data, 'PutDiscoverFavoriteResponse');
|
|
260
|
+
});
|
|
261
|
+
}, (error) => {
|
|
262
|
+
throw WebrpcRequestFailedError.new({
|
|
263
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
deleteDiscoverFavorite = (req, headers, signal) => {
|
|
268
|
+
return this.fetch(this.url('DeleteDiscoverFavorite'), createHttpRequest(JsonEncode(req, 'DeleteDiscoverFavoriteRequest'), headers, signal)).then((res) => {
|
|
269
|
+
return buildResponse(res).then((_data) => {
|
|
270
|
+
return JsonDecode(_data, 'DeleteDiscoverFavoriteResponse');
|
|
271
|
+
});
|
|
272
|
+
}, (error) => {
|
|
273
|
+
throw WebrpcRequestFailedError.new({
|
|
274
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
listDiscoverHistory = (req, headers, signal) => {
|
|
279
|
+
return this.fetch(this.url('ListDiscoverHistory'), createHttpRequest(JsonEncode(req, 'ListDiscoverHistoryRequest'), headers, signal)).then((res) => {
|
|
280
|
+
return buildResponse(res).then((_data) => {
|
|
281
|
+
return JsonDecode(_data, 'ListDiscoverHistoryResponse');
|
|
282
|
+
});
|
|
283
|
+
}, (error) => {
|
|
284
|
+
throw WebrpcRequestFailedError.new({
|
|
285
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
putDiscoverHistory = (req, headers, signal) => {
|
|
290
|
+
return this.fetch(this.url('PutDiscoverHistory'), createHttpRequest(JsonEncode(req, 'PutDiscoverHistoryRequest'), headers, signal)).then((res) => {
|
|
291
|
+
return buildResponse(res).then((_data) => {
|
|
292
|
+
return JsonDecode(_data, 'PutDiscoverHistoryResponse');
|
|
293
|
+
});
|
|
294
|
+
}, (error) => {
|
|
295
|
+
throw WebrpcRequestFailedError.new({
|
|
296
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
deleteDiscoverHistory = (req, headers, signal) => {
|
|
301
|
+
return this.fetch(this.url('DeleteDiscoverHistory'), createHttpRequest(JsonEncode(req, 'DeleteDiscoverHistoryRequest'), headers, signal)).then((res) => {
|
|
302
|
+
return buildResponse(res).then((_data) => {
|
|
303
|
+
return JsonDecode(_data, 'DeleteDiscoverHistoryResponse');
|
|
304
|
+
});
|
|
305
|
+
}, (error) => {
|
|
306
|
+
throw WebrpcRequestFailedError.new({
|
|
307
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
listTokenFavorites = (req, headers, signal) => {
|
|
312
|
+
return this.fetch(this.url('ListTokenFavorites'), createHttpRequest(JsonEncode(req, 'ListTokenFavoritesRequest'), headers, signal)).then((res) => {
|
|
313
|
+
return buildResponse(res).then((_data) => {
|
|
314
|
+
return JsonDecode(_data, 'ListTokenFavoritesResponse');
|
|
315
|
+
});
|
|
316
|
+
}, (error) => {
|
|
317
|
+
throw WebrpcRequestFailedError.new({
|
|
318
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
putTokenFavorite = (req, headers, signal) => {
|
|
323
|
+
return this.fetch(this.url('PutTokenFavorite'), createHttpRequest(JsonEncode(req, 'PutTokenFavoriteRequest'), headers, signal)).then((res) => {
|
|
324
|
+
return buildResponse(res).then((_data) => {
|
|
325
|
+
return JsonDecode(_data, 'PutTokenFavoriteResponse');
|
|
326
|
+
});
|
|
327
|
+
}, (error) => {
|
|
328
|
+
throw WebrpcRequestFailedError.new({
|
|
329
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
deleteTokenFavorite = (req, headers, signal) => {
|
|
334
|
+
return this.fetch(this.url('DeleteTokenFavorite'), createHttpRequest(JsonEncode(req, 'DeleteTokenFavoriteRequest'), headers, signal)).then((res) => {
|
|
335
|
+
return buildResponse(res).then((_data) => {
|
|
336
|
+
return JsonDecode(_data, 'DeleteTokenFavoriteResponse');
|
|
337
|
+
});
|
|
338
|
+
}, (error) => {
|
|
339
|
+
throw WebrpcRequestFailedError.new({
|
|
340
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
};
|
|
344
|
+
listHiddenTokens = (req, headers, signal) => {
|
|
345
|
+
return this.fetch(this.url('ListHiddenTokens'), createHttpRequest(JsonEncode(req, 'ListHiddenTokensRequest'), headers, signal)).then((res) => {
|
|
346
|
+
return buildResponse(res).then((_data) => {
|
|
347
|
+
return JsonDecode(_data, 'ListHiddenTokensResponse');
|
|
348
|
+
});
|
|
349
|
+
}, (error) => {
|
|
350
|
+
throw WebrpcRequestFailedError.new({
|
|
351
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
};
|
|
355
|
+
putHiddenToken = (req, headers, signal) => {
|
|
356
|
+
return this.fetch(this.url('PutHiddenToken'), createHttpRequest(JsonEncode(req, 'PutHiddenTokenRequest'), headers, signal)).then((res) => {
|
|
357
|
+
return buildResponse(res).then((_data) => {
|
|
358
|
+
return JsonDecode(_data, 'PutHiddenTokenResponse');
|
|
359
|
+
});
|
|
360
|
+
}, (error) => {
|
|
361
|
+
throw WebrpcRequestFailedError.new({
|
|
362
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
};
|
|
366
|
+
deleteHiddenToken = (req, headers, signal) => {
|
|
367
|
+
return this.fetch(this.url('DeleteHiddenToken'), createHttpRequest(JsonEncode(req, 'DeleteHiddenTokenRequest'), headers, signal)).then((res) => {
|
|
368
|
+
return buildResponse(res).then((_data) => {
|
|
369
|
+
return JsonDecode(_data, 'DeleteHiddenTokenResponse');
|
|
62
370
|
});
|
|
63
371
|
}, (error) => {
|
|
64
372
|
throw WebrpcRequestFailedError.new({
|
|
@@ -67,7 +375,6 @@ class UserData {
|
|
|
67
375
|
});
|
|
68
376
|
};
|
|
69
377
|
}
|
|
70
|
-
exports.UserData = UserData;
|
|
71
378
|
const createHttpRequest = (body = '{}', headers = {}, signal = null) => {
|
|
72
379
|
const reqHeaders = { ...headers, 'Content-Type': 'application/json' };
|
|
73
380
|
return { method: 'POST', headers: reqHeaders, body, signal };
|
|
@@ -86,16 +393,15 @@ const buildResponse = (res) => {
|
|
|
86
393
|
}
|
|
87
394
|
if (!res.ok) {
|
|
88
395
|
const code = typeof data.code === 'number' ? data.code : 0;
|
|
89
|
-
throw (
|
|
396
|
+
throw (webrpcErrorByCode[code] || WebrpcError).new(data);
|
|
90
397
|
}
|
|
91
398
|
return data;
|
|
92
399
|
});
|
|
93
400
|
};
|
|
94
|
-
const JsonEncode = (obj, _typ = '') => {
|
|
401
|
+
export const JsonEncode = (obj, _typ = '') => {
|
|
95
402
|
return JSON.stringify(obj);
|
|
96
403
|
};
|
|
97
|
-
|
|
98
|
-
const JsonDecode = (data, _typ = '') => {
|
|
404
|
+
export const JsonDecode = (data, _typ = '') => {
|
|
99
405
|
let parsed = data;
|
|
100
406
|
if (typeof data === 'string') {
|
|
101
407
|
try {
|
|
@@ -107,8 +413,7 @@ const JsonDecode = (data, _typ = '') => {
|
|
|
107
413
|
}
|
|
108
414
|
return parsed;
|
|
109
415
|
};
|
|
110
|
-
|
|
111
|
-
class WebrpcError extends Error {
|
|
416
|
+
export class WebrpcError extends Error {
|
|
112
417
|
code;
|
|
113
418
|
status;
|
|
114
419
|
constructor(error = {}) {
|
|
@@ -125,8 +430,7 @@ class WebrpcError extends Error {
|
|
|
125
430
|
return new this({ message: payload.message, code: payload.code, status: payload.status, cause: payload.cause });
|
|
126
431
|
}
|
|
127
432
|
}
|
|
128
|
-
|
|
129
|
-
class WebrpcEndpointError extends WebrpcError {
|
|
433
|
+
export class WebrpcEndpointError extends WebrpcError {
|
|
130
434
|
constructor(error = {}) {
|
|
131
435
|
super(error);
|
|
132
436
|
this.name = error.name || 'WebrpcEndpoint';
|
|
@@ -138,8 +442,7 @@ class WebrpcEndpointError extends WebrpcError {
|
|
|
138
442
|
Object.setPrototypeOf(this, WebrpcEndpointError.prototype);
|
|
139
443
|
}
|
|
140
444
|
}
|
|
141
|
-
|
|
142
|
-
class WebrpcRequestFailedError extends WebrpcError {
|
|
445
|
+
export class WebrpcRequestFailedError extends WebrpcError {
|
|
143
446
|
constructor(error = {}) {
|
|
144
447
|
super(error);
|
|
145
448
|
this.name = error.name || 'WebrpcRequestFailed';
|
|
@@ -151,8 +454,7 @@ class WebrpcRequestFailedError extends WebrpcError {
|
|
|
151
454
|
Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype);
|
|
152
455
|
}
|
|
153
456
|
}
|
|
154
|
-
|
|
155
|
-
class WebrpcBadRouteError extends WebrpcError {
|
|
457
|
+
export class WebrpcBadRouteError extends WebrpcError {
|
|
156
458
|
constructor(error = {}) {
|
|
157
459
|
super(error);
|
|
158
460
|
this.name = error.name || 'WebrpcBadRoute';
|
|
@@ -164,8 +466,7 @@ class WebrpcBadRouteError extends WebrpcError {
|
|
|
164
466
|
Object.setPrototypeOf(this, WebrpcBadRouteError.prototype);
|
|
165
467
|
}
|
|
166
468
|
}
|
|
167
|
-
|
|
168
|
-
class WebrpcBadMethodError extends WebrpcError {
|
|
469
|
+
export class WebrpcBadMethodError extends WebrpcError {
|
|
169
470
|
constructor(error = {}) {
|
|
170
471
|
super(error);
|
|
171
472
|
this.name = error.name || 'WebrpcBadMethod';
|
|
@@ -177,8 +478,7 @@ class WebrpcBadMethodError extends WebrpcError {
|
|
|
177
478
|
Object.setPrototypeOf(this, WebrpcBadMethodError.prototype);
|
|
178
479
|
}
|
|
179
480
|
}
|
|
180
|
-
|
|
181
|
-
class WebrpcBadRequestError extends WebrpcError {
|
|
481
|
+
export class WebrpcBadRequestError extends WebrpcError {
|
|
182
482
|
constructor(error = {}) {
|
|
183
483
|
super(error);
|
|
184
484
|
this.name = error.name || 'WebrpcBadRequest';
|
|
@@ -190,8 +490,7 @@ class WebrpcBadRequestError extends WebrpcError {
|
|
|
190
490
|
Object.setPrototypeOf(this, WebrpcBadRequestError.prototype);
|
|
191
491
|
}
|
|
192
492
|
}
|
|
193
|
-
|
|
194
|
-
class WebrpcBadResponseError extends WebrpcError {
|
|
493
|
+
export class WebrpcBadResponseError extends WebrpcError {
|
|
195
494
|
constructor(error = {}) {
|
|
196
495
|
super(error);
|
|
197
496
|
this.name = error.name || 'WebrpcBadResponse';
|
|
@@ -203,8 +502,7 @@ class WebrpcBadResponseError extends WebrpcError {
|
|
|
203
502
|
Object.setPrototypeOf(this, WebrpcBadResponseError.prototype);
|
|
204
503
|
}
|
|
205
504
|
}
|
|
206
|
-
|
|
207
|
-
class WebrpcServerPanicError extends WebrpcError {
|
|
505
|
+
export class WebrpcServerPanicError extends WebrpcError {
|
|
208
506
|
constructor(error = {}) {
|
|
209
507
|
super(error);
|
|
210
508
|
this.name = error.name || 'WebrpcServerPanic';
|
|
@@ -216,8 +514,7 @@ class WebrpcServerPanicError extends WebrpcError {
|
|
|
216
514
|
Object.setPrototypeOf(this, WebrpcServerPanicError.prototype);
|
|
217
515
|
}
|
|
218
516
|
}
|
|
219
|
-
|
|
220
|
-
class WebrpcInternalErrorError extends WebrpcError {
|
|
517
|
+
export class WebrpcInternalErrorError extends WebrpcError {
|
|
221
518
|
constructor(error = {}) {
|
|
222
519
|
super(error);
|
|
223
520
|
this.name = error.name || 'WebrpcInternalError';
|
|
@@ -229,8 +526,7 @@ class WebrpcInternalErrorError extends WebrpcError {
|
|
|
229
526
|
Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype);
|
|
230
527
|
}
|
|
231
528
|
}
|
|
232
|
-
|
|
233
|
-
class WebrpcClientAbortedError extends WebrpcError {
|
|
529
|
+
export class WebrpcClientAbortedError extends WebrpcError {
|
|
234
530
|
constructor(error = {}) {
|
|
235
531
|
super(error);
|
|
236
532
|
this.name = error.name || 'WebrpcClientAborted';
|
|
@@ -242,8 +538,7 @@ class WebrpcClientAbortedError extends WebrpcError {
|
|
|
242
538
|
Object.setPrototypeOf(this, WebrpcClientAbortedError.prototype);
|
|
243
539
|
}
|
|
244
540
|
}
|
|
245
|
-
|
|
246
|
-
class WebrpcStreamLostError extends WebrpcError {
|
|
541
|
+
export class WebrpcStreamLostError extends WebrpcError {
|
|
247
542
|
constructor(error = {}) {
|
|
248
543
|
super(error);
|
|
249
544
|
this.name = error.name || 'WebrpcStreamLost';
|
|
@@ -255,8 +550,7 @@ class WebrpcStreamLostError extends WebrpcError {
|
|
|
255
550
|
Object.setPrototypeOf(this, WebrpcStreamLostError.prototype);
|
|
256
551
|
}
|
|
257
552
|
}
|
|
258
|
-
|
|
259
|
-
class WebrpcStreamFinishedError extends WebrpcError {
|
|
553
|
+
export class WebrpcStreamFinishedError extends WebrpcError {
|
|
260
554
|
constructor(error = {}) {
|
|
261
555
|
super(error);
|
|
262
556
|
this.name = error.name || 'WebrpcStreamFinished';
|
|
@@ -268,11 +562,10 @@ class WebrpcStreamFinishedError extends WebrpcError {
|
|
|
268
562
|
Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype);
|
|
269
563
|
}
|
|
270
564
|
}
|
|
271
|
-
exports.WebrpcStreamFinishedError = WebrpcStreamFinishedError;
|
|
272
565
|
//
|
|
273
566
|
// Schema errors
|
|
274
567
|
//
|
|
275
|
-
class UnauthorizedError extends WebrpcError {
|
|
568
|
+
export class UnauthorizedError extends WebrpcError {
|
|
276
569
|
constructor(error = {}) {
|
|
277
570
|
super(error);
|
|
278
571
|
this.name = error.name || 'Unauthorized';
|
|
@@ -284,8 +577,7 @@ class UnauthorizedError extends WebrpcError {
|
|
|
284
577
|
Object.setPrototypeOf(this, UnauthorizedError.prototype);
|
|
285
578
|
}
|
|
286
579
|
}
|
|
287
|
-
|
|
288
|
-
class PermissionDeniedError extends WebrpcError {
|
|
580
|
+
export class PermissionDeniedError extends WebrpcError {
|
|
289
581
|
constructor(error = {}) {
|
|
290
582
|
super(error);
|
|
291
583
|
this.name = error.name || 'PermissionDenied';
|
|
@@ -297,8 +589,7 @@ class PermissionDeniedError extends WebrpcError {
|
|
|
297
589
|
Object.setPrototypeOf(this, PermissionDeniedError.prototype);
|
|
298
590
|
}
|
|
299
591
|
}
|
|
300
|
-
|
|
301
|
-
class SessionExpiredError extends WebrpcError {
|
|
592
|
+
export class SessionExpiredError extends WebrpcError {
|
|
302
593
|
constructor(error = {}) {
|
|
303
594
|
super(error);
|
|
304
595
|
this.name = error.name || 'SessionExpired';
|
|
@@ -310,8 +601,7 @@ class SessionExpiredError extends WebrpcError {
|
|
|
310
601
|
Object.setPrototypeOf(this, SessionExpiredError.prototype);
|
|
311
602
|
}
|
|
312
603
|
}
|
|
313
|
-
|
|
314
|
-
class MethodNotFoundError extends WebrpcError {
|
|
604
|
+
export class MethodNotFoundError extends WebrpcError {
|
|
315
605
|
constructor(error = {}) {
|
|
316
606
|
super(error);
|
|
317
607
|
this.name = error.name || 'MethodNotFound';
|
|
@@ -323,8 +613,7 @@ class MethodNotFoundError extends WebrpcError {
|
|
|
323
613
|
Object.setPrototypeOf(this, MethodNotFoundError.prototype);
|
|
324
614
|
}
|
|
325
615
|
}
|
|
326
|
-
|
|
327
|
-
class RequestConflictError extends WebrpcError {
|
|
616
|
+
export class RequestConflictError extends WebrpcError {
|
|
328
617
|
constructor(error = {}) {
|
|
329
618
|
super(error);
|
|
330
619
|
this.name = error.name || 'RequestConflict';
|
|
@@ -336,8 +625,7 @@ class RequestConflictError extends WebrpcError {
|
|
|
336
625
|
Object.setPrototypeOf(this, RequestConflictError.prototype);
|
|
337
626
|
}
|
|
338
627
|
}
|
|
339
|
-
|
|
340
|
-
class AbortedError extends WebrpcError {
|
|
628
|
+
export class AbortedError extends WebrpcError {
|
|
341
629
|
constructor(error = {}) {
|
|
342
630
|
super(error);
|
|
343
631
|
this.name = error.name || 'Aborted';
|
|
@@ -349,8 +637,7 @@ class AbortedError extends WebrpcError {
|
|
|
349
637
|
Object.setPrototypeOf(this, AbortedError.prototype);
|
|
350
638
|
}
|
|
351
639
|
}
|
|
352
|
-
|
|
353
|
-
class GeoblockedError extends WebrpcError {
|
|
640
|
+
export class GeoblockedError extends WebrpcError {
|
|
354
641
|
constructor(error = {}) {
|
|
355
642
|
super(error);
|
|
356
643
|
this.name = error.name || 'Geoblocked';
|
|
@@ -362,8 +649,7 @@ class GeoblockedError extends WebrpcError {
|
|
|
362
649
|
Object.setPrototypeOf(this, GeoblockedError.prototype);
|
|
363
650
|
}
|
|
364
651
|
}
|
|
365
|
-
|
|
366
|
-
class RateLimitedError extends WebrpcError {
|
|
652
|
+
export class RateLimitedError extends WebrpcError {
|
|
367
653
|
constructor(error = {}) {
|
|
368
654
|
super(error);
|
|
369
655
|
this.name = error.name || 'RateLimited';
|
|
@@ -375,8 +661,7 @@ class RateLimitedError extends WebrpcError {
|
|
|
375
661
|
Object.setPrototypeOf(this, RateLimitedError.prototype);
|
|
376
662
|
}
|
|
377
663
|
}
|
|
378
|
-
|
|
379
|
-
class ProjectNotFoundError extends WebrpcError {
|
|
664
|
+
export class ProjectNotFoundError extends WebrpcError {
|
|
380
665
|
constructor(error = {}) {
|
|
381
666
|
super(error);
|
|
382
667
|
this.name = error.name || 'ProjectNotFound';
|
|
@@ -388,8 +673,7 @@ class ProjectNotFoundError extends WebrpcError {
|
|
|
388
673
|
Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
|
|
389
674
|
}
|
|
390
675
|
}
|
|
391
|
-
|
|
392
|
-
class InvalidArgumentError extends WebrpcError {
|
|
676
|
+
export class InvalidArgumentError extends WebrpcError {
|
|
393
677
|
constructor(error = {}) {
|
|
394
678
|
super(error);
|
|
395
679
|
this.name = error.name || 'InvalidArgument';
|
|
@@ -401,8 +685,7 @@ class InvalidArgumentError extends WebrpcError {
|
|
|
401
685
|
Object.setPrototypeOf(this, InvalidArgumentError.prototype);
|
|
402
686
|
}
|
|
403
687
|
}
|
|
404
|
-
|
|
405
|
-
class UnavailableError extends WebrpcError {
|
|
688
|
+
export class UnavailableError extends WebrpcError {
|
|
406
689
|
constructor(error = {}) {
|
|
407
690
|
super(error);
|
|
408
691
|
this.name = error.name || 'Unavailable';
|
|
@@ -414,8 +697,7 @@ class UnavailableError extends WebrpcError {
|
|
|
414
697
|
Object.setPrototypeOf(this, UnavailableError.prototype);
|
|
415
698
|
}
|
|
416
699
|
}
|
|
417
|
-
|
|
418
|
-
class QueryFailedError extends WebrpcError {
|
|
700
|
+
export class QueryFailedError extends WebrpcError {
|
|
419
701
|
constructor(error = {}) {
|
|
420
702
|
super(error);
|
|
421
703
|
this.name = error.name || 'QueryFailed';
|
|
@@ -427,8 +709,7 @@ class QueryFailedError extends WebrpcError {
|
|
|
427
709
|
Object.setPrototypeOf(this, QueryFailedError.prototype);
|
|
428
710
|
}
|
|
429
711
|
}
|
|
430
|
-
|
|
431
|
-
class NotFoundError extends WebrpcError {
|
|
712
|
+
export class NotFoundError extends WebrpcError {
|
|
432
713
|
constructor(error = {}) {
|
|
433
714
|
super(error);
|
|
434
715
|
this.name = error.name || 'NotFound';
|
|
@@ -440,8 +721,7 @@ class NotFoundError extends WebrpcError {
|
|
|
440
721
|
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
441
722
|
}
|
|
442
723
|
}
|
|
443
|
-
|
|
444
|
-
class UnsupportedNetworkError extends WebrpcError {
|
|
724
|
+
export class UnsupportedNetworkError extends WebrpcError {
|
|
445
725
|
constructor(error = {}) {
|
|
446
726
|
super(error);
|
|
447
727
|
this.name = error.name || 'UnsupportedNetwork';
|
|
@@ -453,8 +733,7 @@ class UnsupportedNetworkError extends WebrpcError {
|
|
|
453
733
|
Object.setPrototypeOf(this, UnsupportedNetworkError.prototype);
|
|
454
734
|
}
|
|
455
735
|
}
|
|
456
|
-
|
|
457
|
-
var errors;
|
|
736
|
+
export var errors;
|
|
458
737
|
(function (errors) {
|
|
459
738
|
errors["WebrpcEndpoint"] = "WebrpcEndpoint";
|
|
460
739
|
errors["WebrpcRequestFailed"] = "WebrpcRequestFailed";
|
|
@@ -481,8 +760,8 @@ var errors;
|
|
|
481
760
|
errors["QueryFailed"] = "QueryFailed";
|
|
482
761
|
errors["NotFound"] = "NotFound";
|
|
483
762
|
errors["UnsupportedNetwork"] = "UnsupportedNetwork";
|
|
484
|
-
})(errors || (
|
|
485
|
-
var WebrpcErrorCodes;
|
|
763
|
+
})(errors || (errors = {}));
|
|
764
|
+
export var WebrpcErrorCodes;
|
|
486
765
|
(function (WebrpcErrorCodes) {
|
|
487
766
|
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcEndpoint"] = 0] = "WebrpcEndpoint";
|
|
488
767
|
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcRequestFailed"] = -1] = "WebrpcRequestFailed";
|
|
@@ -509,8 +788,8 @@ var WebrpcErrorCodes;
|
|
|
509
788
|
WebrpcErrorCodes[WebrpcErrorCodes["QueryFailed"] = 2003] = "QueryFailed";
|
|
510
789
|
WebrpcErrorCodes[WebrpcErrorCodes["NotFound"] = 3000] = "NotFound";
|
|
511
790
|
WebrpcErrorCodes[WebrpcErrorCodes["UnsupportedNetwork"] = 3008] = "UnsupportedNetwork";
|
|
512
|
-
})(WebrpcErrorCodes || (
|
|
513
|
-
|
|
791
|
+
})(WebrpcErrorCodes || (WebrpcErrorCodes = {}));
|
|
792
|
+
export const webrpcErrorByCode = {
|
|
514
793
|
[0]: WebrpcEndpointError,
|
|
515
794
|
[-1]: WebrpcRequestFailedError,
|
|
516
795
|
[-2]: WebrpcBadRouteError,
|
|
@@ -540,10 +819,10 @@ exports.webrpcErrorByCode = {
|
|
|
540
819
|
//
|
|
541
820
|
// Webrpc
|
|
542
821
|
//
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
function VersionFromHeader(headers) {
|
|
546
|
-
const headerValue = headers.get(
|
|
822
|
+
export const WebrpcHeader = 'Webrpc';
|
|
823
|
+
export const WebrpcHeaderValue = 'webrpc@v0.30.2;gen-typescript@v0.22.2;userdata@v0.1.0';
|
|
824
|
+
export function VersionFromHeader(headers) {
|
|
825
|
+
const headerValue = headers.get(WebrpcHeader);
|
|
547
826
|
if (!headerValue) {
|
|
548
827
|
return {
|
|
549
828
|
WebrpcGenVersion: '',
|