-
Notifications
You must be signed in to change notification settings - Fork 401
mandatory uuid
parameter
#240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good. Should we have another test case for setter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
}; | ||
|
||
export default class { | ||
_db: DatabaseInterface; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see this removed since it was not used
if (this._db && this._db.set) this._db.set(`${this.subscribeKey}uuid`, val); | ||
if (!val || typeof val !== 'string' || val.trim().length === 0) { | ||
throw new Error('Missing uuid parameter. Provide a valid string uuid'); | ||
} | ||
this.UUID = val; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I know we discussed this and I will hold back my concern on throwing exceptions from constructors :) it is a C# and Java thing (something to do with destructor cleanup of resources that is not relevant here) which made me take that stand. For this it should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since constructor calls setUUID it will have potential to throw when constructor is called
let storageParams = { uuid: 'customUUID', networking: networking }; | ||
const pubnub = new PubNub(storageParams); | ||
assert.equal(pubnub.getUUID(), 'customUUID'); | ||
assert.throws(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice test
publishKey: 'myPublishKey', | ||
uuid: ' ' | ||
}; | ||
assert.throws(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice test
@client-engineering-bot release as v5.0.0 |
f6880b0
🚀 Release successfully completed 🚀 |
refactor: Breaking change,
uuid
parameter is mandatory.uuid
is required parameter in PubNub constructor.BREAKING CHANGES: SDK will not generate or store
uuid
automatically.uuid
is required parameter in PubNub constructor.