Skip to content

Commit 1c1e6dc

Browse files
committed
refactor: Install rest-typings and migrate helper types
Preparation & Setup - Install @rocket.chat/[email protected] - Install @rocket.chat/[email protected] (required dependency) - Explore and document package structure Helper Types Migration - Migrate PaginatedRequest to re-export from @rocket.chat/rest-typings - Migrate PaginatedResult to re-export from @rocket.chat/rest-typings - Update helpers/index.ts with TODO for future endpoint migration - Keep custom ResultFor, Serialized, ErrorResult for SDK compatibility
1 parent 3315fb4 commit 1c1e6dc

File tree

11 files changed

+1254
-16
lines changed

11 files changed

+1254
-16
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,10 @@ e2e/e2e_account.ts
8383
**/e2e_account.js
8484
**/e2e_account.ts
8585

86-
*.p8
86+
*.p8
87+
88+
*MIGRATION*.md
89+
*PHASE_*.md
90+
migration.md
91+
scripts/verify-migration-phase.sh
92+
app/definitions/rest/COMPATIBILITY_LAYER.md

MIGRATION_CHECKLIST.md

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
# Migration Checklist: REST Typings Migration
2+
3+
Use this checklist to track progress through each phase. Check off items as you complete them.
4+
5+
## Phase 0: Preparation & Setup
6+
- [ ] Install `@rocket.chat/rest-typings` package
7+
- [ ] Explore package exports: `npm view @rocket.chat/rest-typings@latest`
8+
- [ ] Check package structure and available exports
9+
- [ ] Document package structure and exports
10+
- [ ] Run `yarn lint` - must pass with 0 errors
11+
- [ ] Create feature branch: `git checkout -b refactor/rest-typings-phase0`
12+
13+
## Phase 1: Helper Types Migration
14+
- [ ] Check if rest-typings provides PaginatedRequest/PaginatedResult
15+
- [ ] Review `app/definitions/rest/helpers/index.ts` structure
16+
- [ ] Create compatibility layer if needed
17+
- [ ] Update helper types to work with rest-typings
18+
- [ ] Test type utilities (PathFor, OperationParams, ResultFor)
19+
- [ ] Run `yarn lint` - must pass with 0 errors
20+
- [ ] Run `tsc --noEmit` - must pass
21+
- [ ] Commit changes: `git commit -m "refactor: migrate helper types to rest-typings"`
22+
23+
## Phase 2: Core Infrastructure
24+
- [ ] Review `app/lib/services/sdk.ts` current implementation
25+
- [ ] Review `app/lib/hooks/useEndpointData.ts` current implementation
26+
- [ ] Update SDK imports to use rest-typings
27+
- [ ] Update useEndpointData hook imports
28+
- [ ] Create bridge file `app/definitions/rest/v1/index.ts` that re-exports from package
29+
- [ ] Test SDK type checking
30+
- [ ] Test useEndpointData hook
31+
- [ ] Run `yarn lint` - must pass with 0 errors
32+
- [ ] Run `tsc --noEmit` - must pass
33+
- [ ] Test basic SDK functionality
34+
- [ ] Commit changes: `git commit -m "refactor: update core infrastructure for rest-typings"`
35+
36+
## Phase 3: Simple Endpoint Categories
37+
38+
### subscriptions.ts
39+
- [ ] Remove `app/definitions/rest/v1/subscriptions.ts`
40+
- [ ] Update imports in `app/lib/services/restApi.ts`
41+
- [ ] Verify type compatibility
42+
- [ ] Test subscription functionality
43+
- [ ] Run `yarn lint` - must pass with 0 errors
44+
- [ ] Run `tsc --noEmit` - must pass
45+
- [ ] Commit: `git commit -m "refactor: migrate subscriptions endpoints to rest-typings"`
46+
47+
### push.ts
48+
- [ ] Remove `app/definitions/rest/v1/push.ts`
49+
- [ ] Update imports
50+
- [ ] Verify type compatibility
51+
- [ ] Test push functionality
52+
- [ ] Run `yarn lint` - must pass with 0 errors
53+
- [ ] Run `tsc --noEmit` - must pass
54+
- [ ] Commit: `git commit -m "refactor: migrate push endpoints to rest-typings"`
55+
56+
### customUserStatus.ts
57+
- [ ] Remove `app/definitions/rest/v1/customUserStatus.ts`
58+
- [ ] Update imports
59+
- [ ] Verify type compatibility
60+
- [ ] Test custom user status functionality
61+
- [ ] Run `yarn lint` - must pass with 0 errors
62+
- [ ] Run `tsc --noEmit` - must pass
63+
- [ ] Commit: `git commit -m "refactor: migrate customUserStatus endpoints to rest-typings"`
64+
65+
### directory.ts
66+
- [ ] Remove `app/definitions/rest/v1/directory.ts`
67+
- [ ] Update imports
68+
- [ ] Verify type compatibility
69+
- [ ] Test directory functionality
70+
- [ ] Run `yarn lint` - must pass with 0 errors
71+
- [ ] Run `tsc --noEmit` - must pass
72+
- [ ] Commit: `git commit -m "refactor: migrate directory endpoints to rest-typings"`
73+
74+
### permissions.ts
75+
- [ ] Remove `app/definitions/rest/v1/permissions.ts`
76+
- [ ] Update imports
77+
- [ ] Verify type compatibility
78+
- [ ] Test permissions functionality
79+
- [ ] Run `yarn lint` - must pass with 0 errors
80+
- [ ] Run `tsc --noEmit` - must pass
81+
- [ ] Commit: `git commit -m "refactor: migrate permissions endpoints to rest-typings"`
82+
83+
### roles.ts
84+
- [ ] Remove `app/definitions/rest/v1/roles.ts`
85+
- [ ] Update imports
86+
- [ ] Verify type compatibility
87+
- [ ] Test roles functionality
88+
- [ ] Run `yarn lint` - must pass with 0 errors
89+
- [ ] Run `tsc --noEmit` - must pass
90+
- [ ] Commit: `git commit -m "refactor: migrate roles endpoints to rest-typings"`
91+
92+
## Phase 4: Medium Complexity Categories
93+
94+
### commands.ts
95+
- [ ] Remove `app/definitions/rest/v1/commands.ts`
96+
- [ ] Update imports
97+
- [ ] Handle type differences
98+
- [ ] Test command functionality
99+
- [ ] Run `yarn lint` - must pass with 0 errors
100+
- [ ] Run `tsc --noEmit` - must pass
101+
- [ ] Commit: `git commit -m "refactor: migrate commands endpoints to rest-typings"`
102+
103+
### e2e.ts
104+
- [ ] Remove `app/definitions/rest/v1/e2e.ts`
105+
- [ ] Update imports
106+
- [ ] Handle type differences
107+
- [ ] Test E2E functionality
108+
- [ ] Run `yarn lint` - must pass with 0 errors
109+
- [ ] Run `tsc --noEmit` - must pass
110+
- [ ] Commit: `git commit -m "refactor: migrate e2e endpoints to rest-typings"`
111+
112+
### settings.ts
113+
- [ ] Remove `app/definitions/rest/v1/settings.ts`
114+
- [ ] Update imports
115+
- [ ] Handle type differences
116+
- [ ] Test settings functionality
117+
- [ ] Run `yarn lint` - must pass with 0 errors
118+
- [ ] Run `tsc --noEmit` - must pass
119+
- [ ] Commit: `git commit -m "refactor: migrate settings endpoints to rest-typings"`
120+
121+
### autotranslate.ts
122+
- [ ] Remove `app/definitions/rest/v1/autotranslate.ts`
123+
- [ ] Update imports
124+
- [ ] Handle type differences
125+
- [ ] Test autotranslate functionality
126+
- [ ] Run `yarn lint` - must pass with 0 errors
127+
- [ ] Run `tsc --noEmit` - must pass
128+
- [ ] Commit: `git commit -m "refactor: migrate autotranslate endpoints to rest-typings"`
129+
130+
### moderation.ts
131+
- [ ] Remove `app/definitions/rest/v1/moderation.ts`
132+
- [ ] Update imports
133+
- [ ] Handle type differences
134+
- [ ] Test moderation functionality
135+
- [ ] Run `yarn lint` - must pass with 0 errors
136+
- [ ] Run `tsc --noEmit` - must pass
137+
- [ ] Commit: `git commit -m "refactor: migrate moderation endpoints to rest-typings"`
138+
139+
### videoConference.ts
140+
- [ ] Remove `app/definitions/rest/v1/videoConference.ts`
141+
- [ ] Update imports
142+
- [ ] Handle type differences
143+
- [ ] Test video conference functionality
144+
- [ ] Run `yarn lint` - must pass with 0 errors
145+
- [ ] Run `tsc --noEmit` - must pass
146+
- [ ] Commit: `git commit -m "refactor: migrate videoConference endpoints to rest-typings"`
147+
148+
## Phase 5: High Complexity Categories
149+
150+
### users.ts
151+
- [ ] Remove `app/definitions/rest/v1/users.ts`
152+
- [ ] Update all imports in `app/lib/services/restApi.ts`
153+
- [ ] Handle type differences carefully
154+
- [ ] Test user management functionality thoroughly
155+
- [ ] Run `yarn lint` - must pass with 0 errors
156+
- [ ] Run `tsc --noEmit` - must pass
157+
- [ ] Manual testing of user flows
158+
- [ ] Commit: `git commit -m "refactor: migrate users endpoints to rest-typings"`
159+
160+
### rooms.ts
161+
- [ ] Remove `app/definitions/rest/v1/rooms.ts`
162+
- [ ] Update all imports
163+
- [ ] Handle type differences carefully
164+
- [ ] Test room operations thoroughly
165+
- [ ] Run `yarn lint` - must pass with 0 errors
166+
- [ ] Run `tsc --noEmit` - must pass
167+
- [ ] Manual testing of room flows
168+
- [ ] Commit: `git commit -m "refactor: migrate rooms endpoints to rest-typings"`
169+
170+
### chat.ts
171+
- [ ] Remove `app/definitions/rest/v1/chat.ts`
172+
- [ ] Update all imports
173+
- [ ] Handle type differences carefully
174+
- [ ] Test chat/messaging functionality thoroughly
175+
- [ ] Run `yarn lint` - must pass with 0 errors
176+
- [ ] Run `tsc --noEmit` - must pass
177+
- [ ] Manual testing of messaging flows
178+
- [ ] Commit: `git commit -m "refactor: migrate chat endpoints to rest-typings"`
179+
180+
### channels.ts
181+
- [ ] Remove `app/definitions/rest/v1/channels.ts`
182+
- [ ] Update all imports
183+
- [ ] Handle type differences carefully
184+
- [ ] Test channel operations thoroughly
185+
- [ ] Run `yarn lint` - must pass with 0 errors
186+
- [ ] Run `tsc --noEmit` - must pass
187+
- [ ] Manual testing of channel flows
188+
- [ ] Commit: `git commit -m "refactor: migrate channels endpoints to rest-typings"`
189+
190+
### groups.ts
191+
- [ ] Remove `app/definitions/rest/v1/groups.ts`
192+
- [ ] Update all imports
193+
- [ ] Handle type differences carefully
194+
- [ ] Test group operations thoroughly
195+
- [ ] Run `yarn lint` - must pass with 0 errors
196+
- [ ] Run `tsc --noEmit` - must pass
197+
- [ ] Manual testing of group flows
198+
- [ ] Commit: `git commit -m "refactor: migrate groups endpoints to rest-typings"`
199+
200+
### im.ts
201+
- [ ] Remove `app/definitions/rest/v1/im.ts`
202+
- [ ] Update all imports
203+
- [ ] Handle type differences carefully
204+
- [ ] Test direct message functionality thoroughly
205+
- [ ] Run `yarn lint` - must pass with 0 errors
206+
- [ ] Run `tsc --noEmit` - must pass
207+
- [ ] Manual testing of DM flows
208+
- [ ] Commit: `git commit -m "refactor: migrate im endpoints to rest-typings"`
209+
210+
### dm.ts
211+
- [ ] Remove `app/definitions/rest/v1/dm.ts`
212+
- [ ] Update all imports
213+
- [ ] Handle type differences carefully
214+
- [ ] Test DM operations thoroughly
215+
- [ ] Run `yarn lint` - must pass with 0 errors
216+
- [ ] Run `tsc --noEmit` - must pass
217+
- [ ] Manual testing of DM flows
218+
- [ ] Commit: `git commit -m "refactor: migrate dm endpoints to rest-typings"`
219+
220+
### teams.ts
221+
- [ ] Remove `app/definitions/rest/v1/teams.ts`
222+
- [ ] Update all imports
223+
- [ ] Handle type differences carefully
224+
- [ ] Test team operations thoroughly
225+
- [ ] Run `yarn lint` - must pass with 0 errors
226+
- [ ] Run `tsc --noEmit` - must pass
227+
- [ ] Manual testing of team flows
228+
- [ ] Commit: `git commit -m "refactor: migrate teams endpoints to rest-typings"`
229+
230+
### emojiCustom.ts
231+
- [ ] Remove `app/definitions/rest/v1/emojiCustom.ts`
232+
- [ ] Update all imports
233+
- [ ] Handle type differences carefully
234+
- [ ] Test custom emoji functionality thoroughly
235+
- [ ] Run `yarn lint` - must pass with 0 errors
236+
- [ ] Run `tsc --noEmit` - must pass
237+
- [ ] Manual testing of emoji flows
238+
- [ ] Commit: `git commit -m "refactor: migrate emojiCustom endpoints to rest-typings"`
239+
240+
### invites.ts
241+
- [ ] Remove `app/definitions/rest/v1/invites.ts`
242+
- [ ] Update all imports
243+
- [ ] Handle type differences carefully
244+
- [ ] Test invite functionality thoroughly
245+
- [ ] Run `yarn lint` - must pass with 0 errors
246+
- [ ] Run `tsc --noEmit` - must pass
247+
- [ ] Manual testing of invite flows
248+
- [ ] Commit: `git commit -m "refactor: migrate invites endpoints to rest-typings"`
249+
250+
### omnichannel.ts
251+
- [ ] Remove `app/definitions/rest/v1/omnichannel.ts`
252+
- [ ] Update all imports
253+
- [ ] Handle type differences carefully (this is complex!)
254+
- [ ] Test omnichannel functionality thoroughly
255+
- [ ] Run `yarn lint` - must pass with 0 errors
256+
- [ ] Run `tsc --noEmit` - must pass
257+
- [ ] Manual testing of omnichannel flows
258+
- [ ] Commit: `git commit -m "refactor: migrate omnichannel endpoints to rest-typings"`
259+
260+
## Phase 6: File Upload & Final Cleanup
261+
- [ ] Update `app/lib/methods/helpers/fileUpload/index.ts`
262+
- [ ] Update `app/lib/methods/helpers/fileUpload/definitions.ts`
263+
- [ ] Update `app/lib/methods/helpers/fileUpload/Upload.ts`
264+
- [ ] Update `app/lib/methods/helpers/fileUpload/Upload.android.ts`
265+
- [ ] Final cleanup of `app/lib/services/restApi.ts`
266+
- [ ] Remove any remaining old imports
267+
- [ ] Test file upload functionality
268+
- [ ] Run `yarn lint` - must pass with 0 errors
269+
- [ ] Run `tsc --noEmit` - must pass
270+
- [ ] Commit: `git commit -m "refactor: update file upload utilities and final cleanup"`
271+
272+
## Phase 7: Verification & Documentation
273+
- [ ] Run full test suite: `yarn test`
274+
- [ ] Verify all REST endpoints are typed correctly
275+
- [ ] Check for any remaining references to old definitions
276+
- [ ] Update documentation if needed
277+
- [ ] Remove old definition files (if not done already)
278+
- [ ] Final `yarn lint` check - must pass with 0 errors
279+
- [ ] Final `tsc --noEmit` check - must pass
280+
- [ ] Create migration summary document
281+
- [ ] Final commit: `git commit -m "refactor: complete migration to rest-typings"`
282+
283+
## Final Steps
284+
- [ ] Create PR with all changes
285+
- [ ] Request code review
286+
- [ ] Address review comments
287+
- [ ] Merge to main branch
288+

0 commit comments

Comments
 (0)