@doist/twist-sdk 1.0.0 → 1.0.2

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.
@@ -51,9 +51,18 @@ exports.paramsSerializer = paramsSerializer;
51
51
  exports.fetchWithRetry = fetchWithRetry;
52
52
  exports.request = request;
53
53
  exports.isSuccess = isSuccess;
54
+ var undici_1 = require("undici");
54
55
  var errors_1 = require("./types/errors");
55
56
  var case_conversion_1 = require("./utils/case-conversion");
56
57
  var timestamp_conversion_1 = require("./utils/timestamp-conversion");
58
+ /**
59
+ * HTTP agent with keepAlive disabled to prevent hanging connections
60
+ * This ensures the process exits immediately after requests complete
61
+ */
62
+ var httpAgent = new undici_1.Agent({
63
+ keepAliveTimeout: 1, // Close connections after 1ms of idle time
64
+ keepAliveMaxTimeout: 1, // Maximum time to keep connections alive
65
+ });
57
66
  function paramsSerializer(params) {
58
67
  var qs = new URLSearchParams();
59
68
  Object.keys(params).forEach(function (key) {
@@ -94,6 +103,32 @@ function isNetworkError(error) {
94
103
  function getRetryDelay(retryCount) {
95
104
  return retryCount === 1 ? 0 : 500;
96
105
  }
106
+ /**
107
+ * Creates an AbortSignal that aborts after timeoutMs. Returns the signal and a
108
+ * clear function to cancel the timeout early.
109
+ */
110
+ function createTimeoutSignal(timeoutMs, existingSignal) {
111
+ var controller = new AbortController();
112
+ var timeoutId = setTimeout(function () {
113
+ controller.abort(new Error("Request timeout after ".concat(timeoutMs, "ms")));
114
+ }, timeoutMs);
115
+ function clear() {
116
+ clearTimeout(timeoutId);
117
+ }
118
+ // Forward existing signal if provided
119
+ if (existingSignal) {
120
+ if (existingSignal.aborted) {
121
+ controller.abort(existingSignal.reason);
122
+ }
123
+ else {
124
+ existingSignal.addEventListener('abort', function () {
125
+ controller.abort(existingSignal.reason);
126
+ clear();
127
+ }, { once: true });
128
+ }
129
+ }
130
+ return { signal: controller.signal, clear: clear };
131
+ }
97
132
  /**
98
133
  * Converts native fetch Response to CustomFetchResponse for consistent interface
99
134
  */
@@ -113,7 +148,7 @@ function convertResponseToCustomFetch(response) {
113
148
  }
114
149
  function fetchWithRetry(url_1, options_1) {
115
150
  return __awaiter(this, arguments, void 0, function (url, options, maxRetries, customFetch) {
116
- var lastError, attempt, response, _a, _b, responseText, responseData, camelCased, transformed, error_1, delay;
151
+ var lastError, attempt, clearTimeoutFn, requestSignal, timeoutResult, response, _a, _b, responseText, responseData, camelCased, transformed, error_1, delay;
117
152
  var _c;
118
153
  if (maxRetries === void 0) { maxRetries = 3; }
119
154
  return __generator(this, function (_d) {
@@ -123,9 +158,16 @@ function fetchWithRetry(url_1, options_1) {
123
158
  _d.label = 1;
124
159
  case 1:
125
160
  if (!(attempt <= maxRetries)) return [3 /*break*/, 13];
161
+ clearTimeoutFn = void 0;
126
162
  _d.label = 2;
127
163
  case 2:
128
164
  _d.trys.push([2, 8, , 12]);
165
+ requestSignal = options.signal || undefined;
166
+ if (options.timeout && options.timeout > 0) {
167
+ timeoutResult = createTimeoutSignal(options.timeout, requestSignal);
168
+ requestSignal = timeoutResult.signal;
169
+ clearTimeoutFn = timeoutResult.clear;
170
+ }
129
171
  if (!customFetch) return [3 /*break*/, 4];
130
172
  return [4 /*yield*/, customFetch(url, options)];
131
173
  case 3:
@@ -133,7 +175,9 @@ function fetchWithRetry(url_1, options_1) {
133
175
  return [3 /*break*/, 6];
134
176
  case 4:
135
177
  _b = convertResponseToCustomFetch;
136
- return [4 /*yield*/, fetch(url, options)];
178
+ return [4 /*yield*/, fetch(url, __assign(__assign({}, options), { signal: requestSignal,
179
+ // @ts-expect-error - dispatcher is valid for Node.js fetch but not in TS types
180
+ dispatcher: httpAgent }))];
137
181
  case 5:
138
182
  _a = _b.apply(void 0, [_d.sent()]);
139
183
  _d.label = 6;
@@ -154,6 +198,10 @@ function fetchWithRetry(url_1, options_1) {
154
198
  }
155
199
  camelCased = (0, case_conversion_1.camelCaseKeys)(responseData);
156
200
  transformed = (0, timestamp_conversion_1.transformTimestamps)(camelCased);
201
+ // Success – clear pending timeout (if any) so Node can exit promptly
202
+ if (clearTimeoutFn) {
203
+ clearTimeoutFn();
204
+ }
157
205
  return [2 /*return*/, {
158
206
  data: transformed,
159
207
  status: response.status,
@@ -169,8 +217,18 @@ function fetchWithRetry(url_1, options_1) {
169
217
  case 9:
170
218
  _d.sent();
171
219
  _d.label = 10;
172
- case 10: return [3 /*break*/, 12];
173
- case 11: return [3 /*break*/, 13];
220
+ case 10:
221
+ // Retry path ensure this attempt's timeout is cleared before looping
222
+ if (clearTimeoutFn) {
223
+ clearTimeoutFn();
224
+ }
225
+ return [3 /*break*/, 12];
226
+ case 11:
227
+ // Final error – clear timeout before throwing
228
+ if (clearTimeoutFn) {
229
+ clearTimeoutFn();
230
+ }
231
+ return [3 /*break*/, 13];
174
232
  case 12:
175
233
  attempt++;
176
234
  return [3 /*break*/, 1];
@@ -193,6 +251,7 @@ function request(args) {
193
251
  options = {
194
252
  method: httpMethod,
195
253
  headers: config.headers,
254
+ timeout: config.timeout,
196
255
  };
197
256
  if (httpMethod === 'GET' && payload) {
198
257
  searchParams = paramsSerializer((0, case_conversion_1.snakeCaseKeys)(payload));
@@ -45,9 +45,18 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ import { Agent } from 'undici';
48
49
  import { TwistRequestError } from './types/errors.js';
49
50
  import { camelCaseKeys, snakeCaseKeys } from './utils/case-conversion.js';
50
51
  import { transformTimestamps } from './utils/timestamp-conversion.js';
52
+ /**
53
+ * HTTP agent with keepAlive disabled to prevent hanging connections
54
+ * This ensures the process exits immediately after requests complete
55
+ */
56
+ var httpAgent = new Agent({
57
+ keepAliveTimeout: 1, // Close connections after 1ms of idle time
58
+ keepAliveMaxTimeout: 1, // Maximum time to keep connections alive
59
+ });
51
60
  export function paramsSerializer(params) {
52
61
  var qs = new URLSearchParams();
53
62
  Object.keys(params).forEach(function (key) {
@@ -88,6 +97,32 @@ function isNetworkError(error) {
88
97
  function getRetryDelay(retryCount) {
89
98
  return retryCount === 1 ? 0 : 500;
90
99
  }
100
+ /**
101
+ * Creates an AbortSignal that aborts after timeoutMs. Returns the signal and a
102
+ * clear function to cancel the timeout early.
103
+ */
104
+ function createTimeoutSignal(timeoutMs, existingSignal) {
105
+ var controller = new AbortController();
106
+ var timeoutId = setTimeout(function () {
107
+ controller.abort(new Error("Request timeout after ".concat(timeoutMs, "ms")));
108
+ }, timeoutMs);
109
+ function clear() {
110
+ clearTimeout(timeoutId);
111
+ }
112
+ // Forward existing signal if provided
113
+ if (existingSignal) {
114
+ if (existingSignal.aborted) {
115
+ controller.abort(existingSignal.reason);
116
+ }
117
+ else {
118
+ existingSignal.addEventListener('abort', function () {
119
+ controller.abort(existingSignal.reason);
120
+ clear();
121
+ }, { once: true });
122
+ }
123
+ }
124
+ return { signal: controller.signal, clear: clear };
125
+ }
91
126
  /**
92
127
  * Converts native fetch Response to CustomFetchResponse for consistent interface
93
128
  */
@@ -107,7 +142,7 @@ function convertResponseToCustomFetch(response) {
107
142
  }
108
143
  export function fetchWithRetry(url_1, options_1) {
109
144
  return __awaiter(this, arguments, void 0, function (url, options, maxRetries, customFetch) {
110
- var lastError, attempt, response, _a, _b, responseText, responseData, camelCased, transformed, error_1, delay;
145
+ var lastError, attempt, clearTimeoutFn, requestSignal, timeoutResult, response, _a, _b, responseText, responseData, camelCased, transformed, error_1, delay;
111
146
  var _c;
112
147
  if (maxRetries === void 0) { maxRetries = 3; }
113
148
  return __generator(this, function (_d) {
@@ -117,9 +152,16 @@ export function fetchWithRetry(url_1, options_1) {
117
152
  _d.label = 1;
118
153
  case 1:
119
154
  if (!(attempt <= maxRetries)) return [3 /*break*/, 13];
155
+ clearTimeoutFn = void 0;
120
156
  _d.label = 2;
121
157
  case 2:
122
158
  _d.trys.push([2, 8, , 12]);
159
+ requestSignal = options.signal || undefined;
160
+ if (options.timeout && options.timeout > 0) {
161
+ timeoutResult = createTimeoutSignal(options.timeout, requestSignal);
162
+ requestSignal = timeoutResult.signal;
163
+ clearTimeoutFn = timeoutResult.clear;
164
+ }
123
165
  if (!customFetch) return [3 /*break*/, 4];
124
166
  return [4 /*yield*/, customFetch(url, options)];
125
167
  case 3:
@@ -127,7 +169,9 @@ export function fetchWithRetry(url_1, options_1) {
127
169
  return [3 /*break*/, 6];
128
170
  case 4:
129
171
  _b = convertResponseToCustomFetch;
130
- return [4 /*yield*/, fetch(url, options)];
172
+ return [4 /*yield*/, fetch(url, __assign(__assign({}, options), { signal: requestSignal,
173
+ // @ts-expect-error - dispatcher is valid for Node.js fetch but not in TS types
174
+ dispatcher: httpAgent }))];
131
175
  case 5:
132
176
  _a = _b.apply(void 0, [_d.sent()]);
133
177
  _d.label = 6;
@@ -148,6 +192,10 @@ export function fetchWithRetry(url_1, options_1) {
148
192
  }
149
193
  camelCased = camelCaseKeys(responseData);
150
194
  transformed = transformTimestamps(camelCased);
195
+ // Success – clear pending timeout (if any) so Node can exit promptly
196
+ if (clearTimeoutFn) {
197
+ clearTimeoutFn();
198
+ }
151
199
  return [2 /*return*/, {
152
200
  data: transformed,
153
201
  status: response.status,
@@ -163,8 +211,18 @@ export function fetchWithRetry(url_1, options_1) {
163
211
  case 9:
164
212
  _d.sent();
165
213
  _d.label = 10;
166
- case 10: return [3 /*break*/, 12];
167
- case 11: return [3 /*break*/, 13];
214
+ case 10:
215
+ // Retry path ensure this attempt's timeout is cleared before looping
216
+ if (clearTimeoutFn) {
217
+ clearTimeoutFn();
218
+ }
219
+ return [3 /*break*/, 12];
220
+ case 11:
221
+ // Final error – clear timeout before throwing
222
+ if (clearTimeoutFn) {
223
+ clearTimeoutFn();
224
+ }
225
+ return [3 /*break*/, 13];
168
226
  case 12:
169
227
  attempt++;
170
228
  return [3 /*break*/, 1];
@@ -187,6 +245,7 @@ export function request(args) {
187
245
  options = {
188
246
  method: httpMethod,
189
247
  headers: config.headers,
248
+ timeout: config.timeout,
190
249
  };
191
250
  if (httpMethod === 'GET' && payload) {
192
251
  searchParams = paramsSerializer(snakeCaseKeys(payload));
@@ -1,4 +1,4 @@
1
- import type { CustomFetch } from './types/http';
1
+ import type { CustomFetch } from './types/http.js';
2
2
  export type AuthOptions = {
3
3
  /** Optional custom base URL for OAuth endpoints */
4
4
  baseUrl?: string;
@@ -1,5 +1,5 @@
1
- import { BaseClient } from './clients/base-client';
2
- import type { BatchRequestDescriptor, BatchResponseArray } from './types/batch';
1
+ import { BaseClient } from './clients/base-client.js';
2
+ import type { BatchRequestDescriptor, BatchResponseArray } from './types/batch.js';
3
3
  /**
4
4
  * Executes multiple API requests in a single HTTP call.
5
5
  *
@@ -1,5 +1,5 @@
1
- import type { ApiVersion } from '../types/api-version';
2
- import type { CustomFetch } from '../types/http';
1
+ import type { ApiVersion } from '../types/api-version.js';
2
+ import type { CustomFetch } from '../types/http.js';
3
3
  export type ClientConfig = {
4
4
  /** API token for authentication */
5
5
  apiToken: string;
@@ -1,7 +1,7 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { Channel } from '../types/entities';
3
- import { CreateChannelArgs, GetChannelsArgs, UpdateChannelArgs } from '../types/requests';
4
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { Channel } from '../types/entities.js';
3
+ import { CreateChannelArgs, GetChannelsArgs, UpdateChannelArgs } from '../types/requests.js';
4
+ import { BaseClient } from './base-client.js';
5
5
  export type AddChannelUserArgs = {
6
6
  id: number;
7
7
  userId: number;
@@ -1,7 +1,7 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { Comment } from '../types/entities';
3
- import { CreateCommentArgs, GetCommentsArgs, UpdateCommentArgs } from '../types/requests';
4
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { Comment } from '../types/entities.js';
3
+ import { CreateCommentArgs, GetCommentsArgs, UpdateCommentArgs } from '../types/requests.js';
4
+ import { BaseClient } from './base-client.js';
5
5
  export type MarkCommentPositionArgs = {
6
6
  threadId: number;
7
7
  commentId: number;
@@ -1,6 +1,6 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { ConversationMessage } from '../types/entities';
3
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { ConversationMessage } from '../types/entities.js';
3
+ import { BaseClient } from './base-client.js';
4
4
  type GetConversationMessagesArgs = {
5
5
  conversationId: number;
6
6
  newerThan?: Date;
@@ -1,7 +1,7 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { Conversation, UnreadConversation } from '../types/entities';
3
- import { GetConversationsArgs, GetOrCreateConversationArgs } from '../types/requests';
4
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { Conversation, UnreadConversation } from '../types/entities.js';
3
+ import { GetConversationsArgs, GetOrCreateConversationArgs } from '../types/requests.js';
4
+ import { BaseClient } from './base-client.js';
5
5
  export type UpdateConversationArgs = {
6
6
  id: number;
7
7
  title: string;
@@ -1,6 +1,6 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { Group } from '../types/entities';
3
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { Group } from '../types/entities.js';
3
+ import { BaseClient } from './base-client.js';
4
4
  export type AddGroupUserArgs = {
5
5
  id: number;
6
6
  userId: number;
@@ -1,6 +1,6 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { InboxThread } from '../types/entities';
3
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { InboxThread } from '../types/entities.js';
3
+ import { BaseClient } from './base-client.js';
4
4
  type GetInboxArgs = {
5
5
  workspaceId: number;
6
6
  since?: Date;
@@ -1,5 +1,5 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { BaseClient } from './base-client.js';
3
3
  type AddReactionArgs = {
4
4
  threadId?: number;
5
5
  commentId?: number;
@@ -1,6 +1,6 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { SearchResult } from '../types/entities';
3
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { SearchResult } from '../types/entities.js';
3
+ import { BaseClient } from './base-client.js';
4
4
  type SearchArgs = {
5
5
  query: string;
6
6
  workspaceId: number;
@@ -60,7 +60,7 @@ export declare class SearchClient extends BaseClient {
60
60
  * ```typescript
61
61
  * const results = await api.search.search({
62
62
  * query: 'important meeting',
63
- import { BaseClient, type ClientConfig } from './base-client'
63
+ import { BaseClient, type ClientConfig } from './base-client.js'
64
64
  * workspaceId: 123
65
65
  * })
66
66
  * ```
@@ -1,7 +1,7 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { Thread, UnreadThread } from '../types/entities';
3
- import { CreateThreadArgs, GetThreadsArgs, UpdateThreadArgs } from '../types/requests';
4
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { Thread, UnreadThread } from '../types/entities.js';
3
+ import { CreateThreadArgs, GetThreadsArgs, UpdateThreadArgs } from '../types/requests.js';
4
+ import { BaseClient } from './base-client.js';
5
5
  export type MoveThreadToChannelArgs = {
6
6
  id: number;
7
7
  toChannel: number;
@@ -1,6 +1,6 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { User } from '../types/entities';
3
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { User } from '../types/entities.js';
3
+ import { BaseClient } from './base-client.js';
4
4
  type AwayMode = {
5
5
  type: 'parental' | 'vacation' | 'sickleave' | 'other';
6
6
  dateFrom?: string;
@@ -1,7 +1,7 @@
1
- import { BatchRequestDescriptor } from '../types/batch';
2
- import { WorkspaceUser } from '../types/entities';
3
- import { UserType } from '../types/enums';
4
- import { BaseClient } from './base-client';
1
+ import { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { WorkspaceUser } from '../types/entities.js';
3
+ import { UserType } from '../types/enums.js';
4
+ import { BaseClient } from './base-client.js';
5
5
  export type GetWorkspaceUsersArgs = {
6
6
  workspaceId: number;
7
7
  archived?: boolean;
@@ -1,6 +1,6 @@
1
- import type { BatchRequestDescriptor } from '../types/batch';
2
- import { Channel, Workspace } from '../types/entities';
3
- import { BaseClient } from './base-client';
1
+ import type { BatchRequestDescriptor } from '../types/batch.js';
2
+ import { Channel, Workspace } from '../types/entities.js';
3
+ import { BaseClient } from './base-client.js';
4
4
  /**
5
5
  * Client for interacting with Twist workspace endpoints.
6
6
  */
@@ -1,4 +1,4 @@
1
- import type { ApiVersion } from '../types/api-version';
1
+ import type { ApiVersion } from '../types/api-version.js';
2
2
  export declare const API_VERSION = "v3";
3
3
  /**
4
4
  * @deprecated Use getTwistBaseUri() instead. This constant is kept for backward compatibility.
@@ -1,9 +1,9 @@
1
- export * from './authentication';
2
- export { BatchBuilder } from './batch-builder';
3
- export { ConversationMessagesClient } from './clients/conversation-messages-client';
4
- export { InboxClient } from './clients/inbox-client';
5
- export { ReactionsClient } from './clients/reactions-client';
6
- export { SearchClient } from './clients/search-client';
7
- export { TwistApi } from './twist-api';
8
- export * from './types/index';
9
- export * from './utils/index';
1
+ export * from './authentication.js';
2
+ export { BatchBuilder } from './batch-builder.js';
3
+ export { ConversationMessagesClient } from './clients/conversation-messages-client.js';
4
+ export { InboxClient } from './clients/inbox-client.js';
5
+ export { ReactionsClient } from './clients/reactions-client.js';
6
+ export { SearchClient } from './clients/search-client.js';
7
+ export { TwistApi } from './twist-api.js';
8
+ export * from './types/index.js';
9
+ export * from './utils/index.js';
@@ -1,6 +1,8 @@
1
- import { CustomFetch, HttpMethod, HttpResponse } from './types/http';
1
+ import { CustomFetch, HttpMethod, HttpResponse } from './types/http.js';
2
2
  export declare function paramsSerializer(params: Record<string, unknown>): string;
3
- export declare function fetchWithRetry<T>(url: string, options: RequestInit, maxRetries?: number, customFetch?: CustomFetch): Promise<HttpResponse<T>>;
3
+ export declare function fetchWithRetry<T>(url: string, options: RequestInit & {
4
+ timeout?: number;
5
+ }, maxRetries?: number, customFetch?: CustomFetch): Promise<HttpResponse<T>>;
4
6
  export type RequestArgs = {
5
7
  httpMethod: HttpMethod;
6
8
  baseUri: string;
@@ -1,5 +1,5 @@
1
1
  import type { RequestUrlParam, RequestUrlResponse } from 'obsidian';
2
- import type { CustomFetch } from '../types/http';
2
+ import type { CustomFetch } from '../types/http.js';
3
3
  /**
4
4
  * Creates a CustomFetch adapter for Obsidian's requestUrl API.
5
5
  *
@@ -16,7 +16,7 @@ import type { CustomFetch } from '../types/http';
16
16
  * @example
17
17
  * ```typescript
18
18
  * import { requestUrl } from 'obsidian'
19
- * import { createObsidianFetchAdapter } from './obsidian-fetch-adapter'
19
+ * import { createObsidianFetchAdapter } from './obsidian-fetch-adapter.js'
20
20
  *
21
21
  * const api = new TwistApi('your-token', {
22
22
  * customFetch: createObsidianFetchAdapter(requestUrl)
@@ -1,4 +1,4 @@
1
- import { Channel, Comment, Conversation, Group, Thread, User, Workspace, WorkspaceUser } from '../types/entities';
1
+ import { Channel, Comment, Conversation, Group, Thread, User, Workspace, WorkspaceUser } from '../types/entities.js';
2
2
  export declare const TEST_API_TOKEN = "test-api-token";
3
3
  export declare const mockUser: User;
4
4
  export declare const mockWorkspace: Workspace;
@@ -1,17 +1,17 @@
1
- import { ChannelsClient } from './clients/channels-client';
2
- import { CommentsClient } from './clients/comments-client';
3
- import { ConversationMessagesClient } from './clients/conversation-messages-client';
4
- import { ConversationsClient } from './clients/conversations-client';
5
- import { GroupsClient } from './clients/groups-client';
6
- import { InboxClient } from './clients/inbox-client';
7
- import { ReactionsClient } from './clients/reactions-client';
8
- import { SearchClient } from './clients/search-client';
9
- import { ThreadsClient } from './clients/threads-client';
10
- import { UsersClient } from './clients/users-client';
11
- import { WorkspaceUsersClient } from './clients/workspace-users-client';
12
- import { WorkspacesClient } from './clients/workspaces-client';
13
- import type { BatchRequestDescriptor, BatchResponseArray } from './types/batch';
14
- import type { CustomFetch } from './types/http';
1
+ import { ChannelsClient } from './clients/channels-client.js';
2
+ import { CommentsClient } from './clients/comments-client.js';
3
+ import { ConversationMessagesClient } from './clients/conversation-messages-client.js';
4
+ import { ConversationsClient } from './clients/conversations-client.js';
5
+ import { GroupsClient } from './clients/groups-client.js';
6
+ import { InboxClient } from './clients/inbox-client.js';
7
+ import { ReactionsClient } from './clients/reactions-client.js';
8
+ import { SearchClient } from './clients/search-client.js';
9
+ import { ThreadsClient } from './clients/threads-client.js';
10
+ import { UsersClient } from './clients/users-client.js';
11
+ import { WorkspaceUsersClient } from './clients/workspace-users-client.js';
12
+ import { WorkspacesClient } from './clients/workspaces-client.js';
13
+ import type { BatchRequestDescriptor, BatchResponseArray } from './types/batch.js';
14
+ import type { CustomFetch } from './types/http.js';
15
15
  export type TwistApiOptions = {
16
16
  /** Optional custom API base URL. If not provided, defaults to Twist's standard API endpoint. */
17
17
  baseUrl?: string;
@@ -1,6 +1,6 @@
1
- export * from './batch';
2
- export * from './entities';
3
- export * from './enums';
4
- export * from './errors';
5
- export * from './http';
6
- export * from './requests';
1
+ export * from './batch.js';
2
+ export * from './entities.js';
3
+ export * from './enums.js';
4
+ export * from './errors.js';
5
+ export * from './http.js';
6
+ export * from './requests.js';
@@ -1,2 +1,2 @@
1
- export * from './case-conversion';
2
- export * from './url-helpers';
1
+ export * from './case-conversion.js';
2
+ export * from './url-helpers.js';
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "@doist/twist-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A TypeScript wrapper for the Twist REST API.",
5
5
  "author": "Doist developers",
6
6
  "homepage": "https://doist.github.io/twist-sdk-typescript/",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/Doist/twist-sdk-typescript.git"
10
- },
7
+ "repository": "https://github.com/Doist/twist-sdk-typescript",
11
8
  "publishConfig": {
12
9
  "registry": "https://registry.npmjs.org"
13
10
  },
@@ -32,8 +29,9 @@
32
29
  "build:cjs": "npx tsc -p tsconfig.cjs.json",
33
30
  "build:esm": "npx tsc -p tsconfig.esm.json",
34
31
  "build:fix-esm": "node scripts/fix-esm-imports.cjs",
32
+ "build:fix-dts": "node scripts/fix-dts-imports.cjs",
35
33
  "build:post": "echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
36
- "build": "npm-run-all clean build:cjs build:esm build:fix-esm build:post",
34
+ "build": "npm-run-all clean build:cjs build:esm build:fix-esm build:fix-dts build:post",
37
35
  "type-check": "npx tsc --noEmit",
38
36
  "biome:sort-imports": "biome check --formatter-enabled=false --linter-enabled=false --organize-imports-enabled=true --write .",
39
37
  "lint:check": "biome lint",
@@ -42,14 +40,16 @@
42
40
  "format:write": "biome format --write",
43
41
  "check": "biome check",
44
42
  "check:fix": "biome check --fix --unsafe",
43
+ "attw": "npx @arethetypeswrong/cli --pack --ignore-rules fallback-condition false-esm",
45
44
  "audit": "npm audit --audit-level=moderate",
46
- "integrity-checks": "npm-run-all clean check test build",
45
+ "integrity-checks": "npm-run-all clean check test build attw",
47
46
  "prepublishOnly": "npm run integrity-checks",
48
47
  "prepare": "npm run build"
49
48
  },
50
49
  "dependencies": {
51
50
  "camelcase": "8.0.0",
52
51
  "ts-custom-error": "^3.2.0",
52
+ "undici": "^7.16.0",
53
53
  "uuid": "^11.1.0",
54
54
  "zod": "4.1.12"
55
55
  },