Commit b7d1df9
authored
refactor!: drop the underscore prefix from non-public members (#1059)
Non-public members in this repo carried a leading underscore on top of
the `private` / `protected` keyword. Crawlee v4 dropped that convention
and we agreed to follow it here.
This renames every such member across `src/`, so none are left.
`LoggerActorRedirect._log()` and `_outputWithConsole()` in
`src/resource_clients/log.ts` keep their names, since both come from the
`Logger` base class in `@apify/log`. The code samples in
`CONTRIBUTING.md` and the public API report follow the rename.
## Renamed helpers
The protected helpers on the base clients show up in the API report, so
subclasses calling the old names have to switch. Where a bare name would
collide with a public method, the helper got a suffix.
| Old | New |
| --- | --- |
| `_url` | `buildUrl` |
| `_publicUrl` | `buildPublicUrl` |
| `_params` | `buildParams` |
| `_subResourceOptions` | `subResourceOptions` |
| `_toSafeId` | `toSafeId` |
| `_listPaginatedFromCallback` | `listPaginatedFromCallback` |
| `_get` | `getResource` |
| `_update` | `updateResource` |
| `_delete` | `deleteResource` |
| `_waitForFinish` | `waitForJobFinish` |
| `_list` | `listResources` |
| `_listPaginated` | `listResourcesPaginated` |
| `_create` | `createResource` |
| `_getOrCreate` | `getOrCreateResource` |
| `_batchAddRequests` | `addRequestBatch` |
| `_batchAddRequestsWithRetries` | `addRequestBatchWithRetries` |
The names match what #1046 picked for the files it touches, so whichever
of the two lands second rebases onto near-identical lines.
## ApifyApiError.clientMethod
`clientMethod` scrapes the stack with `\._?([A-Za-z]+)`, and the
underscore was what turned an internal frame like
`ActorCollectionClient._list` into the public-looking `list`. A public
method that returns the promise of a shared helper without awaiting it
leaves only the helper's frame on the async stack, so after the rename
the field would report `listResources` to users. A
`PUBLIC_METHOD_BY_HELPER` map in `apify_api_error.ts` maps helper frames
back to the public method, and `test/apify_api_error.test.ts` covers
both the Node and the browser build.
Closes #1057
*✍️ Drafted by Claude Code*1 parent b78c8bc commit b7d1df9
11 files changed
Lines changed: 194 additions & 176 deletions
File tree
- docs/04_upgrading
- src
- resource_clients
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| |||
306 | 307 | | |
307 | 308 | | |
308 | 309 | | |
| 310 | + | |
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
| |||
316 | 318 | | |
317 | 319 | | |
318 | 320 | | |
319 | | - | |
| 321 | + | |
320 | 322 | | |
321 | 323 | | |
322 | 324 | | |
323 | | - | |
| 325 | + | |
324 | 326 | | |
325 | 327 | | |
326 | 328 | | |
327 | | - | |
| 329 | + | |
328 | 330 | | |
329 | 331 | | |
330 | 332 | | |
| |||
335 | 337 | | |
336 | 338 | | |
337 | 339 | | |
| 340 | + | |
338 | 341 | | |
339 | 342 | | |
340 | 343 | | |
| |||
346 | 349 | | |
347 | 350 | | |
348 | 351 | | |
349 | | - | |
| 352 | + | |
350 | 353 | | |
351 | 354 | | |
352 | 355 | | |
353 | | - | |
| 356 | + | |
354 | 357 | | |
355 | 358 | | |
356 | 359 | | |
| |||
360 | 363 | | |
361 | 364 | | |
362 | 365 | | |
363 | | - | |
| 366 | + | |
364 | 367 | | |
365 | 368 | | |
366 | 369 | | |
367 | | - | |
| 370 | + | |
368 | 371 | | |
369 | 372 | | |
370 | 373 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 21 | | |
39 | 22 | | |
40 | 23 | | |
| |||
53 | 36 | | |
54 | 37 | | |
55 | 38 | | |
56 | | - | |
57 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
58 | 42 | | |
59 | 43 | | |
60 | 44 | | |
| |||
131 | 115 | | |
132 | 116 | | |
133 | 117 | | |
134 | | - | |
| 118 | + | |
135 | 119 | | |
136 | 120 | | |
137 | 121 | | |
138 | 122 | | |
139 | | - | |
| 123 | + | |
140 | 124 | | |
141 | 125 | | |
142 | 126 | | |
143 | 127 | | |
144 | | - | |
| 128 | + | |
145 | 129 | | |
146 | 130 | | |
147 | 131 | | |
| |||
156 | 140 | | |
157 | 141 | | |
158 | 142 | | |
159 | | - | |
| 143 | + | |
160 | 144 | | |
161 | 145 | | |
162 | 146 | | |
| |||
167 | 151 | | |
168 | 152 | | |
169 | 153 | | |
170 | | - | |
| 154 | + | |
171 | 155 | | |
172 | 156 | | |
173 | | - | |
| 157 | + | |
174 | 158 | | |
175 | 159 | | |
176 | 160 | | |
| |||
187 | 171 | | |
188 | 172 | | |
189 | 173 | | |
190 | | - | |
| 174 | + | |
191 | 175 | | |
192 | 176 | | |
193 | 177 | | |
| |||
0 commit comments