feat: SDK update for version 15.7.0 - #108
Conversation
| update(databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number): Promise<Models.Database>; | ||
| update( | ||
| paramsOrFirst: { databaseId: string, name: string, enabled?: boolean, replicas?: number } | string, | ||
| ...rest: [(string)?, (boolean)?, (number)?] | ||
| paramsOrFirst: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number } | string, | ||
| ...rest: [(string)?, (boolean)?, (string)?, (number)?] | ||
| ): Promise<Models.Database> { | ||
| let params: { databaseId: string, name: string, enabled?: boolean, replicas?: number }; | ||
| let params: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number }; | ||
|
|
||
| if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { | ||
| params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean, replicas?: number }; | ||
| params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number }; | ||
| } else { | ||
| params = { | ||
| databaseId: paramsOrFirst as string, | ||
| name: rest[0] as string, | ||
| enabled: rest[1] as boolean, | ||
| replicas: rest[2] as number | ||
| specification: rest[2] as string, | ||
| replicas: rest[3] as number |
There was a problem hiding this comment.
Replica argument becomes specification
When an existing JavaScript consumer uses the previous positional form update(databaseId, name, enabled, replicas), the replica count is now assigned to specification and replicas is omitted, causing request validation to fail or the wrong database update to be applied. The same positional shift is present in the TablesDB and VectorsDB update methods.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/documents-db.ts
Line: 551-566
Comment:
**Replica argument becomes specification**
When an existing JavaScript consumer uses the previous positional form `update(databaseId, name, enabled, replicas)`, the replica count is now assigned to `specification` and `replicas` is omitted, causing request validation to fail or the wrong database update to be applied. The same positional shift is present in the TablesDB and VectorsDB update methods.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| createFile(bucketId: string, fileId: string, file: File, permissions?: string[], folder?: string, onProgress?: (progress: UploadProgress) => void): Promise<Models.File>; | ||
| createFile( | ||
| paramsOrFirst: { bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void } | string, | ||
| ...rest: [(string)?, (File)?, (string[])?,((progress: UploadProgress) => void)?] | ||
| paramsOrFirst: { bucketId: string, fileId: string, file: File, permissions?: string[], folder?: string, onProgress?: (progress: UploadProgress) => void } | string, | ||
| ...rest: [(string)?, (File)?, (string[])?, (string)?,((progress: UploadProgress) => void)?] | ||
| ): Promise<Models.File> { | ||
| let params: { bucketId: string, fileId: string, file: File, permissions?: string[] }; | ||
| let params: { bucketId: string, fileId: string, file: File, permissions?: string[], folder?: string }; | ||
| let onProgress: ((progress: UploadProgress) => void); | ||
|
|
||
| if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { | ||
| params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, file: File, permissions?: string[] }; | ||
| params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, file: File, permissions?: string[], folder?: string }; | ||
| onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); | ||
| } else { | ||
| params = { | ||
| bucketId: paramsOrFirst as string, | ||
| fileId: rest[0] as string, | ||
| file: rest[1] as File, | ||
| permissions: rest[2] as string[] | ||
| permissions: rest[2] as string[], | ||
| folder: rest[3] as string | ||
| }; | ||
| onProgress = rest[3] as ((progress: UploadProgress) => void); | ||
| onProgress = rest[4] as ((progress: UploadProgress) => void); |
There was a problem hiding this comment.
Upload callback becomes folder value
When an existing JavaScript consumer uses the previous positional form createFile(bucketId, fileId, file, permissions, onProgress), the callback is assigned to folder while onProgress becomes undefined, causing progress notifications to stop and a stringified callback to be sent as the multipart folder value.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/storage.ts
Line: 562-581
Comment:
**Upload callback becomes folder value**
When an existing JavaScript consumer uses the previous positional form `createFile(bucketId, fileId, file, permissions, onProgress)`, the callback is assigned to `folder` while `onProgress` becomes undefined, causing progress notifications to stop and a stringified callback to be sent as the multipart folder value.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Greptile SummaryThe PR updates the Console SDK to 15.7.0.
Confidence Score: 3/5The positional overload regressions must be fixed before merging because existing JavaScript callers can send malformed database and upload requests. New optional parameters were inserted before established positional arguments, so old calls reinterpret replica counts as database specifications and upload callbacks as folder values. Files Needing Attention: src/services/documents-db.ts, src/services/tables-db.ts, src/services/vectors-db.ts, src/services/storage.ts Important Files Changed
Prompt To Fix All With AI### Issue 1
src/services/documents-db.ts:551-566
**Replica argument becomes specification**
When an existing JavaScript consumer uses the previous positional form `update(databaseId, name, enabled, replicas)`, the replica count is now assigned to `specification` and `replicas` is omitted, causing request validation to fail or the wrong database update to be applied. The same positional shift is present in the TablesDB and VectorsDB update methods.
### Issue 2
src/services/storage.ts:562-581
**Upload callback becomes folder value**
When an existing JavaScript consumer uses the previous positional form `createFile(bucketId, fileId, file, permissions, onProgress)`, the callback is assigned to `folder` while `onProgress` becomes undefined, causing progress notifications to stop and a stringified callback to be sent as the multipart folder value.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "chore: update Console SDK to 15.7.0" | Re-trigger Greptile |
main received 15.7.0 as a squash merge (#108), so the same change exists under a different commit on each branch. main's tree is identical to dev's 15.7.0 commit, so dev's generated 15.8.0 tree is kept as-is.
This PR contains updates to the SDK for version 15.7.0.
What's Changed
waf.createChallengeRule()andwaf.updateChallengeRule()for managing challenge rulesWafRuleChallengemodelspecificationparameter toupdate()ontablesDB,documentsDB, andvectorsDBfolderparameter tostorage.createFile()for placing files in virtual foldersbackups.createRestoration()documents in-place restores whennewResourceIdis omitted