@crosspost/sdk 0.2.12 → 0.3.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.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -26,7 +36,6 @@ __export(index_exports, {
26
36
  CrosspostError: () => CrosspostError,
27
37
  PostApi: () => PostApi,
28
38
  SystemApi: () => SystemApi,
29
- apiWrapper: () => apiWrapper,
30
39
  getErrorDetails: () => getErrorDetails,
31
40
  getErrorMessage: () => getErrorMessage,
32
41
  isAuthError: () => isAuthError,
@@ -42,8 +51,8 @@ __export(index_exports, {
42
51
  module.exports = __toCommonJS(index_exports);
43
52
 
44
53
  // src/core/request.ts
54
+ var import_async_retry = __toESM(require("async-retry"), 1);
45
55
  var import_types2 = require("@crosspost/types");
46
- var import_near_sign_verify = require("near-sign-verify");
47
56
 
48
57
  // src/utils/error.ts
49
58
  var import_types = require("@crosspost/types");
@@ -155,41 +164,6 @@ function enrichErrorWithContext(error, context) {
155
164
  { originalError: error, ...context }
156
165
  );
157
166
  }
158
- async function apiWrapper(apiCall, context) {
159
- try {
160
- return await apiCall();
161
- } catch (error) {
162
- if (error instanceof Response) {
163
- try {
164
- const errorData = await error.json();
165
- throw enrichErrorWithContext(
166
- handleErrorResponse(errorData, error.status),
167
- context || {}
168
- );
169
- } catch (jsonError) {
170
- if (jsonError instanceof Error && jsonError.name === "SyntaxError") {
171
- throw enrichErrorWithContext(
172
- createError(
173
- `API request failed with status ${error.status} and non-JSON response`,
174
- import_types.ApiErrorCode.NETWORK_ERROR,
175
- error.status,
176
- { originalResponse: error.statusText }
177
- ),
178
- context || {}
179
- );
180
- }
181
- throw jsonError;
182
- }
183
- }
184
- if (error instanceof CrosspostError) {
185
- throw enrichErrorWithContext(error, context || {});
186
- }
187
- throw enrichErrorWithContext(
188
- error instanceof Error ? error : new Error(String(error)),
189
- context || {}
190
- );
191
- }
192
- }
193
167
  function handleErrorResponse(data, status) {
194
168
  if (!data || typeof data !== "object" || !("success" in data)) {
195
169
  return createError(
@@ -275,97 +249,117 @@ async function makeRequest(method, path, options, data, query) {
275
249
  path,
276
250
  url
277
251
  };
278
- const controller = new AbortController();
279
- const timeoutId = setTimeout(() => controller.abort(), options.timeout);
280
- try {
281
- const headers = {
282
- "Content-Type": "application/json",
283
- "Accept": "application/json"
284
- };
285
- if (method === "GET") {
286
- const nearAccount = options.nearAccount || options.nearAuthData?.account_id;
287
- if (!nearAccount) {
288
- throw new CrosspostError(
289
- "No NEAR account provided for GET request",
290
- import_types2.ApiErrorCode.UNAUTHORIZED,
291
- 401
252
+ return (0, import_async_retry.default)(
253
+ async (bail, _attemptNumber) => {
254
+ const controller = new AbortController();
255
+ const timeoutId = setTimeout(() => controller.abort(), options.timeout);
256
+ try {
257
+ const headers = {
258
+ "Content-Type": "application/json",
259
+ "Accept": "application/json"
260
+ };
261
+ if (method === "GET") {
262
+ const accountId = options.accountId;
263
+ if (!accountId) {
264
+ throw new CrosspostError(
265
+ "No NEAR account provided for GET request",
266
+ import_types2.ApiErrorCode.UNAUTHORIZED,
267
+ 401
268
+ );
269
+ }
270
+ headers["X-Near-Account"] = accountId;
271
+ } else {
272
+ if (!options.authToken) {
273
+ throw new CrosspostError(
274
+ "Auth token required for non-GET request",
275
+ import_types2.ApiErrorCode.UNAUTHORIZED,
276
+ 401
277
+ );
278
+ }
279
+ headers["Authorization"] = `Bearer ${options.authToken}`;
280
+ }
281
+ const requestOptions = {
282
+ method,
283
+ headers,
284
+ body: method !== "GET" && data ? JSON.stringify(data) : void 0,
285
+ signal: controller.signal
286
+ };
287
+ const response = await fetch(url, requestOptions);
288
+ clearTimeout(timeoutId);
289
+ let responseData;
290
+ try {
291
+ responseData = await response.json();
292
+ } catch (jsonError) {
293
+ let responseText;
294
+ try {
295
+ responseText = await response.text();
296
+ } catch (_) {
297
+ }
298
+ throw new CrosspostError(
299
+ `API request failed with status ${response.status} and non-JSON response`,
300
+ import_types2.ApiErrorCode.INVALID_RESPONSE,
301
+ response.status,
302
+ {
303
+ originalStatusText: response.statusText,
304
+ originalError: jsonError instanceof Error ? jsonError.message : String(jsonError),
305
+ responseText
306
+ }
307
+ );
308
+ }
309
+ if (!response.ok) {
310
+ throw handleErrorResponse(responseData, response.status);
311
+ }
312
+ if (!responseData || typeof responseData !== "object" || !("success" in responseData) || !("meta" in responseData)) {
313
+ throw new CrosspostError(
314
+ "Invalid response format from API",
315
+ import_types2.ApiErrorCode.INVALID_RESPONSE,
316
+ response.status,
317
+ { responseData }
318
+ );
319
+ }
320
+ if (responseData.success) {
321
+ return responseData;
322
+ }
323
+ throw handleErrorResponse(responseData, response.status);
324
+ } catch (error) {
325
+ clearTimeout(timeoutId);
326
+ if (error instanceof TypeError || error instanceof DOMException && error.name === "AbortError") {
327
+ throw error;
328
+ }
329
+ if (error instanceof CrosspostError) {
330
+ const enrichedError = enrichErrorWithContext(error, context);
331
+ bail(enrichedError);
332
+ throw enrichedError;
333
+ }
334
+ if (error instanceof TypeError || error instanceof DOMException && error.name === "AbortError") {
335
+ const networkError = createNetworkError(error, url.toString(), options.timeout);
336
+ const enrichedNetworkError = enrichErrorWithContext(networkError, context);
337
+ bail(enrichedNetworkError);
338
+ throw enrichedNetworkError;
339
+ }
340
+ const wrappedError = new CrosspostError(
341
+ error instanceof Error ? error.message : String(error),
342
+ import_types2.ApiErrorCode.INTERNAL_ERROR,
343
+ 500,
344
+ { originalError: String(error) }
292
345
  );
346
+ const enrichedWrappedError = enrichErrorWithContext(wrappedError, context);
347
+ bail(enrichedWrappedError);
348
+ throw enrichedWrappedError;
293
349
  }
294
- headers["X-Near-Account"] = nearAccount;
295
- } else {
296
- if (!options.nearAuthData) {
297
- throw new CrosspostError(
298
- "NEAR authentication data required for non-GET request",
299
- import_types2.ApiErrorCode.UNAUTHORIZED,
300
- 401
350
+ },
351
+ {
352
+ retries: 3,
353
+ factor: 1,
354
+ minTimeout: 1e3,
355
+ maxTimeout: 1e3,
356
+ onRetry: (error, attempt) => {
357
+ console.warn(
358
+ `Attempt ${attempt} failed for ${context.method} ${context.path}: ${error instanceof Error ? error.message : "Unknown error"}. Retrying...`
301
359
  );
302
360
  }
303
- headers["Authorization"] = `Bearer ${(0, import_near_sign_verify.createAuthToken)(options.nearAuthData)}`;
304
- }
305
- const requestOptions = {
306
- method,
307
- headers,
308
- body: method !== "GET" && data ? JSON.stringify(data) : void 0,
309
- signal: controller.signal
310
- };
311
- const response = await fetch(url, requestOptions);
312
- clearTimeout(timeoutId);
313
- let responseData;
314
- try {
315
- responseData = await response.json();
316
- } catch (jsonError) {
317
- let responseText;
318
- try {
319
- responseText = await response.text();
320
- } catch (_) {
321
- }
322
- throw new CrosspostError(
323
- `API request failed with status ${response.status} and non-JSON response`,
324
- import_types2.ApiErrorCode.INVALID_RESPONSE,
325
- response.status,
326
- {
327
- originalStatusText: response.statusText,
328
- originalError: jsonError instanceof Error ? jsonError.message : String(jsonError),
329
- responseText
330
- }
331
- );
332
- }
333
- if (!response.ok) {
334
- throw handleErrorResponse(responseData, response.status);
335
- }
336
- if (!responseData || typeof responseData !== "object" || !("success" in responseData) || !("meta" in responseData)) {
337
- throw new CrosspostError(
338
- "Invalid response format from API",
339
- import_types2.ApiErrorCode.INVALID_RESPONSE,
340
- response.status,
341
- { responseData }
342
- );
343
- }
344
- if (responseData.success) {
345
- return responseData;
346
- }
347
- throw handleErrorResponse(responseData, response.status);
348
- } catch (error) {
349
- clearTimeout(timeoutId);
350
- if (error instanceof CrosspostError) {
351
- throw enrichErrorWithContext(error, context);
352
361
  }
353
- if (error instanceof TypeError || error instanceof DOMException && error.name === "AbortError") {
354
- throw enrichErrorWithContext(
355
- createNetworkError(error, url.toString(), options.timeout),
356
- context
357
- );
358
- }
359
- throw enrichErrorWithContext(
360
- new CrosspostError(
361
- error instanceof Error ? error.message : String(error),
362
- import_types2.ApiErrorCode.INTERNAL_ERROR,
363
- 500,
364
- { originalError: String(error) }
365
- ),
366
- context
367
- );
368
- }
362
+ );
369
363
  }
370
364
 
371
365
  // src/api/activity.ts
@@ -500,7 +494,7 @@ var AuthApi = class {
500
494
  this.options = options;
501
495
  }
502
496
  /**
503
- * Authorizes the NEAR account associated with the provided nearAuthData with the Crosspost service.
497
+ * Authorizes the NEAR account associated with the provided authToken with the Crosspost service.
504
498
  * @returns A promise resolving with the authorization response.
505
499
  */
506
500
  async authorizeNearAccount() {
@@ -797,11 +791,11 @@ var CrosspostClient = class {
797
791
  constructor(config = {}) {
798
792
  const baseUrl = config.baseUrl || DEFAULT_CONFIG.baseUrl;
799
793
  const timeout = config.timeout || DEFAULT_CONFIG.timeout;
800
- const nearAuthData = config.nearAuthData;
794
+ const authToken = config.authToken;
801
795
  this.options = {
802
796
  baseUrl: baseUrl instanceof URL ? baseUrl : new URL(baseUrl),
803
797
  timeout,
804
- nearAuthData
798
+ authToken
805
799
  };
806
800
  this.auth = new AuthApi(this.options);
807
801
  this.post = new PostApi(this.options);
@@ -811,50 +805,32 @@ var CrosspostClient = class {
811
805
  /**
812
806
  * Sets the authentication data (signature) for the client
813
807
  * Required for non-GET requests
814
- * @param nearAuthData The NEAR authentication data
808
+ * @param authToken The NEAR authentication data
815
809
  */
816
- setAuthentication(nearAuthData) {
817
- this.options.nearAuthData = nearAuthData;
818
- if (!this.options.nearAccount) {
819
- this.options.nearAccount = nearAuthData.account_id;
820
- }
810
+ setAuthentication(authToken) {
811
+ this.options.authToken = authToken;
821
812
  }
822
813
  /**
823
814
  * Sets the NEAR account ID for simplified GET request authentication
824
- * If not set, will use account_id from nearAuthData
825
- * @param nearAccount The NEAR account ID
815
+ * @param accountId The NEAR account ID
826
816
  */
827
- setNearAccount(nearAccount) {
828
- this.options.nearAccount = nearAccount;
829
- }
830
- /**
831
- * Gets the current NEAR account ID being used for authentication
832
- * @returns The NEAR account ID from nearAccount or nearAuthData
833
- */
834
- getNearAccount() {
835
- return this.options.nearAccount || this.options.nearAuthData?.account_id;
817
+ setAccountHeader(accountId) {
818
+ this.options.accountId = accountId;
836
819
  }
837
820
  /**
838
821
  * Checks if authentication data (signature) exists on client
839
- * @returns true if nearAuthData is set (required for non-GET requests)
822
+ * @returns true if authToken is set (required for non-GET requests)
840
823
  */
841
824
  isAuthenticated() {
842
- return !!this.options.nearAuthData;
843
- }
844
- /**
845
- * Checks if a NEAR account is set for GET request authentication
846
- * @returns true if either nearAccount or nearAuthData.account_id is set
847
- */
848
- hasNearAccount() {
849
- return !!(this.options.nearAccount || this.options.nearAuthData?.account_id);
825
+ return !!this.options.authToken;
850
826
  }
851
827
  /**
852
828
  * Clears all authentication data from the client
853
829
  * This will prevent all requests from working until new authentication is set
854
830
  */
855
831
  clear() {
856
- this.options.nearAuthData = void 0;
857
- this.options.nearAccount = void 0;
832
+ this.options.authToken = void 0;
833
+ this.options.accountId = void 0;
858
834
  }
859
835
  };
860
836
  // Annotate the CommonJS export names for ESM import in node:
@@ -865,7 +841,6 @@ var CrosspostClient = class {
865
841
  CrosspostError,
866
842
  PostApi,
867
843
  SystemApi,
868
- apiWrapper,
869
844
  getErrorDetails,
870
845
  getErrorMessage,
871
846
  isAuthError,
package/dist/index.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- import { NearAuthData } from 'near-sign-verify';
2
1
  import { ActivityLeaderboardQuery, ApiResponse, ActivityLeaderboardResponse, AccountActivityQuery, AccountActivityResponse, AccountPostsQuery, AccountPostsResponse, NearAuthorizationResponse, Platform, AuthInitRequest, AuthCallbackResponse, AuthUrlResponse, ConnectedAccount, AuthStatusResponse, NearUnauthorizationResponse, AuthRevokeResponse, ConnectedAccountsResponse, CreatePostRequest, MultiStatusData, RepostRequest, QuotePostRequest, ReplyToPostRequest, LikePostRequest, UnlikePostRequest, DeletePostRequest, RateLimitResponse, EndpointRateLimitResponse, HealthStatus, ApiErrorCode, StatusCode, ErrorDetails } from '@crosspost/types';
3
2
 
4
3
  /**
@@ -10,15 +9,13 @@ interface RequestOptions {
10
9
  */
11
10
  baseUrl: URL;
12
11
  /**
13
- * NEAR authentication data for generating auth tokens
14
- * Required for non-GET requests, optional for GET requests
12
+ * Auth token from near-sign-verify
15
13
  */
16
- nearAuthData?: NearAuthData;
14
+ authToken?: string;
17
15
  /**
18
- * NEAR account ID for simplified GET request authentication
19
- * If not provided, will use account_id from nearAuthData
16
+ * NEAR account ID for simple GET request authentication
20
17
  */
21
- nearAccount?: string;
18
+ accountId?: string;
22
19
  /**
23
20
  * Request timeout in milliseconds
24
21
  */
@@ -68,7 +65,7 @@ declare class AuthApi {
68
65
  */
69
66
  constructor(options: RequestOptions);
70
67
  /**
71
- * Authorizes the NEAR account associated with the provided nearAuthData with the Crosspost service.
68
+ * Authorizes the NEAR account associated with the provided authToken with the Crosspost service.
72
69
  * @returns A promise resolving with the authorization response.
73
70
  */
74
71
  authorizeNearAccount(): Promise<ApiResponse<NearAuthorizationResponse>>;
@@ -216,9 +213,9 @@ interface CrosspostClientConfig {
216
213
  */
217
214
  baseUrl?: string | URL;
218
215
  /**
219
- * NEAR authentication data obtained from near-sign-verify
216
+ * Auth token, obtained by near-sign-verify
220
217
  */
221
- nearAuthData?: NearAuthData;
218
+ authToken?: string;
222
219
  /**
223
220
  * Request timeout in milliseconds
224
221
  * @default 30000
@@ -243,30 +240,19 @@ declare class CrosspostClient {
243
240
  /**
244
241
  * Sets the authentication data (signature) for the client
245
242
  * Required for non-GET requests
246
- * @param nearAuthData The NEAR authentication data
243
+ * @param authToken The NEAR authentication data
247
244
  */
248
- setAuthentication(nearAuthData: NearAuthData): void;
245
+ setAuthentication(authToken: string): void;
249
246
  /**
250
247
  * Sets the NEAR account ID for simplified GET request authentication
251
- * If not set, will use account_id from nearAuthData
252
- * @param nearAccount The NEAR account ID
248
+ * @param accountId The NEAR account ID
253
249
  */
254
- setNearAccount(nearAccount: string): void;
255
- /**
256
- * Gets the current NEAR account ID being used for authentication
257
- * @returns The NEAR account ID from nearAccount or nearAuthData
258
- */
259
- getNearAccount(): string | undefined;
250
+ setAccountHeader(accountId: string): void;
260
251
  /**
261
252
  * Checks if authentication data (signature) exists on client
262
- * @returns true if nearAuthData is set (required for non-GET requests)
253
+ * @returns true if authToken is set (required for non-GET requests)
263
254
  */
264
255
  isAuthenticated(): boolean;
265
- /**
266
- * Checks if a NEAR account is set for GET request authentication
267
- * @returns true if either nearAccount or nearAuthData.account_id is set
268
- */
269
- hasNearAccount(): boolean;
270
256
  /**
271
257
  * Clears all authentication data from the client
272
258
  * This will prevent all requests from working until new authentication is set
@@ -336,9 +322,5 @@ declare function getErrorMessage(error: unknown, defaultMessage?: string): strin
336
322
  * Get error details if available
337
323
  */
338
324
  declare function getErrorDetails(error: unknown): ErrorDetails | undefined;
339
- /**
340
- * Wrapper for API calls with consistent error handling
341
- */
342
- declare function apiWrapper<T>(apiCall: () => Promise<T>, context?: Record<string, unknown>): Promise<T>;
343
325
 
344
- export { ActivityApi, AuthApi, CrosspostClient, type CrosspostClientConfig, CrosspostError, PostApi, SystemApi, apiWrapper, getErrorDetails, getErrorMessage, isAuthError, isContentError, isMediaError, isNetworkError, isPlatformError, isPostError, isRateLimitError, isRecoverableError, isValidationError };
326
+ export { ActivityApi, AuthApi, CrosspostClient, type CrosspostClientConfig, CrosspostError, PostApi, SystemApi, getErrorDetails, getErrorMessage, isAuthError, isContentError, isMediaError, isNetworkError, isPlatformError, isPostError, isRateLimitError, isRecoverableError, isValidationError };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { NearAuthData } from 'near-sign-verify';
2
1
  import { ActivityLeaderboardQuery, ApiResponse, ActivityLeaderboardResponse, AccountActivityQuery, AccountActivityResponse, AccountPostsQuery, AccountPostsResponse, NearAuthorizationResponse, Platform, AuthInitRequest, AuthCallbackResponse, AuthUrlResponse, ConnectedAccount, AuthStatusResponse, NearUnauthorizationResponse, AuthRevokeResponse, ConnectedAccountsResponse, CreatePostRequest, MultiStatusData, RepostRequest, QuotePostRequest, ReplyToPostRequest, LikePostRequest, UnlikePostRequest, DeletePostRequest, RateLimitResponse, EndpointRateLimitResponse, HealthStatus, ApiErrorCode, StatusCode, ErrorDetails } from '@crosspost/types';
3
2
 
4
3
  /**
@@ -10,15 +9,13 @@ interface RequestOptions {
10
9
  */
11
10
  baseUrl: URL;
12
11
  /**
13
- * NEAR authentication data for generating auth tokens
14
- * Required for non-GET requests, optional for GET requests
12
+ * Auth token from near-sign-verify
15
13
  */
16
- nearAuthData?: NearAuthData;
14
+ authToken?: string;
17
15
  /**
18
- * NEAR account ID for simplified GET request authentication
19
- * If not provided, will use account_id from nearAuthData
16
+ * NEAR account ID for simple GET request authentication
20
17
  */
21
- nearAccount?: string;
18
+ accountId?: string;
22
19
  /**
23
20
  * Request timeout in milliseconds
24
21
  */
@@ -68,7 +65,7 @@ declare class AuthApi {
68
65
  */
69
66
  constructor(options: RequestOptions);
70
67
  /**
71
- * Authorizes the NEAR account associated with the provided nearAuthData with the Crosspost service.
68
+ * Authorizes the NEAR account associated with the provided authToken with the Crosspost service.
72
69
  * @returns A promise resolving with the authorization response.
73
70
  */
74
71
  authorizeNearAccount(): Promise<ApiResponse<NearAuthorizationResponse>>;
@@ -216,9 +213,9 @@ interface CrosspostClientConfig {
216
213
  */
217
214
  baseUrl?: string | URL;
218
215
  /**
219
- * NEAR authentication data obtained from near-sign-verify
216
+ * Auth token, obtained by near-sign-verify
220
217
  */
221
- nearAuthData?: NearAuthData;
218
+ authToken?: string;
222
219
  /**
223
220
  * Request timeout in milliseconds
224
221
  * @default 30000
@@ -243,30 +240,19 @@ declare class CrosspostClient {
243
240
  /**
244
241
  * Sets the authentication data (signature) for the client
245
242
  * Required for non-GET requests
246
- * @param nearAuthData The NEAR authentication data
243
+ * @param authToken The NEAR authentication data
247
244
  */
248
- setAuthentication(nearAuthData: NearAuthData): void;
245
+ setAuthentication(authToken: string): void;
249
246
  /**
250
247
  * Sets the NEAR account ID for simplified GET request authentication
251
- * If not set, will use account_id from nearAuthData
252
- * @param nearAccount The NEAR account ID
248
+ * @param accountId The NEAR account ID
253
249
  */
254
- setNearAccount(nearAccount: string): void;
255
- /**
256
- * Gets the current NEAR account ID being used for authentication
257
- * @returns The NEAR account ID from nearAccount or nearAuthData
258
- */
259
- getNearAccount(): string | undefined;
250
+ setAccountHeader(accountId: string): void;
260
251
  /**
261
252
  * Checks if authentication data (signature) exists on client
262
- * @returns true if nearAuthData is set (required for non-GET requests)
253
+ * @returns true if authToken is set (required for non-GET requests)
263
254
  */
264
255
  isAuthenticated(): boolean;
265
- /**
266
- * Checks if a NEAR account is set for GET request authentication
267
- * @returns true if either nearAccount or nearAuthData.account_id is set
268
- */
269
- hasNearAccount(): boolean;
270
256
  /**
271
257
  * Clears all authentication data from the client
272
258
  * This will prevent all requests from working until new authentication is set
@@ -336,9 +322,5 @@ declare function getErrorMessage(error: unknown, defaultMessage?: string): strin
336
322
  * Get error details if available
337
323
  */
338
324
  declare function getErrorDetails(error: unknown): ErrorDetails | undefined;
339
- /**
340
- * Wrapper for API calls with consistent error handling
341
- */
342
- declare function apiWrapper<T>(apiCall: () => Promise<T>, context?: Record<string, unknown>): Promise<T>;
343
325
 
344
- export { ActivityApi, AuthApi, CrosspostClient, type CrosspostClientConfig, CrosspostError, PostApi, SystemApi, apiWrapper, getErrorDetails, getErrorMessage, isAuthError, isContentError, isMediaError, isNetworkError, isPlatformError, isPostError, isRateLimitError, isRecoverableError, isValidationError };
326
+ export { ActivityApi, AuthApi, CrosspostClient, type CrosspostClientConfig, CrosspostError, PostApi, SystemApi, getErrorDetails, getErrorMessage, isAuthError, isContentError, isMediaError, isNetworkError, isPlatformError, isPostError, isRateLimitError, isRecoverableError, isValidationError };