@webacy-xyz/sdk-core 1.0.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.
Files changed (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +96 -0
  3. package/dist/cjs/client-base.js +134 -0
  4. package/dist/cjs/client-base.js.map +1 -0
  5. package/dist/cjs/config.js +30 -0
  6. package/dist/cjs/config.js.map +1 -0
  7. package/dist/cjs/errors/authentication.js +35 -0
  8. package/dist/cjs/errors/authentication.js.map +1 -0
  9. package/dist/cjs/errors/base.js +76 -0
  10. package/dist/cjs/errors/base.js.map +1 -0
  11. package/dist/cjs/errors/index.js +16 -0
  12. package/dist/cjs/errors/index.js.map +1 -0
  13. package/dist/cjs/errors/network.js +45 -0
  14. package/dist/cjs/errors/network.js.map +1 -0
  15. package/dist/cjs/errors/not-found.js +38 -0
  16. package/dist/cjs/errors/not-found.js.map +1 -0
  17. package/dist/cjs/errors/rate-limit.js +53 -0
  18. package/dist/cjs/errors/rate-limit.js.map +1 -0
  19. package/dist/cjs/errors/validation.js +49 -0
  20. package/dist/cjs/errors/validation.js.map +1 -0
  21. package/dist/cjs/http/client.js +393 -0
  22. package/dist/cjs/http/client.js.map +1 -0
  23. package/dist/cjs/http/index.js +11 -0
  24. package/dist/cjs/http/index.js.map +1 -0
  25. package/dist/cjs/http/retry.js +43 -0
  26. package/dist/cjs/http/retry.js.map +1 -0
  27. package/dist/cjs/index.js +52 -0
  28. package/dist/cjs/index.js.map +1 -0
  29. package/dist/cjs/package.json +1 -0
  30. package/dist/cjs/resources/base.js +43 -0
  31. package/dist/cjs/resources/base.js.map +1 -0
  32. package/dist/cjs/resources/index.js +6 -0
  33. package/dist/cjs/resources/index.js.map +1 -0
  34. package/dist/cjs/types/chain.js +114 -0
  35. package/dist/cjs/types/chain.js.map +1 -0
  36. package/dist/cjs/types/common.js +49 -0
  37. package/dist/cjs/types/common.js.map +1 -0
  38. package/dist/cjs/types/index.js +18 -0
  39. package/dist/cjs/types/index.js.map +1 -0
  40. package/dist/cjs/types/modules.js +64 -0
  41. package/dist/cjs/types/modules.js.map +1 -0
  42. package/dist/cjs/utils/address-validation.js +124 -0
  43. package/dist/cjs/utils/address-validation.js.map +1 -0
  44. package/dist/cjs/utils/index.js +16 -0
  45. package/dist/cjs/utils/index.js.map +1 -0
  46. package/dist/cjs/utils/url-validation.js +31 -0
  47. package/dist/cjs/utils/url-validation.js.map +1 -0
  48. package/dist/esm/client-base.js +130 -0
  49. package/dist/esm/client-base.js.map +1 -0
  50. package/dist/esm/config.js +26 -0
  51. package/dist/esm/config.js.map +1 -0
  52. package/dist/esm/errors/authentication.js +31 -0
  53. package/dist/esm/errors/authentication.js.map +1 -0
  54. package/dist/esm/errors/base.js +72 -0
  55. package/dist/esm/errors/base.js.map +1 -0
  56. package/dist/esm/errors/index.js +7 -0
  57. package/dist/esm/errors/index.js.map +1 -0
  58. package/dist/esm/errors/network.js +41 -0
  59. package/dist/esm/errors/network.js.map +1 -0
  60. package/dist/esm/errors/not-found.js +34 -0
  61. package/dist/esm/errors/not-found.js.map +1 -0
  62. package/dist/esm/errors/rate-limit.js +49 -0
  63. package/dist/esm/errors/rate-limit.js.map +1 -0
  64. package/dist/esm/errors/validation.js +45 -0
  65. package/dist/esm/errors/validation.js.map +1 -0
  66. package/dist/esm/http/client.js +389 -0
  67. package/dist/esm/http/client.js.map +1 -0
  68. package/dist/esm/http/index.js +3 -0
  69. package/dist/esm/http/index.js.map +1 -0
  70. package/dist/esm/http/retry.js +37 -0
  71. package/dist/esm/http/retry.js.map +1 -0
  72. package/dist/esm/index.js +15 -0
  73. package/dist/esm/index.js.map +1 -0
  74. package/dist/esm/package.json +1 -0
  75. package/dist/esm/resources/base.js +39 -0
  76. package/dist/esm/resources/base.js.map +1 -0
  77. package/dist/esm/resources/index.js +2 -0
  78. package/dist/esm/resources/index.js.map +1 -0
  79. package/dist/esm/types/chain.js +109 -0
  80. package/dist/esm/types/chain.js.map +1 -0
  81. package/dist/esm/types/common.js +46 -0
  82. package/dist/esm/types/common.js.map +1 -0
  83. package/dist/esm/types/index.js +4 -0
  84. package/dist/esm/types/index.js.map +1 -0
  85. package/dist/esm/types/modules.js +61 -0
  86. package/dist/esm/types/modules.js.map +1 -0
  87. package/dist/esm/utils/address-validation.js +113 -0
  88. package/dist/esm/utils/address-validation.js.map +1 -0
  89. package/dist/esm/utils/index.js +3 -0
  90. package/dist/esm/utils/index.js.map +1 -0
  91. package/dist/esm/utils/url-validation.js +28 -0
  92. package/dist/esm/utils/url-validation.js.map +1 -0
  93. package/dist/types/client-base.d.ts +90 -0
  94. package/dist/types/client-base.d.ts.map +1 -0
  95. package/dist/types/config.d.ts +124 -0
  96. package/dist/types/config.d.ts.map +1 -0
  97. package/dist/types/errors/authentication.d.ts +24 -0
  98. package/dist/types/errors/authentication.d.ts.map +1 -0
  99. package/dist/types/errors/base.d.ts +53 -0
  100. package/dist/types/errors/base.d.ts.map +1 -0
  101. package/dist/types/errors/index.d.ts +7 -0
  102. package/dist/types/errors/index.d.ts.map +1 -0
  103. package/dist/types/errors/network.d.ts +30 -0
  104. package/dist/types/errors/network.d.ts.map +1 -0
  105. package/dist/types/errors/not-found.d.ts +27 -0
  106. package/dist/types/errors/not-found.d.ts.map +1 -0
  107. package/dist/types/errors/rate-limit.d.ts +37 -0
  108. package/dist/types/errors/rate-limit.d.ts.map +1 -0
  109. package/dist/types/errors/validation.d.ts +34 -0
  110. package/dist/types/errors/validation.d.ts.map +1 -0
  111. package/dist/types/http/client.d.ts +160 -0
  112. package/dist/types/http/client.d.ts.map +1 -0
  113. package/dist/types/http/index.d.ts +3 -0
  114. package/dist/types/http/index.d.ts.map +1 -0
  115. package/dist/types/http/retry.d.ts +32 -0
  116. package/dist/types/http/retry.d.ts.map +1 -0
  117. package/dist/types/index.d.ts +8 -0
  118. package/dist/types/index.d.ts.map +1 -0
  119. package/dist/types/resources/base.d.ts +26 -0
  120. package/dist/types/resources/base.d.ts.map +1 -0
  121. package/dist/types/resources/index.d.ts +2 -0
  122. package/dist/types/resources/index.d.ts.map +1 -0
  123. package/dist/types/types/chain.d.ts +60 -0
  124. package/dist/types/types/chain.d.ts.map +1 -0
  125. package/dist/types/types/common.d.ts +251 -0
  126. package/dist/types/types/common.d.ts.map +1 -0
  127. package/dist/types/types/index.d.ts +5 -0
  128. package/dist/types/types/index.d.ts.map +1 -0
  129. package/dist/types/types/modules.d.ts +51 -0
  130. package/dist/types/types/modules.d.ts.map +1 -0
  131. package/dist/types/utils/address-validation.d.ts +50 -0
  132. package/dist/types/utils/address-validation.d.ts.map +1 -0
  133. package/dist/types/utils/index.d.ts +3 -0
  134. package/dist/types/utils/index.d.ts.map +1 -0
  135. package/dist/types/utils/url-validation.d.ts +16 -0
  136. package/dist/types/utils/url-validation.d.ts.map +1 -0
  137. package/package.json +64 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-base.d.ts","sourceRoot":"","sources":["../../src/client-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAgC,MAAM,UAAU,CAAC;AAC5E,OAAO,EACL,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;;GAKG;AACH,8BAAsB,UAAU;IAC9B,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAC1C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CACjC,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC,CAC/D,GACC,kBAAkB,CAAC;IAErB;;OAEG;IACH,SAAgB,YAAY,CAAC,EAAE,KAAK,CAAC;gBAEzB,MAAM,EAAE,kBAAkB;IA2BtC;;;;;;;;;;;;;OAaG;IACH,qBAAqB,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI;IAI5D;;;;;;;;;;;;;OAaG;IACH,sBAAsB,CAAC,WAAW,EAAE,mBAAmB,GAAG,IAAI;IAI9D;;;;;;;;;;;;;;;OAeG;IACH,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI;IAIxD;;OAEG;IACH,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAOlF;;OAEG;IACH,SAAS,CAAC,IAAI,CAAC,CAAC,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAO3B;;OAEG;IACH,SAAS,CAAC,GAAG,CAAC,CAAC,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAO3B;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAMtF;AAED;;GAEG;AACH,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
@@ -0,0 +1,124 @@
1
+ import { RetryConfig } from './http/retry';
2
+ /**
3
+ * Debug mode options
4
+ */
5
+ export type DebugMode = boolean | 'requests' | 'responses' | 'errors' | 'all';
6
+ /**
7
+ * Logger interface for custom logging implementations
8
+ */
9
+ export interface Logger {
10
+ debug(message: string, data?: unknown): void;
11
+ info(message: string, data?: unknown): void;
12
+ warn(message: string, data?: unknown): void;
13
+ error(message: string, data?: unknown): void;
14
+ }
15
+ /**
16
+ * Default console logger implementation
17
+ */
18
+ export declare const defaultLogger: Logger;
19
+ /**
20
+ * Webacy client configuration options
21
+ */
22
+ export interface WebacyClientConfig {
23
+ /**
24
+ * Your Webacy API key
25
+ * @required
26
+ */
27
+ apiKey: string;
28
+ /**
29
+ * Base URL for the API
30
+ * @default 'https://api.webacy.com'
31
+ */
32
+ baseUrl?: string;
33
+ /**
34
+ * API version to use
35
+ * @default 'v2'
36
+ */
37
+ apiVersion?: string;
38
+ /**
39
+ * Default request timeout in milliseconds
40
+ * @default 30000
41
+ */
42
+ timeout?: number;
43
+ /**
44
+ * Retry configuration for failed requests
45
+ */
46
+ retry?: Partial<RetryConfig>;
47
+ /**
48
+ * Custom headers to include with all requests
49
+ */
50
+ headers?: Record<string, string>;
51
+ /**
52
+ * Enable debug logging
53
+ *
54
+ * - `true` or `'all'`: Log requests, responses, and errors
55
+ * - `'requests'`: Log only outgoing requests
56
+ * - `'responses'`: Log only incoming responses
57
+ * - `'errors'`: Log only errors
58
+ * - `false`: Disable logging (default)
59
+ *
60
+ * @default false
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const client = new WebacyClient({
65
+ * apiKey: 'your-api-key',
66
+ * debug: true, // Enable full debug logging
67
+ * });
68
+ * ```
69
+ */
70
+ debug?: DebugMode;
71
+ /**
72
+ * Custom logger instance
73
+ *
74
+ * Provide your own logger implementation (e.g., winston, pino)
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * import pino from 'pino';
79
+ *
80
+ * const client = new WebacyClient({
81
+ * apiKey: 'your-api-key',
82
+ * debug: true,
83
+ * logger: pino({ level: 'debug' }),
84
+ * });
85
+ * ```
86
+ */
87
+ logger?: Logger;
88
+ /**
89
+ * Default blockchain to use when chain is not specified
90
+ *
91
+ * When set, you can omit the `chain` parameter on API calls
92
+ * and this chain will be used automatically.
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * import { Chain } from '@webacy-xyz/sdk';
97
+ *
98
+ * const client = new WebacyClient({
99
+ * apiKey: 'your-api-key',
100
+ * defaultChain: Chain.ETH,
101
+ * });
102
+ *
103
+ * // No need to specify chain - uses ETH by default
104
+ * const risk = await client.threat.addresses.analyze('0x...');
105
+ *
106
+ * // Can still override for specific calls
107
+ * const solRisk = await client.threat.addresses.analyze('...', { chain: Chain.SOL });
108
+ * ```
109
+ */
110
+ defaultChain?: import('./types').Chain;
111
+ }
112
+ /**
113
+ * Default API configuration
114
+ */
115
+ export declare const DEFAULT_CONFIG: {
116
+ readonly baseUrl: "https://api.webacy.com";
117
+ readonly apiVersion: "v2";
118
+ readonly timeout: 30000;
119
+ };
120
+ /**
121
+ * Build the full base URL from configuration
122
+ */
123
+ export declare function buildBaseUrl(config: WebacyClientConfig): string;
124
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9C;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAK3B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAE7B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,YAAY,CAAC,EAAE,OAAO,SAAS,EAAE,KAAK,CAAC;CACxC;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAI/D"}
@@ -0,0 +1,24 @@
1
+ import { WebacyError } from './base';
2
+ /**
3
+ * Thrown when API key is invalid or missing
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * try {
8
+ * await client.addresses.analyze(address, { chain: Chain.ETH });
9
+ * } catch (error) {
10
+ * if (error instanceof AuthenticationError) {
11
+ * console.error('Authentication failed:', error.message);
12
+ * console.error('Suggestion:', error.getRecoverySuggestion());
13
+ * }
14
+ * }
15
+ * ```
16
+ */
17
+ export declare class AuthenticationError extends WebacyError {
18
+ constructor(message?: string, options?: {
19
+ requestId?: string;
20
+ endpoint?: string;
21
+ });
22
+ getRecoverySuggestion(): string;
23
+ }
24
+ //# sourceMappingURL=authentication.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../src/errors/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;gBAEhD,OAAO,SAA+B,EACtC,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO;IAWhD,qBAAqB,IAAI,MAAM;CAGzC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Base error class for all Webacy SDK errors
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * try {
7
+ * await client.addresses.analyze(address, { chain: Chain.ETH });
8
+ * } catch (error) {
9
+ * if (error instanceof WebacyError) {
10
+ * console.error(`Error: ${error.message}`);
11
+ * console.error(`Code: ${error.code}`);
12
+ * if (error.endpoint) {
13
+ * console.error(`Endpoint: ${error.endpoint}`);
14
+ * }
15
+ * if (error.requestId) {
16
+ * console.error(`Request ID: ${error.requestId} (include this when contacting support)`);
17
+ * }
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ export declare class WebacyError extends Error {
23
+ /** HTTP status code if applicable */
24
+ readonly status?: number;
25
+ /** Error code for programmatic handling */
26
+ readonly code: string;
27
+ /** Original error if wrapped */
28
+ readonly cause?: Error;
29
+ /** Request ID for support inquiries */
30
+ readonly requestId?: string;
31
+ /** API endpoint that failed (for debugging) */
32
+ readonly endpoint?: string;
33
+ constructor(message: string, options: {
34
+ status?: number;
35
+ code: string;
36
+ cause?: Error;
37
+ requestId?: string;
38
+ endpoint?: string;
39
+ });
40
+ /**
41
+ * Check if this error is retryable
42
+ */
43
+ isRetryable(): boolean;
44
+ /**
45
+ * Convert to JSON for logging
46
+ */
47
+ toJSON(): Record<string, unknown>;
48
+ /**
49
+ * Get a user-friendly description of how to resolve this error
50
+ */
51
+ getRecoverySuggestion(): string | undefined;
52
+ }
53
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/errors/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,qCAAqC;IACrC,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhC,2CAA2C;IAC3C,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B,gCAAgC;IAChC,SAAgB,KAAK,CAAC,EAAE,KAAK,CAAC;IAE9B,uCAAuC;IACvC,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnC,+CAA+C;IAC/C,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAGhC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IAgBH;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAWjC;;OAEG;IACH,qBAAqB,IAAI,MAAM,GAAG,SAAS;CAG5C"}
@@ -0,0 +1,7 @@
1
+ export { WebacyError } from './base';
2
+ export { AuthenticationError } from './authentication';
3
+ export { RateLimitError } from './rate-limit';
4
+ export { ValidationError } from './validation';
5
+ export { NotFoundError } from './not-found';
6
+ export { NetworkError } from './network';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { WebacyError } from './base';
2
+ /**
3
+ * Thrown when a network error occurs
4
+ *
5
+ * This includes timeouts, connection failures, and other transport-level errors.
6
+ * The SDK automatically retries network errors with exponential backoff.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * try {
11
+ * await client.addresses.analyze(address, { chain: Chain.ETH });
12
+ * } catch (error) {
13
+ * if (error instanceof NetworkError) {
14
+ * console.error('Network error:', error.message);
15
+ * if (error.cause) {
16
+ * console.error('Cause:', error.cause.message);
17
+ * }
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ export declare class NetworkError extends WebacyError {
23
+ constructor(message?: string, options?: {
24
+ cause?: Error;
25
+ endpoint?: string;
26
+ });
27
+ isRetryable(): boolean;
28
+ getRecoverySuggestion(): string;
29
+ }
30
+ //# sourceMappingURL=network.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../src/errors/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,YAAa,SAAQ,WAAW;gBAEzC,OAAO,SAA2B,EAClC,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO;IAU3C,WAAW,IAAI,OAAO;IAItB,qBAAqB,IAAI,MAAM;CAMzC"}
@@ -0,0 +1,27 @@
1
+ import { WebacyError } from './base';
2
+ /**
3
+ * Thrown when a resource is not found
4
+ *
5
+ * This typically means the address or resource doesn't exist on the specified chain,
6
+ * or hasn't been indexed yet.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * try {
11
+ * await client.addresses.analyze(address, { chain: Chain.ETH });
12
+ * } catch (error) {
13
+ * if (error instanceof NotFoundError) {
14
+ * console.error('Resource not found:', error.message);
15
+ * // The address may not exist or may not have any activity
16
+ * }
17
+ * }
18
+ * ```
19
+ */
20
+ export declare class NotFoundError extends WebacyError {
21
+ constructor(message?: string, options?: {
22
+ requestId?: string;
23
+ endpoint?: string;
24
+ });
25
+ getRecoverySuggestion(): string;
26
+ }
27
+ //# sourceMappingURL=not-found.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-found.d.ts","sourceRoot":"","sources":["../../../src/errors/not-found.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAc,SAAQ,WAAW;gBAE1C,OAAO,SAAuB,EAC9B,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO;IAWhD,qBAAqB,IAAI,MAAM;CAGzC"}
@@ -0,0 +1,37 @@
1
+ import { WebacyError } from './base';
2
+ /**
3
+ * Thrown when rate limit is exceeded
4
+ *
5
+ * The SDK automatically retries rate-limited requests with exponential backoff.
6
+ * If you're seeing this error frequently, consider reducing request frequency
7
+ * or upgrading your API plan.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * try {
12
+ * await client.addresses.analyze(address, { chain: Chain.ETH });
13
+ * } catch (error) {
14
+ * if (error instanceof RateLimitError) {
15
+ * console.error('Rate limited:', error.message);
16
+ * if (error.retryAfter) {
17
+ * console.log(`Retry after ${error.retryAfter} seconds`);
18
+ * }
19
+ * }
20
+ * }
21
+ * ```
22
+ */
23
+ export declare class RateLimitError extends WebacyError {
24
+ /** When the rate limit resets (Unix timestamp) */
25
+ readonly resetAt?: number;
26
+ /** Number of seconds until reset */
27
+ readonly retryAfter?: number;
28
+ constructor(message?: string, options?: {
29
+ resetAt?: number;
30
+ retryAfter?: number;
31
+ requestId?: string;
32
+ endpoint?: string;
33
+ });
34
+ isRetryable(): boolean;
35
+ getRecoverySuggestion(): string;
36
+ }
37
+ //# sourceMappingURL=rate-limit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../../src/errors/rate-limit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,kDAAkD;IAClD,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjC,oCAAoC;IACpC,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAGlC,OAAO,SAAwB,EAC/B,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO;IAavF,WAAW,IAAI,OAAO;IAItB,qBAAqB,IAAI,MAAM;CAMzC"}
@@ -0,0 +1,34 @@
1
+ import { WebacyError } from './base';
2
+ /**
3
+ * Thrown when request validation fails
4
+ *
5
+ * This error occurs when the provided input doesn't meet the API requirements.
6
+ * Common causes include invalid addresses, unsupported chains, or missing parameters.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * try {
11
+ * await client.addresses.analyze(address, { chain: Chain.ETH });
12
+ * } catch (error) {
13
+ * if (error instanceof ValidationError) {
14
+ * console.error('Validation failed:', error.message);
15
+ * if (error.errors) {
16
+ * for (const [field, messages] of Object.entries(error.errors)) {
17
+ * console.error(` ${field}: ${messages.join(', ')}`);
18
+ * }
19
+ * }
20
+ * }
21
+ * }
22
+ * ```
23
+ */
24
+ export declare class ValidationError extends WebacyError {
25
+ /** Field-level validation errors */
26
+ readonly errors?: Record<string, string[]>;
27
+ constructor(message?: string, options?: {
28
+ errors?: Record<string, string[]>;
29
+ requestId?: string;
30
+ endpoint?: string;
31
+ });
32
+ getRecoverySuggestion(): string;
33
+ }
34
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/errors/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,oCAAoC;IACpC,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;gBAGhD,OAAO,SAAsB,EAC7B,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO;IAYnF,qBAAqB,IAAI,MAAM;CAOzC"}
@@ -0,0 +1,160 @@
1
+ import { WebacyError } from '../errors';
2
+ import { RetryConfig } from './retry';
3
+ import { DebugMode, Logger } from '../config';
4
+ /**
5
+ * HTTP request configuration
6
+ */
7
+ export interface HttpRequestConfig {
8
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
9
+ headers?: Record<string, string>;
10
+ body?: unknown;
11
+ timeout?: number;
12
+ signal?: AbortSignal;
13
+ }
14
+ /**
15
+ * HTTP response wrapper
16
+ */
17
+ export interface HttpResponse<T = unknown> {
18
+ data: T;
19
+ status: number;
20
+ headers: Headers;
21
+ requestId?: string;
22
+ }
23
+ /**
24
+ * Request interceptor function
25
+ */
26
+ export type RequestInterceptor = (url: string, config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>;
27
+ /**
28
+ * Response interceptor function
29
+ */
30
+ export type ResponseInterceptor<T = unknown> = (response: HttpResponse<T>) => HttpResponse<T> | Promise<HttpResponse<T>>;
31
+ /**
32
+ * Error interceptor function
33
+ */
34
+ export type ErrorInterceptor = (error: WebacyError) => WebacyError | Promise<WebacyError>;
35
+ /**
36
+ * HTTP client configuration
37
+ */
38
+ export interface HttpClientConfig {
39
+ /** Base URL for all requests */
40
+ baseUrl: string;
41
+ /** Default headers for all requests */
42
+ headers?: Record<string, string>;
43
+ /** Default timeout in milliseconds */
44
+ timeout?: number;
45
+ /** Retry configuration */
46
+ retry?: Partial<RetryConfig>;
47
+ /** Debug mode for logging */
48
+ debug?: DebugMode;
49
+ /** Custom logger instance */
50
+ logger?: Logger;
51
+ }
52
+ /**
53
+ * HTTP client with retry support and interceptors
54
+ */
55
+ export declare class HttpClient {
56
+ private readonly baseUrl;
57
+ private readonly defaultHeaders;
58
+ private readonly defaultTimeout;
59
+ private readonly retryConfig;
60
+ private readonly requestInterceptors;
61
+ private readonly responseInterceptors;
62
+ private readonly errorInterceptors;
63
+ private readonly debug;
64
+ private readonly logger;
65
+ constructor(config: HttpClientConfig);
66
+ /**
67
+ * Check if request logging is enabled
68
+ */
69
+ private shouldLogRequests;
70
+ /**
71
+ * Check if response logging is enabled
72
+ */
73
+ private shouldLogResponses;
74
+ /**
75
+ * Check if error logging is enabled
76
+ */
77
+ private shouldLogErrors;
78
+ /**
79
+ * Log a request
80
+ */
81
+ private logRequest;
82
+ /**
83
+ * Log a response
84
+ */
85
+ private logResponse;
86
+ /**
87
+ * Log an error
88
+ */
89
+ private logError;
90
+ /**
91
+ * Sanitize request body for logging (remove sensitive data)
92
+ * Recursively processes nested objects and arrays
93
+ */
94
+ private sanitizeBody;
95
+ /**
96
+ * Add a request interceptor
97
+ */
98
+ addRequestInterceptor(interceptor: RequestInterceptor): void;
99
+ /**
100
+ * Add a response interceptor
101
+ */
102
+ addResponseInterceptor(interceptor: ResponseInterceptor): void;
103
+ /**
104
+ * Add an error interceptor
105
+ */
106
+ addErrorInterceptor(interceptor: ErrorInterceptor): void;
107
+ /**
108
+ * Make a GET request
109
+ */
110
+ get<T>(path: string, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
111
+ /**
112
+ * Make a POST request
113
+ */
114
+ post<T>(path: string, body?: unknown, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
115
+ /**
116
+ * Make a PUT request
117
+ */
118
+ put<T>(path: string, body?: unknown, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
119
+ /**
120
+ * Make a PATCH request
121
+ */
122
+ patch<T>(path: string, body?: unknown, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
123
+ /**
124
+ * Make a DELETE request
125
+ */
126
+ delete<T>(path: string, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
127
+ /**
128
+ * Make an HTTP request with retry support
129
+ */
130
+ private request;
131
+ /**
132
+ * Execute a single HTTP request
133
+ */
134
+ private executeRequest;
135
+ /**
136
+ * Create an appropriate error from an HTTP response
137
+ */
138
+ private createErrorFromResponse;
139
+ /**
140
+ * Wrap an unknown error in a WebacyError
141
+ */
142
+ private wrapError;
143
+ /**
144
+ * Parse and validate Retry-After header value
145
+ *
146
+ * Handles edge cases:
147
+ * - NaN from non-numeric strings (e.g., HTTP-date format)
148
+ * - Negative values
149
+ * - Extremely large values (capped at 5 minutes)
150
+ *
151
+ * @param value - Raw header value
152
+ * @returns Validated retry delay in seconds, or undefined if invalid
153
+ */
154
+ private parseRetryAfter;
155
+ /**
156
+ * Combine multiple abort signals
157
+ */
158
+ private combineAbortSignals;
159
+ }
160
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/http/client.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ export { HttpClient, type HttpClientConfig, type HttpRequestConfig, type HttpResponse, type RequestInterceptor, type ResponseInterceptor, type ErrorInterceptor, } from './client';
2
+ export { type RetryConfig, DEFAULT_RETRY_CONFIG, calculateRetryDelay, isRetryableStatusCode, sleep, } from './retry';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,KAAK,WAAW,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,GACN,MAAM,SAAS,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Retry configuration options
3
+ */
4
+ export interface RetryConfig {
5
+ /** Maximum number of retry attempts */
6
+ maxRetries: number;
7
+ /** Initial delay between retries in milliseconds */
8
+ initialDelay: number;
9
+ /** Maximum delay between retries in milliseconds */
10
+ maxDelay: number;
11
+ /** Multiplier for exponential backoff */
12
+ backoffMultiplier: number;
13
+ /** HTTP status codes that should trigger a retry */
14
+ retryableStatusCodes: number[];
15
+ }
16
+ /**
17
+ * Default retry configuration
18
+ */
19
+ export declare const DEFAULT_RETRY_CONFIG: RetryConfig;
20
+ /**
21
+ * Calculate delay for a retry attempt using exponential backoff with jitter
22
+ */
23
+ export declare function calculateRetryDelay(attempt: number, config: RetryConfig, retryAfter?: number): number;
24
+ /**
25
+ * Check if a status code is retryable
26
+ */
27
+ export declare function isRetryableStatusCode(statusCode: number, config: RetryConfig): boolean;
28
+ /**
29
+ * Sleep for a given number of milliseconds
30
+ */
31
+ export declare function sleep(ms: number): Promise<void>;
32
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/http/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAMlC,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CAYR;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAEtF;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C"}
@@ -0,0 +1,8 @@
1
+ export { WebacyClientConfig, DEFAULT_CONFIG, buildBaseUrl, type DebugMode, type Logger, defaultLogger, } from './config';
2
+ export { BaseClient } from './client-base';
3
+ export { BaseResource } from './resources';
4
+ export { HttpClient, type HttpClientConfig, type HttpRequestConfig, type HttpResponse, type RequestInterceptor, type ResponseInterceptor, type ErrorInterceptor, type RetryConfig, DEFAULT_RETRY_CONFIG, } from './http';
5
+ export { WebacyError, AuthenticationError, RateLimitError, ValidationError, NotFoundError, NetworkError, } from './errors';
6
+ export { Chain, ChainCompatibility, getChainCompatibility, isEvmChain, CHAIN_IDS, CHAIN_NAMES, RiskModule, RiskScore, RiskLevel, TypeOfAddress, TokenStandard, type RiskTag, type InformationalTag, type RiskCategory, type ConsolidatedRiskResult, type OwnershipDistribution, type TopHolder, type AddressLabelInfo, type LiquidityPoolData, type LpHolder, type TokenMetadata, type TokenLinks, type BuySellTaxes, type RequestOptions, type PaginationOptions, type PaginatedResponse, } from './types';
7
+ export { isValidAddress, isValidEvmAddress, isValidSolanaAddress, isValidBitcoinAddress, isValidTonAddress, isValidSuiAddress, isValidStellarAddress, normalizeAddress, normalizeEvmAddress, isValidUrl, } from './utils';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,MAAM,EACX,aAAa,GACd,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,oBAAoB,GACrB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACT,aAAa,EACb,aAAa,EACb,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,GACX,MAAM,SAAS,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { HttpClient } from '../http';
2
+ import { Chain } from '../types';
3
+ /**
4
+ * Base class for API resources
5
+ *
6
+ * Provides common functionality for chain resolution and address validation
7
+ * that is shared across all resource implementations.
8
+ */
9
+ export declare abstract class BaseResource {
10
+ protected readonly httpClient: HttpClient;
11
+ protected readonly defaultChain?: Chain | undefined;
12
+ constructor(httpClient: HttpClient, defaultChain?: Chain | undefined);
13
+ /**
14
+ * Resolve the chain to use for a request
15
+ * @throws ValidationError if no chain is specified and no default is set
16
+ */
17
+ protected resolveChain(options?: {
18
+ chain?: Chain;
19
+ }): Chain;
20
+ /**
21
+ * Validate address format for the given chain
22
+ * @throws ValidationError if address format is invalid for the chain
23
+ */
24
+ protected validateAddress(address: string, chain: Chain): void;
25
+ }
26
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/resources/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,KAAK,EAAe,MAAM,UAAU,CAAC;AAG9C;;;;;GAKG;AACH,8BAAsB,YAAY;IAE9B,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU;IACzC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK;gBADpB,UAAU,EAAE,UAAU,EACtB,YAAY,CAAC,EAAE,KAAK,YAAA;IAGzC;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,GAAG,KAAK;IAU1D;;;OAGG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;CAQ/D"}
@@ -0,0 +1,2 @@
1
+ export { BaseResource } from './base';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC"}