idxs 0.0.0 → 0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # idxs
2
+
3
+ TypeScript Interface for [Index Supply](https://indexsupply.net).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm i idxs
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### `IndexSupply`
14
+
15
+ Instantiate and use the `IndexSupply` client to fetch data from the Index Supply API.
16
+
17
+ ```ts
18
+ import { IndexSupply } from 'idxs'
19
+
20
+ const is = IndexSupply.create()
21
+
22
+ // Fetch transactions
23
+ const txs = await is.fetch({
24
+ query: 'select hash, "from", "to", value from txs where chain = 1 limit 10',
25
+ })
26
+ console.log(txs.rows)
27
+
28
+ // Fetch Transfer events with ABI signature
29
+ const transfers = await is.fetch({
30
+ query: 'select "from", "to", value from transfer where chain = 1 limit 10',
31
+ signatures: ['event Transfer(address indexed from, address indexed to, uint256 value)'],
32
+ })
33
+ console.log(transfers.rows)
34
+
35
+ // Pagination with cursor
36
+ const next = await is.fetch({
37
+ query: 'select hash, "from", "to", value from txs where chain = 1 limit 10',
38
+ cursor: txs.cursor,
39
+ })
40
+
41
+ // Live streaming
42
+ for await (const result of is.live({
43
+ query: 'select hash, "from", "to" from txs where chain = 1 limit 10',
44
+ }))
45
+ console.log(result.rows)
46
+
47
+ ```
48
+
49
+ ### `QueryBuilder`
50
+
51
+ `idxs` exports a [Kysely-based](https://kysely.dev) type-safe query builder.
52
+
53
+ ```ts
54
+ import { IndexSupply, QueryBuilder } from 'idxs'
55
+
56
+ const is = IndexSupply.create()
57
+ const qb = QueryBuilder.from(is)
58
+
59
+ // Query standard tables
60
+ const txs = await qb
61
+ .selectFrom('txs')
62
+ .select(['hash', 'from', 'to', 'value'])
63
+ .where('chain', '=', 1)
64
+ .limit(10)
65
+ .execute()
66
+
67
+ // Query with event signatures
68
+ const transfers = await qb
69
+ .withSignatures(['event Transfer(address indexed from, address indexed to, uint256 value)'])
70
+ .selectFrom('transfer')
71
+ .select(['from', 'to', 'value'])
72
+ .where('chain', '=', 1)
73
+ .limit(100)
74
+ .execute()
75
+
76
+ // Pagination with cursor
77
+ const next = await qb
78
+ .atCursor(txs.cursor)
79
+ .selectFrom('txs')
80
+ .select(['hash'])
81
+ .limit(10)
82
+ .execute()
83
+
84
+ // Live streaming
85
+ for await (const txs of qb
86
+ .selectFrom('txs')
87
+ .select(['hash', 'from', 'to', 'value'])
88
+ .where('chain', '=', 1)
89
+ .stream()
90
+ )
91
+ console.log(txs)
92
+ ```
93
+
94
+ ## API
95
+
96
+ TODO
97
+
98
+ ## License
99
+
100
+ MIT
@@ -0,0 +1,205 @@
1
+ import * as Errors from 'ox/Errors';
2
+ import * as Emitter from './internal/emitter.js';
3
+ import * as Result from './internal/result.js';
4
+ export type IS = {
5
+ /** The base URL of the Index Supply API. */
6
+ baseUrl: string;
7
+ /**
8
+ * Fetches data from the Index Supply API.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const result = await is.fetch({
13
+ * query: 'select hash, "from", "to", value from txs limit 10',
14
+ * })
15
+ * console.log(result.rows)
16
+ * ```
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // With event signatures for custom tables
21
+ * const result = await is.fetch({
22
+ * query: 'select "from", "to", value from transfer limit 10',
23
+ * signatures: ['event Transfer(address indexed from, address indexed to, uint256 value)'],
24
+ * })
25
+ * ```
26
+ *
27
+ * @param options - Options for the fetch method.
28
+ * @returns The result of the operation.
29
+ */
30
+ fetch: <const sql extends string = string, const signatures extends readonly Signature[] | undefined = undefined>(options: IS.fetch.Options<sql, signatures>) => Promise<IS.fetch.ReturnValue<sql, signatures>>;
31
+ /**
32
+ * Subscribes to live data updates from the Index Supply API via Server-Sent Events.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * for await (const result of is.live({
37
+ * query: 'select hash, "from", "to", value from txs limit 10',
38
+ * }))
39
+ * console.log(result.rows)
40
+ * ```
41
+ *
42
+ * @param options - Options for the live method.
43
+ * @returns An iterable AsyncGenerator.
44
+ */
45
+ live: <sql extends string = string, signatures extends readonly Signature[] | undefined = undefined>(options: IS.live.Options<sql, signatures>) => AsyncGenerator<IS.fetch.ReturnValue<sql, signatures>, void, unknown>;
46
+ /**
47
+ * Registers an event listener to listen for events from the Index Supply instance.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * is.on('debug', (event, data) => console.log('Debug:', event, data))
52
+ * is.on('request', (request) => console.log('Request:', request.url))
53
+ * is.on('response', (response) => console.log('Response:', response.status))
54
+ * is.on('error', (error) => console.error('Error:', error.message))
55
+ * ```
56
+ */
57
+ on: Emitter.Emitter['on'];
58
+ };
59
+ /** Cursor type for pagination. Can be a string or an object with `chainId` and `blockNumber`. */
60
+ export type Cursor = string | {
61
+ chainId: number;
62
+ blockNumber: number | bigint;
63
+ };
64
+ /** Stringified signature of a function or event. */
65
+ export type Signature = Result.Signature;
66
+ export declare namespace IS {
67
+ namespace fetch {
68
+ /**
69
+ * Options for the `fetch` method.
70
+ */
71
+ type Options<sql extends string = string, signatures extends readonly Signature[] | undefined = undefined> = RequestInit & {
72
+ /** Optional cursor for pagination. */
73
+ cursor?: Cursor | undefined;
74
+ /** Optional number of retry attempts on failure. Defaults to 5. */
75
+ retryCount?: number | undefined;
76
+ /** Optional array of event/function signatures for custom tables. */
77
+ signatures?: signatures | readonly Signature[] | undefined;
78
+ /** SQL query to execute. */
79
+ query: sql | string;
80
+ };
81
+ /**
82
+ * Return value of the `fetch` method.
83
+ */
84
+ type ReturnValue<sql extends string = string, signatures extends readonly Signature[] | undefined = undefined> = Result.Result<sql, signatures>;
85
+ /**
86
+ * Error types that can be thrown by the `fetch` method.
87
+ */
88
+ type ErrorType = FetchRequestError | Errors.GlobalErrorType;
89
+ }
90
+ namespace live {
91
+ /**
92
+ * Options for the `live` method.
93
+ */
94
+ type Options<sql extends string = string, signatures extends readonly Signature[] | undefined = undefined> = fetch.Options<sql, signatures>;
95
+ /**
96
+ * Error types that can be thrown by the `live` method.
97
+ */
98
+ type ErrorType = FetchRequestError | SseError | Errors.GlobalErrorType;
99
+ }
100
+ /**
101
+ * Result type returned by fetch and live methods.
102
+ */
103
+ type Result = Result.Result;
104
+ }
105
+ /**
106
+ * Creates an Index Supply client instance.
107
+ *
108
+ * @param options - Configuration options for the client.
109
+ * @returns An Index Supply client instance.
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * import { IndexSupply } from 'idxs'
114
+ *
115
+ * // Create with default options
116
+ * const is = IndexSupply.create()
117
+ *
118
+ * // Create with API key
119
+ * const is = IndexSupply.create({ apiKey: 'your-api-key' })
120
+ *
121
+ * // Create with custom base URL
122
+ * const is = IndexSupply.create({
123
+ * apiKey: 'your-api-key',
124
+ * baseUrl: 'https://custom-api.example.com',
125
+ * })
126
+ * ```
127
+ */
128
+ export declare function create(options?: create.Options): create.ReturnValue;
129
+ export declare namespace create {
130
+ /**
131
+ * Options for creating an Index Supply client.
132
+ */
133
+ type Options = {
134
+ /** Index Supply API key for authentication. */
135
+ apiKey?: string | undefined;
136
+ /** Index Supply API base URL. Defaults to `'https://api.indexsupply.net/v2'`. */
137
+ baseUrl?: string | undefined;
138
+ };
139
+ /**
140
+ * Return type of the `create` function.
141
+ */
142
+ type ReturnValue = IS;
143
+ }
144
+ /**
145
+ * Error thrown when a fetch request to the Index Supply API fails.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * try {
150
+ * await is.fetch({ query: 'invalid query' })
151
+ * } catch (error) {
152
+ * if (error instanceof IndexSupply.FetchRequestError) {
153
+ * console.error('Request failed:', error.message)
154
+ * console.error('Status:', error.status)
155
+ * }
156
+ * }
157
+ * ```
158
+ */
159
+ export declare class FetchRequestError extends Errors.BaseError {
160
+ readonly name = "IndexSupply.FetchRequestError";
161
+ /** The HTTP response object. */
162
+ response: Response;
163
+ /** The HTTP status code. */
164
+ status: number;
165
+ /**
166
+ * Creates a new FetchRequestError.
167
+ *
168
+ * @param message - The error message.
169
+ * @param response - The HTTP response object.
170
+ */
171
+ constructor(message: string, response: Response);
172
+ }
173
+ /**
174
+ * Error thrown when a Server-Sent Events (SSE) connection fails.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * try {
179
+ * for await (const result of is.live({ query: 'select * from txs' })) {
180
+ * console.log(result)
181
+ * }
182
+ * } catch (error) {
183
+ * if (error instanceof IndexSupply.SseError) {
184
+ * console.error('SSE error:', error.message)
185
+ * console.error('Error type:', error.type) // 'client' or 'server'
186
+ * }
187
+ * }
188
+ * ```
189
+ */
190
+ export declare class SseError extends Errors.BaseError<Error | undefined> {
191
+ readonly name = "IndexSupply.SseError";
192
+ /** The type of error: 'client' for client-side errors, 'server' for server-side errors. */
193
+ type: 'client' | 'server';
194
+ /**
195
+ * Creates a new SseError.
196
+ *
197
+ * @param message - The error message.
198
+ * @param options - Error options including cause and type.
199
+ */
200
+ constructor(message: string, options: {
201
+ cause?: Error | undefined;
202
+ type: 'client' | 'server';
203
+ });
204
+ }
205
+ //# sourceMappingURL=IndexSupply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndexSupply.d.ts","sourceRoot":"","sources":["../src/IndexSupply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAA;AAE9C,MAAM,MAAM,EAAE,GAAG;IACf,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAA;IACf;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,EAAE,CACL,KAAK,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,EACjC,KAAK,CAAC,UAAU,SAAS,SAAS,SAAS,EAAE,GAAG,SAAS,GAAG,SAAS,EAErE,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,KACvC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAA;IACnD;;;;;;;;;;;;;OAaG;IACH,IAAI,EAAE,CACJ,GAAG,SAAS,MAAM,GAAG,MAAM,EAC3B,UAAU,SAAS,SAAS,SAAS,EAAE,GAAG,SAAS,GAAG,SAAS,EAE/D,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,KACtC,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACzE;;;;;;;;;;OAUG;IACH,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;C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+ import * as Result from './internal/result.js';
4
+ /**
5
+ * Creates an Index Supply client instance.
6
+ *
7
+ * @param options - Configuration options for the client.
8
+ * @returns An Index Supply client instance.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { IndexSupply } from 'idxs'
13
+ *
14
+ * // Create with default options
15
+ * const is = IndexSupply.create()
16
+ *
17
+ * // Create with API key
18
+ * const is = IndexSupply.create({ apiKey: 'your-api-key' })
19
+ *
20
+ * // Create with custom base URL
21
+ * const is = IndexSupply.create({
22
+ * apiKey: 'your-api-key',
23
+ * baseUrl: 'https://custom-api.example.com',
24
+ * })
25
+ * ```
26
+ */
27
+ export function create(options = {}) {
28
+ const { apiKey, baseUrl = 'https://api.indexsupply.net/v2' } = options;
29
+ const emitter = Emitter.create();
30
+ return {
31
+ baseUrl,
32
+ on: emitter.on.bind(emitter),
33
+ async fetch(options) {
34
+ const { cursor, signatures, query, retryCount = 5, ...requestInit } = options;
35
+ const { emit } = emitter.instance();
36
+ const url = new URL(`${baseUrl}/query`);
37
+ const requestBody = { query };
38
+ if (cursor !== undefined)
39
+ requestBody.cursor =
40
+ typeof cursor === 'string' ? cursor : `${cursor.chainId}-${cursor.blockNumber.toString()}`;
41
+ if (signatures !== undefined)
42
+ requestBody.signatures = signatures;
43
+ let count = 0;
44
+ let lastError;
45
+ while (count < retryCount) {
46
+ count++;
47
+ try {
48
+ const request = new Request(url, {
49
+ ...requestInit,
50
+ body: JSON.stringify([requestBody]),
51
+ headers: {
52
+ 'Content-Type': 'application/json',
53
+ ...(apiKey ? { 'Api-Key': apiKey } : {}),
54
+ },
55
+ method: 'POST',
56
+ });
57
+ emit('request', request.clone());
58
+ const response = await fetch(request);
59
+ emit('response', response.clone());
60
+ if (!response.ok) {
61
+ const raw = await response.text();
62
+ const message = (() => {
63
+ try {
64
+ return JSON.parse(raw).message;
65
+ }
66
+ catch {
67
+ return raw;
68
+ }
69
+ })();
70
+ throw new FetchRequestError(message, response);
71
+ }
72
+ const [result] = (await response.json());
73
+ if (!result)
74
+ throw new Errors.BaseError('No results returned');
75
+ return Result.parse(result, { query, signatures });
76
+ }
77
+ catch (e) {
78
+ const error = e;
79
+ emit('error', error);
80
+ if (!shouldRetry(error))
81
+ throw error;
82
+ lastError = error;
83
+ await new Promise((resolve) => setTimeout(resolve, Math.min(200 * 2 ** (count - 1), 30_000)));
84
+ }
85
+ }
86
+ lastError ??= new Errors.BaseError('Maximum retry attempts reached');
87
+ throw lastError;
88
+ },
89
+ async *live(options) {
90
+ const { cursor, signatures, query, retryCount = 50, signal, ...requestInit } = options;
91
+ const { emit } = emitter.instance();
92
+ let shouldAbort = false;
93
+ signal?.addEventListener('abort', () => {
94
+ shouldAbort = true;
95
+ });
96
+ let count = 0;
97
+ let lastError;
98
+ while (count < retryCount) {
99
+ count++;
100
+ try {
101
+ const url = new URL(`${baseUrl}/query-live`);
102
+ const params = new URLSearchParams();
103
+ if (cursor)
104
+ params.set('cursor', typeof cursor === 'string'
105
+ ? cursor
106
+ : `${cursor.chainId}-${cursor.blockNumber.toString()}`);
107
+ if (signatures)
108
+ for (const sig of signatures)
109
+ params.append('signatures', sig);
110
+ params.set('query', query);
111
+ url.search = params.toString();
112
+ const request = new Request(url, {
113
+ ...requestInit,
114
+ ...(signal ? { signal } : {}),
115
+ method: 'GET',
116
+ headers: {
117
+ ...(apiKey ? { 'Api-Key': apiKey } : {}),
118
+ },
119
+ });
120
+ emit('request', request.clone());
121
+ const response = await fetch(request);
122
+ emit('response', response.clone());
123
+ if (!response.ok) {
124
+ const raw = await response.text();
125
+ const message = (() => {
126
+ try {
127
+ return JSON.parse(raw).message;
128
+ }
129
+ catch {
130
+ return raw;
131
+ }
132
+ })();
133
+ throw new FetchRequestError(message, response);
134
+ }
135
+ if (!response.body)
136
+ throw new Errors.BaseError('Response body is null');
137
+ const reader = response.body.getReader();
138
+ for await (const data of readStream(reader)) {
139
+ if ('error' in data)
140
+ throw new SseError(data.message, { type: data.error });
141
+ for (const item of data)
142
+ yield item;
143
+ count = 0;
144
+ }
145
+ return;
146
+ }
147
+ catch (e) {
148
+ if (shouldAbort)
149
+ return;
150
+ const error = e;
151
+ emit('error', error);
152
+ if (!shouldRetry(error))
153
+ throw error;
154
+ lastError = error;
155
+ await new Promise((resolve) => setTimeout(resolve, Math.min(200 * 2 ** (count - 1), 30_000)));
156
+ }
157
+ }
158
+ lastError ??= new Errors.BaseError('Maximum retry attempts reached');
159
+ throw lastError;
160
+ },
161
+ };
162
+ }
163
+ /**
164
+ * Error thrown when a fetch request to the Index Supply API fails.
165
+ *
166
+ * @example
167
+ * ```ts
168
+ * try {
169
+ * await is.fetch({ query: 'invalid query' })
170
+ * } catch (error) {
171
+ * if (error instanceof IndexSupply.FetchRequestError) {
172
+ * console.error('Request failed:', error.message)
173
+ * console.error('Status:', error.status)
174
+ * }
175
+ * }
176
+ * ```
177
+ */
178
+ export class FetchRequestError extends Errors.BaseError {
179
+ name = 'IndexSupply.FetchRequestError';
180
+ /** The HTTP response object. */
181
+ response;
182
+ /** The HTTP status code. */
183
+ status;
184
+ /**
185
+ * Creates a new FetchRequestError.
186
+ *
187
+ * @param message - The error message.
188
+ * @param response - The HTTP response object.
189
+ */
190
+ constructor(message, response) {
191
+ super(message, {
192
+ metaMessages: [`Status: ${response.status}`],
193
+ });
194
+ this.response = response;
195
+ this.status = response.status;
196
+ }
197
+ }
198
+ /**
199
+ * Error thrown when a Server-Sent Events (SSE) connection fails.
200
+ *
201
+ * @example
202
+ * ```ts
203
+ * try {
204
+ * for await (const result of is.live({ query: 'select * from txs' })) {
205
+ * console.log(result)
206
+ * }
207
+ * } catch (error) {
208
+ * if (error instanceof IndexSupply.SseError) {
209
+ * console.error('SSE error:', error.message)
210
+ * console.error('Error type:', error.type) // 'client' or 'server'
211
+ * }
212
+ * }
213
+ * ```
214
+ */
215
+ export class SseError extends Errors.BaseError {
216
+ name = 'IndexSupply.SseError';
217
+ /** The type of error: 'client' for client-side errors, 'server' for server-side errors. */
218
+ type;
219
+ /**
220
+ * Creates a new SseError.
221
+ *
222
+ * @param message - The error message.
223
+ * @param options - Error options including cause and type.
224
+ */
225
+ constructor(message, options) {
226
+ const { cause, type } = options;
227
+ super(message, { cause });
228
+ this.type = type;
229
+ }
230
+ }
231
+ /** @internal */
232
+ async function* readStream(reader) {
233
+ const decoder = new TextDecoder('utf-8');
234
+ let buffer = '';
235
+ try {
236
+ while (true) {
237
+ const { value, done } = await reader.read();
238
+ if (done)
239
+ break;
240
+ const decoded = decoder.decode(value, { stream: true });
241
+ buffer += decoded;
242
+ let idx = buffer.indexOf('\n\n');
243
+ while (idx !== -1) {
244
+ const block = buffer.slice(0, idx);
245
+ buffer = buffer.slice(idx + 2);
246
+ const lines = block.split('\n');
247
+ for (const line of lines) {
248
+ if (line.startsWith('data:')) {
249
+ const json = line.slice(5).trim();
250
+ try {
251
+ yield JSON.parse(json);
252
+ }
253
+ catch (e) {
254
+ const error = e;
255
+ await reader.cancel('Invalid JSON in data line');
256
+ throw new SseError(error.message, { cause: error, type: 'client' });
257
+ }
258
+ }
259
+ }
260
+ idx = buffer.indexOf('\n\n');
261
+ }
262
+ }
263
+ }
264
+ finally {
265
+ await reader.cancel('Stream closed');
266
+ }
267
+ }
268
+ /** @internal */
269
+ function shouldRetry(error) {
270
+ if (error instanceof SseError && error.type === 'server')
271
+ return true;
272
+ if (error instanceof FetchRequestError &&
273
+ (error.status === 408 || error.status === 429 || error.status >= 500))
274
+ return true;
275
+ return false;
276
+ }
277
+ //# sourceMappingURL=IndexSupply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndexSupply.js","sourceRoot":"","sources":["../src/IndexSupply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAA;AAgI9C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,MAAM,CAAC,UAA0B,E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AAG,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC;QAErE,OAAO,IAAI,CAAA;IACb,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * as IndexSupply from './IndexSupply.js';
2
+ export * as IS from './IndexSupply.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * as IndexSupply from './IndexSupply.js';
2
+ export * as IS from './IndexSupply.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { EventEmitter } from 'eventemitter3';
2
+ export type Emitter = {
3
+ instance: () => {
4
+ emit: EventEmitter<EventTypes>['emit'];
5
+ };
6
+ on: EventEmitter<EventTypes<true>>['on'];
7
+ };
8
+ export type Events = [
9
+ {
10
+ data: Error;
11
+ event: 'error';
12
+ },
13
+ {
14
+ data: string;
15
+ event: 'log';
16
+ },
17
+ {
18
+ data: Request;
19
+ event: 'request';
20
+ },
21
+ {
22
+ data: Response;
23
+ event: 'response';
24
+ }
25
+ ];
26
+ export type EventTypes<includeOptions extends boolean = false> = {
27
+ debug: (event: Events[number]['event'], data: Events[number]['data'], ...rest: includeOptions extends true ? readonly [{
28
+ id: string;
29
+ }] : readonly []) => void;
30
+ } & {
31
+ [K in Events[number] as K['event']]: (parameters: K['data'], ...rest: includeOptions extends true ? readonly [{
32
+ id: string;
33
+ }] : readonly []) => void;
34
+ };
35
+ export declare function create(): Emitter;
36
+ //# sourceMappingURL=emitter.d.ts.map