@ar.io/wayfinder-core 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -71
- package/dist/client.d.ts +5 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +12 -3
- package/dist/fetch/wayfinder-fetch.d.ts +2 -14
- package/dist/fetch/wayfinder-fetch.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/config.d.ts +36 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +86 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,21 +36,22 @@ import {
|
|
|
36
36
|
createWayfinderClient,
|
|
37
37
|
FastestPingRoutingStrategy,
|
|
38
38
|
NetworkGatewaysProvider,
|
|
39
|
+
WayfinderFetchOptions,
|
|
39
40
|
} from '@ar.io/wayfinder-core';
|
|
40
41
|
import { ARIO } from '@ar.io/sdk';
|
|
41
42
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
const options: WayfinderFetchOptions = {
|
|
44
|
+
routingStrategy: new FastestPingRoutingStrategy({
|
|
45
|
+
gatewaysProvider: new NetworkGatewaysProvider({
|
|
46
|
+
ario: ARIO.mainnet(),
|
|
47
|
+
sortBy: 'operatorStake',
|
|
48
|
+
sortOrder: 'desc',
|
|
49
|
+
limit: 10,
|
|
50
|
+
}),
|
|
51
|
+
}),
|
|
52
|
+
};
|
|
48
53
|
|
|
49
|
-
const wayfinder = createWayfinderClient(
|
|
50
|
-
routingSettings: {
|
|
51
|
-
strategy: new FastestPingRoutingStrategy({ gatewaysProvider }),
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
+
const wayfinder = createWayfinderClient(options);
|
|
54
55
|
```
|
|
55
56
|
|
|
56
57
|
### Enable Verification
|
|
@@ -59,17 +60,17 @@ const wayfinder = createWayfinderClient({
|
|
|
59
60
|
import {
|
|
60
61
|
createWayfinderClient,
|
|
61
62
|
HashVerificationStrategy,
|
|
63
|
+
WayfinderFetchOptions,
|
|
62
64
|
} from '@ar.io/wayfinder-core';
|
|
63
65
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
66
|
+
const options: WayfinderFetchOptions = {
|
|
67
|
+
verificationStrategy: new HashVerificationStrategy({
|
|
68
|
+
trustedGateways: [new URL('https://permagate.io')],
|
|
69
|
+
}),
|
|
70
|
+
strict: true, // Fail requests on verification errors
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const wayfinder = createWayfinderClient(options);
|
|
73
74
|
```
|
|
74
75
|
|
|
75
76
|
Wayfinder Core provides helper functions to construct routing and verification strategies:
|
|
@@ -280,68 +281,66 @@ The `CompositeRoutingStrategy` allows you to chain multiple routing strategies t
|
|
|
280
281
|
|
|
281
282
|
```javascript
|
|
282
283
|
import {
|
|
284
|
+
createWayfinderClient,
|
|
283
285
|
CompositeRoutingStrategy,
|
|
284
286
|
FastestPingRoutingStrategy,
|
|
285
287
|
RandomRoutingStrategy,
|
|
286
288
|
StaticRoutingStrategy,
|
|
287
|
-
NetworkGatewaysProvider
|
|
289
|
+
NetworkGatewaysProvider,
|
|
288
290
|
} from '@ar.io/wayfinder-core';
|
|
289
291
|
import { ARIO } from '@ar.io/sdk';
|
|
290
292
|
|
|
291
293
|
// Example 1: Performance-first with resilience fallback
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
294
|
+
const performanceWayfinder = createWayfinderClient({
|
|
295
|
+
routingStrategy: new CompositeRoutingStrategy({
|
|
296
|
+
strategies: [
|
|
297
|
+
// Try fastest ping first (high performance, but may fail if all gateways are slow)
|
|
298
|
+
new FastestPingRoutingStrategy({
|
|
299
|
+
timeoutMs: 500,
|
|
300
|
+
gatewaysProvider: new NetworkGatewaysProvider({
|
|
301
|
+
ario: ARIO.mainnet(),
|
|
302
|
+
sortBy: 'operatorStake',
|
|
303
|
+
limit: 10,
|
|
304
|
+
}),
|
|
301
305
|
}),
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
// Fallback to random selection (guaranteed to work if gateways exist)
|
|
307
|
+
new RandomRoutingStrategy({
|
|
308
|
+
gatewaysProvider: new NetworkGatewaysProvider({
|
|
309
|
+
ario: ARIO.mainnet(),
|
|
310
|
+
sortBy: 'operatorStake',
|
|
311
|
+
limit: 20, // Use more gateways for fallback
|
|
312
|
+
}),
|
|
309
313
|
}),
|
|
310
|
-
|
|
311
|
-
|
|
314
|
+
],
|
|
315
|
+
}),
|
|
312
316
|
});
|
|
313
317
|
|
|
314
318
|
// Example 2: Preferred gateway with multi-tier fallback
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
// If that fails, try fastest ping from top-tier gateways
|
|
322
|
-
new FastestPingRoutingStrategy({
|
|
323
|
-
timeoutMs: 1000,
|
|
324
|
-
gatewaysProvider: new NetworkGatewaysProvider({
|
|
325
|
-
ario: ARIO.mainnet(),
|
|
326
|
-
sortBy: 'operatorStake',
|
|
327
|
-
limit: 5, // Only top 5 gateways
|
|
319
|
+
const preferredWayfinder = createWayfinderClient({
|
|
320
|
+
routingStrategy: new CompositeRoutingStrategy({
|
|
321
|
+
strategies: [
|
|
322
|
+
// First, try your preferred gateway
|
|
323
|
+
new StaticRoutingStrategy({
|
|
324
|
+
gateway: 'https://my-preferred-gateway.com'
|
|
328
325
|
}),
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
326
|
+
// If that fails, try fastest ping from top-tier gateways
|
|
327
|
+
new FastestPingRoutingStrategy({
|
|
328
|
+
timeoutMs: 1000,
|
|
329
|
+
gatewaysProvider: new NetworkGatewaysProvider({
|
|
330
|
+
ario: ARIO.mainnet(),
|
|
331
|
+
sortBy: 'operatorStake',
|
|
332
|
+
limit: 5, // Only top 5 gateways
|
|
333
|
+
}),
|
|
335
334
|
}),
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
//
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
},
|
|
335
|
+
// Final fallback: any random gateway from a larger pool
|
|
336
|
+
new RandomRoutingStrategy({
|
|
337
|
+
gatewaysProvider: new NetworkGatewaysProvider({
|
|
338
|
+
ario: ARIO.mainnet(),
|
|
339
|
+
limit: 50, // Larger pool for maximum availability
|
|
340
|
+
}),
|
|
341
|
+
}),
|
|
342
|
+
],
|
|
343
|
+
}),
|
|
345
344
|
});
|
|
346
345
|
```
|
|
347
346
|
|
|
@@ -349,10 +348,10 @@ const wayfinder = createWayfinderClient({
|
|
|
349
348
|
|
|
350
349
|
Wayfinder supports multiple data retrieval strategies to fetch transaction data from AR.IO gateways. These strategies determine how data is requested and assembled from the underlying storage layer.
|
|
351
350
|
|
|
352
|
-
| Strategy |
|
|
353
|
-
| --------------------------------- |
|
|
354
|
-
| `ContiguousDataRetrievalStrategy
|
|
355
|
-
| `ChunkDataRetrievalStrategy`
|
|
351
|
+
| Strategy | Use Case | Requirements |
|
|
352
|
+
| --------------------------------- | ------------------------------------------- | -------------------------------------- |
|
|
353
|
+
| `ContiguousDataRetrievalStrategy`| Standard data fetching via direct GET | Gateway has the data cached or able to fetch from trusted peers |
|
|
354
|
+
| `ChunkDataRetrievalStrategy` | Chunk-based data assembly | Gateway supports `/chunk/<offset>/data` endpoint (r58) and has requested transactions indexed |
|
|
356
355
|
|
|
357
356
|
#### ContiguousDataRetrievalStrategy
|
|
358
357
|
|
package/dist/client.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import type { GatewaysProvider, Logger, RoutingOption, RoutingStrategy, VerificationOption, VerificationStrategy, WayfinderOptions } from './types.js';
|
|
17
|
+
import type { GatewaysProvider, Logger, RoutingOption, RoutingStrategy, VerificationOption, VerificationStrategy, WayfinderFetchOptions, WayfinderOptions } from './types.js';
|
|
18
18
|
import { Wayfinder } from './wayfinder.js';
|
|
19
19
|
/**
|
|
20
20
|
* Helper function to construct a routing strategy
|
|
@@ -35,7 +35,10 @@ export declare const createVerificationStrategy: ({ strategy, logger, trustedGat
|
|
|
35
35
|
/**
|
|
36
36
|
* Creates a Wayfinder client with the specified configuration.
|
|
37
37
|
* Uses the trusted peers gateways provider with caching and random routing by default.
|
|
38
|
+
*
|
|
39
|
+
* @param options - Either WayfinderOptions or WayfinderFetchOptions configuration
|
|
40
|
+
* @returns A configured Wayfinder instance
|
|
38
41
|
*/
|
|
39
|
-
export declare function createWayfinderClient(options?: WayfinderOptions): Wayfinder;
|
|
42
|
+
export declare function createWayfinderClient(options?: WayfinderOptions | WayfinderFetchOptions): Wayfinder;
|
|
40
43
|
export declare const createWayfinder: typeof createWayfinderClient;
|
|
41
44
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAUH,OAAO,KAAK,EACV,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAUH,OAAO,KAAK,EACV,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI3C;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,yCAInC;IACD,QAAQ,EAAE,aAAa,CAAC;IACxB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG,eAuBH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,GAAI,wCAIxC;IACD,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;CACzB,KAAG,oBAQH,CAAC;AAqCF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,gBAAgB,GAAG,qBAA0B,GACrD,SAAS,CAqCX;AAED,eAAO,MAAM,eAAe,8BAAwB,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -23,6 +23,7 @@ import { PreferredWithFallbackRoutingStrategy } from './routing/preferred-with-f
|
|
|
23
23
|
import { RandomRoutingStrategy } from './routing/random.js';
|
|
24
24
|
import { RoundRobinRoutingStrategy } from './routing/round-robin.js';
|
|
25
25
|
import { isBrowser } from './utils/browser.js';
|
|
26
|
+
import { convertFetchOptionsToSettings, isWayfinderFetchOptions, } from './utils/config.js';
|
|
26
27
|
import { DataRootVerificationStrategy } from './verification/data-root-verification.js';
|
|
27
28
|
import { HashVerificationStrategy } from './verification/hash-verification.js';
|
|
28
29
|
import { RemoteVerificationStrategy } from './verification/remote-verification.js';
|
|
@@ -91,9 +92,16 @@ const createCachedGatewaysProvider = ({ logger, ttlSeconds = 300, gatewaysProvid
|
|
|
91
92
|
/**
|
|
92
93
|
* Creates a Wayfinder client with the specified configuration.
|
|
93
94
|
* Uses the trusted peers gateways provider with caching and random routing by default.
|
|
95
|
+
*
|
|
96
|
+
* @param options - Either WayfinderOptions or WayfinderFetchOptions configuration
|
|
97
|
+
* @returns A configured Wayfinder instance
|
|
94
98
|
*/
|
|
95
99
|
export function createWayfinderClient(options = {}) {
|
|
96
|
-
|
|
100
|
+
// Convert WayfinderFetchOptions to WayfinderOptions if needed
|
|
101
|
+
const wayfinderOptions = isWayfinderFetchOptions(options)
|
|
102
|
+
? convertFetchOptionsToSettings(options)
|
|
103
|
+
: options;
|
|
104
|
+
const { logger, fetch, routingSettings, verificationSettings, telemetrySettings, } = wayfinderOptions;
|
|
97
105
|
const resolvedLogger = logger ?? defaultLogger;
|
|
98
106
|
// If no routing settings provided, create default ones with cached gateways provider
|
|
99
107
|
const finalRoutingSettings = routingSettings ?? {
|
|
@@ -105,13 +113,14 @@ export function createWayfinderClient(options = {}) {
|
|
|
105
113
|
}),
|
|
106
114
|
};
|
|
107
115
|
// Create final options
|
|
108
|
-
const
|
|
116
|
+
const finalOptions = {
|
|
109
117
|
logger: resolvedLogger,
|
|
110
118
|
fetch,
|
|
111
119
|
routingSettings: finalRoutingSettings,
|
|
112
120
|
verificationSettings,
|
|
113
121
|
telemetrySettings,
|
|
122
|
+
dataRetrievalStrategy: wayfinderOptions.dataRetrievalStrategy,
|
|
114
123
|
};
|
|
115
|
-
return new Wayfinder(
|
|
124
|
+
return new Wayfinder(finalOptions);
|
|
116
125
|
}
|
|
117
126
|
export const createWayfinder = createWayfinderClient;
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
18
|
-
import { WayfinderEmitter } from '../emitter.js';
|
|
19
|
-
import type { DataRetrievalStrategy, Logger, RoutingStrategy, VerificationStrategy, WayfinderEvents, WayfinderRequestInit } from '../types.js';
|
|
17
|
+
import type { WayfinderFetchOptions, WayfinderRequestInit } from '../types.js';
|
|
20
18
|
/**
|
|
21
19
|
* Creates a wrapped fetch function that supports ar:// protocol
|
|
22
20
|
|
|
@@ -31,15 +29,5 @@ import type { DataRetrievalStrategy, Logger, RoutingStrategy, VerificationStrate
|
|
|
31
29
|
* @param events - Optional event handlers for wayfinder events
|
|
32
30
|
* @returns a wrapped fetch function that supports ar:// protocol and always returns Response
|
|
33
31
|
*/
|
|
34
|
-
export declare const createWayfinderFetch: ({ logger, strict, fetch, routingStrategy, dataRetrievalStrategy, verificationStrategy, emitter, tracer, events, }:
|
|
35
|
-
logger?: Logger;
|
|
36
|
-
verificationStrategy?: VerificationStrategy;
|
|
37
|
-
strict?: boolean;
|
|
38
|
-
routingStrategy?: RoutingStrategy;
|
|
39
|
-
dataRetrievalStrategy?: DataRetrievalStrategy;
|
|
40
|
-
emitter?: WayfinderEmitter;
|
|
41
|
-
tracer?: Tracer;
|
|
42
|
-
fetch?: typeof globalThis.fetch;
|
|
43
|
-
events?: WayfinderEvents;
|
|
44
|
-
}) => ((input: URL | RequestInfo, init?: WayfinderRequestInit) => Promise<Response>);
|
|
32
|
+
export declare const createWayfinderFetch: ({ logger, strict, fetch, routingStrategy, dataRetrievalStrategy, verificationStrategy, emitter, tracer, events, }: WayfinderFetchOptions) => ((input: URL | RequestInfo, init?: WayfinderRequestInit) => Promise<Response>);
|
|
45
33
|
//# sourceMappingURL=wayfinder-fetch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wayfinder-fetch.d.ts","sourceRoot":"","sources":["../../src/fetch/wayfinder-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"wayfinder-fetch.d.ts","sourceRoot":"","sources":["../../src/fetch/wayfinder-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAQH,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAS/E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,GAAI,mHAYlC,qBAAqB,KAAG,CAAC,CAC1B,KAAK,EAAE,GAAG,GAAG,WAAW,EACxB,IAAI,CAAC,EAAE,oBAAoB,KACxB,OAAO,CAAC,QAAQ,CAAC,CA0LrB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export * from './verification/data-root-verification.js';
|
|
|
31
31
|
export * from './verification/hash-verification.js';
|
|
32
32
|
export * from './verification/signature-verification.js';
|
|
33
33
|
export * from './verification/remote-verification.js';
|
|
34
|
+
export * from './retrieval/contiguous.js';
|
|
35
|
+
export * from './retrieval/chunk.js';
|
|
34
36
|
export * from './emitter.js';
|
|
35
37
|
export * from './client.js';
|
|
36
38
|
export { Wayfinder } from './wayfinder.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AAGvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAG5C,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AAGtD,cAAc,cAAc,CAAC;AAG7B,cAAc,aAAa,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AAGvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAG5C,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AAGtD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AAGrC,cAAc,cAAc,CAAC;AAG7B,cAAc,aAAa,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,9 @@ export * from './verification/data-root-verification.js';
|
|
|
35
35
|
export * from './verification/hash-verification.js';
|
|
36
36
|
export * from './verification/signature-verification.js';
|
|
37
37
|
export * from './verification/remote-verification.js';
|
|
38
|
+
// retrieval strategies
|
|
39
|
+
export * from './retrieval/contiguous.js';
|
|
40
|
+
export * from './retrieval/chunk.js';
|
|
38
41
|
// emitter
|
|
39
42
|
export * from './emitter.js';
|
|
40
43
|
// utility functions
|
package/dist/types.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
import type { Tracer } from '@opentelemetry/api';
|
|
17
18
|
import type { WayfinderEmitter } from './emitter.js';
|
|
18
19
|
/**
|
|
19
20
|
* This is an extension of the fetch function that allows for overriding the verification and routing settings for a single request.
|
|
@@ -168,6 +169,56 @@ export interface WayfinderOptions {
|
|
|
168
169
|
*/
|
|
169
170
|
dataRetrievalStrategy?: DataRetrievalStrategy;
|
|
170
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Configuration options that match createWayfinderFetch parameters.
|
|
174
|
+
* This type can be used to create a unified configuration for both
|
|
175
|
+
* createWayfinderClient and createWayfinderFetch.
|
|
176
|
+
*/
|
|
177
|
+
export type WayfinderFetchOptions = {
|
|
178
|
+
/**
|
|
179
|
+
* Logger to use for logging
|
|
180
|
+
* @default defaultLogger (standard console logger)
|
|
181
|
+
*/
|
|
182
|
+
logger?: Logger;
|
|
183
|
+
/**
|
|
184
|
+
* The verification strategy to use for verifying data integrity
|
|
185
|
+
*/
|
|
186
|
+
verificationStrategy?: VerificationStrategy;
|
|
187
|
+
/**
|
|
188
|
+
* Whether to enforce strict verification.
|
|
189
|
+
* If true, verification failures will cause requests to fail.
|
|
190
|
+
* If false, verification will be performed asynchronously with events emitted.
|
|
191
|
+
* @default false
|
|
192
|
+
*/
|
|
193
|
+
strict?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* The routing strategy to use for selecting gateways
|
|
196
|
+
* @default RandomRoutingStrategy
|
|
197
|
+
*/
|
|
198
|
+
routingStrategy?: RoutingStrategy;
|
|
199
|
+
/**
|
|
200
|
+
* The data retrieval strategy to use for fetching transaction data
|
|
201
|
+
* @default ContiguousDataRetrievalStrategy
|
|
202
|
+
*/
|
|
203
|
+
dataRetrievalStrategy?: DataRetrievalStrategy;
|
|
204
|
+
/**
|
|
205
|
+
* Event emitter for wayfinder events
|
|
206
|
+
*/
|
|
207
|
+
emitter?: WayfinderEmitter;
|
|
208
|
+
/**
|
|
209
|
+
* OpenTelemetry tracer for distributed tracing
|
|
210
|
+
*/
|
|
211
|
+
tracer?: Tracer;
|
|
212
|
+
/**
|
|
213
|
+
* Custom fetch implementation to use for making HTTP requests
|
|
214
|
+
* @default native fetch
|
|
215
|
+
*/
|
|
216
|
+
fetch?: typeof globalThis.fetch;
|
|
217
|
+
/**
|
|
218
|
+
* Event handlers for wayfinder events
|
|
219
|
+
*/
|
|
220
|
+
events?: WayfinderEvents;
|
|
221
|
+
};
|
|
171
222
|
export interface TelemetrySettings {
|
|
172
223
|
/** Enable or disable telemetry collection */
|
|
173
224
|
enabled: boolean;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIrD;;GAEG;AACH;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG;IAC/C,oBAAoB,CAAC,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IAChE,eAAe,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CACvD,CAAC;AAEF;;;GAGG;AACH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,KAAK,EAAE,GAAG,GAAG,WAAW,EACxB,IAAI,CAAC,EAAE,oBAAoB,KACxB,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,MAAM,cAAc,GAAG;IAC3B,iBAAiB,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,iBAAiB,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,mBAAmB,EAAE;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,gBAAgB,EAAE,KAAK,CAA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C;QAChC,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,QAAQ,GAAG,aAAa,CAAC,CAAC;CACvE;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,CAAC,EACN,OAAO,EACP,UAAU,EACV,OAAO,GACR,EAAE;QACD,OAAO,EAAE,GAAG,CAAC;QACb,UAAU,EAAE,GAAG,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACvB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WayFinder
|
|
3
|
+
* Copyright (C) 2022-2025 Permanent Data Solutions, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { WayfinderFetchOptions, WayfinderOptions } from '../types.js';
|
|
18
|
+
/**
|
|
19
|
+
* Converts WayfinderOptions to WayfinderFetchOptions for use with createWayfinderFetch
|
|
20
|
+
*
|
|
21
|
+
* @param options - WayfinderOptions configuration
|
|
22
|
+
* @returns WayfinderFetchOptions that can be used with createWayfinderFetch
|
|
23
|
+
*/
|
|
24
|
+
export declare function convertSettingsToFetchOptions(options: WayfinderOptions): WayfinderFetchOptions;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the options are WayfinderFetchOptions
|
|
27
|
+
*/
|
|
28
|
+
export declare function isWayfinderFetchOptions(options: WayfinderOptions | WayfinderFetchOptions): options is WayfinderFetchOptions;
|
|
29
|
+
/**
|
|
30
|
+
* Converts WayfinderFetchOptions to WayfinderOptions for use with Wayfinder constructor
|
|
31
|
+
*
|
|
32
|
+
* @param options - WayfinderFetchOptions configuration
|
|
33
|
+
* @returns WayfinderOptions that can be used with Wayfinder
|
|
34
|
+
*/
|
|
35
|
+
export declare function convertFetchOptionsToSettings(options: WayfinderFetchOptions): WayfinderOptions;
|
|
36
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE3E;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,gBAAgB,GACxB,qBAAqB,CA0BvB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,gBAAgB,GAAG,qBAAqB,GAChD,OAAO,IAAI,qBAAqB,CASlC;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,qBAAqB,GAC7B,gBAAgB,CAqClB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WayFinder
|
|
3
|
+
* Copyright (C) 2022-2025 Permanent Data Solutions, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Converts WayfinderOptions to WayfinderFetchOptions for use with createWayfinderFetch
|
|
19
|
+
*
|
|
20
|
+
* @param options - WayfinderOptions configuration
|
|
21
|
+
* @returns WayfinderFetchOptions that can be used with createWayfinderFetch
|
|
22
|
+
*/
|
|
23
|
+
export function convertSettingsToFetchOptions(options) {
|
|
24
|
+
const { logger, fetch, verificationSettings, routingSettings, dataRetrievalStrategy, } = options;
|
|
25
|
+
return {
|
|
26
|
+
logger,
|
|
27
|
+
fetch,
|
|
28
|
+
dataRetrievalStrategy,
|
|
29
|
+
// Extract verification settings
|
|
30
|
+
verificationStrategy: verificationSettings?.strategy,
|
|
31
|
+
strict: verificationSettings?.strict,
|
|
32
|
+
// Extract routing settings
|
|
33
|
+
routingStrategy: routingSettings?.strategy,
|
|
34
|
+
// Extract events from both settings
|
|
35
|
+
events: {
|
|
36
|
+
...(verificationSettings?.events || {}),
|
|
37
|
+
...(routingSettings?.events || {}),
|
|
38
|
+
},
|
|
39
|
+
// Note: emitter and tracer are not available in WayfinderOptions
|
|
40
|
+
// They would need to be provided separately if needed
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Checks if the options are WayfinderFetchOptions
|
|
45
|
+
*/
|
|
46
|
+
export function isWayfinderFetchOptions(options) {
|
|
47
|
+
return ('verificationStrategy' in options ||
|
|
48
|
+
'routingStrategy' in options ||
|
|
49
|
+
'strict' in options ||
|
|
50
|
+
'emitter' in options ||
|
|
51
|
+
'tracer' in options ||
|
|
52
|
+
'events' in options);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Converts WayfinderFetchOptions to WayfinderOptions for use with Wayfinder constructor
|
|
56
|
+
*
|
|
57
|
+
* @param options - WayfinderFetchOptions configuration
|
|
58
|
+
* @returns WayfinderOptions that can be used with Wayfinder
|
|
59
|
+
*/
|
|
60
|
+
export function convertFetchOptionsToSettings(options) {
|
|
61
|
+
const { logger, fetch, dataRetrievalStrategy, verificationStrategy, strict, routingStrategy, events,
|
|
62
|
+
// Note: emitter and tracer are not part of WayfinderOptions
|
|
63
|
+
} = options;
|
|
64
|
+
const result = {
|
|
65
|
+
logger,
|
|
66
|
+
fetch,
|
|
67
|
+
dataRetrievalStrategy,
|
|
68
|
+
};
|
|
69
|
+
// Convert verification settings if any verification-related options are present
|
|
70
|
+
if (verificationStrategy || strict !== undefined || events) {
|
|
71
|
+
result.verificationSettings = {
|
|
72
|
+
enabled: !!verificationStrategy,
|
|
73
|
+
strategy: verificationStrategy,
|
|
74
|
+
strict,
|
|
75
|
+
events,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Convert routing settings if any routing-related options are present
|
|
79
|
+
if (routingStrategy || events) {
|
|
80
|
+
result.routingSettings = {
|
|
81
|
+
strategy: routingStrategy,
|
|
82
|
+
events,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
export declare const WAYFINDER_CORE_VERSION = "v1.8.
|
|
17
|
+
export declare const WAYFINDER_CORE_VERSION = "v1.8.1";
|
|
18
18
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED