@0xtrails/api 0.8.7 → 0.9.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 +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/trails-api.gen.d.ts +77 -28
- package/dist/trails-api.gen.d.ts.map +1 -1
- package/dist/trails-api.gen.js +113 -72
- package/package.json +1 -1
- package/src/trails-api.gen.ts +428 -301
package/dist/trails-api.gen.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// trails-api v1-25.12.
|
|
2
|
+
// trails-api v1-25.12.16-ee270e57 cd6fea50d2e26fb661de670279f19010f6a3f14a
|
|
3
3
|
// --
|
|
4
4
|
// Code generated by Webrpc-gen@v0.31.3 with typescript generator. DO NOT EDIT.
|
|
5
5
|
//
|
|
6
6
|
// webrpc-gen -schema=trails-api.ridl -target=typescript -client -service=Trails -methodTreeShake -ignore=@onramp -out=./clients/trails-api.gen.ts
|
|
7
7
|
// Webrpc description and code-gen version
|
|
8
|
-
export const WebrpcVersion =
|
|
8
|
+
export const WebrpcVersion = 'v1';
|
|
9
9
|
// Schema version of your RIDL schema
|
|
10
|
-
export const WebrpcSchemaVersion = 'v1-25.12.
|
|
10
|
+
export const WebrpcSchemaVersion = 'v1-25.12.16-ee270e57';
|
|
11
11
|
// Schema hash generated from your RIDL schema
|
|
12
|
-
export const WebrpcSchemaHash = '
|
|
12
|
+
export const WebrpcSchemaHash = 'cd6fea50d2e26fb661de670279f19010f6a3f14a';
|
|
13
13
|
//
|
|
14
14
|
// Schema types
|
|
15
15
|
//
|
|
@@ -107,7 +107,7 @@ export class Trails {
|
|
|
107
107
|
getIntentReceipt: (req) => ['Trails', 'getIntentReceipt', req],
|
|
108
108
|
getIntent: (req) => ['Trails', 'getIntent', req],
|
|
109
109
|
searchIntents: (req) => ['Trails', 'searchIntents', req],
|
|
110
|
-
|
|
110
|
+
getIntentHistory: (req) => ['Trails', 'getIntentHistory', req],
|
|
111
111
|
abortIntent: (req) => ['Trails', 'abortIntent', req],
|
|
112
112
|
getChains: (req) => ['Trails', 'getChains', req],
|
|
113
113
|
getExactOutputRoutes: (req) => ['Trails', 'getExactOutputRoutes', req],
|
|
@@ -115,172 +115,186 @@ export class Trails {
|
|
|
115
115
|
getTokenList: (req) => ['Trails', 'getTokenList', req],
|
|
116
116
|
getTokenPrices: (req) => ['Trails', 'getTokenPrices', req],
|
|
117
117
|
getTrailsContracts: () => ['Trails', 'getTrailsContracts'],
|
|
118
|
+
getIntentTransactionHistory: (req) => ['Trails', 'getIntentTransactionHistory', req]
|
|
118
119
|
};
|
|
119
120
|
ping = (headers, signal) => {
|
|
120
|
-
return this.fetch(this.url('Ping'), createHttpRequest('{}', headers, signal)).then(
|
|
121
|
+
return this.fetch(this.url('Ping'), createHttpRequest('{}', headers, signal)).then(res => {
|
|
121
122
|
return buildResponse(res).then(_data => {
|
|
122
123
|
return JsonDecode(_data, 'PingResponse');
|
|
123
124
|
});
|
|
124
|
-
},
|
|
125
|
+
}, error => {
|
|
125
126
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
126
127
|
});
|
|
127
128
|
};
|
|
128
129
|
runtimeStatus = (headers, signal) => {
|
|
129
|
-
return this.fetch(this.url('RuntimeStatus'), createHttpRequest('{}', headers, signal)).then(
|
|
130
|
+
return this.fetch(this.url('RuntimeStatus'), createHttpRequest('{}', headers, signal)).then(res => {
|
|
130
131
|
return buildResponse(res).then(_data => {
|
|
131
132
|
return JsonDecode(_data, 'RuntimeStatusResponse');
|
|
132
133
|
});
|
|
133
|
-
},
|
|
134
|
+
}, error => {
|
|
134
135
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
135
136
|
});
|
|
136
137
|
};
|
|
137
138
|
clock = (headers, signal) => {
|
|
138
|
-
return this.fetch(this.url('Clock'), createHttpRequest('{}', headers, signal)).then(
|
|
139
|
+
return this.fetch(this.url('Clock'), createHttpRequest('{}', headers, signal)).then(res => {
|
|
139
140
|
return buildResponse(res).then(_data => {
|
|
140
141
|
return JsonDecode(_data, 'ClockResponse');
|
|
141
142
|
});
|
|
142
|
-
},
|
|
143
|
+
}, error => {
|
|
143
144
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
144
145
|
});
|
|
145
146
|
};
|
|
146
147
|
quoteIntent = (req, headers, signal) => {
|
|
147
|
-
return this.fetch(this.url('QuoteIntent'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
148
|
+
return this.fetch(this.url('QuoteIntent'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
148
149
|
return buildResponse(res).then(_data => {
|
|
149
150
|
return JsonDecode(_data, 'QuoteIntentResponse');
|
|
150
151
|
});
|
|
151
|
-
},
|
|
152
|
+
}, error => {
|
|
152
153
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
153
154
|
});
|
|
154
155
|
};
|
|
155
156
|
commitIntent = (req, headers, signal) => {
|
|
156
|
-
return this.fetch(this.url('CommitIntent'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
157
|
+
return this.fetch(this.url('CommitIntent'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
157
158
|
return buildResponse(res).then(_data => {
|
|
158
159
|
return JsonDecode(_data, 'CommitIntentResponse');
|
|
159
160
|
});
|
|
160
|
-
},
|
|
161
|
+
}, error => {
|
|
161
162
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
162
163
|
});
|
|
163
164
|
};
|
|
164
165
|
executeIntent = (req, headers, signal) => {
|
|
165
|
-
return this.fetch(this.url('ExecuteIntent'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
166
|
+
return this.fetch(this.url('ExecuteIntent'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
166
167
|
return buildResponse(res).then(_data => {
|
|
167
168
|
return JsonDecode(_data, 'ExecuteIntentResponse');
|
|
168
169
|
});
|
|
169
|
-
},
|
|
170
|
+
}, error => {
|
|
170
171
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
171
172
|
});
|
|
172
173
|
};
|
|
173
174
|
waitIntentReceipt = (req, headers, signal) => {
|
|
174
|
-
return this.fetch(this.url('WaitIntentReceipt'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
175
|
+
return this.fetch(this.url('WaitIntentReceipt'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
175
176
|
return buildResponse(res).then(_data => {
|
|
176
177
|
return JsonDecode(_data, 'WaitIntentReceiptResponse');
|
|
177
178
|
});
|
|
178
|
-
},
|
|
179
|
+
}, error => {
|
|
179
180
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
180
181
|
});
|
|
181
182
|
};
|
|
182
183
|
getIntentReceipt = (req, headers, signal) => {
|
|
183
|
-
return this.fetch(this.url('GetIntentReceipt'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
184
|
+
return this.fetch(this.url('GetIntentReceipt'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
184
185
|
return buildResponse(res).then(_data => {
|
|
185
186
|
return JsonDecode(_data, 'GetIntentReceiptResponse');
|
|
186
187
|
});
|
|
187
|
-
},
|
|
188
|
+
}, error => {
|
|
188
189
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
189
190
|
});
|
|
190
191
|
};
|
|
191
192
|
getIntent = (req, headers, signal) => {
|
|
192
|
-
return this.fetch(this.url('GetIntent'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
193
|
+
return this.fetch(this.url('GetIntent'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
193
194
|
return buildResponse(res).then(_data => {
|
|
194
195
|
return JsonDecode(_data, 'GetIntentResponse');
|
|
195
196
|
});
|
|
196
|
-
},
|
|
197
|
+
}, error => {
|
|
197
198
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
198
199
|
});
|
|
199
200
|
};
|
|
200
201
|
searchIntents = (req, headers, signal) => {
|
|
201
|
-
return this.fetch(this.url('SearchIntents'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
202
|
+
return this.fetch(this.url('SearchIntents'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
202
203
|
return buildResponse(res).then(_data => {
|
|
203
204
|
return JsonDecode(_data, 'SearchIntentsResponse');
|
|
204
205
|
});
|
|
205
|
-
},
|
|
206
|
+
}, error => {
|
|
206
207
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
207
208
|
});
|
|
208
209
|
};
|
|
209
|
-
|
|
210
|
-
return this.fetch(this.url('
|
|
210
|
+
getIntentHistory = (req, headers, signal) => {
|
|
211
|
+
return this.fetch(this.url('GetIntentHistory'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
211
212
|
return buildResponse(res).then(_data => {
|
|
212
|
-
return JsonDecode(_data, '
|
|
213
|
+
return JsonDecode(_data, 'GetIntentHistoryResponse');
|
|
213
214
|
});
|
|
214
|
-
},
|
|
215
|
+
}, error => {
|
|
215
216
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
216
217
|
});
|
|
217
218
|
};
|
|
218
219
|
abortIntent = (req, headers, signal) => {
|
|
219
|
-
return this.fetch(this.url('AbortIntent'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
220
|
+
return this.fetch(this.url('AbortIntent'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
220
221
|
return buildResponse(res).then(_data => {
|
|
221
222
|
return JsonDecode(_data, 'AbortIntentResponse');
|
|
222
223
|
});
|
|
223
|
-
},
|
|
224
|
+
}, error => {
|
|
224
225
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
225
226
|
});
|
|
226
227
|
};
|
|
227
228
|
getChains = (req, headers, signal) => {
|
|
228
|
-
return this.fetch(this.url('GetChains'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
229
|
+
return this.fetch(this.url('GetChains'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
229
230
|
return buildResponse(res).then(_data => {
|
|
230
231
|
return JsonDecode(_data, 'GetChainsResponse');
|
|
231
232
|
});
|
|
232
|
-
},
|
|
233
|
+
}, error => {
|
|
233
234
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
234
235
|
});
|
|
235
236
|
};
|
|
236
237
|
getExactOutputRoutes = (req, headers, signal) => {
|
|
237
|
-
return this.fetch(this.url('GetExactOutputRoutes'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
238
|
+
return this.fetch(this.url('GetExactOutputRoutes'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
238
239
|
return buildResponse(res).then(_data => {
|
|
239
240
|
return JsonDecode(_data, 'GetExactOutputRoutesResponse');
|
|
240
241
|
});
|
|
241
|
-
},
|
|
242
|
+
}, error => {
|
|
242
243
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
243
244
|
});
|
|
244
245
|
};
|
|
245
246
|
getExactInputRoutes = (req, headers, signal) => {
|
|
246
|
-
return this.fetch(this.url('GetExactInputRoutes'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
247
|
+
return this.fetch(this.url('GetExactInputRoutes'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
247
248
|
return buildResponse(res).then(_data => {
|
|
248
249
|
return JsonDecode(_data, 'GetExactInputRoutesResponse');
|
|
249
250
|
});
|
|
250
|
-
},
|
|
251
|
+
}, error => {
|
|
251
252
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
252
253
|
});
|
|
253
254
|
};
|
|
254
255
|
getTokenList = (req, headers, signal) => {
|
|
255
|
-
return this.fetch(this.url('GetTokenList'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
256
|
+
return this.fetch(this.url('GetTokenList'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
256
257
|
return buildResponse(res).then(_data => {
|
|
257
258
|
return JsonDecode(_data, 'GetTokenListResponse');
|
|
258
259
|
});
|
|
259
|
-
},
|
|
260
|
+
}, error => {
|
|
260
261
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
261
262
|
});
|
|
262
263
|
};
|
|
263
264
|
getTokenPrices = (req, headers, signal) => {
|
|
264
|
-
return this.fetch(this.url('GetTokenPrices'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
265
|
+
return this.fetch(this.url('GetTokenPrices'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
265
266
|
return buildResponse(res).then(_data => {
|
|
266
267
|
return JsonDecode(_data, 'GetTokenPricesResponse');
|
|
267
268
|
});
|
|
268
|
-
},
|
|
269
|
+
}, error => {
|
|
269
270
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
270
271
|
});
|
|
271
272
|
};
|
|
272
273
|
getTrailsContracts = (headers, signal) => {
|
|
273
|
-
return this.fetch(this.url('GetTrailsContracts'), createHttpRequest('{}', headers, signal)).then(
|
|
274
|
+
return this.fetch(this.url('GetTrailsContracts'), createHttpRequest('{}', headers, signal)).then(res => {
|
|
274
275
|
return buildResponse(res).then(_data => {
|
|
275
276
|
return JsonDecode(_data, 'GetTrailsContractsResponse');
|
|
276
277
|
});
|
|
277
|
-
},
|
|
278
|
+
}, error => {
|
|
279
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
getIntentTransactionHistory = (req, headers, signal) => {
|
|
283
|
+
return this.fetch(this.url('GetIntentTransactionHistory'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
284
|
+
return buildResponse(res).then(_data => {
|
|
285
|
+
return JsonDecode(_data, 'GetIntentTransactionHistoryResponse');
|
|
286
|
+
});
|
|
287
|
+
}, error => {
|
|
278
288
|
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` });
|
|
279
289
|
});
|
|
280
290
|
};
|
|
281
291
|
}
|
|
282
292
|
const createHttpRequest = (body = '{}', headers = {}, signal = null) => {
|
|
283
|
-
const reqHeaders = {
|
|
293
|
+
const reqHeaders = {
|
|
294
|
+
...headers,
|
|
295
|
+
'Content-Type': 'application/json',
|
|
296
|
+
[WebrpcHeader]: WebrpcHeaderValue
|
|
297
|
+
};
|
|
284
298
|
return { method: 'POST', headers: reqHeaders, body, signal };
|
|
285
299
|
};
|
|
286
300
|
const buildResponse = (res) => {
|
|
@@ -296,7 +310,7 @@ const buildResponse = (res) => {
|
|
|
296
310
|
});
|
|
297
311
|
}
|
|
298
312
|
if (!res.ok) {
|
|
299
|
-
const code =
|
|
313
|
+
const code = typeof data.code === 'number' ? data.code : 0;
|
|
300
314
|
throw (webrpcErrorByCode[code] || WebrpcError).new(data);
|
|
301
315
|
}
|
|
302
316
|
return data;
|
|
@@ -313,21 +327,48 @@ const BIG_INT_FIELDS = {
|
|
|
313
327
|
ExecuteIntentRequest: [['depositSignature', 'DepositSignature']],
|
|
314
328
|
FeeOption: ['amount'],
|
|
315
329
|
GasFeeOptions: [['feeOptions', 'FeeOption[]']],
|
|
330
|
+
GetIntentHistoryResponse: [['intents', 'IntentHistory[]']],
|
|
316
331
|
GetIntentReceiptResponse: [['intentReceipt', 'IntentReceipt']],
|
|
317
332
|
GetIntentResponse: [['intent', 'Intent']],
|
|
318
333
|
GetIntentTransactionHistoryResponse: [['intents', 'IntentSummary[]']],
|
|
319
|
-
Intent: [
|
|
334
|
+
Intent: [
|
|
335
|
+
['quoteRequest', 'QuoteIntentRequest'],
|
|
336
|
+
'salt',
|
|
337
|
+
['depositTransaction', 'DepositTransaction'],
|
|
338
|
+
['originCalls', 'IntentCalls'],
|
|
339
|
+
['destinationCalls', 'IntentCalls'],
|
|
340
|
+
['originPrecondition', 'TransactionPrecondition'],
|
|
341
|
+
['destinationPrecondition', 'TransactionPrecondition'],
|
|
342
|
+
['quote', 'IntentProviderQuote'],
|
|
343
|
+
['fees', 'IntentFees']
|
|
344
|
+
],
|
|
320
345
|
IntentCalls: ['space', 'nonce', ['calls', 'TransactionCall[]']],
|
|
321
|
-
IntentFees: [
|
|
346
|
+
IntentFees: [
|
|
347
|
+
['originGas', 'IntentTransactionGasFee'],
|
|
348
|
+
['destinationGas', 'IntentTransactionGasFee'],
|
|
349
|
+
['provider', 'IntentProviderFees'],
|
|
350
|
+
'feeTokenTotal',
|
|
351
|
+
'totalFeeAmount'
|
|
352
|
+
],
|
|
353
|
+
IntentHistory: [['receipt', 'IntentReceipt']],
|
|
322
354
|
IntentProviderFees: ['quoteProviderFee', 'trailsFee', 'totalFeeAmount'],
|
|
323
355
|
IntentProviderQuote: ['fromAmount', 'fromAmountMin', 'toAmount', 'toAmountMin'],
|
|
324
|
-
IntentReceipt: [
|
|
356
|
+
IntentReceipt: [
|
|
357
|
+
['depositTransaction', 'IntentTransaction'],
|
|
358
|
+
['originTransaction', 'IntentTransaction'],
|
|
359
|
+
['destinationTransaction', 'IntentTransaction'],
|
|
360
|
+
['summary', 'IntentReceiptSummary']
|
|
361
|
+
],
|
|
362
|
+
IntentReceiptSummary: ['originTokenAmount', 'destinationTokenAmount'],
|
|
325
363
|
IntentSummary: ['originTokenAmount', 'destinationTokenAmount'],
|
|
326
364
|
IntentTransaction: ['tokenAmount', ['precondition', 'TransactionPrecondition'], ['depositIntentEntry', 'DepositIntentEntry']],
|
|
327
365
|
IntentTransactionGasFee: ['totalGasLimit', 'gasPrice', 'totalFeeAmount', ['metaTxnFeeDetails', 'MetaTxnFeeDetails']],
|
|
328
366
|
MetaTxnFeeDetails: ['estimatedGasLimit', 'feeNative'],
|
|
329
367
|
QuoteIntentRequest: ['destinationCallValue', 'originTokenAmount', 'destinationTokenAmount'],
|
|
330
|
-
QuoteIntentResponse: [
|
|
368
|
+
QuoteIntentResponse: [
|
|
369
|
+
['intent', 'Intent'],
|
|
370
|
+
['gasFeeOptions', 'GasFeeOptions']
|
|
371
|
+
],
|
|
331
372
|
SearchIntentsResponse: [['intents', 'Intent[]']],
|
|
332
373
|
TransactionCall: ['value', 'gasLimit'],
|
|
333
374
|
TransactionPrecondition: ['minAmount'],
|
|
@@ -399,7 +440,7 @@ function decodeType(typ, obj) {
|
|
|
399
440
|
}
|
|
400
441
|
// Encode object to JSON with BigInts converted to decimal strings.
|
|
401
442
|
export const JsonEncode = (obj) => {
|
|
402
|
-
return JSON.stringify(obj, (key, value) => typeof value === 'bigint' ? value.toString() : value);
|
|
443
|
+
return JSON.stringify(obj, (key, value) => (typeof value === 'bigint' ? value.toString() : value));
|
|
403
444
|
};
|
|
404
445
|
// Decode data (JSON string or already-parsed object) and convert declared BigInt string fields back to BigInt.
|
|
405
446
|
export const JsonDecode = (data, typ = '') => {
|
|
@@ -1070,45 +1111,45 @@ export const webrpcErrorByCode = {
|
|
|
1070
1111
|
[8009]: ClientOutdatedError,
|
|
1071
1112
|
[7000]: IntentsSkippedError,
|
|
1072
1113
|
[7001]: QuoteExpiredError,
|
|
1073
|
-
[9000]: IntentsDisabledError
|
|
1114
|
+
[9000]: IntentsDisabledError
|
|
1074
1115
|
};
|
|
1075
1116
|
//
|
|
1076
1117
|
// Webrpc
|
|
1077
1118
|
//
|
|
1078
|
-
export const WebrpcHeader =
|
|
1079
|
-
export const WebrpcHeaderValue = 'webrpc@v0.31.3;gen-typescript@v0.23.1;trails-api@v1-25.12.
|
|
1119
|
+
export const WebrpcHeader = 'Webrpc';
|
|
1120
|
+
export const WebrpcHeaderValue = 'webrpc@v0.31.3;gen-typescript@v0.23.1;trails-api@v1-25.12.16-ee270e57';
|
|
1080
1121
|
export function VersionFromHeader(headers) {
|
|
1081
1122
|
const headerValue = headers.get(WebrpcHeader);
|
|
1082
1123
|
if (!headerValue) {
|
|
1083
1124
|
return {
|
|
1084
|
-
WebrpcGenVersion:
|
|
1085
|
-
codeGenName:
|
|
1086
|
-
codeGenVersion:
|
|
1087
|
-
schemaName:
|
|
1088
|
-
schemaVersion:
|
|
1125
|
+
WebrpcGenVersion: '',
|
|
1126
|
+
codeGenName: '',
|
|
1127
|
+
codeGenVersion: '',
|
|
1128
|
+
schemaName: '',
|
|
1129
|
+
schemaVersion: ''
|
|
1089
1130
|
};
|
|
1090
1131
|
}
|
|
1091
1132
|
return parseWebrpcGenVersions(headerValue);
|
|
1092
1133
|
}
|
|
1093
1134
|
function parseWebrpcGenVersions(header) {
|
|
1094
|
-
const versions = header.split(
|
|
1135
|
+
const versions = header.split(';');
|
|
1095
1136
|
if (versions.length < 3) {
|
|
1096
1137
|
return {
|
|
1097
|
-
WebrpcGenVersion:
|
|
1098
|
-
codeGenName:
|
|
1099
|
-
codeGenVersion:
|
|
1100
|
-
schemaName:
|
|
1101
|
-
schemaVersion:
|
|
1138
|
+
WebrpcGenVersion: '',
|
|
1139
|
+
codeGenName: '',
|
|
1140
|
+
codeGenVersion: '',
|
|
1141
|
+
schemaName: '',
|
|
1142
|
+
schemaVersion: ''
|
|
1102
1143
|
};
|
|
1103
1144
|
}
|
|
1104
|
-
const [_, WebrpcGenVersion] = versions[0].split(
|
|
1105
|
-
const [codeGenName, codeGenVersion] = versions[1].split(
|
|
1106
|
-
const [schemaName, schemaVersion] = versions[2].split(
|
|
1145
|
+
const [_, WebrpcGenVersion] = versions[0].split('@');
|
|
1146
|
+
const [codeGenName, codeGenVersion] = versions[1].split('@');
|
|
1147
|
+
const [schemaName, schemaVersion] = versions[2].split('@');
|
|
1107
1148
|
return {
|
|
1108
|
-
WebrpcGenVersion: WebrpcGenVersion ??
|
|
1109
|
-
codeGenName: codeGenName ??
|
|
1110
|
-
codeGenVersion: codeGenVersion ??
|
|
1111
|
-
schemaName: schemaName ??
|
|
1112
|
-
schemaVersion: schemaVersion ??
|
|
1149
|
+
WebrpcGenVersion: WebrpcGenVersion ?? '',
|
|
1150
|
+
codeGenName: codeGenName ?? '',
|
|
1151
|
+
codeGenVersion: codeGenVersion ?? '',
|
|
1152
|
+
schemaName: schemaName ?? '',
|
|
1153
|
+
schemaVersion: schemaVersion ?? ''
|
|
1113
1154
|
};
|
|
1114
1155
|
}
|