Skip to content

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

Merged
merged 5 commits into from
Jan 12, 2022
Merged

mandatory uuid parameter #240

merged 5 commits into from
Jan 12, 2022

Conversation

mohitpubnub
Copy link
Contributor

@mohitpubnub mohitpubnub commented Jan 4, 2022

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.

@mohitpubnub mohitpubnub requested a review from a user January 4, 2022 11:18
Copy link
Contributor

@parfeon parfeon left a 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?

@parfeon parfeon self-requested a review January 5, 2022 08:35
@mohitpubnub mohitpubnub requested a review from phairow January 6, 2022 23:40
phairow
phairow previously approved these changes Jan 7, 2022
Copy link
Contributor

@phairow phairow left a 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;
Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link
Contributor

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(() => {
Copy link
Contributor

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(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice test

are
are previously approved these changes Jan 7, 2022
parfeon
parfeon previously approved these changes Jan 12, 2022
@mohitpubnub
Copy link
Contributor Author

@client-engineering-bot release as v5.0.0

@github-actions github-actions bot dismissed stale reviews from parfeon, are, and phairow via f6880b0 January 12, 2022 14:56
@mohitpubnub mohitpubnub merged commit 4f9d197 into master Jan 12, 2022
@mohitpubnub mohitpubnub deleted the clen221 branch January 12, 2022 16:57
@github-actions
Copy link

🚀 Release successfully completed 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants