agentref 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,463 @@
1
+ // src/errors.ts
2
+ var AgentRefError = class extends Error {
3
+ constructor(message, code, status, requestId) {
4
+ super(message);
5
+ this.name = "AgentRefError";
6
+ this.code = code;
7
+ this.status = status;
8
+ this.requestId = requestId;
9
+ Object.setPrototypeOf(this, new.target.prototype);
10
+ }
11
+ };
12
+ var AuthError = class extends AgentRefError {
13
+ constructor(message, code, requestId) {
14
+ super(message, code, 401, requestId);
15
+ this.name = "AuthError";
16
+ }
17
+ };
18
+ var ForbiddenError = class extends AgentRefError {
19
+ constructor(message, code, requestId) {
20
+ super(message, code, 403, requestId);
21
+ this.name = "ForbiddenError";
22
+ }
23
+ };
24
+ var ValidationError = class extends AgentRefError {
25
+ constructor(message, code, requestId, details) {
26
+ super(message, code, 400, requestId);
27
+ this.name = "ValidationError";
28
+ this.details = details;
29
+ }
30
+ };
31
+ var NotFoundError = class extends AgentRefError {
32
+ constructor(message, code, requestId) {
33
+ super(message, code, 404, requestId);
34
+ this.name = "NotFoundError";
35
+ }
36
+ };
37
+ var ConflictError = class extends AgentRefError {
38
+ constructor(message, code, requestId) {
39
+ super(message, code, 409, requestId);
40
+ this.name = "ConflictError";
41
+ }
42
+ };
43
+ var RateLimitError = class extends AgentRefError {
44
+ constructor(message, code, requestId, retryAfter) {
45
+ super(message, code, 429, requestId);
46
+ this.name = "RateLimitError";
47
+ this.retryAfter = retryAfter;
48
+ }
49
+ };
50
+ var ServerError = class extends AgentRefError {
51
+ constructor(message, code, status, requestId) {
52
+ super(message, code, status, requestId);
53
+ this.name = "ServerError";
54
+ }
55
+ };
56
+
57
+ // src/http.ts
58
+ var SAFE_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
59
+ var DEFAULT_BASE_URL = "https://www.agentref.dev/api/v1";
60
+ var DEFAULT_TIMEOUT = 3e4;
61
+ var DEFAULT_MAX_RETRIES = 2;
62
+ var VERSION = true ? "1.0.0" : "0.0.0";
63
+ var HttpClient = class {
64
+ constructor(config = {}) {
65
+ if (typeof window !== "undefined" && !config.dangerouslyAllowBrowser) {
66
+ throw new Error(
67
+ "[AgentRef] Refusing to initialize in browser context. API keys must not be exposed client-side. Use a server-side proxy to call the AgentRef API instead. To override: set dangerouslyAllowBrowser: true (understand the security implications first)."
68
+ );
69
+ }
70
+ const apiKey = config.apiKey ?? process.env["AGENTREF_API_KEY"];
71
+ if (!apiKey) {
72
+ throw new Error(
73
+ "[AgentRef] API key is required. Pass it as apiKey or set the AGENTREF_API_KEY environment variable."
74
+ );
75
+ }
76
+ this.apiKey = apiKey;
77
+ this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
78
+ this.timeout = config.timeout ?? DEFAULT_TIMEOUT;
79
+ this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
80
+ }
81
+ async request(options) {
82
+ const url = this.buildUrl(options.path, options.query);
83
+ const isSafe = SAFE_METHODS.has(options.method);
84
+ const canRetry = isSafe || options.method === "POST" && options.idempotencyKey !== void 0;
85
+ const maxAttempts = canRetry ? this.maxRetries + 1 : 1;
86
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
87
+ let response;
88
+ try {
89
+ const headers = {
90
+ Authorization: `Bearer ${this.apiKey}`,
91
+ "Content-Type": "application/json",
92
+ "User-Agent": `agentref-node/${VERSION}`
93
+ };
94
+ if (options.method === "POST" && options.idempotencyKey) {
95
+ headers["Idempotency-Key"] = options.idempotencyKey;
96
+ }
97
+ response = await fetch(url, {
98
+ method: options.method,
99
+ headers,
100
+ body: options.body !== void 0 ? JSON.stringify(options.body) : void 0,
101
+ signal: AbortSignal.timeout(this.timeout)
102
+ });
103
+ } catch (error) {
104
+ if (canRetry && attempt < maxAttempts - 1) {
105
+ await this.wait(this.backoff(attempt));
106
+ continue;
107
+ }
108
+ throw error;
109
+ }
110
+ if (!response.ok) {
111
+ const parsedError = await this.parseError(response);
112
+ if (canRetry && this.isRetryable(response.status) && attempt < maxAttempts - 1) {
113
+ const delay = response.status === 429 ? this.retryAfterToMs(response.headers.get("Retry-After")) : this.backoff(attempt);
114
+ await this.wait(delay);
115
+ continue;
116
+ }
117
+ throw parsedError;
118
+ }
119
+ return response.json();
120
+ }
121
+ throw new ServerError("Request failed after retries", "REQUEST_RETRY_EXHAUSTED", 500, "");
122
+ }
123
+ buildUrl(path, query) {
124
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
125
+ const url = new URL(`${this.baseUrl}${normalizedPath}`);
126
+ if (query) {
127
+ for (const [key, value] of Object.entries(query)) {
128
+ if (value !== void 0) {
129
+ url.searchParams.set(key, String(value));
130
+ }
131
+ }
132
+ }
133
+ return url.toString();
134
+ }
135
+ async parseError(response) {
136
+ const json = await response.json().catch(() => ({}));
137
+ const code = json.error?.code ?? "UNKNOWN_ERROR";
138
+ const message = json.error?.message ?? response.statusText;
139
+ const requestId = json.meta?.requestId ?? "";
140
+ const details = json.error?.details;
141
+ if (response.status === 400) return new ValidationError(message, code, requestId, details);
142
+ if (response.status === 401) return new AuthError(message, code, requestId);
143
+ if (response.status === 403) return new ForbiddenError(message, code, requestId);
144
+ if (response.status === 404) return new NotFoundError(message, code, requestId);
145
+ if (response.status === 409) return new ConflictError(message, code, requestId);
146
+ if (response.status === 429) {
147
+ return new RateLimitError(message, code, requestId, this.retryAfterToSeconds(response.headers.get("Retry-After")));
148
+ }
149
+ return new ServerError(message, code, response.status, requestId);
150
+ }
151
+ isRetryable(status) {
152
+ return status === 429 || status >= 500;
153
+ }
154
+ retryAfterToSeconds(headerValue) {
155
+ if (!headerValue) return 60;
156
+ const numericSeconds = Number(headerValue);
157
+ if (!Number.isNaN(numericSeconds) && numericSeconds >= 0) {
158
+ return Math.ceil(numericSeconds);
159
+ }
160
+ const asDate = Date.parse(headerValue);
161
+ if (!Number.isNaN(asDate)) {
162
+ const deltaMs = asDate - Date.now();
163
+ return Math.max(0, Math.ceil(deltaMs / 1e3));
164
+ }
165
+ return 60;
166
+ }
167
+ retryAfterToMs(headerValue) {
168
+ return this.retryAfterToSeconds(headerValue) * 1e3;
169
+ }
170
+ wait(ms) {
171
+ return new Promise((resolve) => {
172
+ setTimeout(resolve, ms);
173
+ });
174
+ }
175
+ backoff(attempt) {
176
+ return 500 * Math.pow(2, attempt);
177
+ }
178
+ };
179
+
180
+ // src/resources/affiliates.ts
181
+ var AffiliatesResource = class {
182
+ constructor(http) {
183
+ this.http = http;
184
+ }
185
+ list(params) {
186
+ return this.http.request({ method: "GET", path: "/affiliates", query: params });
187
+ }
188
+ async get(id) {
189
+ const envelope = await this.http.request({
190
+ method: "GET",
191
+ path: `/affiliates/${id}`
192
+ });
193
+ return envelope.data;
194
+ }
195
+ async approve(id, options) {
196
+ const envelope = await this.http.request({
197
+ method: "POST",
198
+ path: `/affiliates/${id}/approve`,
199
+ idempotencyKey: options?.idempotencyKey
200
+ });
201
+ return envelope.data;
202
+ }
203
+ async block(id, data, options) {
204
+ const envelope = await this.http.request({
205
+ method: "POST",
206
+ path: `/affiliates/${id}/block`,
207
+ body: data,
208
+ idempotencyKey: options?.idempotencyKey
209
+ });
210
+ return envelope.data;
211
+ }
212
+ async unblock(id, options) {
213
+ const envelope = await this.http.request({
214
+ method: "POST",
215
+ path: `/affiliates/${id}/unblock`,
216
+ idempotencyKey: options?.idempotencyKey
217
+ });
218
+ return envelope.data;
219
+ }
220
+ };
221
+
222
+ // src/resources/billing.ts
223
+ var BillingResource = class {
224
+ constructor(http) {
225
+ this.http = http;
226
+ }
227
+ async current() {
228
+ const envelope = await this.http.request({
229
+ method: "GET",
230
+ path: "/billing"
231
+ });
232
+ return envelope.data;
233
+ }
234
+ async tiers() {
235
+ const envelope = await this.http.request({
236
+ method: "GET",
237
+ path: "/billing/tiers"
238
+ });
239
+ return envelope.data;
240
+ }
241
+ async subscribe(data, options) {
242
+ const envelope = await this.http.request({
243
+ method: "POST",
244
+ path: "/billing/subscribe",
245
+ body: data,
246
+ idempotencyKey: options?.idempotencyKey
247
+ });
248
+ return envelope.data;
249
+ }
250
+ };
251
+
252
+ // src/resources/conversions.ts
253
+ var ConversionsResource = class {
254
+ constructor(http) {
255
+ this.http = http;
256
+ }
257
+ list(params) {
258
+ return this.http.request({ method: "GET", path: "/conversions", query: params });
259
+ }
260
+ async stats(params) {
261
+ const envelope = await this.http.request({
262
+ method: "GET",
263
+ path: "/conversions/stats",
264
+ query: params
265
+ });
266
+ return envelope.data;
267
+ }
268
+ async recent(params) {
269
+ const envelope = await this.http.request({
270
+ method: "GET",
271
+ path: "/conversions/recent",
272
+ query: params
273
+ });
274
+ return envelope.data;
275
+ }
276
+ };
277
+
278
+ // src/resources/flags.ts
279
+ var FlagsResource = class {
280
+ constructor(http) {
281
+ this.http = http;
282
+ }
283
+ list(params) {
284
+ return this.http.request({ method: "GET", path: "/flags", query: params });
285
+ }
286
+ async stats() {
287
+ const envelope = await this.http.request({
288
+ method: "GET",
289
+ path: "/flags/stats"
290
+ });
291
+ return envelope.data;
292
+ }
293
+ async resolve(id, data, options) {
294
+ const envelope = await this.http.request({
295
+ method: "POST",
296
+ path: `/flags/${id}/resolve`,
297
+ body: data,
298
+ idempotencyKey: options?.idempotencyKey
299
+ });
300
+ return envelope.data;
301
+ }
302
+ };
303
+
304
+ // src/resources/merchant.ts
305
+ var MerchantResource = class {
306
+ constructor(http) {
307
+ this.http = http;
308
+ }
309
+ async get() {
310
+ const envelope = await this.http.request({
311
+ method: "GET",
312
+ path: "/merchant"
313
+ });
314
+ return envelope.data;
315
+ }
316
+ async domainStatus() {
317
+ const envelope = await this.http.request({
318
+ method: "GET",
319
+ path: "/merchant/domain-status"
320
+ });
321
+ return envelope.data;
322
+ }
323
+ };
324
+
325
+ // src/resources/payouts.ts
326
+ var PayoutsResource = class {
327
+ constructor(http) {
328
+ this.http = http;
329
+ }
330
+ list(params) {
331
+ return this.http.request({ method: "GET", path: "/payouts", query: params });
332
+ }
333
+ listPending(params) {
334
+ return this.http.request({ method: "GET", path: "/payouts/pending", query: params });
335
+ }
336
+ async stats(params) {
337
+ const envelope = await this.http.request({
338
+ method: "GET",
339
+ path: "/payouts/stats",
340
+ query: params
341
+ });
342
+ return envelope.data;
343
+ }
344
+ };
345
+
346
+ // src/resources/programs.ts
347
+ var ProgramsResource = class {
348
+ constructor(http) {
349
+ this.http = http;
350
+ }
351
+ list(params) {
352
+ return this.http.request({ method: "GET", path: "/programs", query: params });
353
+ }
354
+ async *listAll(params) {
355
+ let page = 1;
356
+ const pageSize = params?.pageSize ?? 100;
357
+ while (true) {
358
+ const response = await this.list({ page, limit: pageSize });
359
+ yield* response.data;
360
+ if (!response.meta.hasMore) {
361
+ break;
362
+ }
363
+ page += 1;
364
+ }
365
+ }
366
+ async get(id) {
367
+ const envelope = await this.http.request({
368
+ method: "GET",
369
+ path: `/programs/${id}`
370
+ });
371
+ return envelope.data;
372
+ }
373
+ async create(data, options) {
374
+ const envelope = await this.http.request({
375
+ method: "POST",
376
+ path: "/programs",
377
+ body: data,
378
+ idempotencyKey: options?.idempotencyKey
379
+ });
380
+ return envelope.data;
381
+ }
382
+ async update(id, data) {
383
+ const envelope = await this.http.request({
384
+ method: "PATCH",
385
+ path: `/programs/${id}`,
386
+ body: data
387
+ });
388
+ return envelope.data;
389
+ }
390
+ async delete(id) {
391
+ const envelope = await this.http.request({
392
+ method: "DELETE",
393
+ path: `/programs/${id}`
394
+ });
395
+ return envelope.data;
396
+ }
397
+ async stats(id, params) {
398
+ const envelope = await this.http.request({
399
+ method: "GET",
400
+ path: `/programs/${id}/stats`,
401
+ query: params
402
+ });
403
+ return envelope.data;
404
+ }
405
+ listAffiliates(id, params) {
406
+ return this.http.request({
407
+ method: "GET",
408
+ path: `/programs/${id}/affiliates`,
409
+ query: params
410
+ });
411
+ }
412
+ async listCoupons(id) {
413
+ const envelope = await this.http.request({
414
+ method: "GET",
415
+ path: `/programs/${id}/coupons`
416
+ });
417
+ return envelope.data;
418
+ }
419
+ async createCoupon(id, data, options) {
420
+ const envelope = await this.http.request({
421
+ method: "POST",
422
+ path: `/programs/${id}/coupons`,
423
+ body: data,
424
+ idempotencyKey: options?.idempotencyKey
425
+ });
426
+ return envelope.data;
427
+ }
428
+ async createInvite(id, data, options) {
429
+ const envelope = await this.http.request({
430
+ method: "POST",
431
+ path: `/programs/${id}/invites`,
432
+ body: data,
433
+ idempotencyKey: options?.idempotencyKey
434
+ });
435
+ return envelope.data;
436
+ }
437
+ };
438
+
439
+ // src/client.ts
440
+ var AgentRef = class {
441
+ constructor(config) {
442
+ const http = new HttpClient(config);
443
+ this.programs = new ProgramsResource(http);
444
+ this.affiliates = new AffiliatesResource(http);
445
+ this.conversions = new ConversionsResource(http);
446
+ this.payouts = new PayoutsResource(http);
447
+ this.flags = new FlagsResource(http);
448
+ this.billing = new BillingResource(http);
449
+ this.merchant = new MerchantResource(http);
450
+ }
451
+ };
452
+ export {
453
+ AgentRef,
454
+ AgentRefError,
455
+ AuthError,
456
+ ConflictError,
457
+ ForbiddenError,
458
+ NotFoundError,
459
+ RateLimitError,
460
+ ServerError,
461
+ ValidationError
462
+ };
463
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts","../src/http.ts","../src/resources/affiliates.ts","../src/resources/billing.ts","../src/resources/conversions.ts","../src/resources/flags.ts","../src/resources/merchant.ts","../src/resources/payouts.ts","../src/resources/programs.ts","../src/client.ts"],"sourcesContent":["export class AgentRefError extends Error {\n readonly code: string\n readonly status: number\n readonly requestId: string\n\n constructor(message: string, code: string, status: number, requestId: string) {\n super(message)\n this.name = 'AgentRefError'\n this.code = code\n this.status = status\n this.requestId = requestId\n Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n\nexport class AuthError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 401, requestId)\n this.name = 'AuthError'\n }\n}\n\nexport class ForbiddenError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 403, requestId)\n this.name = 'ForbiddenError'\n }\n}\n\nexport class ValidationError extends AgentRefError {\n readonly details: unknown\n\n constructor(message: string, code: string, requestId: string, details?: unknown) {\n super(message, code, 400, requestId)\n this.name = 'ValidationError'\n this.details = details\n }\n}\n\nexport class NotFoundError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 404, requestId)\n this.name = 'NotFoundError'\n }\n}\n\nexport class ConflictError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 409, requestId)\n this.name = 'ConflictError'\n }\n}\n\nexport class RateLimitError extends AgentRefError {\n readonly retryAfter: number\n\n constructor(message: string, code: string, requestId: string, retryAfter: number) {\n super(message, code, 429, requestId)\n this.name = 'RateLimitError'\n this.retryAfter = retryAfter\n }\n}\n\nexport class ServerError extends AgentRefError {\n constructor(message: string, code: string, status: number, requestId: string) {\n super(message, code, status, requestId)\n this.name = 'ServerError'\n }\n}\n","import {\n AgentRefError,\n AuthError,\n ConflictError,\n ForbiddenError,\n NotFoundError,\n RateLimitError,\n ServerError,\n ValidationError,\n} from './errors.js'\nimport type { AgentRefConfig } from './types/index.js'\n\nexport type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PATCH' | 'DELETE'\n\nconst SAFE_METHODS: ReadonlySet<HttpMethod> = new Set(['GET', 'HEAD'])\n\nexport interface RequestOptions {\n method: HttpMethod\n path: string\n body?: unknown\n query?: Record<string, string | number | boolean | undefined>\n idempotencyKey?: string\n}\n\nconst DEFAULT_BASE_URL = 'https://www.agentref.dev/api/v1'\nconst DEFAULT_TIMEOUT = 30_000\nconst DEFAULT_MAX_RETRIES = 2\n\ndeclare const __SDK_VERSION__: string\nconst VERSION = typeof __SDK_VERSION__ === 'string' ? __SDK_VERSION__ : '0.0.0'\n\nexport class HttpClient {\n private readonly apiKey: string\n private readonly baseUrl: string\n private readonly timeout: number\n private readonly maxRetries: number\n\n constructor(config: AgentRefConfig = {}) {\n if (typeof window !== 'undefined' && !config.dangerouslyAllowBrowser) {\n throw new Error(\n '[AgentRef] Refusing to initialize in browser context. API keys must not be exposed client-side. Use a server-side proxy to call the AgentRef API instead. To override: set dangerouslyAllowBrowser: true (understand the security implications first).'\n )\n }\n\n const apiKey = config.apiKey ?? process.env['AGENTREF_API_KEY']\n if (!apiKey) {\n throw new Error(\n '[AgentRef] API key is required. Pass it as apiKey or set the AGENTREF_API_KEY environment variable.'\n )\n }\n\n this.apiKey = apiKey\n this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '')\n this.timeout = config.timeout ?? DEFAULT_TIMEOUT\n this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES\n }\n\n async request<T>(options: RequestOptions): Promise<T> {\n const url = this.buildUrl(options.path, options.query)\n const isSafe = SAFE_METHODS.has(options.method)\n const canRetry = isSafe || (options.method === 'POST' && options.idempotencyKey !== undefined)\n const maxAttempts = canRetry ? this.maxRetries + 1 : 1\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n let response: Response\n\n try {\n const headers: Record<string, string> = {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': `agentref-node/${VERSION}`,\n }\n\n if (options.method === 'POST' && options.idempotencyKey) {\n headers['Idempotency-Key'] = options.idempotencyKey\n }\n\n response = await fetch(url, {\n method: options.method,\n headers,\n body: options.body !== undefined ? JSON.stringify(options.body) : undefined,\n signal: AbortSignal.timeout(this.timeout),\n })\n } catch (error) {\n if (canRetry && attempt < maxAttempts - 1) {\n await this.wait(this.backoff(attempt))\n continue\n }\n throw error\n }\n\n if (!response.ok) {\n const parsedError = await this.parseError(response)\n\n if (canRetry && this.isRetryable(response.status) && attempt < maxAttempts - 1) {\n const delay =\n response.status === 429\n ? this.retryAfterToMs(response.headers.get('Retry-After'))\n : this.backoff(attempt)\n await this.wait(delay)\n continue\n }\n\n throw parsedError\n }\n\n return response.json() as Promise<T>\n }\n\n throw new ServerError('Request failed after retries', 'REQUEST_RETRY_EXHAUSTED', 500, '')\n }\n\n private buildUrl(path: string, query?: Record<string, string | number | boolean | undefined>): string {\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n const url = new URL(`${this.baseUrl}${normalizedPath}`)\n\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value))\n }\n }\n }\n\n return url.toString()\n }\n\n private async parseError(response: Response): Promise<AgentRefError> {\n const json = (await response.json().catch(() => ({}))) as {\n error?: { code?: string; message?: string; details?: unknown }\n meta?: { requestId?: string }\n }\n\n const code = json.error?.code ?? 'UNKNOWN_ERROR'\n const message = json.error?.message ?? response.statusText\n const requestId = json.meta?.requestId ?? ''\n const details = json.error?.details\n\n if (response.status === 400) return new ValidationError(message, code, requestId, details)\n if (response.status === 401) return new AuthError(message, code, requestId)\n if (response.status === 403) return new ForbiddenError(message, code, requestId)\n if (response.status === 404) return new NotFoundError(message, code, requestId)\n if (response.status === 409) return new ConflictError(message, code, requestId)\n if (response.status === 429) {\n return new RateLimitError(message, code, requestId, this.retryAfterToSeconds(response.headers.get('Retry-After')))\n }\n\n return new ServerError(message, code, response.status, requestId)\n }\n\n private isRetryable(status: number): boolean {\n return status === 429 || status >= 500\n }\n\n private retryAfterToSeconds(headerValue: string | null): number {\n if (!headerValue) return 60\n\n const numericSeconds = Number(headerValue)\n if (!Number.isNaN(numericSeconds) && numericSeconds >= 0) {\n return Math.ceil(numericSeconds)\n }\n\n const asDate = Date.parse(headerValue)\n if (!Number.isNaN(asDate)) {\n const deltaMs = asDate - Date.now()\n return Math.max(0, Math.ceil(deltaMs / 1000))\n }\n\n return 60\n }\n\n private retryAfterToMs(headerValue: string | null): number {\n return this.retryAfterToSeconds(headerValue) * 1000\n }\n\n private wait(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms)\n })\n }\n\n private backoff(attempt: number): number {\n return 500 * Math.pow(2, attempt)\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Affiliate, MutationOptions, PaginatedResponse } from '../types/index.js'\n\nexport class AffiliatesResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n includeBlocked?: boolean\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Affiliate>> {\n return this.http.request({ method: 'GET', path: '/affiliates', query: params })\n }\n\n async get(id: string): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'GET',\n path: `/affiliates/${id}`,\n })\n return envelope.data\n }\n\n async approve(id: string, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/approve`,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async block(id: string, data?: { reason?: string }, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/block`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async unblock(id: string, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/unblock`,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { BillingStatus, BillingTier, MutationOptions } from '../types/index.js'\n\nexport class BillingResource {\n constructor(private readonly http: HttpClient) {}\n\n async current(): Promise<BillingStatus> {\n const envelope = await this.http.request<{ data: BillingStatus; meta: unknown }>({\n method: 'GET',\n path: '/billing',\n })\n return envelope.data\n }\n\n async tiers(): Promise<BillingTier[]> {\n const envelope = await this.http.request<{ data: BillingTier[]; meta: unknown }>({\n method: 'GET',\n path: '/billing/tiers',\n })\n return envelope.data\n }\n\n async subscribe(data: { tier: 'starter' | 'growth' | 'pro' | 'scale' }, options?: MutationOptions): Promise<BillingStatus> {\n const envelope = await this.http.request<{ data: BillingStatus; meta: unknown }>({\n method: 'POST',\n path: '/billing/subscribe',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Conversion, ConversionStats, PaginatedResponse } from '../types/index.js'\n\nexport class ConversionsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n affiliateId?: string\n status?: string\n startDate?: string\n endDate?: string\n from?: string\n to?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Conversion>> {\n return this.http.request({ method: 'GET', path: '/conversions', query: params })\n }\n\n async stats(params?: { programId?: string; period?: '7d' | '30d' | '90d' | 'all' }): Promise<ConversionStats> {\n const envelope = await this.http.request<{ data: ConversionStats; meta: unknown }>({\n method: 'GET',\n path: '/conversions/stats',\n query: params,\n })\n return envelope.data\n }\n\n async recent(params?: { limit?: number }): Promise<Conversion[]> {\n const envelope = await this.http.request<{ data: Conversion[]; meta: unknown }>({\n method: 'GET',\n path: '/conversions/recent',\n query: params,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Flag, FlagStats, MutationOptions, PaginatedResponse, ResolveFlagParams } from '../types/index.js'\n\nexport class FlagsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n status?: string\n type?: string\n affiliateId?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Flag>> {\n return this.http.request({ method: 'GET', path: '/flags', query: params })\n }\n\n async stats(): Promise<FlagStats> {\n const envelope = await this.http.request<{ data: FlagStats; meta: unknown }>({\n method: 'GET',\n path: '/flags/stats',\n })\n return envelope.data\n }\n\n async resolve(id: string, data: ResolveFlagParams, options?: MutationOptions): Promise<Flag> {\n const envelope = await this.http.request<{ data: Flag; meta: unknown }>({\n method: 'POST',\n path: `/flags/${id}/resolve`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Merchant } from '../types/index.js'\n\nexport interface DomainStatus {\n domain: string | null\n verified: boolean\n txtRecord?: string | null\n [key: string]: unknown\n}\n\nexport class MerchantResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Merchant> {\n const envelope = await this.http.request<{ data: Merchant; meta: unknown }>({\n method: 'GET',\n path: '/merchant',\n })\n return envelope.data\n }\n\n async domainStatus(): Promise<DomainStatus> {\n const envelope = await this.http.request<{ data: DomainStatus; meta: unknown }>({\n method: 'GET',\n path: '/merchant/domain-status',\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { PaginatedResponse, PendingAffiliate, Payout, PayoutStats, PayoutStatus } from '../types/index.js'\n\nexport class PayoutsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n affiliateId?: string\n status?: PayoutStatus\n startDate?: string\n endDate?: string\n from?: string\n to?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Payout>> {\n return this.http.request({ method: 'GET', path: '/payouts', query: params })\n }\n\n listPending(params?: {\n programId?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<PendingAffiliate>> {\n return this.http.request({ method: 'GET', path: '/payouts/pending', query: params })\n }\n\n async stats(params?: { programId?: string; period?: '7d' | '30d' | '90d' | 'all' }): Promise<PayoutStats> {\n const envelope = await this.http.request<{ data: PayoutStats; meta: unknown }>({\n method: 'GET',\n path: '/payouts/stats',\n query: params,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n Affiliate,\n Coupon,\n CreateCouponParams,\n CreateProgramParams,\n Invite,\n MutationOptions,\n PaginatedResponse,\n Program,\n ProgramStats,\n UpdateProgramParams,\n} from '../types/index.js'\n\nexport class ProgramsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Program>> {\n return this.http.request({ method: 'GET', path: '/programs', query: params })\n }\n\n async *listAll(params?: {\n pageSize?: number\n }): AsyncGenerator<Program> {\n let page = 1\n const pageSize = params?.pageSize ?? 100\n\n while (true) {\n const response = await this.list({ page, limit: pageSize })\n yield* response.data\n\n if (!response.meta.hasMore) {\n break\n }\n\n page += 1\n }\n }\n\n async get(id: string): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}`,\n })\n return envelope.data\n }\n\n async create(data: CreateProgramParams, options?: MutationOptions): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'POST',\n path: '/programs',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async update(id: string, data: UpdateProgramParams): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'PATCH',\n path: `/programs/${id}`,\n body: data,\n })\n return envelope.data\n }\n\n async delete(id: string): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}`,\n })\n return envelope.data\n }\n\n async stats(id: string, params?: { period?: string }): Promise<ProgramStats> {\n const envelope = await this.http.request<{ data: ProgramStats; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/stats`,\n query: params,\n })\n return envelope.data\n }\n\n listAffiliates(\n id: string,\n params?: { includeBlocked?: boolean; cursor?: string; limit?: number; page?: number; pageSize?: number; offset?: number }\n ): Promise<PaginatedResponse<Affiliate>> {\n return this.http.request({\n method: 'GET',\n path: `/programs/${id}/affiliates`,\n query: params,\n })\n }\n\n async listCoupons(id: string): Promise<Coupon[]> {\n const envelope = await this.http.request<{ data: Coupon[]; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/coupons`,\n })\n return envelope.data\n }\n\n async createCoupon(id: string, data: CreateCouponParams, options?: MutationOptions): Promise<Coupon> {\n const envelope = await this.http.request<{ data: Coupon; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/coupons`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async createInvite(\n id: string,\n data: {\n email?: string\n name?: string\n isPublic?: boolean\n usageLimit?: number\n expiresInDays?: number\n },\n options?: MutationOptions\n ): Promise<Invite> {\n const envelope = await this.http.request<{ data: Invite; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/invites`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import { HttpClient } from './http.js'\nimport type { AgentRefConfig } from './types/index.js'\nimport { AffiliatesResource } from './resources/affiliates.js'\nimport { BillingResource } from './resources/billing.js'\nimport { ConversionsResource } from './resources/conversions.js'\nimport { FlagsResource } from './resources/flags.js'\nimport { MerchantResource } from './resources/merchant.js'\nimport { PayoutsResource } from './resources/payouts.js'\nimport { ProgramsResource } from './resources/programs.js'\n\nexport class AgentRef {\n readonly programs: ProgramsResource\n readonly affiliates: AffiliatesResource\n readonly conversions: ConversionsResource\n readonly payouts: PayoutsResource\n readonly flags: FlagsResource\n readonly billing: BillingResource\n readonly merchant: MerchantResource\n\n constructor(config?: AgentRefConfig) {\n const http = new HttpClient(config)\n\n this.programs = new ProgramsResource(http)\n this.affiliates = new AffiliatesResource(http)\n this.conversions = new ConversionsResource(http)\n this.payouts = new PayoutsResource(http)\n this.flags = new FlagsResource(http)\n this.billing = new BillingResource(http)\n this.merchant = new MerchantResource(http)\n }\n}\n"],"mappings":";AAAO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAKvC,YAAY,SAAiB,MAAc,QAAgB,WAAmB;AAC5E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,YAAY;AACjB,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAEO,IA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@ -0,0 +1,37 @@
1
+ {
2
+ "name": "agentref",
3
+ "version": "1.0.0",
4
+ "description": "Official TypeScript/JavaScript SDK for the AgentRef Affiliate API",
5
+ "author": "AgentRef <hi@agentref.dev>",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/agentref/agentref-node.git"
10
+ },
11
+ "main": "./dist/index.cjs",
12
+ "module": "./dist/index.mjs",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.mjs",
18
+ "require": "./dist/index.cjs"
19
+ }
20
+ },
21
+ "files": ["dist", "README.md", "CHANGELOG.md"],
22
+ "scripts": {
23
+ "build": "tsup",
24
+ "dev": "tsup --watch",
25
+ "test": "vitest run",
26
+ "test:watch": "vitest",
27
+ "typecheck": "tsc --noEmit",
28
+ "lint": "tsc --noEmit"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "^20.0.0",
32
+ "msw": "^2.3.0",
33
+ "tsup": "^8.0.0",
34
+ "typescript": "^5.4.0",
35
+ "vitest": "^1.6.0"
36
+ }
37
+ }