@doist/twist-sdk 0.1.0-alpha.0 → 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/twist-sdk",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0-alpha.1",
4
4
  "description": "A TypeScript wrapper for the Twist REST API.",
5
5
  "author": "Doist developers",
6
6
  "repository": {
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "files": [
66
66
  "dist/**/*",
67
- "!dist/**/*.test.js",
68
- "!dist/**/*.test.d.ts"
67
+ "!dist/**/*.test.*",
68
+ "!dist/testUtils"
69
69
  ]
70
70
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"authentication.test.d.ts","sourceRoot":"","sources":["../src/authentication.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch-builder.test.d.ts","sourceRoot":"","sources":["../src/batch-builder.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"channels-client.test.d.ts","sourceRoot":"","sources":["../../src/clients/channels-client.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"comments-client.test.d.ts","sourceRoot":"","sources":["../../src/clients/comments-client.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"conversation-messages-client.test.d.ts","sourceRoot":"","sources":["../../src/clients/conversation-messages-client.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"conversations-client.test.d.ts","sourceRoot":"","sources":["../../src/clients/conversations-client.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"groups-client.test.d.ts","sourceRoot":"","sources":["../../src/clients/groups-client.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"reactions-client.test.d.ts","sourceRoot":"","sources":["../../src/clients/reactions-client.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"threads-client.test.d.ts","sourceRoot":"","sources":["../../src/clients/threads-client.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"users-client.test.d.ts","sourceRoot":"","sources":["../../src/clients/users-client.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace-users-client.test.d.ts","sourceRoot":"","sources":["../../src/clients/workspace-users-client.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspaces-client.test.d.ts","sourceRoot":"","sources":["../../src/clients/workspaces-client.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"rest-client.test.d.ts","sourceRoot":"","sources":["../src/rest-client.test.ts"],"names":[],"mappings":""}
@@ -1,29 +0,0 @@
1
- import { HttpResponse, http } from 'msw';
2
- type JsonValue = string | number | boolean | null | JsonValue[] | {
3
- [key: string]: JsonValue;
4
- };
5
- /**
6
- * Creates a successful API response with the given data
7
- */
8
- export declare function createSuccessResponse(data: JsonValue): HttpResponse<import("msw").JsonBodyType>;
9
- /**
10
- * Creates an error API response
11
- */
12
- export declare function createErrorResponse(errorCode: string, errorMessage: string, status?: number): HttpResponse<import("msw").JsonBodyType>;
13
- /**
14
- * Helper to create API endpoint URL
15
- */
16
- export declare function apiUrl(path: string): string;
17
- /**
18
- * Creates a handler for a GET endpoint
19
- */
20
- export declare function createGetHandler(endpoint: string, responseData: JsonValue): import("msw").HttpHandler;
21
- /**
22
- * Creates a handler for a POST endpoint
23
- */
24
- export declare function createPostHandler(endpoint: string, responseData: JsonValue): import("msw").HttpHandler;
25
- /**
26
- * Export http from msw for custom handlers
27
- */
28
- export { http, HttpResponse };
29
- //# sourceMappingURL=msw-handlers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"msw-handlers.d.ts","sourceRoot":"","sources":["../../src/testUtils/msw-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAIxC,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAE9F;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,4CAEpD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAM,4CAQxF;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI3C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,6BAIzE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,6BAI1E;AAED;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA"}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpResponse = exports.http = void 0;
4
- exports.createSuccessResponse = createSuccessResponse;
5
- exports.createErrorResponse = createErrorResponse;
6
- exports.apiUrl = apiUrl;
7
- exports.createGetHandler = createGetHandler;
8
- exports.createPostHandler = createPostHandler;
9
- var msw_1 = require("msw");
10
- Object.defineProperty(exports, "HttpResponse", { enumerable: true, get: function () { return msw_1.HttpResponse; } });
11
- Object.defineProperty(exports, "http", { enumerable: true, get: function () { return msw_1.http; } });
12
- var BASE_URL = 'https://api.twist.com';
13
- /**
14
- * Creates a successful API response with the given data
15
- */
16
- function createSuccessResponse(data) {
17
- return msw_1.HttpResponse.json(data, { status: 200 });
18
- }
19
- /**
20
- * Creates an error API response
21
- */
22
- function createErrorResponse(errorCode, errorMessage, status) {
23
- if (status === void 0) { status = 400; }
24
- return msw_1.HttpResponse.json({
25
- error_code: errorCode,
26
- error_string: errorMessage,
27
- }, { status: status });
28
- }
29
- /**
30
- * Helper to create API endpoint URL
31
- */
32
- function apiUrl(path) {
33
- // Remove leading slash if present
34
- var cleanPath = path.startsWith('/') ? path.slice(1) : path;
35
- return "".concat(BASE_URL, "/").concat(cleanPath);
36
- }
37
- /**
38
- * Creates a handler for a GET endpoint
39
- */
40
- function createGetHandler(endpoint, responseData) {
41
- return msw_1.http.get(apiUrl(endpoint), function () {
42
- return createSuccessResponse(responseData);
43
- });
44
- }
45
- /**
46
- * Creates a handler for a POST endpoint
47
- */
48
- function createPostHandler(endpoint, responseData) {
49
- return msw_1.http.post(apiUrl(endpoint), function () {
50
- return createSuccessResponse(responseData);
51
- });
52
- }
@@ -1,2 +0,0 @@
1
- export declare const server: import("msw/node").SetupServerApi;
2
- //# sourceMappingURL=msw-setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"msw-setup.d.ts","sourceRoot":"","sources":["../../src/testUtils/msw-setup.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,mCAAgB,CAAA"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.server = void 0;
4
- var node_1 = require("msw/node");
5
- var vitest_1 = require("vitest");
6
- // Create MSW server instance
7
- exports.server = (0, node_1.setupServer)();
8
- // Start server before all tests
9
- (0, vitest_1.beforeAll)(function () {
10
- // Only warn on unhandled requests instead of error, since rest-client.test.ts
11
- // uses direct fetch mocking which bypasses MSW
12
- exports.server.listen({ onUnhandledRequest: 'warn' });
13
- });
14
- // Reset handlers after each test
15
- (0, vitest_1.afterEach)(function () {
16
- exports.server.resetHandlers();
17
- });
18
- // Clean up after all tests
19
- (0, vitest_1.afterAll)(function () {
20
- exports.server.close();
21
- });
@@ -1,11 +0,0 @@
1
- import { Channel, Comment, Conversation, Group, Thread, User, Workspace, WorkspaceUser } from '../types/entities';
2
- export declare const TEST_API_TOKEN = "test-api-token";
3
- export declare const mockUser: User;
4
- export declare const mockWorkspace: Workspace;
5
- export declare const mockChannel: Channel;
6
- export declare const mockThread: Thread;
7
- export declare const mockGroup: Group;
8
- export declare const mockConversation: Conversation;
9
- export declare const mockComment: Comment;
10
- export declare const mockWorkspaceUser: WorkspaceUser;
11
- //# sourceMappingURL=test-defaults.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-defaults.d.ts","sourceRoot":"","sources":["../../src/testUtils/test-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,OAAO,EACP,YAAY,EACZ,KAAK,EACL,MAAM,EACN,IAAI,EACJ,SAAS,EACT,aAAa,EAChB,MAAM,mBAAmB,CAAA;AAE1B,eAAO,MAAM,cAAc,mBAAmB,CAAA;AAE9C,eAAO,MAAM,QAAQ,EAAE,IAStB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,SAK3B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,OASzB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,MAexB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAMvB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,YAY9B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,OAMzB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,aAsB/B,CAAA"}
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mockWorkspaceUser = exports.mockComment = exports.mockConversation = exports.mockGroup = exports.mockThread = exports.mockChannel = exports.mockWorkspace = exports.mockUser = exports.TEST_API_TOKEN = void 0;
4
- exports.TEST_API_TOKEN = 'test-api-token';
5
- exports.mockUser = {
6
- id: 1,
7
- email: 'test@example.com',
8
- name: 'Test User',
9
- shortName: 'TU',
10
- bot: false,
11
- timezone: 'America/New_York',
12
- removed: false,
13
- lang: 'en',
14
- };
15
- exports.mockWorkspace = {
16
- id: 1,
17
- name: 'Test Workspace',
18
- creator: 1,
19
- created: new Date('2021-01-01T00:00:00Z'),
20
- };
21
- exports.mockChannel = {
22
- id: 1,
23
- name: 'general',
24
- creator: 1,
25
- public: true,
26
- workspaceId: 1,
27
- archived: false,
28
- created: new Date('2021-01-01T00:00:00Z'),
29
- version: 0,
30
- };
31
- exports.mockThread = {
32
- id: 1,
33
- title: 'Test Thread',
34
- content: 'This is a test thread',
35
- creator: 1,
36
- channelId: 1,
37
- workspaceId: 1,
38
- commentCount: 0,
39
- lastUpdated: new Date('2021-01-01T00:00:00Z'),
40
- pinned: false,
41
- posted: new Date('2021-01-01T00:00:00Z'),
42
- snippet: 'This is a test thread',
43
- snippetCreator: 1,
44
- starred: false,
45
- isArchived: false,
46
- };
47
- exports.mockGroup = {
48
- id: 1,
49
- name: 'Test Group',
50
- workspaceId: 1,
51
- userIds: [1, 2, 3],
52
- version: 0,
53
- };
54
- exports.mockConversation = {
55
- id: 1,
56
- workspaceId: 1,
57
- userIds: [1, 2],
58
- messageCount: 1,
59
- lastObjIndex: 0,
60
- snippet: 'Hello there',
61
- snippetCreators: [1],
62
- lastActive: new Date('2021-01-01T00:00:00Z'),
63
- archived: false,
64
- created: new Date('2021-01-01T00:00:00Z'),
65
- creator: 1,
66
- };
67
- exports.mockComment = {
68
- id: 1,
69
- content: 'This is a comment',
70
- creator: 1,
71
- threadId: 1,
72
- posted: new Date('2021-01-01T00:00:00Z'),
73
- };
74
- exports.mockWorkspaceUser = {
75
- id: 1,
76
- name: 'Test User',
77
- email: 'test@example.com',
78
- userType: 'USER',
79
- shortName: 'TU',
80
- firstName: 'Test',
81
- avatarId: null,
82
- avatarUrls: null,
83
- awayMode: null,
84
- bot: false,
85
- contactInfo: null,
86
- dateFormat: null,
87
- featureFlags: null,
88
- profession: null,
89
- removed: false,
90
- restricted: null,
91
- setupPending: null,
92
- theme: null,
93
- timeFormat: null,
94
- timezone: 'America/New_York',
95
- version: 1,
96
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"twist-api.test.d.ts","sourceRoot":"","sources":["../src/twist-api.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"case-conversion.test.d.ts","sourceRoot":"","sources":["../../src/utils/case-conversion.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"url-helpers.test.d.ts","sourceRoot":"","sources":["../../src/utils/url-helpers.test.ts"],"names":[],"mappings":""}