listbee 0.4.0 → 0.6.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.
Files changed (175) hide show
  1. package/README.md +187 -381
  2. package/dist/cjs/base-client.d.ts +9 -29
  3. package/dist/cjs/base-client.js +58 -14
  4. package/dist/cjs/base-client.js.map +1 -1
  5. package/dist/cjs/client.d.ts +17 -13
  6. package/dist/cjs/client.js +14 -11
  7. package/dist/cjs/client.js.map +1 -1
  8. package/dist/cjs/errors.d.ts +12 -0
  9. package/dist/cjs/errors.js +31 -1
  10. package/dist/cjs/errors.js.map +1 -1
  11. package/dist/cjs/generated/api-types.d.ts +4089 -0
  12. package/dist/cjs/generated/api-types.js +7 -0
  13. package/dist/cjs/generated/api-types.js.map +1 -0
  14. package/dist/cjs/generated/enums.d.ts +94 -0
  15. package/dist/cjs/generated/enums.js +87 -0
  16. package/dist/cjs/generated/enums.js.map +1 -0
  17. package/dist/cjs/generated/operations.d.ts +233 -0
  18. package/dist/cjs/generated/operations.js +39 -0
  19. package/dist/cjs/generated/operations.js.map +1 -0
  20. package/dist/cjs/generated/types.d.ts +68 -0
  21. package/dist/cjs/{types/order.js → generated/types.js} +1 -4
  22. package/dist/cjs/generated/types.js.map +1 -0
  23. package/dist/cjs/index.d.ts +7 -13
  24. package/dist/cjs/index.js +22 -15
  25. package/dist/cjs/index.js.map +1 -1
  26. package/dist/cjs/resources/account.d.ts +11 -6
  27. package/dist/cjs/resources/account.js +19 -8
  28. package/dist/cjs/resources/account.js.map +1 -1
  29. package/dist/cjs/resources/api-keys.d.ts +18 -4
  30. package/dist/cjs/resources/api-keys.js +17 -1
  31. package/dist/cjs/resources/api-keys.js.map +1 -1
  32. package/dist/cjs/resources/customers.d.ts +23 -0
  33. package/dist/cjs/resources/customers.js +44 -0
  34. package/dist/cjs/resources/customers.js.map +1 -0
  35. package/dist/cjs/resources/files.d.ts +27 -0
  36. package/dist/cjs/resources/files.js +37 -0
  37. package/dist/cjs/resources/files.js.map +1 -0
  38. package/dist/cjs/resources/index.d.ts +3 -1
  39. package/dist/cjs/resources/index.js +7 -3
  40. package/dist/cjs/resources/index.js.map +1 -1
  41. package/dist/cjs/resources/listings.d.ts +35 -35
  42. package/dist/cjs/resources/listings.js +51 -116
  43. package/dist/cjs/resources/listings.js.map +1 -1
  44. package/dist/cjs/resources/orders.d.ts +28 -16
  45. package/dist/cjs/resources/orders.js +43 -40
  46. package/dist/cjs/resources/orders.js.map +1 -1
  47. package/dist/cjs/resources/signup.d.ts +21 -9
  48. package/dist/cjs/resources/signup.js +20 -3
  49. package/dist/cjs/resources/signup.js.map +1 -1
  50. package/dist/cjs/resources/stripe.d.ts +18 -6
  51. package/dist/cjs/resources/stripe.js +18 -7
  52. package/dist/cjs/resources/stripe.js.map +1 -1
  53. package/dist/cjs/resources/webhooks.d.ts +59 -3
  54. package/dist/cjs/resources/webhooks.js +102 -21
  55. package/dist/cjs/resources/webhooks.js.map +1 -1
  56. package/dist/cjs/types/index.d.ts +4 -10
  57. package/dist/cjs/types/index.js +17 -10
  58. package/dist/cjs/types/index.js.map +1 -1
  59. package/dist/cjs/types/shared.d.ts +25 -145
  60. package/dist/cjs/types/shared.js +12 -66
  61. package/dist/cjs/types/shared.js.map +1 -1
  62. package/dist/esm/base-client.d.ts +9 -29
  63. package/dist/esm/base-client.js +56 -12
  64. package/dist/esm/base-client.js.map +1 -1
  65. package/dist/esm/client.d.ts +17 -13
  66. package/dist/esm/client.js +14 -11
  67. package/dist/esm/client.js.map +1 -1
  68. package/dist/esm/errors.d.ts +12 -0
  69. package/dist/esm/errors.js +27 -0
  70. package/dist/esm/errors.js.map +1 -1
  71. package/dist/esm/generated/api-types.d.ts +4089 -0
  72. package/dist/esm/generated/api-types.js +6 -0
  73. package/dist/esm/generated/api-types.js.map +1 -0
  74. package/dist/esm/generated/enums.d.ts +94 -0
  75. package/dist/esm/generated/enums.js +84 -0
  76. package/dist/esm/generated/enums.js.map +1 -0
  77. package/dist/esm/generated/operations.d.ts +233 -0
  78. package/dist/esm/generated/operations.js +36 -0
  79. package/dist/esm/generated/operations.js.map +1 -0
  80. package/dist/esm/generated/types.d.ts +68 -0
  81. package/dist/esm/generated/types.js +2 -0
  82. package/dist/esm/generated/types.js.map +1 -0
  83. package/dist/esm/index.d.ts +7 -13
  84. package/dist/esm/index.js +5 -4
  85. package/dist/esm/index.js.map +1 -1
  86. package/dist/esm/resources/account.d.ts +11 -6
  87. package/dist/esm/resources/account.js +19 -8
  88. package/dist/esm/resources/account.js.map +1 -1
  89. package/dist/esm/resources/api-keys.d.ts +18 -4
  90. package/dist/esm/resources/api-keys.js +17 -1
  91. package/dist/esm/resources/api-keys.js.map +1 -1
  92. package/dist/esm/resources/customers.d.ts +23 -0
  93. package/dist/esm/resources/customers.js +39 -0
  94. package/dist/esm/resources/customers.js.map +1 -0
  95. package/dist/esm/resources/files.d.ts +27 -0
  96. package/dist/esm/resources/files.js +33 -0
  97. package/dist/esm/resources/files.js.map +1 -0
  98. package/dist/esm/resources/index.d.ts +3 -1
  99. package/dist/esm/resources/index.js +3 -1
  100. package/dist/esm/resources/index.js.map +1 -1
  101. package/dist/esm/resources/listings.d.ts +35 -35
  102. package/dist/esm/resources/listings.js +50 -116
  103. package/dist/esm/resources/listings.js.map +1 -1
  104. package/dist/esm/resources/orders.d.ts +28 -16
  105. package/dist/esm/resources/orders.js +43 -40
  106. package/dist/esm/resources/orders.js.map +1 -1
  107. package/dist/esm/resources/signup.d.ts +21 -9
  108. package/dist/esm/resources/signup.js +20 -3
  109. package/dist/esm/resources/signup.js.map +1 -1
  110. package/dist/esm/resources/stripe.d.ts +18 -6
  111. package/dist/esm/resources/stripe.js +18 -7
  112. package/dist/esm/resources/stripe.js.map +1 -1
  113. package/dist/esm/resources/webhooks.d.ts +59 -3
  114. package/dist/esm/resources/webhooks.js +101 -21
  115. package/dist/esm/resources/webhooks.js.map +1 -1
  116. package/dist/esm/types/index.d.ts +4 -10
  117. package/dist/esm/types/index.js +2 -1
  118. package/dist/esm/types/index.js.map +1 -1
  119. package/dist/esm/types/shared.d.ts +25 -145
  120. package/dist/esm/types/shared.js +10 -65
  121. package/dist/esm/types/shared.js.map +1 -1
  122. package/package.json +4 -82
  123. package/dist/cjs/resources/stores.d.ts +0 -31
  124. package/dist/cjs/resources/stores.js +0 -67
  125. package/dist/cjs/resources/stores.js.map +0 -1
  126. package/dist/cjs/types/account.d.ts +0 -47
  127. package/dist/cjs/types/account.js +0 -6
  128. package/dist/cjs/types/account.js.map +0 -1
  129. package/dist/cjs/types/api-key.d.ts +0 -18
  130. package/dist/cjs/types/api-key.js +0 -6
  131. package/dist/cjs/types/api-key.js.map +0 -1
  132. package/dist/cjs/types/listing.d.ts +0 -189
  133. package/dist/cjs/types/listing.js +0 -6
  134. package/dist/cjs/types/listing.js.map +0 -1
  135. package/dist/cjs/types/order.d.ts +0 -74
  136. package/dist/cjs/types/order.js.map +0 -1
  137. package/dist/cjs/types/signup.d.ts +0 -24
  138. package/dist/cjs/types/signup.js +0 -6
  139. package/dist/cjs/types/signup.js.map +0 -1
  140. package/dist/cjs/types/store.d.ts +0 -70
  141. package/dist/cjs/types/store.js +0 -6
  142. package/dist/cjs/types/store.js.map +0 -1
  143. package/dist/cjs/types/stripe.d.ts +0 -12
  144. package/dist/cjs/types/stripe.js +0 -6
  145. package/dist/cjs/types/stripe.js.map +0 -1
  146. package/dist/cjs/types/webhook.d.ts +0 -88
  147. package/dist/cjs/types/webhook.js +0 -6
  148. package/dist/cjs/types/webhook.js.map +0 -1
  149. package/dist/esm/resources/stores.d.ts +0 -31
  150. package/dist/esm/resources/stores.js +0 -63
  151. package/dist/esm/resources/stores.js.map +0 -1
  152. package/dist/esm/types/account.d.ts +0 -47
  153. package/dist/esm/types/account.js +0 -5
  154. package/dist/esm/types/account.js.map +0 -1
  155. package/dist/esm/types/api-key.d.ts +0 -18
  156. package/dist/esm/types/api-key.js +0 -5
  157. package/dist/esm/types/api-key.js.map +0 -1
  158. package/dist/esm/types/listing.d.ts +0 -189
  159. package/dist/esm/types/listing.js +0 -5
  160. package/dist/esm/types/listing.js.map +0 -1
  161. package/dist/esm/types/order.d.ts +0 -74
  162. package/dist/esm/types/order.js +0 -5
  163. package/dist/esm/types/order.js.map +0 -1
  164. package/dist/esm/types/signup.d.ts +0 -24
  165. package/dist/esm/types/signup.js +0 -5
  166. package/dist/esm/types/signup.js.map +0 -1
  167. package/dist/esm/types/store.d.ts +0 -70
  168. package/dist/esm/types/store.js +0 -5
  169. package/dist/esm/types/store.js.map +0 -1
  170. package/dist/esm/types/stripe.d.ts +0 -12
  171. package/dist/esm/types/stripe.js +0 -5
  172. package/dist/esm/types/stripe.js.map +0 -1
  173. package/dist/esm/types/webhook.d.ts +0 -88
  174. package/dist/esm/types/webhook.js +0 -5
  175. package/dist/esm/types/webhook.js.map +0 -1
@@ -1,15 +1,71 @@
1
1
  /**
2
- * Webhooks resource — CRUD + events + test for /v1/webhooks.
2
+ * Webhooks resource — CRUD + events + test + verify for /v1/webhooks.
3
3
  */
4
4
  import type { BaseClient, CursorPage } from '../base-client';
5
- import type { WebhookResponse, CreateWebhookParams, UpdateWebhookParams, WebhookEventResponse, ListWebhookEventsParams, WebhookTestResponse } from '../types/webhook';
5
+ import type { WebhookResponse, CreateWebhookParams, UpdateWebhookParams, WebhookEventResponse, ListWebhookEventsParams, WebhookTestResponse } from '../generated/types';
6
+ import type { RequestOptions } from '../types/shared';
6
7
  export declare class WebhooksResource {
7
8
  private readonly _client;
8
9
  constructor(_client: BaseClient);
9
- create(params: CreateWebhookParams): Promise<WebhookResponse>;
10
+ /**
11
+ * List all webhook endpoints.
12
+ *
13
+ * @returns Array of WebhookResponse objects (not paginated).
14
+ */
10
15
  list(): Promise<WebhookResponse[]>;
16
+ /**
17
+ * Register a new webhook endpoint.
18
+ *
19
+ * @param params - Webhook creation parameters (name, url, events).
20
+ * @param options - Request options.
21
+ * @returns The created WebhookResponse with signing secret.
22
+ */
23
+ create(params: CreateWebhookParams, options?: RequestOptions): Promise<WebhookResponse>;
24
+ /**
25
+ * Update a webhook endpoint.
26
+ *
27
+ * @param webhookId - The webhook ID (e.g. "wh_abc123").
28
+ * @param params - Fields to update.
29
+ * @returns The updated WebhookResponse.
30
+ */
11
31
  update(webhookId: string, params: UpdateWebhookParams): Promise<WebhookResponse>;
32
+ /**
33
+ * Delete a webhook endpoint.
34
+ *
35
+ * @param webhookId - The webhook ID (e.g. "wh_abc123").
36
+ */
12
37
  delete(webhookId: string): Promise<void>;
38
+ /**
39
+ * List delivery event history for a webhook endpoint.
40
+ *
41
+ * @param webhookId - The webhook ID.
42
+ * @param params - Filter and pagination parameters.
43
+ * @returns A CursorPage of WebhookEventResponse objects.
44
+ */
13
45
  listEvents(webhookId: string, params?: ListWebhookEventsParams): Promise<CursorPage<WebhookEventResponse>>;
46
+ /**
47
+ * Retry a failed webhook event delivery.
48
+ *
49
+ * @param webhookId - The webhook ID.
50
+ * @param eventId - The event ID (e.g. "evt_abc123").
51
+ * @param options - Request options.
52
+ * @returns The updated WebhookEventResponse.
53
+ */
54
+ retryEvent(webhookId: string, eventId: string, options?: RequestOptions): Promise<WebhookEventResponse>;
55
+ /**
56
+ * Send a test event to a webhook endpoint.
57
+ *
58
+ * @param webhookId - The webhook ID.
59
+ * @returns WebhookTestResponse with delivery result.
60
+ */
14
61
  test(webhookId: string): Promise<WebhookTestResponse>;
62
+ /**
63
+ * Verify the HMAC-SHA256 signature of an incoming webhook payload.
64
+ *
65
+ * @param payload - The raw request body string.
66
+ * @param signature - The value of the X-ListBee-Signature header.
67
+ * @param secret - Your webhook signing secret (whsec_...).
68
+ * @throws WebhookVerificationError if the signature is invalid.
69
+ */
70
+ verify(payload: string, signature: string, secret: string): Promise<void>;
15
71
  }
@@ -1,55 +1,136 @@
1
1
  "use strict";
2
2
  /**
3
- * Webhooks resource — CRUD + events + test for /v1/webhooks.
3
+ * Webhooks resource — CRUD + events + test + verify for /v1/webhooks.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.WebhooksResource = void 0;
7
+ const errors_1 = require("../errors");
7
8
  class WebhooksResource {
8
9
  constructor(_client) {
9
10
  this._client = _client;
10
11
  }
11
- async create(params) {
12
- const body = { name: params.name, url: params.url };
13
- if (params.events !== undefined)
14
- body['events'] = params.events;
15
- const response = await this._client.post('/v1/webhooks', body);
16
- return (await response.json());
17
- }
12
+ /**
13
+ * List all webhook endpoints.
14
+ *
15
+ * @returns Array of WebhookResponse objects (not paginated).
16
+ */
18
17
  async list() {
19
18
  var _a;
20
19
  const response = await this._client.get('/v1/webhooks');
21
20
  const body = (await response.json());
22
21
  return ((_a = body.data) !== null && _a !== void 0 ? _a : []);
23
22
  }
23
+ /**
24
+ * Register a new webhook endpoint.
25
+ *
26
+ * @param params - Webhook creation parameters (name, url, events).
27
+ * @param options - Request options.
28
+ * @returns The created WebhookResponse with signing secret.
29
+ */
30
+ async create(params, options) {
31
+ const response = await this._client.post('/v1/webhooks', params, options);
32
+ return (await response.json());
33
+ }
34
+ /**
35
+ * Update a webhook endpoint.
36
+ *
37
+ * @param webhookId - The webhook ID (e.g. "wh_abc123").
38
+ * @param params - Fields to update.
39
+ * @returns The updated WebhookResponse.
40
+ */
24
41
  async update(webhookId, params) {
25
- const body = {};
26
- if (params.name !== undefined)
27
- body['name'] = params.name;
28
- if (params.url !== undefined)
29
- body['url'] = params.url;
30
- if (params.events !== undefined)
31
- body['events'] = params.events;
32
- if (params.enabled !== undefined)
33
- body['enabled'] = params.enabled;
34
- const response = await this._client.put(`/v1/webhooks/${webhookId}`, body);
42
+ const response = await this._client.put(`/v1/webhooks/${webhookId}`, params);
35
43
  return (await response.json());
36
44
  }
45
+ /**
46
+ * Delete a webhook endpoint.
47
+ *
48
+ * @param webhookId - The webhook ID (e.g. "wh_abc123").
49
+ */
37
50
  async delete(webhookId) {
38
51
  await this._client.delete(`/v1/webhooks/${webhookId}`);
39
52
  }
53
+ /**
54
+ * List delivery event history for a webhook endpoint.
55
+ *
56
+ * @param webhookId - The webhook ID.
57
+ * @param params - Filter and pagination parameters.
58
+ * @returns A CursorPage of WebhookEventResponse objects.
59
+ */
40
60
  async listEvents(webhookId, params = {}) {
41
61
  var _a;
42
62
  const queryParams = { limit: (_a = params.limit) !== null && _a !== void 0 ? _a : 20 };
43
- if (params.status !== undefined)
44
- queryParams['status'] = params.status;
45
- if (params.cursor !== undefined)
63
+ if (params.delivered != null)
64
+ queryParams['delivered'] = params.delivered;
65
+ if (params.cursor != null)
46
66
  queryParams['cursor'] = params.cursor;
47
67
  return this._client.getPage(`/v1/webhooks/${webhookId}/events`, queryParams, (item) => item);
48
68
  }
69
+ /**
70
+ * Retry a failed webhook event delivery.
71
+ *
72
+ * @param webhookId - The webhook ID.
73
+ * @param eventId - The event ID (e.g. "evt_abc123").
74
+ * @param options - Request options.
75
+ * @returns The updated WebhookEventResponse.
76
+ */
77
+ async retryEvent(webhookId, eventId, options) {
78
+ const response = await this._client.post(`/v1/webhooks/${webhookId}/events/${eventId}/retry`, undefined, options);
79
+ return (await response.json());
80
+ }
81
+ /**
82
+ * Send a test event to a webhook endpoint.
83
+ *
84
+ * @param webhookId - The webhook ID.
85
+ * @returns WebhookTestResponse with delivery result.
86
+ */
49
87
  async test(webhookId) {
50
88
  const response = await this._client.post(`/v1/webhooks/${webhookId}/test`);
51
89
  return (await response.json());
52
90
  }
91
+ /**
92
+ * Verify the HMAC-SHA256 signature of an incoming webhook payload.
93
+ *
94
+ * @param payload - The raw request body string.
95
+ * @param signature - The value of the X-ListBee-Signature header.
96
+ * @param secret - Your webhook signing secret (whsec_...).
97
+ * @throws WebhookVerificationError if the signature is invalid.
98
+ */
99
+ async verify(payload, signature, secret) {
100
+ var _a;
101
+ const encoder = new TextEncoder();
102
+ const keyData = encoder.encode(secret);
103
+ const msgData = encoder.encode(payload);
104
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
105
+ const subtle = (_a = globalThis.crypto) === null || _a === void 0 ? void 0 : _a.subtle;
106
+ if (!subtle) {
107
+ throw new errors_1.WebhookVerificationError('crypto.subtle is not available in this environment');
108
+ }
109
+ const cryptoKey = await subtle.importKey('raw', keyData, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
110
+ const sigBuffer = await subtle.sign('HMAC', cryptoKey, msgData);
111
+ const sigHex = Array.from(new Uint8Array(sigBuffer))
112
+ .map((b) => b.toString(16).padStart(2, '0'))
113
+ .join('');
114
+ // Constant-time comparison using HMAC
115
+ const expectedBytes = encoder.encode(sigHex);
116
+ const actualBytes = encoder.encode(signature);
117
+ if (expectedBytes.length !== actualBytes.length) {
118
+ throw new errors_1.WebhookVerificationError('Invalid webhook signature');
119
+ }
120
+ // Compare using HMAC to avoid timing attacks
121
+ const compareKey = await subtle.importKey('raw', keyData, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
122
+ const expectedSig = await subtle.sign('HMAC', compareKey, expectedBytes);
123
+ const actualSig = await subtle.sign('HMAC', compareKey, actualBytes);
124
+ const expectedArr = new Uint8Array(expectedSig);
125
+ const actualArr = new Uint8Array(actualSig);
126
+ let mismatch = 0;
127
+ for (let i = 0; i < expectedArr.length; i++) {
128
+ mismatch |= expectedArr[i] ^ actualArr[i];
129
+ }
130
+ if (mismatch !== 0) {
131
+ throw new errors_1.WebhookVerificationError('Invalid webhook signature');
132
+ }
133
+ }
53
134
  }
54
135
  exports.WebhooksResource = WebhooksResource;
55
136
  //# sourceMappingURL=webhooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../../src/resources/webhooks.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAYH,MAAa,gBAAgB;IAC3B,YAA6B,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;IAAG,CAAC;IAEpD,KAAK,CAAC,MAAM,CAAC,MAA2B;QACtC,MAAM,IAAI,GAA4B,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,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CAAC;YAC5C,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QAC5C,CAAC;QAED,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACnB,MAAM,IAAI,iCAAwB,CAAC,2BAA2B,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;CACF;AA9JD,4CA8JC"}
@@ -1,10 +1,4 @@
1
- export type { AccountReadiness, ListingReadiness, ReadinessAction, ListResponse, CheckoutField, ShippingAddress } from './shared';
2
- export { ContentType, DeliverableType, FulfillmentMode, CheckoutFieldType, OrderStatus, FulfillmentStatus, WebhookEventType, ActionKind, ActionCode } from './shared';
3
- export type { AccountResponse, UpdateAccountParams, AccountStats } from './account';
4
- export type { BlurMode, CreateListingParams, FaqItem, ListingResponse, ListingStatus, Review, UpdateListingParams, } from './listing';
5
- export type { ApiKeyResponse } from './api-key';
6
- export type { OrderResponse, ListOrdersParams, FulfillOrderParams, ShipOrderParams } from './order';
7
- export type { SignupResponse, VerifyResponse } from './signup';
8
- export type { StripeConnectSessionResponse } from './stripe';
9
- export type { WebhookResponse, CreateWebhookParams, UpdateWebhookParams, WebhookEventResponse, ListWebhookEventsParams, WebhookTestResponse, } from './webhook';
10
- export type { StoreResponse, StoreListResponse, DomainResponse, DomainStatus, CreateStoreParams, UpdateStoreParams } from './store';
1
+ export type { ClientOptions, RequestOptions, ListResponse } from './shared';
2
+ export { CursorPage } from './shared';
3
+ export type * from '../generated/types';
4
+ export * from '../generated/enums';
@@ -1,14 +1,21 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActionCode = exports.ActionKind = exports.WebhookEventType = exports.FulfillmentStatus = exports.OrderStatus = exports.CheckoutFieldType = exports.FulfillmentMode = exports.DeliverableType = exports.ContentType = void 0;
17
+ exports.CursorPage = void 0;
4
18
  var shared_1 = require("./shared");
5
- Object.defineProperty(exports, "ContentType", { enumerable: true, get: function () { return shared_1.ContentType; } });
6
- Object.defineProperty(exports, "DeliverableType", { enumerable: true, get: function () { return shared_1.DeliverableType; } });
7
- Object.defineProperty(exports, "FulfillmentMode", { enumerable: true, get: function () { return shared_1.FulfillmentMode; } });
8
- Object.defineProperty(exports, "CheckoutFieldType", { enumerable: true, get: function () { return shared_1.CheckoutFieldType; } });
9
- Object.defineProperty(exports, "OrderStatus", { enumerable: true, get: function () { return shared_1.OrderStatus; } });
10
- Object.defineProperty(exports, "FulfillmentStatus", { enumerable: true, get: function () { return shared_1.FulfillmentStatus; } });
11
- Object.defineProperty(exports, "WebhookEventType", { enumerable: true, get: function () { return shared_1.WebhookEventType; } });
12
- Object.defineProperty(exports, "ActionKind", { enumerable: true, get: function () { return shared_1.ActionKind; } });
13
- Object.defineProperty(exports, "ActionCode", { enumerable: true, get: function () { return shared_1.ActionCode; } });
19
+ Object.defineProperty(exports, "CursorPage", { enumerable: true, get: function () { return shared_1.CursorPage; } });
20
+ __exportStar(require("../generated/enums"), exports);
14
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AACA,mCAAsK;AAA7J,qGAAA,WAAW,OAAA;AAAE,yGAAA,eAAe,OAAA;AAAE,yGAAA,eAAe,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAAE,qGAAA,WAAW,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AAAE,oGAAA,UAAU,OAAA;AAAE,oGAAA,UAAU,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,mCAAsC;AAA7B,oGAAA,UAAU,OAAA;AAEnB,qDAAmC"}
@@ -1,156 +1,36 @@
1
1
  /**
2
- * Shared types used across multiple resources.
2
+ * SDK infrastructure types and shared domain types.
3
3
  */
4
- /** A single readiness action describing how to resolve an issue. */
5
- export interface ReadinessAction {
6
- /** Machine-readable action code. */
7
- code: string;
8
- /** Whether this action is resolved via the API or manually by the human. */
9
- kind: 'api' | 'human';
10
- /** Human-readable description of the action. */
11
- message: string;
12
- /** How to resolve this action. */
13
- resolve: {
14
- /** HTTP method for API actions. */
15
- method: string;
16
- /** API endpoint path for `kind: "api"` actions. */
17
- endpoint: string | null;
18
- /** External URL for `kind: "human"` actions. */
19
- url: string | null;
20
- /** Request parameters to include. */
21
- params: Record<string, unknown> | null;
22
- };
4
+ export interface ClientOptions {
5
+ /** Your ListBee API key (lb_...). Falls back to LISTBEE_API_KEY env var. */
6
+ apiKey?: string;
7
+ /** API base URL. Default: https://api.listbee.so */
8
+ baseUrl?: string;
9
+ /** Default request timeout in milliseconds. Default: 30000 */
10
+ timeoutMs?: number;
11
+ /** Max retries on 429/5xx responses. Default: 3 */
12
+ maxRetries?: number;
23
13
  }
24
- /** Account operational readiness. */
25
- export interface AccountReadiness {
26
- /** Whether the account can accept payments. */
27
- operational: boolean;
28
- /** List of actions required to become operational. */
29
- actions: ReadinessAction[];
30
- /** Code of the highest-priority action, or null if operational. */
31
- next: string | null;
14
+ export interface RequestOptions {
15
+ /** Request timeout in milliseconds. */
16
+ timeoutMs?: number;
17
+ /** Idempotency key for safe request retries. */
18
+ idempotencyKey?: string;
19
+ /** Whether to include Authorization header. Default: true. */
20
+ authenticated?: boolean;
32
21
  }
33
- /** Listing monetization readiness. */
34
- export interface ListingReadiness {
35
- /** Whether buyers can complete a purchase on this listing. */
36
- sellable: boolean;
37
- /** List of actions required to become sellable. */
38
- actions: ReadinessAction[];
39
- /** Code of the highest-priority action, or null if sellable. */
40
- next: string | null;
41
- }
42
- /** Paginated list response wrapper. */
43
22
  export interface ListResponse<T> {
44
23
  object: 'list';
45
24
  data: T[];
46
25
  has_more: boolean;
47
26
  cursor: string | null;
27
+ total_count?: number;
48
28
  }
49
- /** Deliverable type auto-detected from the content value at creation. */
50
- export declare const DeliverableType: {
51
- readonly FILE: "file";
52
- readonly URL: "url";
53
- readonly TEXT: "text";
54
- };
55
- export type DeliverableType = (typeof DeliverableType)[keyof typeof DeliverableType];
56
- /**
57
- * Content type — auto-detected from the content value at creation.
58
- * @deprecated Use `DeliverableType` instead.
59
- */
60
- export declare const ContentType: {
61
- readonly FILE: "file";
62
- readonly URL: "url";
63
- readonly TEXT: "text";
64
- };
65
- /**
66
- * @deprecated Use `DeliverableType` instead.
67
- */
68
- export type ContentType = DeliverableType;
69
- /** Fulfillment mode for a listing. */
70
- export declare const FulfillmentMode: {
71
- readonly MANAGED: "managed";
72
- readonly EXTERNAL: "external";
73
- };
74
- export type FulfillmentMode = (typeof FulfillmentMode)[keyof typeof FulfillmentMode];
75
- /** Checkout field type for buyer-facing forms. */
76
- export declare const CheckoutFieldType: {
77
- readonly ADDRESS: "address";
78
- readonly TEXT: "text";
79
- readonly SELECT: "select";
80
- readonly DATE: "date";
81
- };
82
- export type CheckoutFieldType = (typeof CheckoutFieldType)[keyof typeof CheckoutFieldType];
83
- /** A single checkout field definition for the listing checkout form. */
84
- export interface CheckoutField {
85
- /** Field type. */
86
- type: CheckoutFieldType;
87
- /** Unique machine-readable field key. */
88
- key: string;
89
- /** Human-readable label shown to the buyer. */
90
- label: string;
91
- /** Whether the buyer must fill this field. */
92
- required: boolean;
93
- /** Available options (only for "select" type). */
94
- options?: string[];
95
- }
96
- /** Shipping address collected at checkout. */
97
- export interface ShippingAddress {
98
- /** Street address line 1. */
99
- line1: string;
100
- /** Street address line 2. */
101
- line2: string | null;
102
- /** City name. */
103
- city: string;
104
- /** State, province, or region. */
105
- state: string | null;
106
- /** Postal or ZIP code. */
107
- postal_code: string;
108
- /** Two-letter ISO 3166-1 alpha-2 country code. */
109
- country: string;
29
+ export declare class CursorPage<T> {
30
+ readonly object: "list";
31
+ readonly data: T[];
32
+ readonly has_more: boolean;
33
+ readonly cursor: string | null;
34
+ readonly total_count?: number;
35
+ constructor(body: ListResponse<T>);
110
36
  }
111
- /** Order status. */
112
- export declare const OrderStatus: {
113
- readonly PENDING: "pending";
114
- readonly PAID: "paid";
115
- readonly FULFILLED: "fulfilled";
116
- readonly CANCELED: "canceled";
117
- readonly FAILED: "failed";
118
- };
119
- export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];
120
- /** Order fulfillment status. */
121
- export declare const FulfillmentStatus: {
122
- readonly PENDING: "pending";
123
- readonly SHIPPED: "shipped";
124
- readonly FULFILLED: "fulfilled";
125
- };
126
- export type FulfillmentStatus = (typeof FulfillmentStatus)[keyof typeof FulfillmentStatus];
127
- /** Webhook event type. */
128
- export declare const WebhookEventType: {
129
- readonly ORDER_PAID: "order.paid";
130
- readonly ORDER_FULFILLED: "order.fulfilled";
131
- readonly ORDER_SHIPPED: "order.shipped";
132
- readonly ORDER_REFUNDED: "order.refunded";
133
- readonly ORDER_DISPUTED: "order.disputed";
134
- readonly ORDER_DISPUTE_CLOSED: "order.dispute_closed";
135
- readonly LISTING_CREATED: "listing.created";
136
- readonly LISTING_UPDATED: "listing.updated";
137
- readonly LISTING_PAUSED: "listing.paused";
138
- readonly LISTING_RESUMED: "listing.resumed";
139
- readonly LISTING_DELETED: "listing.deleted";
140
- };
141
- export type WebhookEventType = (typeof WebhookEventType)[keyof typeof WebhookEventType];
142
- /** Readiness action kind. */
143
- export declare const ActionKind: {
144
- readonly API: "api";
145
- readonly HUMAN: "human";
146
- };
147
- export type ActionKind = (typeof ActionKind)[keyof typeof ActionKind];
148
- /** Readiness action code. */
149
- export declare const ActionCode: {
150
- readonly SET_STRIPE_KEY: "set_stripe_key";
151
- readonly CONNECT_STRIPE: "connect_stripe";
152
- readonly ENABLE_CHARGES: "enable_charges";
153
- readonly UPDATE_BILLING: "update_billing";
154
- readonly CONFIGURE_WEBHOOK: "configure_webhook";
155
- };
156
- export type ActionCode = (typeof ActionCode)[keyof typeof ActionCode];
@@ -1,71 +1,17 @@
1
1
  "use strict";
2
2
  /**
3
- * Shared types used across multiple resources.
3
+ * SDK infrastructure types and shared domain types.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ActionCode = exports.ActionKind = exports.WebhookEventType = exports.FulfillmentStatus = exports.OrderStatus = exports.CheckoutFieldType = exports.FulfillmentMode = exports.ContentType = exports.DeliverableType = void 0;
7
- /** Deliverable type — auto-detected from the content value at creation. */
8
- exports.DeliverableType = {
9
- FILE: 'file',
10
- URL: 'url',
11
- TEXT: 'text',
12
- };
13
- /**
14
- * Content type — auto-detected from the content value at creation.
15
- * @deprecated Use `DeliverableType` instead.
16
- */
17
- exports.ContentType = exports.DeliverableType;
18
- /** Fulfillment mode for a listing. */
19
- exports.FulfillmentMode = {
20
- MANAGED: 'managed',
21
- EXTERNAL: 'external',
22
- };
23
- /** Checkout field type for buyer-facing forms. */
24
- exports.CheckoutFieldType = {
25
- ADDRESS: 'address',
26
- TEXT: 'text',
27
- SELECT: 'select',
28
- DATE: 'date',
29
- };
30
- /** Order status. */
31
- exports.OrderStatus = {
32
- PENDING: 'pending',
33
- PAID: 'paid',
34
- FULFILLED: 'fulfilled',
35
- CANCELED: 'canceled',
36
- FAILED: 'failed',
37
- };
38
- /** Order fulfillment status. */
39
- exports.FulfillmentStatus = {
40
- PENDING: 'pending',
41
- SHIPPED: 'shipped',
42
- FULFILLED: 'fulfilled',
43
- };
44
- /** Webhook event type. */
45
- exports.WebhookEventType = {
46
- ORDER_PAID: 'order.paid',
47
- ORDER_FULFILLED: 'order.fulfilled',
48
- ORDER_SHIPPED: 'order.shipped',
49
- ORDER_REFUNDED: 'order.refunded',
50
- ORDER_DISPUTED: 'order.disputed',
51
- ORDER_DISPUTE_CLOSED: 'order.dispute_closed',
52
- LISTING_CREATED: 'listing.created',
53
- LISTING_UPDATED: 'listing.updated',
54
- LISTING_PAUSED: 'listing.paused',
55
- LISTING_RESUMED: 'listing.resumed',
56
- LISTING_DELETED: 'listing.deleted',
57
- };
58
- /** Readiness action kind. */
59
- exports.ActionKind = {
60
- API: 'api',
61
- HUMAN: 'human',
62
- };
63
- /** Readiness action code. */
64
- exports.ActionCode = {
65
- SET_STRIPE_KEY: 'set_stripe_key',
66
- CONNECT_STRIPE: 'connect_stripe',
67
- ENABLE_CHARGES: 'enable_charges',
68
- UPDATE_BILLING: 'update_billing',
69
- CONFIGURE_WEBHOOK: 'configure_webhook',
70
- };
6
+ exports.CursorPage = void 0;
7
+ class CursorPage {
8
+ constructor(body) {
9
+ this.object = 'list';
10
+ this.data = body.data;
11
+ this.has_more = body.has_more;
12
+ this.cursor = body.cursor;
13
+ this.total_count = body.total_count;
14
+ }
15
+ }
16
+ exports.CursorPage = CursorPage;
71
17
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/types/shared.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAmDH,2EAA2E;AAC9D,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAC;AAGX;;;GAGG;AACU,QAAA,WAAW,GAAG,uBAAe,CAAC;AAM3C,sCAAsC;AACzB,QAAA,eAAe,GAAG;IAC7B,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;CACZ,CAAC;AAGX,kDAAkD;AACrC,Q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AAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACtC,CAAC;CACF;AAbD,gCAaC"}
@@ -1,33 +1,11 @@
1
1
  /**
2
2
  * Base HTTP client for the ListBee SDK.
3
3
  */
4
- import type { ListResponse } from './types/shared';
5
- /** Options accepted by the ListBee client constructor. */
6
- export interface ClientOptions {
7
- /** Your ListBee API key (lb_...). Falls back to LISTBEE_API_KEY env var. */
8
- apiKey?: string;
9
- /** API base URL. Default: https://api.listbee.so */
10
- baseUrl?: string;
11
- /** Default request timeout in milliseconds. Default: 30000 */
12
- timeoutMs?: number;
13
- /** Max retries on 429/5xx responses. Default: 3 */
14
- maxRetries?: number;
15
- }
16
- /** Options for individual HTTP requests. */
17
- export interface RequestOptions {
18
- /** Request timeout in milliseconds. */
19
- timeoutMs?: number;
20
- /** Whether to include the Authorization header. Default: true. */
21
- authenticated?: boolean;
22
- }
23
- /** A cursor page holding one page of results. */
24
- export declare class CursorPage<T> {
25
- readonly object: "list";
26
- readonly data: T[];
27
- readonly has_more: boolean;
28
- readonly cursor: string | null;
29
- constructor(body: ListResponse<T>);
30
- }
4
+ /// <reference types="node" />
5
+ import { CursorPage } from './types/shared';
6
+ import type { ClientOptions, RequestOptions } from './types/shared';
7
+ export type { ClientOptions, RequestOptions };
8
+ export { CursorPage };
31
9
  /** Internal HTTP response wrapper. */
32
10
  interface HttpResponse {
33
11
  status: number;
@@ -54,12 +32,14 @@ export declare class BaseClient {
54
32
  params?: Record<string, string | number | boolean>;
55
33
  timeoutMs?: number;
56
34
  authenticated?: boolean;
35
+ idempotencyKey?: string;
57
36
  }): Promise<HttpResponse>;
58
37
  get(path: string, params?: Record<string, string | number | boolean>, options?: RequestOptions): Promise<HttpResponse>;
59
38
  post(path: string, body?: unknown, options?: RequestOptions): Promise<HttpResponse>;
60
39
  put(path: string, body?: unknown, options?: RequestOptions): Promise<HttpResponse>;
61
40
  patch(path: string, body?: unknown, options?: RequestOptions): Promise<HttpResponse>;
62
- delete(path: string, options?: RequestOptions): Promise<HttpResponse>;
41
+ delete(path: string, options?: RequestOptions): Promise<void>;
42
+ deleteWithResponse<T>(path: string, options?: RequestOptions): Promise<T>;
43
+ postMultipart<T>(path: string, formData: FormData, options?: RequestOptions): Promise<T>;
63
44
  getPage<T>(path: string, params: Record<string, string | number | boolean>, parse: (item: unknown) => T, options?: RequestOptions): Promise<CursorPage<T>>;
64
45
  }
65
- export {};