Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// $ExpectError
uuid.v4({
rng: () => "bla"
});
// $ExpectError
v4({
rng: () => "bla"
});
v3.name;
v3("bla");
v3("bla", "bla");
v3("bla", v3.DNS);
v3("bla", v3.URL);
v3([0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea]);
v3(
[0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea],
[0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36]
);
// $ExpectError
v3("bla", { yolo: true });
v5.name;
v5("bla");
v5("bla", "bla");
v5("bla", v5.DNS);
v5("bla", v5.URL);
v5([0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea]);
v5(
value: function onSubmit(event) {
var _this2 = this;
event.preventDefault();
var mutate = this.props.mutate;
var _this$state$form2 = this.state.form,
password = _this$state$form2.password,
username = _this$state$form2.username; // Validate
if (!this.valid()) return; // Mutate
mutate({
variables: {
clientId: v3("".concat(password).concat(username), v3.URL),
username: username,
password: password
},
refetchQueries: [{
query: VIEWER_QUERY
}]
}).then(function (payload) {
_this2.processResults(payload);
}).catch(function (err) {
var form = Object.assign({
formError: 'Invalid Login'
}, _this2.state.form);
_this2.setState({
form: form
});
onSubmit(event) {
event.preventDefault();
const { mutate } = this.props;
const { password, username } = this.state.form;
// Validate
if(!this.valid()) return;
// Mutate
mutate({
variables: { clientId: v3(`${password}${username}`, v3.URL), username, password },
refetchQueries: [{ query: VIEWER_QUERY }],
})
.then(payload => {
this.processResults(payload)
})
.catch(err => {
const form = Object.assign({ formError: 'Invalid Login' }, this.state.form)
this.setState({ form });
});
}
private saveTransport (tid: number, transport: MsgTransport): string {
const uuidv3 = require('uuid/v3')
this.transports[tid] = transport
const app = this.config.description.application
const keys: string[] = Object.keys(this.transports)
const a = uuidv3(app.http.uri, uuidv3.URL)
this.keys.addUpdate(a, transport)
this.logger.info(`new transport id = ${tid} token = ${a} created total transports = ${keys.length}`)
this.emit('transport', transport)
return a
}
return;
}
mutate({
mutation: NEW_COMMENT_MUTATION,
variables: {
author: author,
authorEmail: authorEmail,
authorUrl: authorUrl,
type: null,
userId: userId,
parent: null,
postId: postId,
content: content,
date: date,
clientId: v3("".concat(author).concat(key), v3.URL)
},
update: function update(cache, _ref2) {
var comment = _ref2.data.createComment.comment;
var _cache$readQuery = cache.readQuery({
query: POST_COMMENTS_QUERY,
variables: {
id: _this3.props.id
}
}),
post = _cache$readQuery.post;
post.comments.nodes.push(comment);
cache.writeQuery({
query: POST_COMMENTS_QUERY,
data: {
return () => {
const { workingState: { [key]: { content } } } = this.state;
mutate({
mutation: UPDATE_COMMENT_MUTATION,
variables: {
type: null,
id,
content,
clientId: v3(`${id}update`, v3.URL),
},
update: (cache, { data: { updateComment: { comment } } } ) => {
const { post } = cache.readQuery({
query: POST_COMMENTS_QUERY,
variables: { id: this.props.id }
});
const index = findIndex(post.comments.nodes, ({ id }) => id === comment.id )
post.comments.nodes[index] = comment;
cache.writeQuery({
query: POST_COMMENTS_QUERY,
data: { post: post }
});
},
})
.then(() => {
return function () {
var content = _this6.state.workingState[key].content;
mutate({
mutation: UPDATE_COMMENT_MUTATION,
variables: {
type: null,
id: id,
content: content,
clientId: v3("".concat(id, "update"), v3.URL)
},
update: function update(cache, _ref5) {
var comment = _ref5.data.updateComment.comment;
var _cache$readQuery3 = cache.readQuery({
query: POST_COMMENTS_QUERY,
variables: {
id: _this6.props.id
}
}),
post = _cache$readQuery3.post;
var index = findIndex(post.comments.nodes, function (_ref6) {
var id = _ref6.id;
return id === comment.id;
});