Closed prokopsimek closed 4 years ago
Hello @prokopsimek
Can you please try v2.0.1
and see if the problem still exists. There were some buggy TypeScript types declaration in the previous release.
@MunifTanjim v2.0.1
is still broken. There are some changes in exports, probably?
See my PR https://github.com/DXHeroes/dx-scanner/pull/237 and Travis job.
Well, the library seems to be fixed. Now you'll have to update the internal types you consumed from the bitbucket@1
.
The exported types have changed in v2
@MunifTanjim I understand. This issue is about adding update guide v2 to understand breaking changes.
Many things have changed since v1
.
Here are some major differences between v1
and v2
import Bitbucket from 'bitbucket'
type Client = Bitbucket;
type Params = Bitbucket.Params;
type Schema = Bitbucket.Schema;
type Response = Bitbucket.Response;
// Pre GDPR: `username` param key
/**
* AUTHENTICATION
*/
const client = new Bitbucket({})
client.authenticate({ type: '', username: '', password: '' })
// or
client.authenticate({ type: '', token: '' })
import { Bitbucket } from 'bitbucket';
type Client = import('bitbucket').APIClient;
type Params = import('bitbucket').Params;
type Schema = import('bitbucket').Schema;
type Response<T> = import('bitbucket/src/request/types').Response<T>;
// Post GDPR: `workspace` param key instead of `username`
/**
* AUTHENTICATION
*/
let client = Bitbucket({})
client = Bitbucket({ auth: { username: '', password: '' } })
// or
client = Bitbucket({ auth: { token: '' } })
These are everything that comes to mind right now.
For the rest, you have to dig through the errors TypeScript provides.
@MunifTanjim We've updated all to v2 but we're missing export of Response
or AsyncResponse
. Could you export it from the library to be able to use it manually to override e.g. createComment response? (before we had: Bitbucket.Response<Bitbucket.Schema.Commit>
- now the reponse is not exported)
The same Auth
interface from v1.
we're missing export of
Response
The previous comment included it:
type Response<T> = import('bitbucket/src/request/types').Response<T>;
Ohh sorry, will try it.
The same
Auth
interface from v1.
Try importing from bitbucket/src/plugins/auth/types
. The signatures are a bit different.
@MunifTanjim Thanks for your help. We've just updated the bitbucket to v2. š https://github.com/DXHeroes/dx-scanner/pull/237/
@MunifTanjim Is it possible to disable the BITBUCKET CLOUD API
warnings?
BITBUCKET CLOUD API CHANGING NOTICE: https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-gdpr
BITBUCKET CLOUD API MIGRATION GUIDE: https://developer.atlassian.com/cloud/bitbucket/bbc-gdpr-api-migration-guide
BITBUCKET CLOUD API REPO URL CHANGE: https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-workspaces
Try passing notice: false
in client options.
@MunifTanjim Thanks! It has changed from hideNotice: true
to notice: false
. š
@MunifTanjim Could you add a changelog with a list of breaking changes or some upgrade guide from v1 to v2?
I have got some errors and don't know what to change...
See "yarn build" log in terminal
node_modules/bitbucket/src/request/types.ts:2:3 - error TS2440: Import declaration conflicts with local declaration of 'Endpoint'. 2 Endpoint, ~~~~~~~~ node_modules/bitbucket/src/request/types.ts:3:3 - error TS2440: Import declaration conflicts with local declaration of 'EndpointDefaults'. 3 EndpointDefaults, ~~~~~~~~~~~~~~~~ node_modules/bitbucket/src/request/types.ts:4:3 - error TS2440: Import declaration conflicts with local declaration of 'EndpointOptions'. 4 EndpointOptions, ~~~~~~~~~~~~~~~ node_modules/bitbucket/src/request/types.ts:5:3 - error TS2440: Import declaration conflicts with local declaration of 'EndpointParams'. 5 EndpointParams, ~~~~~~~~~~~~~~ node_modules/bitbucket/src/request/types.ts:6:3 - error TS2440: Import declaration conflicts with local declaration of 'Headers'. 6 Headers ~~~~~~~ node_modules/bitbucket/src/client/types.ts:3:27 - error TS2307: Cannot find module '../error'. 3 import { HTTPError } from '../error' ~~~~~~~~~~ src/services/bitbucket/BitbucketService.ts:42:28 - error TS2709: Cannot use namespace 'Bitbucket' as a type. 42 private readonly client: Bitbucket; ~~~~~~~~~ src/services/bitbucket/BitbucketService.ts:51:23 - error TS2351: This expression is not constructable. Type 'typeof import("/Users/prokop/Sites/_dxheroes/scanner/node_modules/bitbucket/lib/index")' has no construct signatures. 51 this.client = new Bitbucket({ ~~~~~~~~~ src/services/bitbucket/BitbucketService.ts:73:25 - error TS2694: Namespace '"/Users/prokop/Sites/_dxheroes/scanner/node_modules/bitbucket/lib/index"' has no exported member 'Auth'. 73 let auth: Bitbucket.Auth; ~~~~ src/services/bitbucket/BitbucketService.ts:83:29 - error TS2694: Namespace '"/Users/prokop/Sites/_dxheroes/scanner/node_modules/bitbucket/lib/index"' has no exported member 'Params'. 83 const params: Bitbucket.Params.RepositoriesGet = { ~~~~~~ src/services/bitbucket/BitbucketService.ts:107:44 - error TS2694: Namespace '"/Users/prokop/Sites/_dxheroes/scanner/node_modules/bitbucket/lib/index"' has no exported member 'Response'. 107 const response: DeepRequired