diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 00000000000..abb4a51e371
Binary files /dev/null and b/.DS_Store differ
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000000..dfe0770424b
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+# Auto detect text files and perform LF normalization
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..20444fa1266
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+node_modules
+auth_info.json
diff --git a/README.md b/README.md
new file mode 100644
index 00000000000..32f6bbc1268
--- /dev/null
+++ b/README.md
@@ -0,0 +1,10 @@
+# Baileys
+ Reverse Engineered WhatsApp Web API in Node.js
+
+ Thank you to [Sigalor](https://github.com/sigalor/whatsapp-web-reveng) for writing the guide reverse engineering WhatsApp Web and to the go reimplementation written by [Rhymen](https://github.com/Rhymen/go-whatsapp/tree/484cfe758705761d76724e01839d6fc473dc10c4)
+
+To use Baileys: ``` js const WhatsAppWeb = require('Baileys') ```
+Check out test.js to see exactly how to use Baileys.
+
+# Note
+ I am in no way affiliated with WhatsApp. This is purely for educational purposes.
\ No newline at end of file
diff --git a/WhatsAppWeb.Recv.js b/WhatsAppWeb.Recv.js
new file mode 100644
index 00000000000..d58dd9b90ba
--- /dev/null
+++ b/WhatsAppWeb.Recv.js
@@ -0,0 +1,205 @@
+const Utils = require("./WhatsAppWeb.Utils")
+/*
+ Contains the code for recieving messages and forwarding what to do with them to the correct functions
+*/
+module.exports = function(WhatsAppWeb) {
+
+ const Status = WhatsAppWeb.Status
+
+ WhatsAppWeb.prototype.onMessageRecieved = function (message) {
+
+ if (message[0] === "!") { // when the first character in the message is an '!', the server is updating on the last seen
+ const timestamp = message.slice(1,message.length)
+ this.lastSeen = new Date( parseInt(timestamp) )
+ } else {
+ const commaIndex = message.indexOf(",") // all whatsapp messages have a tag and a comma, followed by the actual message
+
+ if (commaIndex < 0) { // if there was no comma, then this message must be not be valid
+ return this.gotError([2, "invalid message", message])
+ }
+
+ var data = message.slice(commaIndex+1, message.length)
+ if (data.length === 0) {
+ // got an empty message, usually get one after sending a message or something, just return then
+ return
+ }
+
+ let json
+ if (data[0] === "[" || data[0] === "{") { // if the first character is a "[", then the data must just be plain JSON array or object
+ json = JSON.parse( data ) // simply parse the JSON
+ } else if (this.status === Status.connected) {
+ /*
+ If the data recieved was not a JSON, then it must be an encrypted message.
+ Such a message can only be decrypted if we're connected successfully to the servers & have encryption keys
+ */
+
+ data = Buffer.from(data, 'binary') // convert the string to a buffer
+ const checksum = data.slice(0, 32) // the first 32 bytes of the buffer are the HMAC sign of the message
+ data = data.slice(32, data.length) // the actual message
+
+ const computedChecksum = Utils.hmacSign(data, this.authInfo.macKey) // compute the sign of the message we recieved using our macKey
+
+ if (checksum.equals(computedChecksum)) { // the checksum the server sent, must match the one we computed for the message to be valid
+ const decrypted = Utils.aesDecrypt(data, this.authInfo.encKey) // decrypt using AES
+ json = this.decoder.read( decrypted ) // decode the binary message into a JSON array
+ } else {
+ return this.gotError([7, "checksums don't match"])
+ }
+ //console.log("enc_json: " + JSON.stringify(json))
+ } else {
+ // if we recieved a message that was encrypted but we weren't conencted, then there must be an error
+ return this.gotError([3, "recieved encrypted message when not connected: " + this.status, message])
+ }
+
+ //console.log(json)
+ // the first item in the recieved JSON, if it exists, it tells us what the message is about
+ switch (json[0]) {
+ case "Conn":
+ /*
+ we get this message when a new connection is established,
+ whether we're starting a new session or are logging back in.
+ Sometimes, we also recieve it when one opens their phone
+ */
+ this.validateNewConnection(json[1])
+ return
+ case "Cmd":
+ /*
+ WhatsApp usually sends this when we're trying to restore a closed session,
+ WhatsApp will challenge us to see whether we still have the keys
+ */
+ if (json[1].type === "challenge") { // if it really is a challenge
+ this.respondToChallenge(json[1].challenge)
+ }
+ return
+ case "action":
+ /*
+ this is when some action was taken on a chat or that we recieve a message.
+ json[1] tells us more about the message, it can be null
+ */
+ if (!json[1]) { // if json[1] is null
+ json = json[2][0] // set json to the first element in json[2]; it contains the relevant part
+
+ if (json[0] === "read") { // if one marked a chat as read or unread on the phone
+ const id = json[1].jid.replace("@c.us", "@s.whatsapp.net") // format the sender's ID
+ if (this.chats[id] && json[1].type === 'false') { // if it was marked unread
+ this.chats[id].user.count = 1 // up the read count
+ this.clearUnreadMessages(id) // send notification to the handler about the unread message
+ } else { // if it was marked read
+ this.chats[id].user.count = 0 // set the read count to zero
+ }
+ }
+
+ } else if (json[1].add === "relay") { // if we just recieved a new message sent to us
+ this.onNewMessage( json[2][0][2] ) // handle this new message
+ } else if (json[1].add === "before" || json[1].add === "last") {
+ /*
+ if we're recieving a full chat log
+ if json[1].add equals before: if its non-recent messages
+ if json[1].add equals last: contains the last message of the conversation between the sender and us
+ */
+
+ json = json[2] // json[2] is the relevant part
+ /* reverse for loop, because messages are sent ordered by most recent
+ I can order them by recency if I add them in reverse order */
+ for (var k = json.length-1;k >= 0;k--) {
+ const message = json[k]
+ const id = message[2].key.remoteJid
+ if (!this.chats[ id ]) { // if we haven't added this ID before, add them now
+ this.chats[ id ] = {user: { jid: id, count: 0 }, messages: []}
+ }
+
+ this.chats[id].messages.push(message[2]) // append this message to the array
+ }
+
+ const id = json[0][2].key.remoteJid // get the ID whose chats we just processed
+ this.clearUnreadMessages(id) // forward to the handler any any unread messages
+ }
+ break
+ case "response":
+ // if it is the list of all the people the WhatsApp account has chats with
+ if (json[1].type === "chat") {
+ json[2].forEach (chat => {
+ if (chat[0] === "chat" && chat[1].jid) {
+ const jid = chat[1].jid.replace("@c.us", "@s.whatsapp.net") // format ID
+ this.chats[ jid ] = {
+ user: {
+ jid: jid, // the ID of the person
+ count: chat[1].count}, // number of unread messages we have from them
+ messages: [ ] // empty messages, is filled by content in the previous section
+ }
+ }
+ })
+
+ }
+ break
+ default:
+ break
+ }
+
+ // if the recieved JSON wasn't an array, then we must have recieved a status for a request we made
+ // this would include creating new sessions & logging in
+ switch (json.status) {
+ case 200: // all good and we can procede to generate a QR code for new connection, or can now login given present auth info
+
+ if (this.status === Status.creatingNewConnection){ // if we're trying to start a connection
+ if (this.authInfo.encKey && this.authInfo.macKey) { // if we have the info to restore a closed session
+ this.status = Status.loggingIn
+ // create the login request
+ const data = ["admin", "login", this.authInfo.clientToken, this.authInfo.serverToken, this.authInfo.clientID, "takeover"]
+ this.sendJSON( data )
+ } else {
+ this.generateKeysForAuth(json.ref)
+ }
+ } else {
+
+ }
+ break
+ case 401: // if the phone was unpaired
+ this.close()
+ return this.gotError([json.status, "unpaired from phone", message])
+ case 429: // request to login was denied, don't know why it happens
+ this.close()
+ return this.gotError([ json.status, "request denied, try reconnecting", message ])
+ case 304: // request to generate a new key for a QR code was denied
+ console.log("reuse previous ref")
+ return this.gotError([ json.status, "request for new key denied", message ])
+ default:
+ break
+ }
+
+ }
+ }
+ // shoot off notifications to the handler that new unread message are available
+ WhatsAppWeb.prototype.clearUnreadMessages = function (id) {
+ const chat = this.chats[id] // get the chat
+ var j = 0
+ let unreadMessages = chat.user.count
+ while (unreadMessages > 0) {
+ if (!chat.messages[j].key.fromMe) { // only forward if the message is from the sender
+ this.handlers.onUnreadMessage( chat.messages[j] ) // send off the unread message
+ unreadMessages -= 1 // reduce
+ }
+ j += 1
+ }
+ }
+ // when a new message is recieved
+ WhatsAppWeb.prototype.onNewMessage = function (message) {
+
+ if (message && message.message) { // confirm that the message really is valid
+ if (!this.chats[message.key.remoteJid]) { // if we don't have any chats from this ID before, add them to our DB
+ this.chats[message.key.remoteJid] = {
+ user: { jid: message.key.remoteJid, count: 0 },
+ messages: [ message ]
+ }
+ } else {
+ // if the chat was already there, then insert the message at the front of the array
+ this.chats[ message.key.remoteJid ].messages.splice(0, 0, message)
+ }
+
+ if (!message.key.fromMe) { // if this message was sent to us, notify the handler
+ this.handlers.onUnreadMessage ( message )
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/WhatsAppWeb.Send.js b/WhatsAppWeb.Send.js
new file mode 100644
index 00000000000..b9b0b032b02
--- /dev/null
+++ b/WhatsAppWeb.Send.js
@@ -0,0 +1,85 @@
+const Utils = require("./WhatsAppWeb.Utils")
+
+/*
+ Contains the code for sending stuff to WhatsApp
+*/
+module.exports = function(WhatsAppWeb) {
+
+ // send a read receipt to the given ID on a certain message
+ WhatsAppWeb.prototype.sendReadReceipt = function (jid, messageID) {
+ const json = [
+ "action",
+ { epoch: this.msgCount.toString(), type: "set" },
+ [ ["read", {count: "1", index: messageID, jid: jid, owner: "false"}, null] ]
+ ]
+ this.sendBinary(json, [10, 128]) // encrypt and send off
+
+ if (this.chats[ jid ]) {
+ this.chats[jid].user.count = 0 // reset read count
+ }
+ }
+ // tell someone about your presence -- online, typing, offline etc.
+ WhatsAppWeb.prototype.updatePresence = function (jid, type) {
+ const json = [
+ "action",
+ { epoch: this.msgCount.toString(), type: "set" },
+ [ ["presence", {type: type, to: jid}, null] ]
+ ]
+ this.sendBinary(json, [10, 128])
+ }
+ // send a text message to someone, optionally you can provide the time at which you want the message to be sent
+ WhatsAppWeb.prototype.sendTextMessage = function (id, txt, timestamp=null) {
+ const message = {conversation: txt}
+ return this.sendMessage(id, message, timestamp)
+ }
+ // generic send message construct
+ WhatsAppWeb.prototype.sendMessage = function (id, message, timestamp=null) {
+ if (!timestamp) { // if no timestamp was provided,
+ timestamp = new Date() // set timestamp to now
+ }
+ timestamp = timestamp.getTime()/1000
+
+ const messageJSON = {
+ key: {
+ remoteJid: id,
+ fromMe: true,
+ id: Utils.generateMessageID()
+ },
+ message: message,
+ messageTimestamp: timestamp,
+ status: "ERROR"
+ }
+
+ const json = [
+ "action",
+ {epoch: this.msgCount.toString(), type: "relay" },
+ [ ['message', null, messageJSON] ]
+ ]
+ return this.sendBinary(json, [16, 128])
+ }
+ // send a binary message, the tags parameter tell WhatsApp what the message is all about
+ WhatsAppWeb.prototype.sendBinary = function (json, tags) {
+ const binary = this.encoder.write(json) // encode the JSON to the WhatsApp binary format
+
+ var buff = Utils.aesEncrypt(binary, this.authInfo.encKey) // encrypt it using AES and our encKey
+ const sign = Utils.hmacSign(buff, this.authInfo.macKey) // sign the message using HMAC and our macKey
+
+ buff = Buffer.concat([
+ Buffer.from( Utils.generateMessageTag() + "," ), // generate & prefix the message tag
+ Buffer.from(tags), // prefix some bytes that tell whatsapp what the message is about
+ sign, // the HMAC sign of the message
+ buff // the actual encrypted buffer
+ ])
+ this.send(buff) // send it off
+ }
+ // send a JSON message to WhatsApp servers
+ WhatsAppWeb.prototype.sendJSON = function (json) {
+ const str = JSON.stringify(json)
+ this.send( Utils.generateMessageTag() + "," + str )
+ }
+ WhatsAppWeb.prototype.send = function (m) {
+ this.msgCount += 1 // increment message count, it makes the 'epoch' field when sending binary messages
+ this.conn.send( m )
+ }
+
+}
\ No newline at end of file
diff --git a/WhatsAppWeb.Session.js b/WhatsAppWeb.Session.js
new file mode 100644
index 00000000000..aa64bc6e335
--- /dev/null
+++ b/WhatsAppWeb.Session.js
@@ -0,0 +1,200 @@
+const WebSocket = require('ws')
+const Curve = require ('curve25519-js')
+const HKDF = require('futoin-hkdf')
+const Utils = require('./WhatsAppWeb.Utils')
+const QR = require('qrcode-terminal')
+
+/*
+ Contains the code for connecting to WhatsApp Web, establishing a new session & logging back in
+*/
+module.exports = function (WhatsAppWeb) {
+ const Status = WhatsAppWeb.Status
+
+ // connect to the WhatsApp Web servers
+ WhatsAppWeb.prototype.connect = function () {
+ if (this.status != Status.notConnected) {
+ return this.gotError([1, "already connected or connecting"])
+ }
+
+ this.status = Status.connecting
+
+ this.conn = new WebSocket("wss://web.whatsapp.com/ws", {origin: "https://web.whatsapp.com"})
+
+ this.conn.on('open', () => this.onConnect())
+ this.conn.on('message', (m) => this.onMessageRecieved(m)) // in WhatsAppWeb.Recv.js
+ this.conn.on('error', (error) => { // if there was an error in the WebSocket
+ this.close()
+ this.gotError([20, error])
+ })
+ this.conn.on('close', () => { })
+ }
+ // once a connection has been successfully established
+ WhatsAppWeb.prototype.onConnect = function () {
+ console.log("connected to WhatsApp Web")
+
+ this.status = Status.creatingNewConnection
+ if (!this.authInfo) { // if no auth info is present, that is, a new session has to be established
+ this.authInfo = { clientID: Utils.generateClientID() } // generate a client ID
+ }
+
+ const data = ["admin", "init", WhatsAppWeb.version, WhatsAppWeb.browserDescriptions, this.authInfo.clientID, true]
+
+ this.sendJSON( data )
+ }
+ // restore a previously closed session using the given authentication information
+ WhatsAppWeb.prototype.login = function (authInfo) {
+ this.authInfo = {
+ clientID: authInfo.clientID,
+ serverToken: authInfo.serverToken,
+ clientToken: authInfo.clientToken,
+ encKey: Buffer.from( authInfo.encKey, 'base64' ),
+ macKey: Buffer.from( authInfo.macKey, 'base64' )
+ }
+
+ this.connect()
+ }
+ // once the QR code is scanned and we can validate our connection,
+ // or we resolved the challenge when logging back in
+ WhatsAppWeb.prototype.validateNewConnection = function (json) {
+ if (json.connected) { // only if we're connected
+ if (!json.secret) { // if we didn't get a secret, that is we don't need it
+ return this.didConnectSuccessfully()
+ }
+ const secret = Buffer.from(json.secret, 'base64')
+
+ if (secret.length !== 144) {
+ return this.gotError([4, "incorrect secret length: " + secret.length])
+ }
+ // generate shared key from our private key & the secret shared by the server
+ const sharedKey = Curve.sharedKey( this.curveKeys.private, secret.slice(0, 32) )
+ // expand the key to 80 bytes using HKDF
+ const expandedKey = HKDF(sharedKey, 80, [ Buffer.alloc(32), '', 'SHA-256' ])
+
+ // perform HMAC validation.
+ const hmacValidationKey = expandedKey.slice(32, 64)
+ const hmacValidationMessage = Buffer.concat( [ secret.slice(0, 32), secret.slice(64, secret.length) ] )
+
+ const hmac = Utils.hmacSign(hmacValidationMessage, hmacValidationKey)
+
+ if ( hmac.equals(secret.slice(32, 64)) ) { // computed HMAC should equal secret[32:64]
+ // expandedKey[64:] + secret[64:] are the keys, encrypted using AES, that are used to encrypt/decrypt the messages recieved from WhatsApp
+ // they are encrypted using key: expandedKey[0:32]
+ const encryptedAESKeys = Buffer.concat([ expandedKey.slice(64, expandedKey.length), secret.slice(64, secret.length) ])
+ const decryptedKeys = Utils.aesDecrypt(encryptedAESKeys, expandedKey.slice(0,32))
+
+ // this data is required to restore closed sessions
+ this.authInfo = {
+ encKey: decryptedKeys.slice(0, 32), // first 32 bytes form the key to encrypt/decrypt messages
+ macKey: decryptedKeys.slice(32, 64), // last 32 bytes from the key to sign messages
+ clientToken: json.clientToken,
+ serverToken: json.serverToken,
+ clientID: this.authInfo.clientID
+ }
+ this.userMetaData = {
+ id: json.wid, // one's WhatsApp ID [cc][number]@s.whatsapp.net
+ name: json.pushname, // name set on whatsapp
+ phone: json.phone // information about the phone one has logged in to
+ }
+ this.status = Status.CONNECTED
+
+ this.didConnectSuccessfully()
+ } else { // if the checksums didn't match
+ this.close()
+ this.gotError([5, "HMAC validation failed"])
+ }
+ } else { // if we didn't get the connected field (usually we get this message when one opens WhatsApp on their phone)
+ if (this.status !== Status.connected) { // and we're not already connected
+ this.close()
+ this.gotError([6, "json connection failed", json])
+ }
+ }
+ }
+ /*
+ when logging back in (restoring a previously closed session), WhatsApp may challenge one to check if one still has the encryption keys
+ WhatsApp does that by asking for us to sign a string it sends with our macKey
+ */
+ WhatsAppWeb.prototype.respondToChallenge = function (challenge) {
+ const bytes = Buffer.from(challenge, 'base64') // decode the base64 encoded challenge string
+ const signed = Utils.hmacSign(bytes, this.authInfo.macKey).toString('base64') // sign the challenge string with our macKey
+ const data = ["admin", "challenge", signed, this.authInfo.serverToken, this.authInfo.clientID] // prepare to send this signed string with the serverToken & clientID
+
+ console.log( "resolving challenge" )
+
+ this.sendJSON( data )
+ }
+ /*
+ when starting a new session, generate a QR code by generating a private/public key pair & the keys the server sends
+ */
+ WhatsAppWeb.prototype.generateKeysForAuth = function (ref) {
+ this.curveKeys = Curve.generateKeyPair( Utils.randomBytes(32) )
+
+ const publicKeyStr = Buffer.from(this.curveKeys.public).toString('base64')
+ //console.log ("private key: " + Buffer.from(this.curveKeys.private) )
+
+ let str = ref + "," + publicKeyStr + "," + this.authInfo.clientID
+
+ console.log("authenticating... Converting to QR: " + str)
+
+ QR.generate(str, {small: true})
+ }
+ // send a keep alive request every 25 seconds, server updates & responds with last seen
+ WhatsAppWeb.prototype.startKeepAliveRequest = function () {
+ this.keepAliveReq = setInterval(() => {
+ const diff = (new Date().getTime()-this.lastSeen.getTime())/1000
+ /*
+ check if it's been a suspicious amount of time since the server responded with our last seen
+ could be that the network is down, or the phone got disconnected or unpaired
+ */
+ if (diff > 25+10) {
+ console.log("disconnected")
+
+ this.close()
+ if (this.handlers.onDisconnect)
+ this.handlers.onDisconnect()
+
+ if (this.autoReconnect) { // attempt reconnecting if the user wants us to
+ // keep trying to connect
+ this.reconnectLoop = setInterval( () => {
+ // only connect if we're not already in the prcoess of connectin
+ if (this.status === Status.notConnected) {
+ this.connect()
+ }
+ }, 10 * 1000)
+ }
+ } else { // if its all good, send a keep alive request
+ this.send( "?,," )
+ }
+ }, 25 * 1000)
+ }
+ WhatsAppWeb.prototype.disconnect = function () {
+ if (this.status === Status.connected) {
+ this.conn.send('goodbye,["admin","Conn","disconnect"]', null, () => {
+ this.conn.close()
+ if (this.handlers.onDisconnect)
+ this.handlers.onDisconnect()
+ })
+ } else if (this.conn) {
+ this.close()
+ }
+ }
+ WhatsAppWeb.prototype.close = function () {
+ this.conn.close()
+ this.conn = null
+ this.status = Status.notConnected
+ this.msgCount = 0
+ this.chats = {}
+
+ if (this.keepAliveReq) {
+ clearInterval(this.keepAliveReq)
+ }
+ }
+ // request a new QR code from the server (HAVEN'T TESTED THIS OUT YET)
+ WhatsAppWeb.prototype.requestNewQRCode = function () {
+ if (this.status !== Status.creatingNewConnection) { // if we're not in the process of connecting
+ return
+ }
+ const json = ["admin", "Conn", "reref"]
+ this.sendJSON(json)
+ }
+
+}
\ No newline at end of file
diff --git a/WhatsAppWeb.Utils.js b/WhatsAppWeb.Utils.js
new file mode 100644
index 00000000000..5e583d9103b
--- /dev/null
+++ b/WhatsAppWeb.Utils.js
@@ -0,0 +1,31 @@
+const Crypto = require("crypto")
+
+/*
+ Basic cryptographic utilities to interact with WhatsApp servers
+*/
+module.exports = {
+ // decrypt AES 256 CBC; where the IV is prefixed to the buffer
+ aesDecrypt: function (buffer, key) {
+ const aes = Crypto.createDecipheriv('aes-256-cbc', key, buffer.slice(0,16) ) // first 16 bytes of buffer is IV
+ return Buffer.concat( [ aes.update(buffer.slice(16, buffer.length)), aes.final() ] )
+ },
+ // encrypt AES 256 CBC; where the IV is prefixed to the buffer
+ aesEncrypt: function (buffer, key) {
+ const IV = this.randomBytes(16)
+ const aes = Crypto.createCipheriv('aes-256-cbc', key, IV)
+ return Buffer.concat( [ IV, aes.update(buffer), aes.final() ] ) // prefix IV to the buffer
+ },
+ // sign HMAC using SHA 256
+ hmacSign: function (buffer, key) {
+ return Crypto.createHmac('sha256', key).update(buffer).digest()
+ },
+ // generate a buffer with random bytes of the specified length
+ randomBytes: function (length) { return Crypto.randomBytes(length) },
+
+ // whatsapp requires a message tag for every message, we just use the timestamp as one
+ generateMessageTag: function () { return new Date().getTime().toString() },
+ // generate a random 16 byte client ID
+ generateClientID: function () { return this.randomBytes(16).toString('base64') },
+ // generate a random 10 byte ID to attach to a message
+ generateMessageID: function () { return this.randomBytes(10).toString('hex').toUpperCase() }
+}
\ No newline at end of file
diff --git a/WhatsAppWeb.js b/WhatsAppWeb.js
new file mode 100644
index 00000000000..f3e6a95ea28
--- /dev/null
+++ b/WhatsAppWeb.js
@@ -0,0 +1,79 @@
+const BinaryCoding = require('./binary_coding/binary_encoder.js')
+
+class WhatsAppWeb {
+
+ static version = [0,4,1296] // the version of WhatsApp Web we're telling the servers we are
+ static browserDescriptions = ["Baileys", "Baileys"]
+
+ static Status = {
+ notConnected: 0,
+ connecting: 1,
+ creatingNewConnection: 3,
+ loggingIn: 4,
+ connected: 5
+ }
+
+ // set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send
+ static Presence = {
+ available: "available", // "online"
+ unavailable: "unavailable", // offline
+ composing: "composing", // "typing..."
+ recording: "recording", // "recording..."
+ paused: "paused" // I have no clue
+ }
+
+ constructor() {
+ this.conn = null // the websocket connection
+
+ this.authInfo = null // the auth info used to extablish new connections & restore connections
+
+ this.userMetaData = null // metadata of the user i.e. name, phone number, phone stats
+ this.chats = {} // all chats of the user, mapped by the user ID
+ this.handlers = {} // data for the event handlers
+ this.msgCount = 0 // number of messages sent to the server; required field for sending messages etc.
+ this.autoReconnect = true // reconnect automatically after an unexpected disconnect
+ this.lastSeen = null // updated by sending a keep alive request to the server, and the server responds with our updated last seen
+
+ this.encoder = new BinaryCoding.Encoder()
+ this.decoder = new BinaryCoding.Decoder()
+
+ this.status = WhatsAppWeb.Status.notConnected
+ }
+ // error is a json array: [errorCode, "error description", optionalDescription]
+ gotError (error) {
+ this.handlers.onError(error) // tell the handler, we got an error
+ }
+ // called when established a connection to the WhatsApp servers successfully
+ didConnectSuccessfully () {
+ console.log("connected successfully")
+
+ this.status = WhatsAppWeb.Status.connected // update our status
+ this.lastSeen = new Date() // set last seen to right now
+ this.startKeepAliveRequest() // start sending keep alive requests (keeps the WebSocket alive & updates our last seen)
+
+ if (this.reconnectLoop) { // if we connected after being disconnected
+ clearInterval(this.reconnectLoop) // kill the loop to reconnect us
+ } else { // if we connected for the first time, i.e. not after being disconnected
+ if (this.handlers.onConnected) // tell the handler that we're connected
+ this.handlers.onConnected()
+ }
+ }
+ // base 64 encode the authentication credentials and return them, these can then be saved used to login again
+ // see login () in WhatsAppWeb.Session
+ base64EncodedAuthInfo () {
+ return {
+ clientID: this.authInfo.clientID,
+ serverToken: this.authInfo.serverToken,
+ clientToken: this.authInfo.clientToken,
+ encKey: this.authInfo.encKey.toString('base64'),
+ macKey: this.authInfo.macKey.toString('base64')
+ }
+ }
+}
+
+/* import the rest of the code */
+require("./WhatsAppWeb.Session.js")(WhatsAppWeb)
+require("./WhatsAppWeb.Recv.js")(WhatsAppWeb)
+require("./WhatsAppWeb.Send.js")(WhatsAppWeb)
+
+module.exports = WhatsAppWeb
\ No newline at end of file
diff --git a/binary_coding/.DS_Store b/binary_coding/.DS_Store
new file mode 100644
index 00000000000..73d41478af9
Binary files /dev/null and b/binary_coding/.DS_Store differ
diff --git a/binary_coding/binary_coding_tests.js b/binary_coding/binary_coding_tests.js
new file mode 100644
index 00000000000..e733ad4ebe8
--- /dev/null
+++ b/binary_coding/binary_coding_tests.js
@@ -0,0 +1,25 @@
+const assert = require('assert').strict
+const BinaryCoding = require("./binary_encoder.js")
+
+const testingPairs = [
+ [
+ "f806092f5a0a10f804f80234fc6c0a350a1b39313735323938373131313740732e77686174736170702e6e657410011a143345423030393637354537454433374141424632122b0a292a7069616e6f20726f6f6d2074696d696e6773206172653a2a0a20363a3030414d2d31323a3030414d18b3faa7f3052003f80234fc4c0a410a1b39313735323938373131313740732e77686174736170702e6e657410001a20304643454335333330463634393239433645394132434646443242433845414418bdfaa7f305c00101f80234fc930a350a1b39313735323938373131313740732e77686174736170702e6e657410011a14334542303033433742353339414644303937353312520a50536f727279206672656e2c204920636f756c646e277420756e6465727374616e6420274c69627261272e2054797065202768656c702720746f206b6e6f77207768617420616c6c20492063616e20646f18c1faa7f3052003f80234fc540a410a1b39313735323938373131313740732e77686174736170702e6e657410001a20413132333042384436423041314437393345433241453245413043313638443812090a076c69627261727918c2faa7f305",
+ ["action",{"last":"true","add":"before"},[["message",null,{"key":{"remoteJid":"917529871117@s.whatsapp.net","fromMe":true,"id":"3EB009675E7ED37AABF2"},"message":{"conversation":"*piano room timings are:*\n 6:00AM-12:00AM"},"messageTimestamp":"1584004403","status":"DELIVERY_ACK"}],["message",null,{"key":{"remoteJid":"917529871117@s.whatsapp.net","fromMe":false,"id":"0FCEC5330F64929C6E9A2CFFD2BC8EAD"},"messageTimestamp":"1584004413","messageStubType":"REVOKE"}],["message",null,{"key":{"remoteJid":"917529871117@s.whatsapp.net","fromMe":true,"id":"3EB003C7B539AFD09753"},"message":{"conversation":"Sorry fren, I couldn't understand 'Libra'. Type 'help' to know what all I can do"},"messageTimestamp":"1584004417","status":"DELIVERY_ACK"}],["message",null,{"key":{"remoteJid":"917529871117@s.whatsapp.net","fromMe":false,"id":"A1230B8D6B0A1D793EC2AE2EA0C168D8"},"message":{"conversation":"library"},"messageTimestamp":"1584004418"}]]]
+ ]
+]
+function testCoding () {
+ const encoder = new BinaryCoding.Encoder()
+ const decoder = new BinaryCoding.Decoder()
+
+ testingPairs.forEach(pair => {
+ const buff = Buffer.from(pair[0], 'hex')
+ const decoded = decoder.read(buff)
+
+ assert.deepEqual( JSON.stringify( decoded ), JSON.stringify( pair[1] ))
+
+ const encoded = encoder.write(decoded)
+ assert.deepEqual(encoded, buff)
+ })
+ console.log("all coding tests passed")
+}
+testCoding()
diff --git a/binary_coding/binary_encoder.js b/binary_coding/binary_encoder.js
new file mode 100644
index 00000000000..6dfe94fb4f4
--- /dev/null
+++ b/binary_coding/binary_encoder.js
@@ -0,0 +1,476 @@
+const ProtoBuf = require("protobufjs")
+
+const WATags = {
+ LIST_EMPTY: 0,
+ STREAM_END: 2,
+ DICTIONARY_0: 236,
+ DICTIONARY_1: 237,
+ DICTIONARY_2: 238,
+ DICTIONARY_3: 239,
+ LIST_8 : 248,
+ LIST_16 : 249,
+ JID_PAIR : 250,
+ HEX_8 : 251,
+ BINARY_8 : 252,
+ BINARY_20 : 253,
+ BINARY_32 : 254,
+ NIBBLE_8 : 255,
+ SINGLE_BYTE_MAX: 256,
+ PACKED_MAX: 254
+}
+const WADoubleByteTokens = []
+
+const WASingleByteTokens = [
+ null,null,null,"200","400","404","500","501","502","action","add",
+ "after","archive","author","available","battery","before","body",
+ "broadcast","chat","clear","code","composing","contacts","count",
+ "create","debug","delete","demote","duplicate","encoding","error",
+ "false","filehash","from","g.us","group","groups_v2","height","id",
+ "image","in","index","invis","item","jid","kind","last","leave",
+ "live","log","media","message","mimetype","missing","modify","name",
+ "notification","notify","out","owner","participant","paused",
+ "picture","played","presence","preview","promote","query","raw",
+ "read","receipt","received","recipient","recording","relay",
+ "remove","response","resume","retry","s.whatsapp.net","seconds",
+ "set","size","status","subject","subscribe","t","text","to","true",
+ "type","unarchive","unavailable","url","user","value","web","width",
+ "mute","read_only","admin","creator","short","update","powersave",
+ "checksum","epoch","block","previous","409","replaced","reason",
+ "spam","modify_tag","message_info","delivery","emoji","title",
+ "description","canonical-url","matched-text","star","unstar",
+ "media_key","filename","identity","unread","page","page_count",
+ "search","media_message","security","call_log","profile","ciphertext",
+ "invite","gif","vcard","frequent","privacy","blacklist","whitelist",
+ "verify","location","document","elapsed","revoke_invite","expiration",
+ "unsubscribe","disable","vname","old_jid","new_jid","announcement",
+ "locked","prop","label","color","call","offer","call-id",
+ "quick_reply", "sticker", "pay_t", "accept", "reject", "sticker_pack",
+ "invalid", "canceled", "missed", "connected", "result", "audio",
+ "video", "recent"
+]
+const WebMessageInfo = ProtoBuf.Root.fromJSON( require("./whatsapp_message_coding.json") ).lookupType("proto.WebMessageInfo")
+
+class WhatsAppBinaryEncoder {
+
+ constructor () {
+ this.data = []
+ }
+ pushByte (value) {
+
+ this.data.push((value & 0xFF))
+ }
+ pushInt (value, n, littleEndian=false) {
+ for (var i = 0; i < n;i++) {
+ const curShift = littleEndian ? i : (n-1-i)
+ this.data.push( (value>>(curShift*8)) & 0xFF )
+ }
+ }
+ pushInt20 (value) {
+ this.pushBytes ( [(value >> 16) & 0x0F, (value >> 8) & 0xFF, value & 0xFF] )
+ }
+ pushInt16 (value) {
+ this.pushInt(value, 2)
+ }
+ pushInt32 (value) {
+ this.pushInt(value, 4)
+ }
+ pushInt64 (value) {
+ this.pushInt(value, 8)
+ }
+ pushBytes (bytes) {
+ this.data.push.apply(this.data, bytes)
+ }
+ pushString (str) {
+ const bytes = new TextEncoder('utf-8').encode(str)
+ this.pushBytes(bytes)
+ }
+ writeByteLength (length) {
+ if (length >= 4294967296) {
+ throw "string too large to encode: " + length
+ }
+
+ if (length >= (1<<20)) {
+ this.pushByte(WATags.BINARY_32)
+ this.pushInt32(length)
+ } else if (length >= 256) {
+ this.pushByte(WATags.BINARY_20)
+ this.pushInt20(length)
+ } else {
+ this.pushByte(WATags.BINARY_8)
+ this.pushByte(length)
+ }
+ }
+ writeStringRaw (string) {
+ this.writeByteLength( string.length )
+ this.pushString(string)
+ }
+ writeJid(left,right) {
+ this.pushByte(WATags.JID_PAIR)
+ if (left && left.length > 0) {
+ this.writeString(left)
+ } else {
+ this.writeToken(WATags.LIST_EMPTY)
+ }
+ this.writeString(right)
+ }
+ writeToken (token) {
+ if (token < 245) {
+ this.pushByte(token)
+ } else if (token <= 500) {
+ throw "invalid token"
+ }
+ }
+ writeString(token, i=null) {
+ if (typeof token !== "string") {
+ throw "invalid string: " + token
+ }
+
+ if (token === "c.us") {
+ token = "s.whatsapp.net"
+ }
+
+
+ const tokenIndex = WASingleByteTokens.indexOf(token)
+ if (!i && token === "s.whatsapp.net") {
+ this.writeToken( tokenIndex )
+ } else if ( tokenIndex >= 0 ) {
+ if (tokenIndex < WATags.SINGLE_BYTE_MAX) {
+ this.writeToken(tokenIndex)
+ } else {
+ const overflow = tokenIndex-WATags.SINGLE_BYTE_MAX
+ const dictionaryIndex = overflow >> 8
+ if (dictionaryIndex < 0 || dictionaryIndex > 3) {
+ throw "double byte dict token out of range: " + token + ", " + tokenIndex
+ }
+ this.writeToken(WATags.DICTIONARY_0 + dictionaryIndex)
+ this.writeToken(overflow % 256)
+ }
+ } else {
+ const jidSepIndex = token.indexOf("@")
+
+ if (jidSepIndex <= 0) {
+ this.writeStringRaw(token)
+ } else {
+ this.writeJid(token.slice(0,jidSepIndex), token.slice(jidSepIndex+1, token.length))
+ }
+ }
+ }
+ writeAttributes (attrs) {
+ if (!attrs) {
+ return
+ }
+ Object.keys(attrs).forEach (key => {
+ this.writeString( key )
+ this.writeString( attrs[key] )
+ })
+ }
+ writeListStart (listSize) {
+ if (listSize === 0) {
+ this.pushByte(WATags.LIST_EMPTY)
+ } else if (listSize < 256) {
+ this.pushBytes([WATags.LIST_8, listSize])
+ } else {
+ this.pushByte([WATags.LIST_16, listSize])
+ }
+ }
+ writeChildren (children) {
+ if (!children) {
+ return
+ }
+
+ if (typeof children === "string") {
+ this.writeString(children, true)
+ } else if (typeof children === "Buffer" || typeof children === "Uint8Array") {
+ this.writeByteLength(children.length)
+ this.pushBytes(children)
+ } else if (Array.isArray(children)) {
+ this.writeListStart(children.length)
+ children.forEach (c => {
+ this.writeNode(c)
+ })
+ } else if (typeof children === "object") {
+ //console.log(children)
+ const buff = WebMessageInfo.encode(children).finish()
+ this.writeByteLength(buff.length)
+ this.pushBytes(buff)
+ } else {
+ throw "invalid children: " + children + " (" + (typeof children) + ")"
+ }
+ }
+ getNumValidKeys (arr) {
+ return arr ? Object.keys(arr).length : 0
+ }
+ writeNode (node) {
+ if (!node) {
+ return
+ } else if (!Array.isArray(node) || node.length !== 3) {
+ throw "invalid node given: " + node
+ }
+
+ const numAttributes = this.getNumValidKeys(node[1])
+
+ this.writeListStart( 2*numAttributes + 1 + ( node[2] ? 1 : 0 ) )
+ this.writeString(node[0])
+ this.writeAttributes(node[1])
+ this.writeChildren(node[2])
+ }
+ write (data) {
+ this.data = new Array()
+ this.writeNode(data)
+
+ return Buffer.from(this.data)
+ }
+}
+class WhatsAppBinaryDecoder {
+
+ constructor () {
+ this.buffer = null
+ this.index = 0
+
+ }
+ checkEOS (length) {
+ if (this.index+length > this.buffer.length) {
+ throw "end of stream"
+ }
+ }
+ next () {
+ const value = this.buffer[this.index]
+ this.index += 1
+ return value
+ }
+ readByte () {
+ this.checkEOS(1)
+ return this.next()
+ }
+
+ readInt (n, littleEndian=false) {
+ this.checkEOS(n)
+ let val = 0
+ for (var i = 0; i < n;i++) {
+ const shift = (littleEndian) ? i : (n-1-i)
+ val |= this.next() << (shift*8)
+ }
+ return val
+ }
+ readInt16 (littleEndian=false) {
+ return this.readInt(2, littleEndian)
+ }
+ readInt20 () {
+ this.checkEOS(3)
+ return ( (this.next() & 15) << 16 ) + (this.next()<<8) + this.next()
+ }
+ readInt32 (littleEndian=false) {
+ return this.readInt(4, littleEndian)
+ }
+ readInt64 (littleEndian=false) {
+ return this.readInt(8, littleEndian)
+ }
+ unpackHex (value) {
+ if (value >= 0 && value < 16) {
+ return value<10 ? ('0'.charCodeAt(0)+value) : ('A'.charCodeAt(0)+value-10)
+ }
+ throw "invalid hex: " + value
+ }
+ unpackNibble(value) {
+ if (value >= 0 && value <= 9) {
+ return '0'.charCodeAt(0)+value
+ }
+ switch (value) {
+ case 10:
+ return '-'.charCodeAt(0)
+ case 11:
+ return '.'.charCodeAt(0)
+ case 15:
+ return '\0'.charCodeAt(0)
+ default:
+ throw "invalid nibble: " + value
+ }
+ }
+ unpackByte (tag, value) {
+ if (tag === WATags.NIBBLE_8) {
+ return this.unpackNibble(value)
+ } else if (tag === WATags.HEX_8) {
+ return this.unpackHex(value)
+ } else {
+ throw "unknown tag: " + tag
+ }
+ }
+ readPacked8(tag) {
+ const startByte = this.readByte()
+ let value = ""
+
+ for (var i = 0; i < (startByte&127);i++) {
+ let curByte = this.readByte()
+ value += String.fromCharCode( this.unpackByte(tag, (curByte&0xF0) >> 4) )
+ value += String.fromCharCode( this.unpackByte(tag, curByte&0x0F) )
+ }
+ if ((startByte >> 7) !== 0) {
+ value = value.slice(0,-1)
+ }
+ return value
+
+ }
+ readRangedVarInt (min, max, description="unknown") {
+ // value =
+ throw "WTF"
+ }
+ isListTag (tag) {
+ return tag === WATags.LIST_EMPTY || tag === WATags.LIST_8 || tag === WATags.LIST_16
+ }
+ readListSize (tag) {
+ switch (tag) {
+ case WATags.LIST_EMPTY:
+ return 0
+ case WATags.LIST_8:
+ return this.readByte()
+ case WATags.LIST_16:
+ return this.readInt16()
+ default:
+ throw "invalid tag for list size: " + tag
+ }
+ }
+ readStringFromChars (length) {
+ this.checkEOS(length)
+ const value = this.buffer.slice(this.index, this.index+length)
+
+ this.index += length
+ return new TextDecoder('utf-8').decode(value)
+ }
+ readString (tag) {
+ if (tag >= 3 && tag <= 235) {
+ const token = this.getToken(tag)
+ return token === "s.whatsapp.net" ? "c.us" : token
+ }
+
+ switch (tag) {
+ case WATags.DICTIONARY_0:
+ case WATags.DICTIONARY_1:
+ case WATags.DICTIONARY_2:
+ case WATags.DICTIONARY_3:
+ return this.getTokenDouble( tag - WATags.DICTIONARY_0, this.readByte() )
+ case WATags.LIST_EMPTY:
+ return null
+ case WATags.BINARY_8:
+ return this.readStringFromChars( this.readByte() )
+ case WATags.BINARY_20:
+ return this.readStringFromChars( this.readInt20() )
+ case WATags.BINARY_32:
+ return this.readStringFromChars( this.readInt32() )
+ case WATags.JID_PAIR:
+ const i = this.readString( this.readByte() )
+ const j = this.readString( this.readByte() )
+ if (i && j) {
+ return i + "@" + j
+ }
+ throw "invalid jid pair: " + i + ", " + j
+ case WATags.HEX_8:
+ case WATags.NIBBLE_8:
+ return this.readPacked8(tag)
+ default:
+ throw "invalid string with tag: " + tag
+ }
+ }
+ readAttributes (n) {
+ if (n !== 0) {
+ let attributes = {}
+ for (var i = 0;i < n;i++) {
+ const index = this.readString(this.readByte())
+ const b = this.readByte()
+
+ attributes[index] = this.readString(b)
+ }
+ return attributes
+ } else {
+ return null
+ }
+ }
+ readList (tag) {
+ let list = Array( this.readListSize(tag) )
+ for (var i = 0;i < list.length;i++) {
+ list[i] = this.readNode()
+ }
+ return list
+ }
+ readBytes (n) {
+ this.checkEOS(n)
+ const value = this.buffer.slice(this.index, this.index+n)
+ this.index += n
+ return value
+ }
+ getToken (index) {
+ if (index < 3 || index >= WASingleByteTokens.length) {
+ throw "invalid token index: " + index
+ }
+ return WASingleByteTokens[index]
+ }
+ getTokenDouble (index1, index2) {
+ const n = 256*index1 + index2
+ if (n < 0 || n > WADoubleByteTokens.length) {
+ throw "invalid double token index: " + n
+ }
+ return WADoubleByteTokens[n]
+ }
+ readNode () {
+ const listSize = this.readListSize( this.readByte() )
+ const descrTag = this.readByte()
+
+ if (descrTag === WATags.STREAM_END) {
+ throw "unexpected stream end"
+ }
+
+ const descr = this.readString(descrTag)
+ if (listSize === 0 || !descr) {
+ throw "invalid node"
+ }
+ //console.log(descr + "," + listSize)
+
+ let attrs = this.readAttributes( (listSize-1) >> 1 )
+ let content = null
+
+
+ if (listSize%2 === 0) {
+ const tag = this.readByte()
+
+ if (this.isListTag(tag)) {
+ content = this.readList(tag)
+ } else {
+ switch (tag) {
+ case WATags.BINARY_8:
+ content = this.readBytes( this.readByte() )
+ break
+ case WATags.BINARY_20:
+ content = this.readBytes( this.readInt20() )
+ break
+ case WATags.BINARY_32:
+ content = this.readBytes( this.readInt32() )
+ break
+ default:
+ content = this.readString(tag)
+ break
+ }
+ }
+ }
+ //console.log( descr + "," + JSON.stringify(attrs) + ", " + content)
+ return [descr, attrs, content]
+ }
+
+ read (buffer) {
+ this.buffer = buffer
+ this.index = 0
+
+ let node = this.readNode()
+
+ if (node[2]) {
+ for (var i = 0; i < node[2].length;i++) {
+ if (node[2][0][0] === "message") {
+ node[2][i][2] = WebMessageInfo.decode( node[2][i][2] )
+ }
+ }
+ }
+
+ return node
+ }
+
+}
+
+module.exports = { Encoder: WhatsAppBinaryEncoder, Decoder: WhatsAppBinaryDecoder }
\ No newline at end of file
diff --git a/binary_coding/def.proto b/binary_coding/def.proto
new file mode 100644
index 00000000000..6d4006d764b
--- /dev/null
+++ b/binary_coding/def.proto
@@ -0,0 +1,671 @@
+syntax = "proto2";
+package proto;
+
+message HydratedQuickReplyButton {
+ optional string displayText = 1;
+ optional string id = 2;
+}
+
+message HydratedURLButton {
+ optional string displayText = 1;
+ optional string url = 2;
+}
+
+message HydratedCallButton {
+ optional string displayText = 1;
+ optional string phoneNumber = 2;
+}
+
+message HydratedTemplateButton {
+ optional uint32 index = 4;
+ oneof hydratedButton {
+ HydratedQuickReplyButton quickReplyButton = 1;
+ HydratedURLButton urlButton = 2;
+ HydratedCallButton callButton = 3;
+ }
+}
+
+message QuickReplyButton {
+ optional HighlyStructuredMessage displayText = 1;
+ optional string id = 2;
+}
+
+message URLButton {
+ optional HighlyStructuredMessage displayText = 1;
+ optional HighlyStructuredMessage url = 2;
+}
+
+message CallButton {
+ optional HighlyStructuredMessage displayText = 1;
+ optional HighlyStructuredMessage phoneNumber = 2;
+}
+
+message TemplateButton {
+ optional uint32 index = 4;
+ oneof button {
+ QuickReplyButton quickReplyButton = 1;
+ URLButton urlButton = 2;
+ CallButton callButton = 3;
+ }
+}
+
+message Location {
+ optional double degreesLatitude = 1;
+ optional double degreesLongitude = 2;
+ optional string name = 3;
+}
+
+message Point {
+ optional double x = 3;
+ optional double y = 4;
+}
+
+message InteractiveAnnotation {
+ repeated Point polygonVertices = 1;
+ oneof action {
+ Location location = 2;
+ }
+}
+
+message AdReplyInfo {
+ optional string advertiserName = 1;
+ enum AD_REPLY_INFO_MEDIATYPE {
+ NONE = 0;
+ IMAGE = 1;
+ VIDEO = 2;
+ }
+ optional AD_REPLY_INFO_MEDIATYPE mediaType = 2;
+ optional bytes jpegThumbnail = 16;
+ optional string caption = 17;
+}
+
+message ContextInfo {
+ optional string stanzaId = 1;
+ optional string participant = 2;
+ optional Message quotedMessage = 3;
+ optional string remoteJid = 4;
+ repeated string mentionedJid = 15;
+ optional string conversionSource = 18;
+ optional bytes conversionData = 19;
+ optional uint32 conversionDelaySeconds = 20;
+ optional uint32 forwardingScore = 21;
+ optional bool isForwarded = 22;
+ optional AdReplyInfo quotedAd = 23;
+ optional MessageKey placeholderKey = 24;
+ optional uint32 expiration = 25;
+}
+
+message SenderKeyDistributionMessage {
+ optional string groupId = 1;
+ optional bytes axolotlSenderKeyDistributionMessage = 2;
+}
+
+message ImageMessage {
+ optional string url = 1;
+ optional string mimetype = 2;
+ optional string caption = 3;
+ optional bytes fileSha256 = 4;
+ optional uint64 fileLength = 5;
+ optional uint32 height = 6;
+ optional uint32 width = 7;
+ optional bytes mediaKey = 8;
+ optional bytes fileEncSha256 = 9;
+ repeated InteractiveAnnotation interactiveAnnotations = 10;
+ optional string directPath = 11;
+ optional int64 mediaKeyTimestamp = 12;
+ optional bytes jpegThumbnail = 16;
+ optional ContextInfo contextInfo = 17;
+ optional bytes firstScanSidecar = 18;
+ optional uint32 firstScanLength = 19;
+ optional uint32 experimentGroupId = 20;
+ optional bytes scansSidecar = 21;
+ repeated uint32 scanLengths = 22;
+ optional bytes midQualityFileSha256 = 23;
+ optional bytes midQualityFileEncSha256 = 24;
+}
+
+message ContactMessage {
+ optional string displayName = 1;
+ optional string vcard = 16;
+ optional ContextInfo contextInfo = 17;
+}
+
+message LocationMessage {
+ optional double degreesLatitude = 1;
+ optional double degreesLongitude = 2;
+ optional string name = 3;
+ optional string address = 4;
+ optional string url = 5;
+ optional bytes jpegThumbnail = 16;
+ optional ContextInfo contextInfo = 17;
+}
+
+message ExtendedTextMessage {
+ optional string text = 1;
+ optional string matchedText = 2;
+ optional string canonicalUrl = 4;
+ optional string description = 5;
+ optional string title = 6;
+ optional fixed32 textArgb = 7;
+ optional fixed32 backgroundArgb = 8;
+ enum EXTENDED_TEXT_MESSAGE_FONTTYPE {
+ SANS_SERIF = 0;
+ SERIF = 1;
+ NORICAN_REGULAR = 2;
+ BRYNDAN_WRITE = 3;
+ BEBASNEUE_REGULAR = 4;
+ OSWALD_HEAVY = 5;
+ }
+ optional EXTENDED_TEXT_MESSAGE_FONTTYPE font = 9;
+ enum EXTENDED_TEXT_MESSAGE_PREVIEWTYPE {
+ NONE = 0;
+ VIDEO = 1;
+ }
+ optional EXTENDED_TEXT_MESSAGE_PREVIEWTYPE previewType = 10;
+ optional bytes jpegThumbnail = 16;
+ optional ContextInfo contextInfo = 17;
+ optional bool doNotPlayInline = 18;
+}
+
+message DocumentMessage {
+ optional string url = 1;
+ optional string mimetype = 2;
+ optional string title = 3;
+ optional bytes fileSha256 = 4;
+ optional uint64 fileLength = 5;
+ optional uint32 pageCount = 6;
+ optional bytes mediaKey = 7;
+ optional string fileName = 8;
+ optional bytes fileEncSha256 = 9;
+ optional string directPath = 10;
+ optional int64 mediaKeyTimestamp = 11;
+ optional bytes jpegThumbnail = 16;
+ optional ContextInfo contextInfo = 17;
+}
+
+message AudioMessage {
+ optional string url = 1;
+ optional string mimetype = 2;
+ optional bytes fileSha256 = 3;
+ optional uint64 fileLength = 4;
+ optional uint32 seconds = 5;
+ optional bool ptt = 6;
+ optional bytes mediaKey = 7;
+ optional bytes fileEncSha256 = 8;
+ optional string directPath = 9;
+ optional int64 mediaKeyTimestamp = 10;
+ optional ContextInfo contextInfo = 17;
+ optional bytes streamingSidecar = 18;
+}
+
+message VideoMessage {
+ optional string url = 1;
+ optional string mimetype = 2;
+ optional bytes fileSha256 = 3;
+ optional uint64 fileLength = 4;
+ optional uint32 seconds = 5;
+ optional bytes mediaKey = 6;
+ optional string caption = 7;
+ optional bool gifPlayback = 8;
+ optional uint32 height = 9;
+ optional uint32 width = 10;
+ optional bytes fileEncSha256 = 11;
+ repeated InteractiveAnnotation interactiveAnnotations = 12;
+ optional string directPath = 13;
+ optional int64 mediaKeyTimestamp = 14;
+ optional bytes jpegThumbnail = 16;
+ optional ContextInfo contextInfo = 17;
+ optional bytes streamingSidecar = 18;
+ enum VIDEO_MESSAGE_ATTRIBUTION {
+ NONE = 0;
+ GIPHY = 1;
+ TENOR = 2;
+ }
+ optional VIDEO_MESSAGE_ATTRIBUTION gifAttribution = 19;
+}
+
+message Call {
+ optional bytes callKey = 1;
+}
+
+message Chat {
+ optional string displayName = 1;
+ optional string id = 2;
+}
+
+message ProtocolMessage {
+ optional MessageKey key = 1;
+ enum PROTOCOL_MESSAGE_TYPE {
+ REVOKE = 0;
+ EPHEMERAL_SETTING = 3;
+ }
+ optional PROTOCOL_MESSAGE_TYPE type = 2;
+ optional uint32 ephemeralExpiration = 4;
+}
+
+message ContactsArrayMessage {
+ optional string displayName = 1;
+ repeated ContactMessage contacts = 2;
+ optional ContextInfo contextInfo = 17;
+}
+
+message HSMCurrency {
+ optional string currencyCode = 1;
+ optional int64 amount1000 = 2;
+}
+
+message HSMDateTimeComponent {
+ enum HSM_DATE_TIME_COMPONENT_DAYOFWEEKTYPE {
+ MONDAY = 1;
+ TUESDAY = 2;
+ WEDNESDAY = 3;
+ THURSDAY = 4;
+ FRIDAY = 5;
+ SATURDAY = 6;
+ SUNDAY = 7;
+ }
+ optional HSM_DATE_TIME_COMPONENT_DAYOFWEEKTYPE dayOfWeek = 1;
+ optional uint32 year = 2;
+ optional uint32 month = 3;
+ optional uint32 dayOfMonth = 4;
+ optional uint32 hour = 5;
+ optional uint32 minute = 6;
+ enum HSM_DATE_TIME_COMPONENT_CALENDARTYPE {
+ GREGORIAN = 1;
+ SOLAR_HIJRI = 2;
+ }
+ optional HSM_DATE_TIME_COMPONENT_CALENDARTYPE calendar = 7;
+}
+
+message HSMDateTimeUnixEpoch {
+ optional int64 timestamp = 1;
+}
+
+message HSMDateTime {
+ oneof datetimeOneof {
+ HSMDateTimeComponent component = 1;
+ HSMDateTimeUnixEpoch unixEpoch = 2;
+ }
+}
+
+message HSMLocalizableParameter {
+ optional string default = 1;
+ oneof paramOneof {
+ HSMCurrency currency = 2;
+ HSMDateTime dateTime = 3;
+ }
+}
+
+message HighlyStructuredMessage {
+ optional string namespace = 1;
+ optional string elementName = 2;
+ repeated string params = 3;
+ optional string fallbackLg = 4;
+ optional string fallbackLc = 5;
+ repeated HSMLocalizableParameter localizableParams = 6;
+ optional string deterministicLg = 7;
+ optional string deterministicLc = 8;
+ optional TemplateMessage hydratedHsm = 9;
+}
+
+message SendPaymentMessage {
+ optional Message noteMessage = 2;
+ optional MessageKey requestMessageKey = 3;
+}
+
+message RequestPaymentMessage {
+ optional Message noteMessage = 4;
+ optional string currencyCodeIso4217 = 1;
+ optional uint64 amount1000 = 2;
+ optional string requestFrom = 3;
+ optional int64 expiryTimestamp = 5;
+}
+
+message DeclinePaymentRequestMessage {
+ optional MessageKey key = 1;
+}
+
+message CancelPaymentRequestMessage {
+ optional MessageKey key = 1;
+}
+
+message LiveLocationMessage {
+ optional double degreesLatitude = 1;
+ optional double degreesLongitude = 2;
+ optional uint32 accuracyInMeters = 3;
+ optional float speedInMps = 4;
+ optional uint32 degreesClockwiseFromMagneticNorth = 5;
+ optional string caption = 6;
+ optional int64 sequenceNumber = 7;
+ optional uint32 timeOffset = 8;
+ optional bytes jpegThumbnail = 16;
+ optional ContextInfo contextInfo = 17;
+}
+
+message StickerMessage {
+ optional string url = 1;
+ optional bytes fileSha256 = 2;
+ optional bytes fileEncSha256 = 3;
+ optional bytes mediaKey = 4;
+ optional string mimetype = 5;
+ optional uint32 height = 6;
+ optional uint32 width = 7;
+ optional string directPath = 8;
+ optional uint64 fileLength = 9;
+ optional int64 mediaKeyTimestamp = 10;
+ optional uint32 firstFrameLength = 11;
+ optional bytes firstFrameSidecar = 12;
+ optional ContextInfo contextInfo = 17;
+}
+
+message FourRowTemplate {
+ optional HighlyStructuredMessage content = 6;
+ optional HighlyStructuredMessage footer = 7;
+ repeated TemplateButton buttons = 8;
+ oneof title {
+ DocumentMessage documentMessage = 1;
+ HighlyStructuredMessage highlyStructuredMessage = 2;
+ ImageMessage imageMessage = 3;
+ VideoMessage videoMessage = 4;
+ LocationMessage locationMessage = 5;
+ }
+}
+
+message HydratedFourRowTemplate {
+ optional string hydratedContentText = 6;
+ optional string hydratedFooterText = 7;
+ repeated HydratedTemplateButton hydratedButtons = 8;
+ optional string templateId = 9;
+ oneof title {
+ DocumentMessage documentMessage = 1;
+ string hydratedTitleText = 2;
+ ImageMessage imageMessage = 3;
+ VideoMessage videoMessage = 4;
+ LocationMessage locationMessage = 5;
+ }
+}
+
+message TemplateMessage {
+ optional ContextInfo contextInfo = 3;
+ optional HydratedFourRowTemplate hydratedTemplate = 4;
+ oneof format {
+ FourRowTemplate fourRowTemplate = 1;
+ HydratedFourRowTemplate hydratedFourRowTemplate = 2;
+ }
+}
+
+message TemplateButtonReplyMessage {
+ optional string selectedId = 1;
+ optional string selectedDisplayText = 2;
+ optional ContextInfo contextInfo = 3;
+ optional uint32 selectedIndex = 4;
+}
+
+message ProductSnapshot {
+ optional ImageMessage productImage = 1;
+ optional string productId = 2;
+ optional string title = 3;
+ optional string description = 4;
+ optional string currencyCode = 5;
+ optional int64 priceAmount1000 = 6;
+ optional string retailerId = 7;
+ optional string url = 8;
+ optional uint32 productImageCount = 9;
+ optional string firstImageId = 11;
+}
+
+message ProductMessage {
+ optional ProductSnapshot product = 1;
+ optional string businessOwnerJid = 2;
+ optional ContextInfo contextInfo = 17;
+}
+
+message GroupInviteMessage {
+ optional string groupJid = 1;
+ optional string inviteCode = 2;
+ optional int64 inviteExpiration = 3;
+ optional string groupName = 4;
+ optional bytes jpegThumbnail = 5;
+ optional string caption = 6;
+ optional ContextInfo contextInfo = 7;
+}
+
+message DeviceSentMessage {
+ optional string destinationJid = 1;
+ optional Message message = 2;
+}
+
+message DeviceSyncMessage {
+ optional bytes serializedXmlBytes = 1;
+}
+
+message Message {
+ optional string conversation = 1;
+ optional SenderKeyDistributionMessage senderKeyDistributionMessage = 2;
+ optional ImageMessage imageMessage = 3;
+ optional ContactMessage contactMessage = 4;
+ optional LocationMessage locationMessage = 5;
+ optional ExtendedTextMessage extendedTextMessage = 6;
+ optional DocumentMessage documentMessage = 7;
+ optional AudioMessage audioMessage = 8;
+ optional VideoMessage videoMessage = 9;
+ optional Call call = 10;
+ optional Chat chat = 11;
+ optional ProtocolMessage protocolMessage = 12;
+ optional ContactsArrayMessage contactsArrayMessage = 13;
+ optional HighlyStructuredMessage highlyStructuredMessage = 14;
+ optional SenderKeyDistributionMessage fastRatchetKeySenderKeyDistributionMessage = 15;
+ optional SendPaymentMessage sendPaymentMessage = 16;
+ optional LiveLocationMessage liveLocationMessage = 18;
+ optional RequestPaymentMessage requestPaymentMessage = 22;
+ optional DeclinePaymentRequestMessage declinePaymentRequestMessage = 23;
+ optional CancelPaymentRequestMessage cancelPaymentRequestMessage = 24;
+ optional TemplateMessage templateMessage = 25;
+ optional StickerMessage stickerMessage = 26;
+ optional GroupInviteMessage groupInviteMessage = 28;
+ optional TemplateButtonReplyMessage templateButtonReplyMessage = 29;
+ optional ProductMessage productMessage = 30;
+ optional DeviceSentMessage deviceSentMessage = 31;
+ optional DeviceSyncMessage deviceSyncMessage = 32;
+}
+
+message MessageKey {
+ optional string remoteJid = 1;
+ optional bool fromMe = 2;
+ optional string id = 3;
+ optional string participant = 4;
+}
+
+message WebFeatures {
+ enum WEB_FEATURES_FLAG {
+ NOT_STARTED = 0;
+ FORCE_UPGRADE = 1;
+ DEVELOPMENT = 2;
+ PRODUCTION = 3;
+ }
+ optional WEB_FEATURES_FLAG labelsDisplay = 1;
+ optional WEB_FEATURES_FLAG voipIndividualOutgoing = 2;
+ optional WEB_FEATURES_FLAG groupsV3 = 3;
+ optional WEB_FEATURES_FLAG groupsV3Create = 4;
+ optional WEB_FEATURES_FLAG changeNumberV2 = 5;
+ optional WEB_FEATURES_FLAG queryStatusV3Thumbnail = 6;
+ optional WEB_FEATURES_FLAG liveLocations = 7;
+ optional WEB_FEATURES_FLAG queryVname = 8;
+ optional WEB_FEATURES_FLAG voipIndividualIncoming = 9;
+ optional WEB_FEATURES_FLAG quickRepliesQuery = 10;
+ optional WEB_FEATURES_FLAG payments = 11;
+ optional WEB_FEATURES_FLAG stickerPackQuery = 12;
+ optional WEB_FEATURES_FLAG liveLocationsFinal = 13;
+ optional WEB_FEATURES_FLAG labelsEdit = 14;
+ optional WEB_FEATURES_FLAG mediaUpload = 15;
+ optional WEB_FEATURES_FLAG mediaUploadRichQuickReplies = 18;
+ optional WEB_FEATURES_FLAG vnameV2 = 19;
+ optional WEB_FEATURES_FLAG videoPlaybackUrl = 20;
+ optional WEB_FEATURES_FLAG statusRanking = 21;
+ optional WEB_FEATURES_FLAG voipIndividualVideo = 22;
+ optional WEB_FEATURES_FLAG thirdPartyStickers = 23;
+ optional WEB_FEATURES_FLAG frequentlyForwardedSetting = 24;
+ optional WEB_FEATURES_FLAG groupsV4JoinPermission = 25;
+ optional WEB_FEATURES_FLAG recentStickers = 26;
+ optional WEB_FEATURES_FLAG catalog = 27;
+ optional WEB_FEATURES_FLAG starredStickers = 28;
+ optional WEB_FEATURES_FLAG voipGroupCall = 29;
+ optional WEB_FEATURES_FLAG templateMessage = 30;
+ optional WEB_FEATURES_FLAG templateMessageInteractivity = 31;
+ optional WEB_FEATURES_FLAG ephemeralMessages = 32;
+}
+
+message TabletNotificationsInfo {
+ optional uint64 timestamp = 2;
+ optional uint32 unreadChats = 3;
+ optional uint32 notifyMessageCount = 4;
+ repeated NotificationMessageInfo notifyMessage = 5;
+}
+
+message NotificationMessageInfo {
+ optional MessageKey key = 1;
+ optional Message message = 2;
+ optional uint64 messageTimestamp = 3;
+ optional string participant = 4;
+}
+
+message WebNotificationsInfo {
+ optional uint64 timestamp = 2;
+ optional uint32 unreadChats = 3;
+ optional uint32 notifyMessageCount = 4;
+ repeated WebMessageInfo notifyMessages = 5;
+}
+
+message PaymentInfo {
+ optional uint64 amount1000 = 2;
+ optional string receiverJid = 3;
+ enum PAYMENT_INFO_STATUS {
+ UNKNOWN_STATUS = 0;
+ PROCESSING = 1;
+ SENT = 2;
+ NEED_TO_ACCEPT = 3;
+ COMPLETE = 4;
+ COULD_NOT_COMPLETE = 5;
+ REFUNDED = 6;
+ EXPIRED = 7;
+ REJECTED = 8;
+ CANCELLED = 9;
+ WAITING_FOR_PAYER = 10;
+ WAITING = 11;
+ }
+ optional PAYMENT_INFO_STATUS status = 4;
+ optional uint64 transactionTimestamp = 5;
+ optional MessageKey requestMessageKey = 6;
+ optional uint64 expiryTimestamp = 7;
+ optional bool futureproofed = 8;
+ optional string currency = 9;
+}
+
+message WebMessageInfo {
+ required MessageKey key = 1;
+ optional Message message = 2;
+ optional uint64 messageTimestamp = 3;
+ enum WEB_MESSAGE_INFO_STATUS {
+ ERROR = 0;
+ PENDING = 1;
+ SERVER_ACK = 2;
+ DELIVERY_ACK = 3;
+ READ = 4;
+ PLAYED = 5;
+ }
+ optional WEB_MESSAGE_INFO_STATUS status = 4;
+ optional string participant = 5;
+ optional bool ignore = 16;
+ optional bool starred = 17;
+ optional bool broadcast = 18;
+ optional string pushName = 19;
+ optional bytes mediaCiphertextSha256 = 20;
+ optional bool multicast = 21;
+ optional bool urlText = 22;
+ optional bool urlNumber = 23;
+ enum WEB_MESSAGE_INFO_STUBTYPE {
+ UNKNOWN = 0;
+ REVOKE = 1;
+ CIPHERTEXT = 2;
+ FUTUREPROOF = 3;
+ NON_VERIFIED_TRANSITION = 4;
+ UNVERIFIED_TRANSITION = 5;
+ VERIFIED_TRANSITION = 6;
+ VERIFIED_LOW_UNKNOWN = 7;
+ VERIFIED_HIGH = 8;
+ VERIFIED_INITIAL_UNKNOWN = 9;
+ VERIFIED_INITIAL_LOW = 10;
+ VERIFIED_INITIAL_HIGH = 11;
+ VERIFIED_TRANSITION_ANY_TO_NONE = 12;
+ VERIFIED_TRANSITION_ANY_TO_HIGH = 13;
+ VERIFIED_TRANSITION_HIGH_TO_LOW = 14;
+ VERIFIED_TRANSITION_HIGH_TO_UNKNOWN = 15;
+ VERIFIED_TRANSITION_UNKNOWN_TO_LOW = 16;
+ VERIFIED_TRANSITION_LOW_TO_UNKNOWN = 17;
+ VERIFIED_TRANSITION_NONE_TO_LOW = 18;
+ VERIFIED_TRANSITION_NONE_TO_UNKNOWN = 19;
+ GROUP_CREATE = 20;
+ GROUP_CHANGE_SUBJECT = 21;
+ GROUP_CHANGE_ICON = 22;
+ GROUP_CHANGE_INVITE_LINK = 23;
+ GROUP_CHANGE_DESCRIPTION = 24;
+ GROUP_CHANGE_RESTRICT = 25;
+ GROUP_CHANGE_ANNOUNCE = 26;
+ GROUP_PARTICIPANT_ADD = 27;
+ GROUP_PARTICIPANT_REMOVE = 28;
+ GROUP_PARTICIPANT_PROMOTE = 29;
+ GROUP_PARTICIPANT_DEMOTE = 30;
+ GROUP_PARTICIPANT_INVITE = 31;
+ GROUP_PARTICIPANT_LEAVE = 32;
+ GROUP_PARTICIPANT_CHANGE_NUMBER = 33;
+ BROADCAST_CREATE = 34;
+ BROADCAST_ADD = 35;
+ BROADCAST_REMOVE = 36;
+ GENERIC_NOTIFICATION = 37;
+ E2E_IDENTITY_CHANGED = 38;
+ E2E_ENCRYPTED = 39;
+ CALL_MISSED_VOICE = 40;
+ CALL_MISSED_VIDEO = 41;
+ INDIVIDUAL_CHANGE_NUMBER = 42;
+ GROUP_DELETE = 43;
+ GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE = 44;
+ CALL_MISSED_GROUP_VOICE = 45;
+ CALL_MISSED_GROUP_VIDEO = 46;
+ PAYMENT_CIPHERTEXT = 47;
+ PAYMENT_FUTUREPROOF = 48;
+ PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED = 49;
+ PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED = 50;
+ PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED = 51;
+ PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP = 52;
+ PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP = 53;
+ PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER = 54;
+ PAYMENT_ACTION_SEND_PAYMENT_REMINDER = 55;
+ PAYMENT_ACTION_SEND_PAYMENT_INVITATION = 56;
+ PAYMENT_ACTION_REQUEST_DECLINED = 57;
+ PAYMENT_ACTION_REQUEST_EXPIRED = 58;
+ PAYMENT_ACTION_REQUEST_CANCELLED = 59;
+ BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM = 60;
+ BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP = 61;
+ BIZ_INTRO_TOP = 62;
+ BIZ_INTRO_BOTTOM = 63;
+ BIZ_NAME_CHANGE = 64;
+ BIZ_MOVE_TO_CONSUMER_APP = 65;
+ BIZ_TWO_TIER_MIGRATION_TOP = 66;
+ BIZ_TWO_TIER_MIGRATION_BOTTOM = 67;
+ OVERSIZED = 68;
+ GROUP_CHANGE_NO_FREQUENTLY_FORWARDED = 69;
+ GROUP_V4_ADD_INVITE_SENT = 70;
+ GROUP_PARTICIPANT_ADD_REQUEST_JOIN = 71;
+ CHANGE_EPHEMERAL_SETTING = 72;
+ }
+ optional WEB_MESSAGE_INFO_STUBTYPE messageStubType = 24;
+ optional bool clearMedia = 25;
+ repeated string messageStubParameters = 26;
+ optional uint32 duration = 27;
+ repeated string labels = 28;
+ optional PaymentInfo paymentInfo = 29;
+ optional LiveLocationMessage finalLiveLocation = 30;
+ optional PaymentInfo quotedPaymentInfo = 31;
+ optional uint64 ephemeralStartTimestamp = 32;
+ optional uint32 ephemeralDuration = 33;
+}
\ No newline at end of file
diff --git a/binary_coding/whatsapp_message_coding.json b/binary_coding/whatsapp_message_coding.json
new file mode 100644
index 00000000000..de6f89a2551
--- /dev/null
+++ b/binary_coding/whatsapp_message_coding.json
@@ -0,0 +1,1889 @@
+{
+ "nested": {
+ "proto": {
+ "nested": {
+ "HydratedQuickReplyButton": {
+ "fields": {
+ "displayText": {
+ "type": "string",
+ "id": 1
+ },
+ "id": {
+ "type": "string",
+ "id": 2
+ }
+ }
+ },
+ "HydratedURLButton": {
+ "fields": {
+ "displayText": {
+ "type": "string",
+ "id": 1
+ },
+ "url": {
+ "type": "string",
+ "id": 2
+ }
+ }
+ },
+ "HydratedCallButton": {
+ "fields": {
+ "displayText": {
+ "type": "string",
+ "id": 1
+ },
+ "phoneNumber": {
+ "type": "string",
+ "id": 2
+ }
+ }
+ },
+ "HydratedTemplateButton": {
+ "oneofs": {
+ "hydratedButton": {
+ "oneof": [
+ "quickReplyButton",
+ "urlButton",
+ "callButton"
+ ]
+ }
+ },
+ "fields": {
+ "index": {
+ "type": "uint32",
+ "id": 4
+ },
+ "quickReplyButton": {
+ "type": "HydratedQuickReplyButton",
+ "id": 1
+ },
+ "urlButton": {
+ "type": "HydratedURLButton",
+ "id": 2
+ },
+ "callButton": {
+ "type": "HydratedCallButton",
+ "id": 3
+ }
+ }
+ },
+ "QuickReplyButton": {
+ "fields": {
+ "displayText": {
+ "type": "HighlyStructuredMessage",
+ "id": 1
+ },
+ "id": {
+ "type": "string",
+ "id": 2
+ }
+ }
+ },
+ "URLButton": {
+ "fields": {
+ "displayText": {
+ "type": "HighlyStructuredMessage",
+ "id": 1
+ },
+ "url": {
+ "type": "HighlyStructuredMessage",
+ "id": 2
+ }
+ }
+ },
+ "CallButton": {
+ "fields": {
+ "displayText": {
+ "type": "HighlyStructuredMessage",
+ "id": 1
+ },
+ "phoneNumber": {
+ "type": "HighlyStructuredMessage",
+ "id": 2
+ }
+ }
+ },
+ "TemplateButton": {
+ "oneofs": {
+ "button": {
+ "oneof": [
+ "quickReplyButton",
+ "urlButton",
+ "callButton"
+ ]
+ }
+ },
+ "fields": {
+ "index": {
+ "type": "uint32",
+ "id": 4
+ },
+ "quickReplyButton": {
+ "type": "QuickReplyButton",
+ "id": 1
+ },
+ "urlButton": {
+ "type": "URLButton",
+ "id": 2
+ },
+ "callButton": {
+ "type": "CallButton",
+ "id": 3
+ }
+ }
+ },
+ "Location": {
+ "fields": {
+ "degreesLatitude": {
+ "type": "double",
+ "id": 1
+ },
+ "degreesLongitude": {
+ "type": "double",
+ "id": 2
+ },
+ "name": {
+ "type": "string",
+ "id": 3
+ }
+ }
+ },
+ "Point": {
+ "fields": {
+ "x": {
+ "type": "double",
+ "id": 3
+ },
+ "y": {
+ "type": "double",
+ "id": 4
+ }
+ }
+ },
+ "InteractiveAnnotation": {
+ "oneofs": {
+ "action": {
+ "oneof": [
+ "location"
+ ]
+ }
+ },
+ "fields": {
+ "polygonVertices": {
+ "rule": "repeated",
+ "type": "Point",
+ "id": 1
+ },
+ "location": {
+ "type": "Location",
+ "id": 2
+ }
+ }
+ },
+ "AdReplyInfo": {
+ "fields": {
+ "advertiserName": {
+ "type": "string",
+ "id": 1
+ },
+ "mediaType": {
+ "type": "AD_REPLY_INFO_MEDIATYPE",
+ "id": 2
+ },
+ "jpegThumbnail": {
+ "type": "bytes",
+ "id": 16
+ },
+ "caption": {
+ "type": "string",
+ "id": 17
+ }
+ },
+ "nested": {
+ "AD_REPLY_INFO_MEDIATYPE": {
+ "values": {
+ "NONE": 0,
+ "IMAGE": 1,
+ "VIDEO": 2
+ }
+ }
+ }
+ },
+ "ContextInfo": {
+ "fields": {
+ "stanzaId": {
+ "type": "string",
+ "id": 1
+ },
+ "participant": {
+ "type": "string",
+ "id": 2
+ },
+ "quotedMessage": {
+ "type": "Message",
+ "id": 3
+ },
+ "remoteJid": {
+ "type": "string",
+ "id": 4
+ },
+ "mentionedJid": {
+ "rule": "repeated",
+ "type": "string",
+ "id": 15
+ },
+ "conversionSource": {
+ "type": "string",
+ "id": 18
+ },
+ "conversionData": {
+ "type": "bytes",
+ "id": 19
+ },
+ "conversionDelaySeconds": {
+ "type": "uint32",
+ "id": 20
+ },
+ "forwardingScore": {
+ "type": "uint32",
+ "id": 21
+ },
+ "isForwarded": {
+ "type": "bool",
+ "id": 22
+ },
+ "quotedAd": {
+ "type": "AdReplyInfo",
+ "id": 23
+ },
+ "placeholderKey": {
+ "type": "MessageKey",
+ "id": 24
+ },
+ "expiration": {
+ "type": "uint32",
+ "id": 25
+ }
+ }
+ },
+ "SenderKeyDistributionMessage": {
+ "fields": {
+ "groupId": {
+ "type": "string",
+ "id": 1
+ },
+ "axolotlSenderKeyDistributionMessage": {
+ "type": "bytes",
+ "id": 2
+ }
+ }
+ },
+ "ImageMessage": {
+ "fields": {
+ "url": {
+ "type": "string",
+ "id": 1
+ },
+ "mimetype": {
+ "type": "string",
+ "id": 2
+ },
+ "caption": {
+ "type": "string",
+ "id": 3
+ },
+ "fileSha256": {
+ "type": "bytes",
+ "id": 4
+ },
+ "fileLength": {
+ "type": "uint64",
+ "id": 5
+ },
+ "height": {
+ "type": "uint32",
+ "id": 6
+ },
+ "width": {
+ "type": "uint32",
+ "id": 7
+ },
+ "mediaKey": {
+ "type": "bytes",
+ "id": 8
+ },
+ "fileEncSha256": {
+ "type": "bytes",
+ "id": 9
+ },
+ "interactiveAnnotations": {
+ "rule": "repeated",
+ "type": "InteractiveAnnotation",
+ "id": 10
+ },
+ "directPath": {
+ "type": "string",
+ "id": 11
+ },
+ "mediaKeyTimestamp": {
+ "type": "int64",
+ "id": 12
+ },
+ "jpegThumbnail": {
+ "type": "bytes",
+ "id": 16
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ },
+ "firstScanSidecar": {
+ "type": "bytes",
+ "id": 18
+ },
+ "firstScanLength": {
+ "type": "uint32",
+ "id": 19
+ },
+ "experimentGroupId": {
+ "type": "uint32",
+ "id": 20
+ },
+ "scansSidecar": {
+ "type": "bytes",
+ "id": 21
+ },
+ "scanLengths": {
+ "rule": "repeated",
+ "type": "uint32",
+ "id": 22,
+ "options": {
+ "packed": false
+ }
+ },
+ "midQualityFileSha256": {
+ "type": "bytes",
+ "id": 23
+ },
+ "midQualityFileEncSha256": {
+ "type": "bytes",
+ "id": 24
+ }
+ }
+ },
+ "ContactMessage": {
+ "fields": {
+ "displayName": {
+ "type": "string",
+ "id": 1
+ },
+ "vcard": {
+ "type": "string",
+ "id": 16
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ }
+ }
+ },
+ "LocationMessage": {
+ "fields": {
+ "degreesLatitude": {
+ "type": "double",
+ "id": 1
+ },
+ "degreesLongitude": {
+ "type": "double",
+ "id": 2
+ },
+ "name": {
+ "type": "string",
+ "id": 3
+ },
+ "address": {
+ "type": "string",
+ "id": 4
+ },
+ "url": {
+ "type": "string",
+ "id": 5
+ },
+ "jpegThumbnail": {
+ "type": "bytes",
+ "id": 16
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ }
+ }
+ },
+ "ExtendedTextMessage": {
+ "fields": {
+ "text": {
+ "type": "string",
+ "id": 1
+ },
+ "matchedText": {
+ "type": "string",
+ "id": 2
+ },
+ "canonicalUrl": {
+ "type": "string",
+ "id": 4
+ },
+ "description": {
+ "type": "string",
+ "id": 5
+ },
+ "title": {
+ "type": "string",
+ "id": 6
+ },
+ "textArgb": {
+ "type": "fixed32",
+ "id": 7
+ },
+ "backgroundArgb": {
+ "type": "fixed32",
+ "id": 8
+ },
+ "font": {
+ "type": "EXTENDED_TEXT_MESSAGE_FONTTYPE",
+ "id": 9
+ },
+ "previewType": {
+ "type": "EXTENDED_TEXT_MESSAGE_PREVIEWTYPE",
+ "id": 10
+ },
+ "jpegThumbnail": {
+ "type": "bytes",
+ "id": 16
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ },
+ "doNotPlayInline": {
+ "type": "bool",
+ "id": 18
+ }
+ },
+ "nested": {
+ "EXTENDED_TEXT_MESSAGE_FONTTYPE": {
+ "values": {
+ "SANS_SERIF": 0,
+ "SERIF": 1,
+ "NORICAN_REGULAR": 2,
+ "BRYNDAN_WRITE": 3,
+ "BEBASNEUE_REGULAR": 4,
+ "OSWALD_HEAVY": 5
+ }
+ },
+ "EXTENDED_TEXT_MESSAGE_PREVIEWTYPE": {
+ "values": {
+ "NONE": 0,
+ "VIDEO": 1
+ }
+ }
+ }
+ },
+ "DocumentMessage": {
+ "fields": {
+ "url": {
+ "type": "string",
+ "id": 1
+ },
+ "mimetype": {
+ "type": "string",
+ "id": 2
+ },
+ "title": {
+ "type": "string",
+ "id": 3
+ },
+ "fileSha256": {
+ "type": "bytes",
+ "id": 4
+ },
+ "fileLength": {
+ "type": "uint64",
+ "id": 5
+ },
+ "pageCount": {
+ "type": "uint32",
+ "id": 6
+ },
+ "mediaKey": {
+ "type": "bytes",
+ "id": 7
+ },
+ "fileName": {
+ "type": "string",
+ "id": 8
+ },
+ "fileEncSha256": {
+ "type": "bytes",
+ "id": 9
+ },
+ "directPath": {
+ "type": "string",
+ "id": 10
+ },
+ "mediaKeyTimestamp": {
+ "type": "int64",
+ "id": 11
+ },
+ "jpegThumbnail": {
+ "type": "bytes",
+ "id": 16
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ }
+ }
+ },
+ "AudioMessage": {
+ "fields": {
+ "url": {
+ "type": "string",
+ "id": 1
+ },
+ "mimetype": {
+ "type": "string",
+ "id": 2
+ },
+ "fileSha256": {
+ "type": "bytes",
+ "id": 3
+ },
+ "fileLength": {
+ "type": "uint64",
+ "id": 4
+ },
+ "seconds": {
+ "type": "uint32",
+ "id": 5
+ },
+ "ptt": {
+ "type": "bool",
+ "id": 6
+ },
+ "mediaKey": {
+ "type": "bytes",
+ "id": 7
+ },
+ "fileEncSha256": {
+ "type": "bytes",
+ "id": 8
+ },
+ "directPath": {
+ "type": "string",
+ "id": 9
+ },
+ "mediaKeyTimestamp": {
+ "type": "int64",
+ "id": 10
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ },
+ "streamingSidecar": {
+ "type": "bytes",
+ "id": 18
+ }
+ }
+ },
+ "VideoMessage": {
+ "fields": {
+ "url": {
+ "type": "string",
+ "id": 1
+ },
+ "mimetype": {
+ "type": "string",
+ "id": 2
+ },
+ "fileSha256": {
+ "type": "bytes",
+ "id": 3
+ },
+ "fileLength": {
+ "type": "uint64",
+ "id": 4
+ },
+ "seconds": {
+ "type": "uint32",
+ "id": 5
+ },
+ "mediaKey": {
+ "type": "bytes",
+ "id": 6
+ },
+ "caption": {
+ "type": "string",
+ "id": 7
+ },
+ "gifPlayback": {
+ "type": "bool",
+ "id": 8
+ },
+ "height": {
+ "type": "uint32",
+ "id": 9
+ },
+ "width": {
+ "type": "uint32",
+ "id": 10
+ },
+ "fileEncSha256": {
+ "type": "bytes",
+ "id": 11
+ },
+ "interactiveAnnotations": {
+ "rule": "repeated",
+ "type": "InteractiveAnnotation",
+ "id": 12
+ },
+ "directPath": {
+ "type": "string",
+ "id": 13
+ },
+ "mediaKeyTimestamp": {
+ "type": "int64",
+ "id": 14
+ },
+ "jpegThumbnail": {
+ "type": "bytes",
+ "id": 16
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ },
+ "streamingSidecar": {
+ "type": "bytes",
+ "id": 18
+ },
+ "gifAttribution": {
+ "type": "VIDEO_MESSAGE_ATTRIBUTION",
+ "id": 19
+ }
+ },
+ "nested": {
+ "VIDEO_MESSAGE_ATTRIBUTION": {
+ "values": {
+ "NONE": 0,
+ "GIPHY": 1,
+ "TENOR": 2
+ }
+ }
+ }
+ },
+ "Call": {
+ "fields": {
+ "callKey": {
+ "type": "bytes",
+ "id": 1
+ }
+ }
+ },
+ "Chat": {
+ "fields": {
+ "displayName": {
+ "type": "string",
+ "id": 1
+ },
+ "id": {
+ "type": "string",
+ "id": 2
+ }
+ }
+ },
+ "ProtocolMessage": {
+ "fields": {
+ "key": {
+ "type": "MessageKey",
+ "id": 1
+ },
+ "type": {
+ "type": "PROTOCOL_MESSAGE_TYPE",
+ "id": 2
+ },
+ "ephemeralExpiration": {
+ "type": "uint32",
+ "id": 4
+ }
+ },
+ "nested": {
+ "PROTOCOL_MESSAGE_TYPE": {
+ "values": {
+ "REVOKE": 0,
+ "EPHEMERAL_SETTING": 3
+ }
+ }
+ }
+ },
+ "ContactsArrayMessage": {
+ "fields": {
+ "displayName": {
+ "type": "string",
+ "id": 1
+ },
+ "contacts": {
+ "rule": "repeated",
+ "type": "ContactMessage",
+ "id": 2
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ }
+ }
+ },
+ "HSMCurrency": {
+ "fields": {
+ "currencyCode": {
+ "type": "string",
+ "id": 1
+ },
+ "amount1000": {
+ "type": "int64",
+ "id": 2
+ }
+ }
+ },
+ "HSMDateTimeComponent": {
+ "fields": {
+ "dayOfWeek": {
+ "type": "HSM_DATE_TIME_COMPONENT_DAYOFWEEKTYPE",
+ "id": 1
+ },
+ "year": {
+ "type": "uint32",
+ "id": 2
+ },
+ "month": {
+ "type": "uint32",
+ "id": 3
+ },
+ "dayOfMonth": {
+ "type": "uint32",
+ "id": 4
+ },
+ "hour": {
+ "type": "uint32",
+ "id": 5
+ },
+ "minute": {
+ "type": "uint32",
+ "id": 6
+ },
+ "calendar": {
+ "type": "HSM_DATE_TIME_COMPONENT_CALENDARTYPE",
+ "id": 7
+ }
+ },
+ "nested": {
+ "HSM_DATE_TIME_COMPONENT_DAYOFWEEKTYPE": {
+ "values": {
+ "MONDAY": 1,
+ "TUESDAY": 2,
+ "WEDNESDAY": 3,
+ "THURSDAY": 4,
+ "FRIDAY": 5,
+ "SATURDAY": 6,
+ "SUNDAY": 7
+ }
+ },
+ "HSM_DATE_TIME_COMPONENT_CALENDARTYPE": {
+ "values": {
+ "GREGORIAN": 1,
+ "SOLAR_HIJRI": 2
+ }
+ }
+ }
+ },
+ "HSMDateTimeUnixEpoch": {
+ "fields": {
+ "timestamp": {
+ "type": "int64",
+ "id": 1
+ }
+ }
+ },
+ "HSMDateTime": {
+ "oneofs": {
+ "datetimeOneof": {
+ "oneof": [
+ "component",
+ "unixEpoch"
+ ]
+ }
+ },
+ "fields": {
+ "component": {
+ "type": "HSMDateTimeComponent",
+ "id": 1
+ },
+ "unixEpoch": {
+ "type": "HSMDateTimeUnixEpoch",
+ "id": 2
+ }
+ }
+ },
+ "HSMLocalizableParameter": {
+ "oneofs": {
+ "paramOneof": {
+ "oneof": [
+ "currency",
+ "dateTime"
+ ]
+ }
+ },
+ "fields": {
+ "default": {
+ "type": "string",
+ "id": 1
+ },
+ "currency": {
+ "type": "HSMCurrency",
+ "id": 2
+ },
+ "dateTime": {
+ "type": "HSMDateTime",
+ "id": 3
+ }
+ }
+ },
+ "HighlyStructuredMessage": {
+ "fields": {
+ "namespace": {
+ "type": "string",
+ "id": 1
+ },
+ "elementName": {
+ "type": "string",
+ "id": 2
+ },
+ "params": {
+ "rule": "repeated",
+ "type": "string",
+ "id": 3
+ },
+ "fallbackLg": {
+ "type": "string",
+ "id": 4
+ },
+ "fallbackLc": {
+ "type": "string",
+ "id": 5
+ },
+ "localizableParams": {
+ "rule": "repeated",
+ "type": "HSMLocalizableParameter",
+ "id": 6
+ },
+ "deterministicLg": {
+ "type": "string",
+ "id": 7
+ },
+ "deterministicLc": {
+ "type": "string",
+ "id": 8
+ },
+ "hydratedHsm": {
+ "type": "TemplateMessage",
+ "id": 9
+ }
+ }
+ },
+ "SendPaymentMessage": {
+ "fields": {
+ "noteMessage": {
+ "type": "Message",
+ "id": 2
+ },
+ "requestMessageKey": {
+ "type": "MessageKey",
+ "id": 3
+ }
+ }
+ },
+ "RequestPaymentMessage": {
+ "fields": {
+ "noteMessage": {
+ "type": "Message",
+ "id": 4
+ },
+ "currencyCodeIso4217": {
+ "type": "string",
+ "id": 1
+ },
+ "amount1000": {
+ "type": "uint64",
+ "id": 2
+ },
+ "requestFrom": {
+ "type": "string",
+ "id": 3
+ },
+ "expiryTimestamp": {
+ "type": "int64",
+ "id": 5
+ }
+ }
+ },
+ "DeclinePaymentRequestMessage": {
+ "fields": {
+ "key": {
+ "type": "MessageKey",
+ "id": 1
+ }
+ }
+ },
+ "CancelPaymentRequestMessage": {
+ "fields": {
+ "key": {
+ "type": "MessageKey",
+ "id": 1
+ }
+ }
+ },
+ "LiveLocationMessage": {
+ "fields": {
+ "degreesLatitude": {
+ "type": "double",
+ "id": 1
+ },
+ "degreesLongitude": {
+ "type": "double",
+ "id": 2
+ },
+ "accuracyInMeters": {
+ "type": "uint32",
+ "id": 3
+ },
+ "speedInMps": {
+ "type": "float",
+ "id": 4
+ },
+ "degreesClockwiseFromMagneticNorth": {
+ "type": "uint32",
+ "id": 5
+ },
+ "caption": {
+ "type": "string",
+ "id": 6
+ },
+ "sequenceNumber": {
+ "type": "int64",
+ "id": 7
+ },
+ "timeOffset": {
+ "type": "uint32",
+ "id": 8
+ },
+ "jpegThumbnail": {
+ "type": "bytes",
+ "id": 16
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ }
+ }
+ },
+ "StickerMessage": {
+ "fields": {
+ "url": {
+ "type": "string",
+ "id": 1
+ },
+ "fileSha256": {
+ "type": "bytes",
+ "id": 2
+ },
+ "fileEncSha256": {
+ "type": "bytes",
+ "id": 3
+ },
+ "mediaKey": {
+ "type": "bytes",
+ "id": 4
+ },
+ "mimetype": {
+ "type": "string",
+ "id": 5
+ },
+ "height": {
+ "type": "uint32",
+ "id": 6
+ },
+ "width": {
+ "type": "uint32",
+ "id": 7
+ },
+ "directPath": {
+ "type": "string",
+ "id": 8
+ },
+ "fileLength": {
+ "type": "uint64",
+ "id": 9
+ },
+ "mediaKeyTimestamp": {
+ "type": "int64",
+ "id": 10
+ },
+ "firstFrameLength": {
+ "type": "uint32",
+ "id": 11
+ },
+ "firstFrameSidecar": {
+ "type": "bytes",
+ "id": 12
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ }
+ }
+ },
+ "FourRowTemplate": {
+ "oneofs": {
+ "title": {
+ "oneof": [
+ "documentMessage",
+ "highlyStructuredMessage",
+ "imageMessage",
+ "videoMessage",
+ "locationMessage"
+ ]
+ }
+ },
+ "fields": {
+ "content": {
+ "type": "HighlyStructuredMessage",
+ "id": 6
+ },
+ "footer": {
+ "type": "HighlyStructuredMessage",
+ "id": 7
+ },
+ "buttons": {
+ "rule": "repeated",
+ "type": "TemplateButton",
+ "id": 8
+ },
+ "documentMessage": {
+ "type": "DocumentMessage",
+ "id": 1
+ },
+ "highlyStructuredMessage": {
+ "type": "HighlyStructuredMessage",
+ "id": 2
+ },
+ "imageMessage": {
+ "type": "ImageMessage",
+ "id": 3
+ },
+ "videoMessage": {
+ "type": "VideoMessage",
+ "id": 4
+ },
+ "locationMessage": {
+ "type": "LocationMessage",
+ "id": 5
+ }
+ }
+ },
+ "HydratedFourRowTemplate": {
+ "oneofs": {
+ "title": {
+ "oneof": [
+ "documentMessage",
+ "hydratedTitleText",
+ "imageMessage",
+ "videoMessage",
+ "locationMessage"
+ ]
+ }
+ },
+ "fields": {
+ "hydratedContentText": {
+ "type": "string",
+ "id": 6
+ },
+ "hydratedFooterText": {
+ "type": "string",
+ "id": 7
+ },
+ "hydratedButtons": {
+ "rule": "repeated",
+ "type": "HydratedTemplateButton",
+ "id": 8
+ },
+ "templateId": {
+ "type": "string",
+ "id": 9
+ },
+ "documentMessage": {
+ "type": "DocumentMessage",
+ "id": 1
+ },
+ "hydratedTitleText": {
+ "type": "string",
+ "id": 2
+ },
+ "imageMessage": {
+ "type": "ImageMessage",
+ "id": 3
+ },
+ "videoMessage": {
+ "type": "VideoMessage",
+ "id": 4
+ },
+ "locationMessage": {
+ "type": "LocationMessage",
+ "id": 5
+ }
+ }
+ },
+ "TemplateMessage": {
+ "oneofs": {
+ "format": {
+ "oneof": [
+ "fourRowTemplate",
+ "hydratedFourRowTemplate"
+ ]
+ }
+ },
+ "fields": {
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 3
+ },
+ "hydratedTemplate": {
+ "type": "HydratedFourRowTemplate",
+ "id": 4
+ },
+ "fourRowTemplate": {
+ "type": "FourRowTemplate",
+ "id": 1
+ },
+ "hydratedFourRowTemplate": {
+ "type": "HydratedFourRowTemplate",
+ "id": 2
+ }
+ }
+ },
+ "TemplateButtonReplyMessage": {
+ "fields": {
+ "selectedId": {
+ "type": "string",
+ "id": 1
+ },
+ "selectedDisplayText": {
+ "type": "string",
+ "id": 2
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 3
+ },
+ "selectedIndex": {
+ "type": "uint32",
+ "id": 4
+ }
+ }
+ },
+ "ProductSnapshot": {
+ "fields": {
+ "productImage": {
+ "type": "ImageMessage",
+ "id": 1
+ },
+ "productId": {
+ "type": "string",
+ "id": 2
+ },
+ "title": {
+ "type": "string",
+ "id": 3
+ },
+ "description": {
+ "type": "string",
+ "id": 4
+ },
+ "currencyCode": {
+ "type": "string",
+ "id": 5
+ },
+ "priceAmount1000": {
+ "type": "int64",
+ "id": 6
+ },
+ "retailerId": {
+ "type": "string",
+ "id": 7
+ },
+ "url": {
+ "type": "string",
+ "id": 8
+ },
+ "productImageCount": {
+ "type": "uint32",
+ "id": 9
+ },
+ "firstImageId": {
+ "type": "string",
+ "id": 11
+ }
+ }
+ },
+ "ProductMessage": {
+ "fields": {
+ "product": {
+ "type": "ProductSnapshot",
+ "id": 1
+ },
+ "businessOwnerJid": {
+ "type": "string",
+ "id": 2
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 17
+ }
+ }
+ },
+ "GroupInviteMessage": {
+ "fields": {
+ "groupJid": {
+ "type": "string",
+ "id": 1
+ },
+ "inviteCode": {
+ "type": "string",
+ "id": 2
+ },
+ "inviteExpiration": {
+ "type": "int64",
+ "id": 3
+ },
+ "groupName": {
+ "type": "string",
+ "id": 4
+ },
+ "jpegThumbnail": {
+ "type": "bytes",
+ "id": 5
+ },
+ "caption": {
+ "type": "string",
+ "id": 6
+ },
+ "contextInfo": {
+ "type": "ContextInfo",
+ "id": 7
+ }
+ }
+ },
+ "DeviceSentMessage": {
+ "fields": {
+ "destinationJid": {
+ "type": "string",
+ "id": 1
+ },
+ "message": {
+ "type": "Message",
+ "id": 2
+ }
+ }
+ },
+ "DeviceSyncMessage": {
+ "fields": {
+ "serializedXmlBytes": {
+ "type": "bytes",
+ "id": 1
+ }
+ }
+ },
+ "Message": {
+ "fields": {
+ "conversation": {
+ "type": "string",
+ "id": 1
+ },
+ "senderKeyDistributionMessage": {
+ "type": "SenderKeyDistributionMessage",
+ "id": 2
+ },
+ "imageMessage": {
+ "type": "ImageMessage",
+ "id": 3
+ },
+ "contactMessage": {
+ "type": "ContactMessage",
+ "id": 4
+ },
+ "locationMessage": {
+ "type": "LocationMessage",
+ "id": 5
+ },
+ "extendedTextMessage": {
+ "type": "ExtendedTextMessage",
+ "id": 6
+ },
+ "documentMessage": {
+ "type": "DocumentMessage",
+ "id": 7
+ },
+ "audioMessage": {
+ "type": "AudioMessage",
+ "id": 8
+ },
+ "videoMessage": {
+ "type": "VideoMessage",
+ "id": 9
+ },
+ "call": {
+ "type": "Call",
+ "id": 10
+ },
+ "chat": {
+ "type": "Chat",
+ "id": 11
+ },
+ "protocolMessage": {
+ "type": "ProtocolMessage",
+ "id": 12
+ },
+ "contactsArrayMessage": {
+ "type": "ContactsArrayMessage",
+ "id": 13
+ },
+ "highlyStructuredMessage": {
+ "type": "HighlyStructuredMessage",
+ "id": 14
+ },
+ "fastRatchetKeySenderKeyDistributionMessage": {
+ "type": "SenderKeyDistributionMessage",
+ "id": 15
+ },
+ "sendPaymentMessage": {
+ "type": "SendPaymentMessage",
+ "id": 16
+ },
+ "liveLocationMessage": {
+ "type": "LiveLocationMessage",
+ "id": 18
+ },
+ "requestPaymentMessage": {
+ "type": "RequestPaymentMessage",
+ "id": 22
+ },
+ "declinePaymentRequestMessage": {
+ "type": "DeclinePaymentRequestMessage",
+ "id": 23
+ },
+ "cancelPaymentRequestMessage": {
+ "type": "CancelPaymentRequestMessage",
+ "id": 24
+ },
+ "templateMessage": {
+ "type": "TemplateMessage",
+ "id": 25
+ },
+ "stickerMessage": {
+ "type": "StickerMessage",
+ "id": 26
+ },
+ "groupInviteMessage": {
+ "type": "GroupInviteMessage",
+ "id": 28
+ },
+ "templateButtonReplyMessage": {
+ "type": "TemplateButtonReplyMessage",
+ "id": 29
+ },
+ "productMessage": {
+ "type": "ProductMessage",
+ "id": 30
+ },
+ "deviceSentMessage": {
+ "type": "DeviceSentMessage",
+ "id": 31
+ },
+ "deviceSyncMessage": {
+ "type": "DeviceSyncMessage",
+ "id": 32
+ }
+ }
+ },
+ "MessageKey": {
+ "fields": {
+ "remoteJid": {
+ "type": "string",
+ "id": 1
+ },
+ "fromMe": {
+ "type": "bool",
+ "id": 2
+ },
+ "id": {
+ "type": "string",
+ "id": 3
+ },
+ "participant": {
+ "type": "string",
+ "id": 4
+ }
+ }
+ },
+ "WebFeatures": {
+ "fields": {
+ "labelsDisplay": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 1
+ },
+ "voipIndividualOutgoing": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 2
+ },
+ "groupsV3": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 3
+ },
+ "groupsV3Create": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 4
+ },
+ "changeNumberV2": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 5
+ },
+ "queryStatusV3Thumbnail": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 6
+ },
+ "liveLocations": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 7
+ },
+ "queryVname": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 8
+ },
+ "voipIndividualIncoming": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 9
+ },
+ "quickRepliesQuery": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 10
+ },
+ "payments": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 11
+ },
+ "stickerPackQuery": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 12
+ },
+ "liveLocationsFinal": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 13
+ },
+ "labelsEdit": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 14
+ },
+ "mediaUpload": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 15
+ },
+ "mediaUploadRichQuickReplies": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 18
+ },
+ "vnameV2": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 19
+ },
+ "videoPlaybackUrl": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 20
+ },
+ "statusRanking": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 21
+ },
+ "voipIndividualVideo": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 22
+ },
+ "thirdPartyStickers": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 23
+ },
+ "frequentlyForwardedSetting": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 24
+ },
+ "groupsV4JoinPermission": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 25
+ },
+ "recentStickers": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 26
+ },
+ "catalog": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 27
+ },
+ "starredStickers": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 28
+ },
+ "voipGroupCall": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 29
+ },
+ "templateMessage": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 30
+ },
+ "templateMessageInteractivity": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 31
+ },
+ "ephemeralMessages": {
+ "type": "WEB_FEATURES_FLAG",
+ "id": 32
+ }
+ },
+ "nested": {
+ "WEB_FEATURES_FLAG": {
+ "values": {
+ "NOT_STARTED": 0,
+ "FORCE_UPGRADE": 1,
+ "DEVELOPMENT": 2,
+ "PRODUCTION": 3
+ }
+ }
+ }
+ },
+ "TabletNotificationsInfo": {
+ "fields": {
+ "timestamp": {
+ "type": "uint64",
+ "id": 2
+ },
+ "unreadChats": {
+ "type": "uint32",
+ "id": 3
+ },
+ "notifyMessageCount": {
+ "type": "uint32",
+ "id": 4
+ },
+ "notifyMessage": {
+ "rule": "repeated",
+ "type": "NotificationMessageInfo",
+ "id": 5
+ }
+ }
+ },
+ "NotificationMessageInfo": {
+ "fields": {
+ "key": {
+ "type": "MessageKey",
+ "id": 1
+ },
+ "message": {
+ "type": "Message",
+ "id": 2
+ },
+ "messageTimestamp": {
+ "type": "uint64",
+ "id": 3
+ },
+ "participant": {
+ "type": "string",
+ "id": 4
+ }
+ }
+ },
+ "WebNotificationsInfo": {
+ "fields": {
+ "timestamp": {
+ "type": "uint64",
+ "id": 2
+ },
+ "unreadChats": {
+ "type": "uint32",
+ "id": 3
+ },
+ "notifyMessageCount": {
+ "type": "uint32",
+ "id": 4
+ },
+ "notifyMessages": {
+ "rule": "repeated",
+ "type": "WebMessageInfo",
+ "id": 5
+ }
+ }
+ },
+ "PaymentInfo": {
+ "fields": {
+ "amount1000": {
+ "type": "uint64",
+ "id": 2
+ },
+ "receiverJid": {
+ "type": "string",
+ "id": 3
+ },
+ "status": {
+ "type": "PAYMENT_INFO_STATUS",
+ "id": 4
+ },
+ "transactionTimestamp": {
+ "type": "uint64",
+ "id": 5
+ },
+ "requestMessageKey": {
+ "type": "MessageKey",
+ "id": 6
+ },
+ "expiryTimestamp": {
+ "type": "uint64",
+ "id": 7
+ },
+ "futureproofed": {
+ "type": "bool",
+ "id": 8
+ },
+ "currency": {
+ "type": "string",
+ "id": 9
+ }
+ },
+ "nested": {
+ "PAYMENT_INFO_STATUS": {
+ "values": {
+ "UNKNOWN_STATUS": 0,
+ "PROCESSING": 1,
+ "SENT": 2,
+ "NEED_TO_ACCEPT": 3,
+ "COMPLETE": 4,
+ "COULD_NOT_COMPLETE": 5,
+ "REFUNDED": 6,
+ "EXPIRED": 7,
+ "REJECTED": 8,
+ "CANCELLED": 9,
+ "WAITING_FOR_PAYER": 10,
+ "WAITING": 11
+ }
+ }
+ }
+ },
+ "WebMessageInfo": {
+ "fields": {
+ "key": {
+ "rule": "required",
+ "type": "MessageKey",
+ "id": 1
+ },
+ "message": {
+ "type": "Message",
+ "id": 2
+ },
+ "messageTimestamp": {
+ "type": "uint64",
+ "id": 3
+ },
+ "status": {
+ "type": "WEB_MESSAGE_INFO_STATUS",
+ "id": 4
+ },
+ "participant": {
+ "type": "string",
+ "id": 5
+ },
+ "ignore": {
+ "type": "bool",
+ "id": 16
+ },
+ "starred": {
+ "type": "bool",
+ "id": 17
+ },
+ "broadcast": {
+ "type": "bool",
+ "id": 18
+ },
+ "pushName": {
+ "type": "string",
+ "id": 19
+ },
+ "mediaCiphertextSha256": {
+ "type": "bytes",
+ "id": 20
+ },
+ "multicast": {
+ "type": "bool",
+ "id": 21
+ },
+ "urlText": {
+ "type": "bool",
+ "id": 22
+ },
+ "urlNumber": {
+ "type": "bool",
+ "id": 23
+ },
+ "messageStubType": {
+ "type": "WEB_MESSAGE_INFO_STUBTYPE",
+ "id": 24
+ },
+ "clearMedia": {
+ "type": "bool",
+ "id": 25
+ },
+ "messageStubParameters": {
+ "rule": "repeated",
+ "type": "string",
+ "id": 26
+ },
+ "duration": {
+ "type": "uint32",
+ "id": 27
+ },
+ "labels": {
+ "rule": "repeated",
+ "type": "string",
+ "id": 28
+ },
+ "paymentInfo": {
+ "type": "PaymentInfo",
+ "id": 29
+ },
+ "finalLiveLocation": {
+ "type": "LiveLocationMessage",
+ "id": 30
+ },
+ "quotedPaymentInfo": {
+ "type": "PaymentInfo",
+ "id": 31
+ },
+ "ephemeralStartTimestamp": {
+ "type": "uint64",
+ "id": 32
+ },
+ "ephemeralDuration": {
+ "type": "uint32",
+ "id": 33
+ }
+ },
+ "nested": {
+ "WEB_MESSAGE_INFO_STATUS": {
+ "values": {
+ "ERROR": 0,
+ "PENDING": 1,
+ "SERVER_ACK": 2,
+ "DELIVERY_ACK": 3,
+ "READ": 4,
+ "PLAYED": 5
+ }
+ },
+ "WEB_MESSAGE_INFO_STUBTYPE": {
+ "values": {
+ "UNKNOWN": 0,
+ "REVOKE": 1,
+ "CIPHERTEXT": 2,
+ "FUTUREPROOF": 3,
+ "NON_VERIFIED_TRANSITION": 4,
+ "UNVERIFIED_TRANSITION": 5,
+ "VERIFIED_TRANSITION": 6,
+ "VERIFIED_LOW_UNKNOWN": 7,
+ "VERIFIED_HIGH": 8,
+ "VERIFIED_INITIAL_UNKNOWN": 9,
+ "VERIFIED_INITIAL_LOW": 10,
+ "VERIFIED_INITIAL_HIGH": 11,
+ "VERIFIED_TRANSITION_ANY_TO_NONE": 12,
+ "VERIFIED_TRANSITION_ANY_TO_HIGH": 13,
+ "VERIFIED_TRANSITION_HIGH_TO_LOW": 14,
+ "VERIFIED_TRANSITION_HIGH_TO_UNKNOWN": 15,
+ "VERIFIED_TRANSITION_UNKNOWN_TO_LOW": 16,
+ "VERIFIED_TRANSITION_LOW_TO_UNKNOWN": 17,
+ "VERIFIED_TRANSITION_NONE_TO_LOW": 18,
+ "VERIFIED_TRANSITION_NONE_TO_UNKNOWN": 19,
+ "GROUP_CREATE": 20,
+ "GROUP_CHANGE_SUBJECT": 21,
+ "GROUP_CHANGE_ICON": 22,
+ "GROUP_CHANGE_INVITE_LINK": 23,
+ "GROUP_CHANGE_DESCRIPTION": 24,
+ "GROUP_CHANGE_RESTRICT": 25,
+ "GROUP_CHANGE_ANNOUNCE": 26,
+ "GROUP_PARTICIPANT_ADD": 27,
+ "GROUP_PARTICIPANT_REMOVE": 28,
+ "GROUP_PARTICIPANT_PROMOTE": 29,
+ "GROUP_PARTICIPANT_DEMOTE": 30,
+ "GROUP_PARTICIPANT_INVITE": 31,
+ "GROUP_PARTICIPANT_LEAVE": 32,
+ "GROUP_PARTICIPANT_CHANGE_NUMBER": 33,
+ "BROADCAST_CREATE": 34,
+ "BROADCAST_ADD": 35,
+ "BROADCAST_REMOVE": 36,
+ "GENERIC_NOTIFICATION": 37,
+ "E2E_IDENTITY_CHANGED": 38,
+ "E2E_ENCRYPTED": 39,
+ "CALL_MISSED_VOICE": 40,
+ "CALL_MISSED_VIDEO": 41,
+ "INDIVIDUAL_CHANGE_NUMBER": 42,
+ "GROUP_DELETE": 43,
+ "GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE": 44,
+ "CALL_MISSED_GROUP_VOICE": 45,
+ "CALL_MISSED_GROUP_VIDEO": 46,
+ "PAYMENT_CIPHERTEXT": 47,
+ "PAYMENT_FUTUREPROOF": 48,
+ "PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED": 49,
+ "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED": 50,
+ "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED": 51,
+ "PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP": 52,
+ "PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP": 53,
+ "PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER": 54,
+ "PAYMENT_ACTION_SEND_PAYMENT_REMINDER": 55,
+ "PAYMENT_ACTION_SEND_PAYMENT_INVITATION": 56,
+ "PAYMENT_ACTION_REQUEST_DECLINED": 57,
+ "PAYMENT_ACTION_REQUEST_EXPIRED": 58,
+ "PAYMENT_ACTION_REQUEST_CANCELLED": 59,
+ "BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM": 60,
+ "BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP": 61,
+ "BIZ_INTRO_TOP": 62,
+ "BIZ_INTRO_BOTTOM": 63,
+ "BIZ_NAME_CHANGE": 64,
+ "BIZ_MOVE_TO_CONSUMER_APP": 65,
+ "BIZ_TWO_TIER_MIGRATION_TOP": 66,
+ "BIZ_TWO_TIER_MIGRATION_BOTTOM": 67,
+ "OVERSIZED": 68,
+ "GROUP_CHANGE_NO_FREQUENTLY_FORWARDED": 69,
+ "GROUP_V4_ADD_INVITE_SENT": 70,
+ "GROUP_PARTICIPANT_ADD_REQUEST_JOIN": 71,
+ "CHANGE_EPHEMERAL_SETTING": 72
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/node_modules/.DS_Store b/node_modules/.DS_Store
new file mode 100644
index 00000000000..20b77c9259c
Binary files /dev/null and b/node_modules/.DS_Store differ
diff --git a/node_modules/.bin/pbjs b/node_modules/.bin/pbjs
new file mode 120000
index 00000000000..a96b24a4cc9
--- /dev/null
+++ b/node_modules/.bin/pbjs
@@ -0,0 +1 @@
+../protobufjs/bin/pbjs
\ No newline at end of file
diff --git a/node_modules/.bin/pbts b/node_modules/.bin/pbts
new file mode 120000
index 00000000000..b4c7c520cd9
--- /dev/null
+++ b/node_modules/.bin/pbts
@@ -0,0 +1 @@
+../protobufjs/bin/pbts
\ No newline at end of file
diff --git a/node_modules/.bin/qrcode-terminal b/node_modules/.bin/qrcode-terminal
new file mode 120000
index 00000000000..2a09d26406b
--- /dev/null
+++ b/node_modules/.bin/qrcode-terminal
@@ -0,0 +1 @@
+../qrcode-terminal/bin/qrcode-terminal.js
\ No newline at end of file
diff --git a/node_modules/@protobufjs/aspromise/LICENSE b/node_modules/@protobufjs/aspromise/LICENSE
new file mode 100644
index 00000000000..be2b397e3c3
--- /dev/null
+++ b/node_modules/@protobufjs/aspromise/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@protobufjs/aspromise/README.md b/node_modules/@protobufjs/aspromise/README.md
new file mode 100644
index 00000000000..c7ae36f0e69
--- /dev/null
+++ b/node_modules/@protobufjs/aspromise/README.md
@@ -0,0 +1,13 @@
+@protobufjs/aspromise
+=====================
+[![npm](https://img.shields.io/npm/v/@protobufjs/aspromise.svg)](https://www.npmjs.com/package/@protobufjs/aspromise)
+
+Returns a promise from a node-style callback function.
+
+API
+---
+
+* **asPromise(fn: `function`, ctx: `Object`, ...params: `*`): `Promise<*>`**
+ Returns a promise from a node-style callback function.
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/node_modules/@protobufjs/aspromise/index.d.ts b/node_modules/@protobufjs/aspromise/index.d.ts
new file mode 100644
index 00000000000..3db03dbee77
--- /dev/null
+++ b/node_modules/@protobufjs/aspromise/index.d.ts
@@ -0,0 +1,13 @@
+export = asPromise;
+
+type asPromiseCallback = (error: Error | null, ...params: any[]) => {};
+
+/**
+ * Returns a promise from a node-style callback function.
+ * @memberof util
+ * @param {asPromiseCallback} fn Function to call
+ * @param {*} ctx Function context
+ * @param {...*} params Function arguments
+ * @returns {Promise<*>} Promisified function
+ */
+declare function asPromise(fn: asPromiseCallback, ctx: any, ...params: any[]): Promise;
diff --git a/node_modules/@protobufjs/aspromise/index.js b/node_modules/@protobufjs/aspromise/index.js
new file mode 100644
index 00000000000..d6f642cb705
--- /dev/null
+++ b/node_modules/@protobufjs/aspromise/index.js
@@ -0,0 +1,52 @@
+"use strict";
+module.exports = asPromise;
+
+/**
+ * Callback as used by {@link util.asPromise}.
+ * @typedef asPromiseCallback
+ * @type {function}
+ * @param {Error|null} error Error, if any
+ * @param {...*} params Additional arguments
+ * @returns {undefined}
+ */
+
+/**
+ * Returns a promise from a node-style callback function.
+ * @memberof util
+ * @param {asPromiseCallback} fn Function to call
+ * @param {*} ctx Function context
+ * @param {...*} params Function arguments
+ * @returns {Promise<*>} Promisified function
+ */
+function asPromise(fn, ctx/*, varargs */) {
+ var params = new Array(arguments.length - 1),
+ offset = 0,
+ index = 2,
+ pending = true;
+ while (index < arguments.length)
+ params[offset++] = arguments[index++];
+ return new Promise(function executor(resolve, reject) {
+ params[offset] = function callback(err/*, varargs */) {
+ if (pending) {
+ pending = false;
+ if (err)
+ reject(err);
+ else {
+ var params = new Array(arguments.length - 1),
+ offset = 0;
+ while (offset < params.length)
+ params[offset++] = arguments[offset];
+ resolve.apply(null, params);
+ }
+ }
+ };
+ try {
+ fn.apply(ctx || null, params);
+ } catch (err) {
+ if (pending) {
+ pending = false;
+ reject(err);
+ }
+ }
+ });
+}
diff --git a/node_modules/@protobufjs/aspromise/package.json b/node_modules/@protobufjs/aspromise/package.json
new file mode 100644
index 00000000000..446f48a6f07
--- /dev/null
+++ b/node_modules/@protobufjs/aspromise/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@protobufjs/aspromise",
+ "description": "Returns a promise from a node-style callback function.",
+ "version": "1.1.2",
+ "author": "Daniel Wirtz ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "devDependencies": {
+ "istanbul": "^0.4.5",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "tape tests/*.js",
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
+ }
+
+,"_resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz"
+,"_integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78="
+,"_from": "@protobufjs/aspromise@1.1.2"
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/aspromise/tests/index.js b/node_modules/@protobufjs/aspromise/tests/index.js
new file mode 100644
index 00000000000..cfdb258a6fc
--- /dev/null
+++ b/node_modules/@protobufjs/aspromise/tests/index.js
@@ -0,0 +1,130 @@
+var tape = require("tape");
+
+var asPromise = require("..");
+
+tape.test("aspromise", function(test) {
+
+ test.test(this.name + " - resolve", function(test) {
+
+ function fn(arg1, arg2, callback) {
+ test.equal(this, ctx, "function should be called with this = ctx");
+ test.equal(arg1, 1, "function should be called with arg1 = 1");
+ test.equal(arg2, 2, "function should be called with arg2 = 2");
+ callback(null, arg2);
+ }
+
+ var ctx = {};
+
+ var promise = asPromise(fn, ctx, 1, 2);
+ promise.then(function(arg2) {
+ test.equal(arg2, 2, "promise should be resolved with arg2 = 2");
+ test.end();
+ }).catch(function(err) {
+ test.fail("promise should not be rejected (" + err + ")");
+ });
+ });
+
+ test.test(this.name + " - reject", function(test) {
+
+ function fn(arg1, arg2, callback) {
+ test.equal(this, ctx, "function should be called with this = ctx");
+ test.equal(arg1, 1, "function should be called with arg1 = 1");
+ test.equal(arg2, 2, "function should be called with arg2 = 2");
+ callback(arg1);
+ }
+
+ var ctx = {};
+
+ var promise = asPromise(fn, ctx, 1, 2);
+ promise.then(function() {
+ test.fail("promise should not be resolved");
+ }).catch(function(err) {
+ test.equal(err, 1, "promise should be rejected with err = 1");
+ test.end();
+ });
+ });
+
+ test.test(this.name + " - resolve twice", function(test) {
+
+ function fn(arg1, arg2, callback) {
+ test.equal(this, ctx, "function should be called with this = ctx");
+ test.equal(arg1, 1, "function should be called with arg1 = 1");
+ test.equal(arg2, 2, "function should be called with arg2 = 2");
+ callback(null, arg2);
+ callback(null, arg1);
+ }
+
+ var ctx = {};
+ var count = 0;
+
+ var promise = asPromise(fn, ctx, 1, 2);
+ promise.then(function(arg2) {
+ test.equal(arg2, 2, "promise should be resolved with arg2 = 2");
+ if (++count > 1)
+ test.fail("promise should not be resolved twice");
+ test.end();
+ }).catch(function(err) {
+ test.fail("promise should not be rejected (" + err + ")");
+ });
+ });
+
+ test.test(this.name + " - reject twice", function(test) {
+
+ function fn(arg1, arg2, callback) {
+ test.equal(this, ctx, "function should be called with this = ctx");
+ test.equal(arg1, 1, "function should be called with arg1 = 1");
+ test.equal(arg2, 2, "function should be called with arg2 = 2");
+ callback(arg1);
+ callback(arg2);
+ }
+
+ var ctx = {};
+ var count = 0;
+
+ var promise = asPromise(fn, ctx, 1, 2);
+ promise.then(function() {
+ test.fail("promise should not be resolved");
+ }).catch(function(err) {
+ test.equal(err, 1, "promise should be rejected with err = 1");
+ if (++count > 1)
+ test.fail("promise should not be rejected twice");
+ test.end();
+ });
+ });
+
+ test.test(this.name + " - reject error", function(test) {
+
+ function fn(callback) {
+ test.ok(arguments.length === 1 && typeof callback === "function", "function should be called with just a callback");
+ throw 3;
+ }
+
+ var promise = asPromise(fn, null);
+ promise.then(function() {
+ test.fail("promise should not be resolved");
+ }).catch(function(err) {
+ test.equal(err, 3, "promise should be rejected with err = 3");
+ test.end();
+ });
+ });
+
+ test.test(this.name + " - reject and error", function(test) {
+
+ function fn(callback) {
+ callback(3);
+ throw 4;
+ }
+
+ var count = 0;
+
+ var promise = asPromise(fn, null);
+ promise.then(function() {
+ test.fail("promise should not be resolved");
+ }).catch(function(err) {
+ test.equal(err, 3, "promise should be rejected with err = 3");
+ if (++count > 1)
+ test.fail("promise should not be rejected twice");
+ test.end();
+ });
+ });
+});
diff --git a/node_modules/@protobufjs/base64/LICENSE b/node_modules/@protobufjs/base64/LICENSE
new file mode 100644
index 00000000000..be2b397e3c3
--- /dev/null
+++ b/node_modules/@protobufjs/base64/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@protobufjs/base64/README.md b/node_modules/@protobufjs/base64/README.md
new file mode 100644
index 00000000000..b06cb0a2776
--- /dev/null
+++ b/node_modules/@protobufjs/base64/README.md
@@ -0,0 +1,19 @@
+@protobufjs/base64
+==================
+[![npm](https://img.shields.io/npm/v/@protobufjs/base64.svg)](https://www.npmjs.com/package/@protobufjs/base64)
+
+A minimal base64 implementation for number arrays.
+
+API
+---
+
+* **base64.length(string: `string`): `number`**
+ Calculates the byte length of a base64 encoded string.
+
+* **base64.encode(buffer: `Uint8Array`, start: `number`, end: `number`): `string`**
+ Encodes a buffer to a base64 encoded string.
+
+* **base64.decode(string: `string`, buffer: `Uint8Array`, offset: `number`): `number`**
+ Decodes a base64 encoded string to a buffer.
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/node_modules/@protobufjs/base64/index.d.ts b/node_modules/@protobufjs/base64/index.d.ts
new file mode 100644
index 00000000000..085d0a7a016
--- /dev/null
+++ b/node_modules/@protobufjs/base64/index.d.ts
@@ -0,0 +1,32 @@
+/**
+ * Calculates the byte length of a base64 encoded string.
+ * @param {string} string Base64 encoded string
+ * @returns {number} Byte length
+ */
+export function length(string: string): number;
+
+/**
+ * Encodes a buffer to a base64 encoded string.
+ * @param {Uint8Array} buffer Source buffer
+ * @param {number} start Source start
+ * @param {number} end Source end
+ * @returns {string} Base64 encoded string
+ */
+export function encode(buffer: Uint8Array, start: number, end: number): string;
+
+/**
+ * Decodes a base64 encoded string to a buffer.
+ * @param {string} string Source string
+ * @param {Uint8Array} buffer Destination buffer
+ * @param {number} offset Destination offset
+ * @returns {number} Number of bytes written
+ * @throws {Error} If encoding is invalid
+ */
+export function decode(string: string, buffer: Uint8Array, offset: number): number;
+
+/**
+ * Tests if the specified string appears to be base64 encoded.
+ * @param {string} string String to test
+ * @returns {boolean} `true` if it appears to be base64 encoded, otherwise false
+ */
+export function test(string: string): boolean;
diff --git a/node_modules/@protobufjs/base64/index.js b/node_modules/@protobufjs/base64/index.js
new file mode 100644
index 00000000000..6146f5430f9
--- /dev/null
+++ b/node_modules/@protobufjs/base64/index.js
@@ -0,0 +1,139 @@
+"use strict";
+
+/**
+ * A minimal base64 implementation for number arrays.
+ * @memberof util
+ * @namespace
+ */
+var base64 = exports;
+
+/**
+ * Calculates the byte length of a base64 encoded string.
+ * @param {string} string Base64 encoded string
+ * @returns {number} Byte length
+ */
+base64.length = function length(string) {
+ var p = string.length;
+ if (!p)
+ return 0;
+ var n = 0;
+ while (--p % 4 > 1 && string.charAt(p) === "=")
+ ++n;
+ return Math.ceil(string.length * 3) / 4 - n;
+};
+
+// Base64 encoding table
+var b64 = new Array(64);
+
+// Base64 decoding table
+var s64 = new Array(123);
+
+// 65..90, 97..122, 48..57, 43, 47
+for (var i = 0; i < 64;)
+ s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
+
+/**
+ * Encodes a buffer to a base64 encoded string.
+ * @param {Uint8Array} buffer Source buffer
+ * @param {number} start Source start
+ * @param {number} end Source end
+ * @returns {string} Base64 encoded string
+ */
+base64.encode = function encode(buffer, start, end) {
+ var parts = null,
+ chunk = [];
+ var i = 0, // output index
+ j = 0, // goto index
+ t; // temporary
+ while (start < end) {
+ var b = buffer[start++];
+ switch (j) {
+ case 0:
+ chunk[i++] = b64[b >> 2];
+ t = (b & 3) << 4;
+ j = 1;
+ break;
+ case 1:
+ chunk[i++] = b64[t | b >> 4];
+ t = (b & 15) << 2;
+ j = 2;
+ break;
+ case 2:
+ chunk[i++] = b64[t | b >> 6];
+ chunk[i++] = b64[b & 63];
+ j = 0;
+ break;
+ }
+ if (i > 8191) {
+ (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
+ i = 0;
+ }
+ }
+ if (j) {
+ chunk[i++] = b64[t];
+ chunk[i++] = 61;
+ if (j === 1)
+ chunk[i++] = 61;
+ }
+ if (parts) {
+ if (i)
+ parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
+ return parts.join("");
+ }
+ return String.fromCharCode.apply(String, chunk.slice(0, i));
+};
+
+var invalidEncoding = "invalid encoding";
+
+/**
+ * Decodes a base64 encoded string to a buffer.
+ * @param {string} string Source string
+ * @param {Uint8Array} buffer Destination buffer
+ * @param {number} offset Destination offset
+ * @returns {number} Number of bytes written
+ * @throws {Error} If encoding is invalid
+ */
+base64.decode = function decode(string, buffer, offset) {
+ var start = offset;
+ var j = 0, // goto index
+ t; // temporary
+ for (var i = 0; i < string.length;) {
+ var c = string.charCodeAt(i++);
+ if (c === 61 && j > 1)
+ break;
+ if ((c = s64[c]) === undefined)
+ throw Error(invalidEncoding);
+ switch (j) {
+ case 0:
+ t = c;
+ j = 1;
+ break;
+ case 1:
+ buffer[offset++] = t << 2 | (c & 48) >> 4;
+ t = c;
+ j = 2;
+ break;
+ case 2:
+ buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
+ t = c;
+ j = 3;
+ break;
+ case 3:
+ buffer[offset++] = (t & 3) << 6 | c;
+ j = 0;
+ break;
+ }
+ }
+ if (j === 1)
+ throw Error(invalidEncoding);
+ return offset - start;
+};
+
+/**
+ * Tests if the specified string appears to be base64 encoded.
+ * @param {string} string String to test
+ * @returns {boolean} `true` if probably base64 encoded, otherwise false
+ */
+base64.test = function test(string) {
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
+};
diff --git a/node_modules/@protobufjs/base64/package.json b/node_modules/@protobufjs/base64/package.json
new file mode 100644
index 00000000000..d7c03f185fe
--- /dev/null
+++ b/node_modules/@protobufjs/base64/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@protobufjs/base64",
+ "description": "A minimal base64 implementation for number arrays.",
+ "version": "1.1.2",
+ "author": "Daniel Wirtz ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "devDependencies": {
+ "istanbul": "^0.4.5",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "tape tests/*.js",
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
+ }
+
+,"_resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz"
+,"_integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
+,"_from": "@protobufjs/base64@1.1.2"
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/base64/tests/index.js b/node_modules/@protobufjs/base64/tests/index.js
new file mode 100644
index 00000000000..6ede32c26a1
--- /dev/null
+++ b/node_modules/@protobufjs/base64/tests/index.js
@@ -0,0 +1,46 @@
+var tape = require("tape");
+
+var base64 = require("..");
+
+var strings = {
+ "": "",
+ "a": "YQ==",
+ "ab": "YWI=",
+ "abcdefg": "YWJjZGVmZw==",
+ "abcdefgh": "YWJjZGVmZ2g=",
+ "abcdefghi": "YWJjZGVmZ2hp"
+};
+
+tape.test("base64", function(test) {
+
+ Object.keys(strings).forEach(function(str) {
+ var enc = strings[str];
+
+ test.equal(base64.test(enc), true, "should detect '" + enc + "' to be base64 encoded");
+
+ var len = base64.length(enc);
+ test.equal(len, str.length, "should calculate '" + enc + "' as " + str.length + " bytes");
+
+ var buf = new Array(len);
+ var len2 = base64.decode(enc, buf, 0);
+ test.equal(len2, len, "should decode '" + enc + "' to " + len + " bytes");
+
+ test.equal(String.fromCharCode.apply(String, buf), str, "should decode '" + enc + "' to '" + str + "'");
+
+ var enc2 = base64.encode(buf, 0, buf.length);
+ test.equal(enc2, enc, "should encode '" + str + "' to '" + enc + "'");
+
+ });
+
+ test.throws(function() {
+ var buf = new Array(10);
+ base64.decode("YQ!", buf, 0);
+ }, Error, "should throw if encoding is invalid");
+
+ test.throws(function() {
+ var buf = new Array(10);
+ base64.decode("Y", buf, 0);
+ }, Error, "should throw if string is truncated");
+
+ test.end();
+});
diff --git a/node_modules/@protobufjs/codegen/LICENSE b/node_modules/@protobufjs/codegen/LICENSE
new file mode 100644
index 00000000000..be2b397e3c3
--- /dev/null
+++ b/node_modules/@protobufjs/codegen/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@protobufjs/codegen/README.md b/node_modules/@protobufjs/codegen/README.md
new file mode 100644
index 00000000000..577c43ed028
--- /dev/null
+++ b/node_modules/@protobufjs/codegen/README.md
@@ -0,0 +1,49 @@
+@protobufjs/codegen
+===================
+[![npm](https://img.shields.io/npm/v/@protobufjs/codegen.svg)](https://www.npmjs.com/package/@protobufjs/codegen)
+
+A minimalistic code generation utility.
+
+API
+---
+
+* **codegen([functionParams: `string[]`], [functionName: string]): `Codegen`**
+ Begins generating a function.
+
+* **codegen.verbose = `false`**
+ When set to true, codegen will log generated code to console. Useful for debugging.
+
+Invoking **codegen** returns an appender function that appends code to the function's body and returns itself:
+
+* **Codegen(formatString: `string`, [...formatParams: `any`]): Codegen**
+ Appends code to the function's body. The format string can contain placeholders specifying the types of inserted format parameters:
+
+ * `%d`: Number (integer or floating point value)
+ * `%f`: Floating point value
+ * `%i`: Integer value
+ * `%j`: JSON.stringify'ed value
+ * `%s`: String value
+ * `%%`: Percent sign
+
+* **Codegen([scope: `Object.`]): `Function`**
+ Finishes the function and returns it.
+
+* **Codegen.toString([functionNameOverride: `string`]): `string`**
+ Returns the function as a string.
+
+Example
+-------
+
+```js
+var codegen = require("@protobufjs/codegen");
+
+var add = codegen(["a", "b"], "add") // A function with parameters "a" and "b" named "add"
+ ("// awesome comment") // adds the line to the function's body
+ ("return a + b - c + %d", 1) // replaces %d with 1 and adds the line to the body
+ ({ c: 1 }); // adds "c" with a value of 1 to the function's scope
+
+console.log(add.toString()); // function add(a, b) { return a + b - c + 1 }
+console.log(add(1, 2)); // calculates 1 + 2 - 1 + 1 = 3
+```
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/node_modules/@protobufjs/codegen/index.d.ts b/node_modules/@protobufjs/codegen/index.d.ts
new file mode 100644
index 00000000000..f8ed9089cb7
--- /dev/null
+++ b/node_modules/@protobufjs/codegen/index.d.ts
@@ -0,0 +1,31 @@
+export = codegen;
+
+/**
+ * Appends code to the function's body.
+ * @param [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
+ * @param [formatParams] Format parameters
+ * @returns Itself or the generated function if finished
+ * @throws {Error} If format parameter counts do not match
+ */
+type Codegen = (formatStringOrScope?: (string|{ [k: string]: any }), ...formatParams: any[]) => (Codegen|Function);
+
+/**
+ * Begins generating a function.
+ * @param functionParams Function parameter names
+ * @param [functionName] Function name if not anonymous
+ * @returns Appender that appends code to the function's body
+ */
+declare function codegen(functionParams: string[], functionName?: string): Codegen;
+
+/**
+ * Begins generating a function.
+ * @param [functionName] Function name if not anonymous
+ * @returns Appender that appends code to the function's body
+ */
+declare function codegen(functionName?: string): Codegen;
+
+declare namespace codegen {
+
+ /** When set to `true`, codegen will log generated code to console. Useful for debugging. */
+ let verbose: boolean;
+}
diff --git a/node_modules/@protobufjs/codegen/index.js b/node_modules/@protobufjs/codegen/index.js
new file mode 100644
index 00000000000..af005cb0f14
--- /dev/null
+++ b/node_modules/@protobufjs/codegen/index.js
@@ -0,0 +1,99 @@
+"use strict";
+module.exports = codegen;
+
+/**
+ * Begins generating a function.
+ * @memberof util
+ * @param {string[]} functionParams Function parameter names
+ * @param {string} [functionName] Function name if not anonymous
+ * @returns {Codegen} Appender that appends code to the function's body
+ */
+function codegen(functionParams, functionName) {
+
+ /* istanbul ignore if */
+ if (typeof functionParams === "string") {
+ functionName = functionParams;
+ functionParams = undefined;
+ }
+
+ var body = [];
+
+ /**
+ * Appends code to the function's body or finishes generation.
+ * @typedef Codegen
+ * @type {function}
+ * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
+ * @param {...*} [formatParams] Format parameters
+ * @returns {Codegen|Function} Itself or the generated function if finished
+ * @throws {Error} If format parameter counts do not match
+ */
+
+ function Codegen(formatStringOrScope) {
+ // note that explicit array handling below makes this ~50% faster
+
+ // finish the function
+ if (typeof formatStringOrScope !== "string") {
+ var source = toString();
+ if (codegen.verbose)
+ console.log("codegen: " + source); // eslint-disable-line no-console
+ source = "return " + source;
+ if (formatStringOrScope) {
+ var scopeKeys = Object.keys(formatStringOrScope),
+ scopeParams = new Array(scopeKeys.length + 1),
+ scopeValues = new Array(scopeKeys.length),
+ scopeOffset = 0;
+ while (scopeOffset < scopeKeys.length) {
+ scopeParams[scopeOffset] = scopeKeys[scopeOffset];
+ scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
+ }
+ scopeParams[scopeOffset] = source;
+ return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
+ }
+ return Function(source)(); // eslint-disable-line no-new-func
+ }
+
+ // otherwise append to body
+ var formatParams = new Array(arguments.length - 1),
+ formatOffset = 0;
+ while (formatOffset < formatParams.length)
+ formatParams[formatOffset] = arguments[++formatOffset];
+ formatOffset = 0;
+ formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
+ var value = formatParams[formatOffset++];
+ switch ($1) {
+ case "d": case "f": return String(Number(value));
+ case "i": return String(Math.floor(value));
+ case "j": return JSON.stringify(value);
+ case "s": return String(value);
+ }
+ return "%";
+ });
+ if (formatOffset !== formatParams.length)
+ throw Error("parameter count mismatch");
+ body.push(formatStringOrScope);
+ return Codegen;
+ }
+
+ function toString(functionNameOverride) {
+ return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
+ }
+
+ Codegen.toString = toString;
+ return Codegen;
+}
+
+/**
+ * Begins generating a function.
+ * @memberof util
+ * @function codegen
+ * @param {string} [functionName] Function name if not anonymous
+ * @returns {Codegen} Appender that appends code to the function's body
+ * @variation 2
+ */
+
+/**
+ * When set to `true`, codegen will log generated code to console. Useful for debugging.
+ * @name util.codegen.verbose
+ * @type {boolean}
+ */
+codegen.verbose = false;
diff --git a/node_modules/@protobufjs/codegen/package.json b/node_modules/@protobufjs/codegen/package.json
new file mode 100644
index 00000000000..123a7a4086a
--- /dev/null
+++ b/node_modules/@protobufjs/codegen/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "@protobufjs/codegen",
+ "description": "A minimalistic code generation utility.",
+ "version": "2.0.4",
+ "author": "Daniel Wirtz ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts"
+
+,"_resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz"
+,"_integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
+,"_from": "@protobufjs/codegen@2.0.4"
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/codegen/tests/index.js b/node_modules/@protobufjs/codegen/tests/index.js
new file mode 100644
index 00000000000..b189117d14e
--- /dev/null
+++ b/node_modules/@protobufjs/codegen/tests/index.js
@@ -0,0 +1,13 @@
+var codegen = require("..");
+
+// new require("benchmark").Suite().add("add", function() {
+
+var add = codegen(["a", "b"], "add")
+ ("// awesome comment")
+ ("return a + b - c + %d", 1)
+ ({ c: 1 });
+
+if (add(1, 2) !== 3)
+ throw Error("failed");
+
+// }).on("cycle", function(event) { process.stdout.write(String(event.target) + "\n"); }).run();
diff --git a/node_modules/@protobufjs/eventemitter/LICENSE b/node_modules/@protobufjs/eventemitter/LICENSE
new file mode 100644
index 00000000000..be2b397e3c3
--- /dev/null
+++ b/node_modules/@protobufjs/eventemitter/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@protobufjs/eventemitter/README.md b/node_modules/@protobufjs/eventemitter/README.md
new file mode 100644
index 00000000000..528e725e4d2
--- /dev/null
+++ b/node_modules/@protobufjs/eventemitter/README.md
@@ -0,0 +1,22 @@
+@protobufjs/eventemitter
+========================
+[![npm](https://img.shields.io/npm/v/@protobufjs/eventemitter.svg)](https://www.npmjs.com/package/@protobufjs/eventemitter)
+
+A minimal event emitter.
+
+API
+---
+
+* **new EventEmitter()**
+ Constructs a new event emitter instance.
+
+* **EventEmitter#on(evt: `string`, fn: `function`, [ctx: `Object`]): `EventEmitter`**
+ Registers an event listener.
+
+* **EventEmitter#off([evt: `string`], [fn: `function`]): `EventEmitter`**
+ Removes an event listener or any matching listeners if arguments are omitted.
+
+* **EventEmitter#emit(evt: `string`, ...args: `*`): `EventEmitter`**
+ Emits an event by calling its listeners with the specified arguments.
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/node_modules/@protobufjs/eventemitter/index.d.ts b/node_modules/@protobufjs/eventemitter/index.d.ts
new file mode 100644
index 00000000000..f1778238544
--- /dev/null
+++ b/node_modules/@protobufjs/eventemitter/index.d.ts
@@ -0,0 +1,43 @@
+export = EventEmitter;
+
+/**
+ * Constructs a new event emitter instance.
+ * @classdesc A minimal event emitter.
+ * @memberof util
+ * @constructor
+ */
+declare class EventEmitter {
+
+ /**
+ * Constructs a new event emitter instance.
+ * @classdesc A minimal event emitter.
+ * @memberof util
+ * @constructor
+ */
+ constructor();
+
+ /**
+ * Registers an event listener.
+ * @param {string} evt Event name
+ * @param {function} fn Listener
+ * @param {*} [ctx] Listener context
+ * @returns {util.EventEmitter} `this`
+ */
+ on(evt: string, fn: () => any, ctx?: any): EventEmitter;
+
+ /**
+ * Removes an event listener or any matching listeners if arguments are omitted.
+ * @param {string} [evt] Event name. Removes all listeners if omitted.
+ * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
+ * @returns {util.EventEmitter} `this`
+ */
+ off(evt?: string, fn?: () => any): EventEmitter;
+
+ /**
+ * Emits an event by calling its listeners with the specified arguments.
+ * @param {string} evt Event name
+ * @param {...*} args Arguments
+ * @returns {util.EventEmitter} `this`
+ */
+ emit(evt: string, ...args: any[]): EventEmitter;
+}
diff --git a/node_modules/@protobufjs/eventemitter/index.js b/node_modules/@protobufjs/eventemitter/index.js
new file mode 100644
index 00000000000..f766fd07aea
--- /dev/null
+++ b/node_modules/@protobufjs/eventemitter/index.js
@@ -0,0 +1,76 @@
+"use strict";
+module.exports = EventEmitter;
+
+/**
+ * Constructs a new event emitter instance.
+ * @classdesc A minimal event emitter.
+ * @memberof util
+ * @constructor
+ */
+function EventEmitter() {
+
+ /**
+ * Registered listeners.
+ * @type {Object.}
+ * @private
+ */
+ this._listeners = {};
+}
+
+/**
+ * Registers an event listener.
+ * @param {string} evt Event name
+ * @param {function} fn Listener
+ * @param {*} [ctx] Listener context
+ * @returns {util.EventEmitter} `this`
+ */
+EventEmitter.prototype.on = function on(evt, fn, ctx) {
+ (this._listeners[evt] || (this._listeners[evt] = [])).push({
+ fn : fn,
+ ctx : ctx || this
+ });
+ return this;
+};
+
+/**
+ * Removes an event listener or any matching listeners if arguments are omitted.
+ * @param {string} [evt] Event name. Removes all listeners if omitted.
+ * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
+ * @returns {util.EventEmitter} `this`
+ */
+EventEmitter.prototype.off = function off(evt, fn) {
+ if (evt === undefined)
+ this._listeners = {};
+ else {
+ if (fn === undefined)
+ this._listeners[evt] = [];
+ else {
+ var listeners = this._listeners[evt];
+ for (var i = 0; i < listeners.length;)
+ if (listeners[i].fn === fn)
+ listeners.splice(i, 1);
+ else
+ ++i;
+ }
+ }
+ return this;
+};
+
+/**
+ * Emits an event by calling its listeners with the specified arguments.
+ * @param {string} evt Event name
+ * @param {...*} args Arguments
+ * @returns {util.EventEmitter} `this`
+ */
+EventEmitter.prototype.emit = function emit(evt) {
+ var listeners = this._listeners[evt];
+ if (listeners) {
+ var args = [],
+ i = 1;
+ for (; i < arguments.length;)
+ args.push(arguments[i++]);
+ for (i = 0; i < listeners.length;)
+ listeners[i].fn.apply(listeners[i++].ctx, args);
+ }
+ return this;
+};
diff --git a/node_modules/@protobufjs/eventemitter/package.json b/node_modules/@protobufjs/eventemitter/package.json
new file mode 100644
index 00000000000..eda8bd3a543
--- /dev/null
+++ b/node_modules/@protobufjs/eventemitter/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@protobufjs/eventemitter",
+ "description": "A minimal event emitter.",
+ "version": "1.1.0",
+ "author": "Daniel Wirtz ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "devDependencies": {
+ "istanbul": "^0.4.5",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "tape tests/*.js",
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
+ }
+
+,"_resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz"
+,"_integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A="
+,"_from": "@protobufjs/eventemitter@1.1.0"
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/eventemitter/tests/index.js b/node_modules/@protobufjs/eventemitter/tests/index.js
new file mode 100644
index 00000000000..390958fd810
--- /dev/null
+++ b/node_modules/@protobufjs/eventemitter/tests/index.js
@@ -0,0 +1,47 @@
+var tape = require("tape");
+
+var EventEmitter = require("..");
+
+tape.test("eventemitter", function(test) {
+
+ var ee = new EventEmitter();
+ var fn;
+ var ctx = {};
+
+ test.doesNotThrow(function() {
+ ee.emit("a", 1);
+ ee.off();
+ ee.off("a");
+ ee.off("a", function() {});
+ }, "should not throw if no listeners are registered");
+
+ test.equal(ee.on("a", function(arg1) {
+ test.equal(this, ctx, "should be called with this = ctx");
+ test.equal(arg1, 1, "should be called with arg1 = 1");
+ }, ctx), ee, "should return itself when registering events");
+ ee.emit("a", 1);
+
+ ee.off("a");
+ test.same(ee._listeners, { a: [] }, "should remove all listeners of the respective event when calling off(evt)");
+
+ ee.off();
+ test.same(ee._listeners, {}, "should remove all listeners when just calling off()");
+
+ ee.on("a", fn = function(arg1) {
+ test.equal(this, ctx, "should be called with this = ctx");
+ test.equal(arg1, 1, "should be called with arg1 = 1");
+ }, ctx).emit("a", 1);
+
+ ee.off("a", fn);
+ test.same(ee._listeners, { a: [] }, "should remove the exact listener when calling off(evt, fn)");
+
+ ee.on("a", function() {
+ test.equal(this, ee, "should be called with this = ee");
+ }).emit("a");
+
+ test.doesNotThrow(function() {
+ ee.off("a", fn);
+ }, "should not throw if no such listener is found");
+
+ test.end();
+});
diff --git a/node_modules/@protobufjs/fetch/LICENSE b/node_modules/@protobufjs/fetch/LICENSE
new file mode 100644
index 00000000000..be2b397e3c3
--- /dev/null
+++ b/node_modules/@protobufjs/fetch/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@protobufjs/fetch/README.md b/node_modules/@protobufjs/fetch/README.md
new file mode 100644
index 00000000000..1ebf4d4f524
--- /dev/null
+++ b/node_modules/@protobufjs/fetch/README.md
@@ -0,0 +1,13 @@
+@protobufjs/fetch
+=================
+[![npm](https://img.shields.io/npm/v/@protobufjs/fetch.svg)](https://www.npmjs.com/package/@protobufjs/fetch)
+
+Fetches the contents of a file accross node and browsers.
+
+API
+---
+
+* **fetch(path: `string`, [options: { binary: boolean } ], [callback: `function(error: ?Error, [contents: string])`]): `Promise|undefined`**
+ Fetches the contents of a file.
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/node_modules/@protobufjs/fetch/index.d.ts b/node_modules/@protobufjs/fetch/index.d.ts
new file mode 100644
index 00000000000..ab0820cdfba
--- /dev/null
+++ b/node_modules/@protobufjs/fetch/index.d.ts
@@ -0,0 +1,56 @@
+export = fetch;
+
+/**
+ * Node-style callback as used by {@link util.fetch}.
+ * @typedef FetchCallback
+ * @type {function}
+ * @param {?Error} error Error, if any, otherwise `null`
+ * @param {string} [contents] File contents, if there hasn't been an error
+ * @returns {undefined}
+ */
+type FetchCallback = (error: Error, contents?: string) => void;
+
+/**
+ * Options as used by {@link util.fetch}.
+ * @typedef FetchOptions
+ * @type {Object}
+ * @property {boolean} [binary=false] Whether expecting a binary response
+ * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
+ */
+
+interface FetchOptions {
+ binary?: boolean;
+ xhr?: boolean
+}
+
+/**
+ * Fetches the contents of a file.
+ * @memberof util
+ * @param {string} filename File path or url
+ * @param {FetchOptions} options Fetch options
+ * @param {FetchCallback} callback Callback function
+ * @returns {undefined}
+ */
+declare function fetch(filename: string, options: FetchOptions, callback: FetchCallback): void;
+
+/**
+ * Fetches the contents of a file.
+ * @name util.fetch
+ * @function
+ * @param {string} path File path or url
+ * @param {FetchCallback} callback Callback function
+ * @returns {undefined}
+ * @variation 2
+ */
+declare function fetch(path: string, callback: FetchCallback): void;
+
+/**
+ * Fetches the contents of a file.
+ * @name util.fetch
+ * @function
+ * @param {string} path File path or url
+ * @param {FetchOptions} [options] Fetch options
+ * @returns {Promise} Promise
+ * @variation 3
+ */
+declare function fetch(path: string, options?: FetchOptions): Promise<(string|Uint8Array)>;
diff --git a/node_modules/@protobufjs/fetch/index.js b/node_modules/@protobufjs/fetch/index.js
new file mode 100644
index 00000000000..d92aa689709
--- /dev/null
+++ b/node_modules/@protobufjs/fetch/index.js
@@ -0,0 +1,115 @@
+"use strict";
+module.exports = fetch;
+
+var asPromise = require("@protobufjs/aspromise"),
+ inquire = require("@protobufjs/inquire");
+
+var fs = inquire("fs");
+
+/**
+ * Node-style callback as used by {@link util.fetch}.
+ * @typedef FetchCallback
+ * @type {function}
+ * @param {?Error} error Error, if any, otherwise `null`
+ * @param {string} [contents] File contents, if there hasn't been an error
+ * @returns {undefined}
+ */
+
+/**
+ * Options as used by {@link util.fetch}.
+ * @typedef FetchOptions
+ * @type {Object}
+ * @property {boolean} [binary=false] Whether expecting a binary response
+ * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
+ */
+
+/**
+ * Fetches the contents of a file.
+ * @memberof util
+ * @param {string} filename File path or url
+ * @param {FetchOptions} options Fetch options
+ * @param {FetchCallback} callback Callback function
+ * @returns {undefined}
+ */
+function fetch(filename, options, callback) {
+ if (typeof options === "function") {
+ callback = options;
+ options = {};
+ } else if (!options)
+ options = {};
+
+ if (!callback)
+ return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
+
+ // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
+ if (!options.xhr && fs && fs.readFile)
+ return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
+ return err && typeof XMLHttpRequest !== "undefined"
+ ? fetch.xhr(filename, options, callback)
+ : err
+ ? callback(err)
+ : callback(null, options.binary ? contents : contents.toString("utf8"));
+ });
+
+ // use the XHR version otherwise.
+ return fetch.xhr(filename, options, callback);
+}
+
+/**
+ * Fetches the contents of a file.
+ * @name util.fetch
+ * @function
+ * @param {string} path File path or url
+ * @param {FetchCallback} callback Callback function
+ * @returns {undefined}
+ * @variation 2
+ */
+
+/**
+ * Fetches the contents of a file.
+ * @name util.fetch
+ * @function
+ * @param {string} path File path or url
+ * @param {FetchOptions} [options] Fetch options
+ * @returns {Promise} Promise
+ * @variation 3
+ */
+
+/**/
+fetch.xhr = function fetch_xhr(filename, options, callback) {
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
+
+ if (xhr.readyState !== 4)
+ return undefined;
+
+ // local cors security errors return status 0 / empty string, too. afaik this cannot be
+ // reliably distinguished from an actually empty file for security reasons. feel free
+ // to send a pull request if you are aware of a solution.
+ if (xhr.status !== 0 && xhr.status !== 200)
+ return callback(Error("status " + xhr.status));
+
+ // if binary data is expected, make sure that some sort of array is returned, even if
+ // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
+ if (options.binary) {
+ var buffer = xhr.response;
+ if (!buffer) {
+ buffer = [];
+ for (var i = 0; i < xhr.responseText.length; ++i)
+ buffer.push(xhr.responseText.charCodeAt(i) & 255);
+ }
+ return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
+ }
+ return callback(null, xhr.responseText);
+ };
+
+ if (options.binary) {
+ // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
+ if ("overrideMimeType" in xhr)
+ xhr.overrideMimeType("text/plain; charset=x-user-defined");
+ xhr.responseType = "arraybuffer";
+ }
+
+ xhr.open("GET", filename);
+ xhr.send();
+};
diff --git a/node_modules/@protobufjs/fetch/package.json b/node_modules/@protobufjs/fetch/package.json
new file mode 100644
index 00000000000..d986ece5bb1
--- /dev/null
+++ b/node_modules/@protobufjs/fetch/package.json
@@ -0,0 +1,29 @@
+{
+ "name": "@protobufjs/fetch",
+ "description": "Fetches the contents of a file accross node and browsers.",
+ "version": "1.1.0",
+ "author": "Daniel Wirtz ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "dependencies": {
+ "@protobufjs/aspromise": "^1.1.1",
+ "@protobufjs/inquire": "^1.1.0"
+ },
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "devDependencies": {
+ "istanbul": "^0.4.5",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "tape tests/*.js",
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
+ }
+
+,"_resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz"
+,"_integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU="
+,"_from": "@protobufjs/fetch@1.1.0"
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/fetch/tests/index.js b/node_modules/@protobufjs/fetch/tests/index.js
new file mode 100644
index 00000000000..b7fbf81766d
--- /dev/null
+++ b/node_modules/@protobufjs/fetch/tests/index.js
@@ -0,0 +1,16 @@
+var tape = require("tape");
+
+var fetch = require("..");
+
+tape.test("fetch", function(test) {
+
+ if (typeof Promise !== "undefined") {
+ var promise = fetch("NOTFOUND");
+ promise.catch(function() {});
+ test.ok(promise instanceof Promise, "should return a promise if callback has been omitted");
+ }
+
+ // TODO - some way to test this properly?
+
+ test.end();
+});
diff --git a/node_modules/@protobufjs/float/LICENSE b/node_modules/@protobufjs/float/LICENSE
new file mode 100644
index 00000000000..be2b397e3c3
--- /dev/null
+++ b/node_modules/@protobufjs/float/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@protobufjs/float/README.md b/node_modules/@protobufjs/float/README.md
new file mode 100644
index 00000000000..e475fc921b9
--- /dev/null
+++ b/node_modules/@protobufjs/float/README.md
@@ -0,0 +1,102 @@
+@protobufjs/float
+=================
+[![npm](https://img.shields.io/npm/v/@protobufjs/float.svg)](https://www.npmjs.com/package/@protobufjs/float)
+
+Reads / writes floats / doubles from / to buffers in both modern and ancient browsers. Fast.
+
+API
+---
+
+* **writeFloatLE(val: `number`, buf: `Uint8Array`, pos: `number`)**
+ Writes a 32 bit float to a buffer using little endian byte order.
+
+* **writeFloatBE(val: `number`, buf: `Uint8Array`, pos: `number`)**
+ Writes a 32 bit float to a buffer using big endian byte order.
+
+* **readFloatLE(buf: `Uint8Array`, pos: `number`): `number`**
+ Reads a 32 bit float from a buffer using little endian byte order.
+
+* **readFloatBE(buf: `Uint8Array`, pos: `number`): `number`**
+ Reads a 32 bit float from a buffer using big endian byte order.
+
+* **writeDoubleLE(val: `number`, buf: `Uint8Array`, pos: `number`)**
+ Writes a 64 bit double to a buffer using little endian byte order.
+
+* **writeDoubleBE(val: `number`, buf: `Uint8Array`, pos: `number`)**
+ Writes a 64 bit double to a buffer using big endian byte order.
+
+* **readDoubleLE(buf: `Uint8Array`, pos: `number`): `number`**
+ Reads a 64 bit double from a buffer using little endian byte order.
+
+* **readDoubleBE(buf: `Uint8Array`, pos: `number`): `number`**
+ Reads a 64 bit double from a buffer using big endian byte order.
+
+Performance
+-----------
+There is a simple benchmark included comparing raw read/write performance of this library (float), float's fallback for old browsers, the [ieee754](https://www.npmjs.com/package/ieee754) module and node's [buffer](https://nodejs.org/api/buffer.html). On an i7-2600k running node 6.9.1 it yields:
+
+```
+benchmarking writeFloat performance ...
+
+float x 42,741,625 ops/sec ±1.75% (81 runs sampled)
+float (fallback) x 11,272,532 ops/sec ±1.12% (85 runs sampled)
+ieee754 x 8,653,337 ops/sec ±1.18% (84 runs sampled)
+buffer x 12,412,414 ops/sec ±1.41% (83 runs sampled)
+buffer (noAssert) x 13,471,149 ops/sec ±1.09% (84 runs sampled)
+
+ float was fastest
+ float (fallback) was 73.5% slower
+ ieee754 was 79.6% slower
+ buffer was 70.9% slower
+ buffer (noAssert) was 68.3% slower
+
+benchmarking readFloat performance ...
+
+float x 44,382,729 ops/sec ±1.70% (84 runs sampled)
+float (fallback) x 20,925,938 ops/sec ±0.86% (87 runs sampled)
+ieee754 x 17,189,009 ops/sec ±1.01% (87 runs sampled)
+buffer x 10,518,437 ops/sec ±1.04% (83 runs sampled)
+buffer (noAssert) x 11,031,636 ops/sec ±1.15% (87 runs sampled)
+
+ float was fastest
+ float (fallback) was 52.5% slower
+ ieee754 was 61.0% slower
+ buffer was 76.1% slower
+ buffer (noAssert) was 75.0% slower
+
+benchmarking writeDouble performance ...
+
+float x 38,624,906 ops/sec ±0.93% (83 runs sampled)
+float (fallback) x 10,457,811 ops/sec ±1.54% (85 runs sampled)
+ieee754 x 7,681,130 ops/sec ±1.11% (83 runs sampled)
+buffer x 12,657,876 ops/sec ±1.03% (83 runs sampled)
+buffer (noAssert) x 13,372,795 ops/sec ±0.84% (85 runs sampled)
+
+ float was fastest
+ float (fallback) was 73.1% slower
+ ieee754 was 80.1% slower
+ buffer was 67.3% slower
+ buffer (noAssert) was 65.3% slower
+
+benchmarking readDouble performance ...
+
+float x 40,527,888 ops/sec ±1.05% (84 runs sampled)
+float (fallback) x 18,696,480 ops/sec ±0.84% (86 runs sampled)
+ieee754 x 14,074,028 ops/sec ±1.04% (87 runs sampled)
+buffer x 10,092,367 ops/sec ±1.15% (84 runs sampled)
+buffer (noAssert) x 10,623,793 ops/sec ±0.96% (84 runs sampled)
+
+ float was fastest
+ float (fallback) was 53.8% slower
+ ieee754 was 65.3% slower
+ buffer was 75.1% slower
+ buffer (noAssert) was 73.8% slower
+```
+
+To run it yourself:
+
+```
+$> npm run bench
+```
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/node_modules/@protobufjs/float/bench/index.js b/node_modules/@protobufjs/float/bench/index.js
new file mode 100644
index 00000000000..911f4617b64
--- /dev/null
+++ b/node_modules/@protobufjs/float/bench/index.js
@@ -0,0 +1,87 @@
+"use strict";
+
+var float = require(".."),
+ ieee754 = require("ieee754"),
+ newSuite = require("./suite");
+
+var F32 = Float32Array;
+var F64 = Float64Array;
+delete global.Float32Array;
+delete global.Float64Array;
+var floatFallback = float({});
+global.Float32Array = F32;
+global.Float64Array = F64;
+
+var buf = new Buffer(8);
+
+newSuite("writeFloat")
+.add("float", function() {
+ float.writeFloatLE(0.1, buf, 0);
+})
+.add("float (fallback)", function() {
+ floatFallback.writeFloatLE(0.1, buf, 0);
+})
+.add("ieee754", function() {
+ ieee754.write(buf, 0.1, 0, true, 23, 4);
+})
+.add("buffer", function() {
+ buf.writeFloatLE(0.1, 0);
+})
+.add("buffer (noAssert)", function() {
+ buf.writeFloatLE(0.1, 0, true);
+})
+.run();
+
+newSuite("readFloat")
+.add("float", function() {
+ float.readFloatLE(buf, 0);
+})
+.add("float (fallback)", function() {
+ floatFallback.readFloatLE(buf, 0);
+})
+.add("ieee754", function() {
+ ieee754.read(buf, 0, true, 23, 4);
+})
+.add("buffer", function() {
+ buf.readFloatLE(0);
+})
+.add("buffer (noAssert)", function() {
+ buf.readFloatLE(0, true);
+})
+.run();
+
+newSuite("writeDouble")
+.add("float", function() {
+ float.writeDoubleLE(0.1, buf, 0);
+})
+.add("float (fallback)", function() {
+ floatFallback.writeDoubleLE(0.1, buf, 0);
+})
+.add("ieee754", function() {
+ ieee754.write(buf, 0.1, 0, true, 52, 8);
+})
+.add("buffer", function() {
+ buf.writeDoubleLE(0.1, 0);
+})
+.add("buffer (noAssert)", function() {
+ buf.writeDoubleLE(0.1, 0, true);
+})
+.run();
+
+newSuite("readDouble")
+.add("float", function() {
+ float.readDoubleLE(buf, 0);
+})
+.add("float (fallback)", function() {
+ floatFallback.readDoubleLE(buf, 0);
+})
+.add("ieee754", function() {
+ ieee754.read(buf, 0, true, 52, 8);
+})
+.add("buffer", function() {
+ buf.readDoubleLE(0);
+})
+.add("buffer (noAssert)", function() {
+ buf.readDoubleLE(0, true);
+})
+.run();
diff --git a/node_modules/@protobufjs/float/bench/suite.js b/node_modules/@protobufjs/float/bench/suite.js
new file mode 100644
index 00000000000..e8016d23e97
--- /dev/null
+++ b/node_modules/@protobufjs/float/bench/suite.js
@@ -0,0 +1,46 @@
+"use strict";
+module.exports = newSuite;
+
+var benchmark = require("benchmark"),
+ chalk = require("chalk");
+
+var padSize = 27;
+
+function newSuite(name) {
+ var benches = [];
+ return new benchmark.Suite(name)
+ .on("add", function(event) {
+ benches.push(event.target);
+ })
+ .on("start", function() {
+ process.stdout.write("benchmarking " + name + " performance ...\n\n");
+ })
+ .on("cycle", function(event) {
+ process.stdout.write(String(event.target) + "\n");
+ })
+ .on("complete", function() {
+ if (benches.length > 1) {
+ var fastest = this.filter("fastest"), // eslint-disable-line no-invalid-this
+ fastestHz = getHz(fastest[0]);
+ process.stdout.write("\n" + chalk.white(pad(fastest[0].name, padSize)) + " was " + chalk.green("fastest") + "\n");
+ benches.forEach(function(bench) {
+ if (fastest.indexOf(bench) === 0)
+ return;
+ var hz = hz = getHz(bench);
+ var percent = (1 - hz / fastestHz) * 100;
+ process.stdout.write(chalk.white(pad(bench.name, padSize)) + " was " + chalk.red(percent.toFixed(1) + "% slower") + "\n");
+ });
+ }
+ process.stdout.write("\n");
+ });
+}
+
+function getHz(bench) {
+ return 1 / (bench.stats.mean + bench.stats.moe);
+}
+
+function pad(str, len, l) {
+ while (str.length < len)
+ str = l ? str + " " : " " + str;
+ return str;
+}
diff --git a/node_modules/@protobufjs/float/index.d.ts b/node_modules/@protobufjs/float/index.d.ts
new file mode 100644
index 00000000000..ab05de3612c
--- /dev/null
+++ b/node_modules/@protobufjs/float/index.d.ts
@@ -0,0 +1,83 @@
+/**
+ * Writes a 32 bit float to a buffer using little endian byte order.
+ * @name writeFloatLE
+ * @function
+ * @param {number} val Value to write
+ * @param {Uint8Array} buf Target buffer
+ * @param {number} pos Target buffer offset
+ * @returns {undefined}
+ */
+export function writeFloatLE(val: number, buf: Uint8Array, pos: number): void;
+
+/**
+ * Writes a 32 bit float to a buffer using big endian byte order.
+ * @name writeFloatBE
+ * @function
+ * @param {number} val Value to write
+ * @param {Uint8Array} buf Target buffer
+ * @param {number} pos Target buffer offset
+ * @returns {undefined}
+ */
+export function writeFloatBE(val: number, buf: Uint8Array, pos: number): void;
+
+/**
+ * Reads a 32 bit float from a buffer using little endian byte order.
+ * @name readFloatLE
+ * @function
+ * @param {Uint8Array} buf Source buffer
+ * @param {number} pos Source buffer offset
+ * @returns {number} Value read
+ */
+export function readFloatLE(buf: Uint8Array, pos: number): number;
+
+/**
+ * Reads a 32 bit float from a buffer using big endian byte order.
+ * @name readFloatBE
+ * @function
+ * @param {Uint8Array} buf Source buffer
+ * @param {number} pos Source buffer offset
+ * @returns {number} Value read
+ */
+export function readFloatBE(buf: Uint8Array, pos: number): number;
+
+/**
+ * Writes a 64 bit double to a buffer using little endian byte order.
+ * @name writeDoubleLE
+ * @function
+ * @param {number} val Value to write
+ * @param {Uint8Array} buf Target buffer
+ * @param {number} pos Target buffer offset
+ * @returns {undefined}
+ */
+export function writeDoubleLE(val: number, buf: Uint8Array, pos: number): void;
+
+/**
+ * Writes a 64 bit double to a buffer using big endian byte order.
+ * @name writeDoubleBE
+ * @function
+ * @param {number} val Value to write
+ * @param {Uint8Array} buf Target buffer
+ * @param {number} pos Target buffer offset
+ * @returns {undefined}
+ */
+export function writeDoubleBE(val: number, buf: Uint8Array, pos: number): void;
+
+/**
+ * Reads a 64 bit double from a buffer using little endian byte order.
+ * @name readDoubleLE
+ * @function
+ * @param {Uint8Array} buf Source buffer
+ * @param {number} pos Source buffer offset
+ * @returns {number} Value read
+ */
+export function readDoubleLE(buf: Uint8Array, pos: number): number;
+
+/**
+ * Reads a 64 bit double from a buffer using big endian byte order.
+ * @name readDoubleBE
+ * @function
+ * @param {Uint8Array} buf Source buffer
+ * @param {number} pos Source buffer offset
+ * @returns {number} Value read
+ */
+export function readDoubleBE(buf: Uint8Array, pos: number): number;
diff --git a/node_modules/@protobufjs/float/index.js b/node_modules/@protobufjs/float/index.js
new file mode 100644
index 00000000000..52ba3aa2377
--- /dev/null
+++ b/node_modules/@protobufjs/float/index.js
@@ -0,0 +1,335 @@
+"use strict";
+
+module.exports = factory(factory);
+
+/**
+ * Reads / writes floats / doubles from / to buffers.
+ * @name util.float
+ * @namespace
+ */
+
+/**
+ * Writes a 32 bit float to a buffer using little endian byte order.
+ * @name util.float.writeFloatLE
+ * @function
+ * @param {number} val Value to write
+ * @param {Uint8Array} buf Target buffer
+ * @param {number} pos Target buffer offset
+ * @returns {undefined}
+ */
+
+/**
+ * Writes a 32 bit float to a buffer using big endian byte order.
+ * @name util.float.writeFloatBE
+ * @function
+ * @param {number} val Value to write
+ * @param {Uint8Array} buf Target buffer
+ * @param {number} pos Target buffer offset
+ * @returns {undefined}
+ */
+
+/**
+ * Reads a 32 bit float from a buffer using little endian byte order.
+ * @name util.float.readFloatLE
+ * @function
+ * @param {Uint8Array} buf Source buffer
+ * @param {number} pos Source buffer offset
+ * @returns {number} Value read
+ */
+
+/**
+ * Reads a 32 bit float from a buffer using big endian byte order.
+ * @name util.float.readFloatBE
+ * @function
+ * @param {Uint8Array} buf Source buffer
+ * @param {number} pos Source buffer offset
+ * @returns {number} Value read
+ */
+
+/**
+ * Writes a 64 bit double to a buffer using little endian byte order.
+ * @name util.float.writeDoubleLE
+ * @function
+ * @param {number} val Value to write
+ * @param {Uint8Array} buf Target buffer
+ * @param {number} pos Target buffer offset
+ * @returns {undefined}
+ */
+
+/**
+ * Writes a 64 bit double to a buffer using big endian byte order.
+ * @name util.float.writeDoubleBE
+ * @function
+ * @param {number} val Value to write
+ * @param {Uint8Array} buf Target buffer
+ * @param {number} pos Target buffer offset
+ * @returns {undefined}
+ */
+
+/**
+ * Reads a 64 bit double from a buffer using little endian byte order.
+ * @name util.float.readDoubleLE
+ * @function
+ * @param {Uint8Array} buf Source buffer
+ * @param {number} pos Source buffer offset
+ * @returns {number} Value read
+ */
+
+/**
+ * Reads a 64 bit double from a buffer using big endian byte order.
+ * @name util.float.readDoubleBE
+ * @function
+ * @param {Uint8Array} buf Source buffer
+ * @param {number} pos Source buffer offset
+ * @returns {number} Value read
+ */
+
+// Factory function for the purpose of node-based testing in modified global environments
+function factory(exports) {
+
+ // float: typed array
+ if (typeof Float32Array !== "undefined") (function() {
+
+ var f32 = new Float32Array([ -0 ]),
+ f8b = new Uint8Array(f32.buffer),
+ le = f8b[3] === 128;
+
+ function writeFloat_f32_cpy(val, buf, pos) {
+ f32[0] = val;
+ buf[pos ] = f8b[0];
+ buf[pos + 1] = f8b[1];
+ buf[pos + 2] = f8b[2];
+ buf[pos + 3] = f8b[3];
+ }
+
+ function writeFloat_f32_rev(val, buf, pos) {
+ f32[0] = val;
+ buf[pos ] = f8b[3];
+ buf[pos + 1] = f8b[2];
+ buf[pos + 2] = f8b[1];
+ buf[pos + 3] = f8b[0];
+ }
+
+ /* istanbul ignore next */
+ exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;
+ /* istanbul ignore next */
+ exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;
+
+ function readFloat_f32_cpy(buf, pos) {
+ f8b[0] = buf[pos ];
+ f8b[1] = buf[pos + 1];
+ f8b[2] = buf[pos + 2];
+ f8b[3] = buf[pos + 3];
+ return f32[0];
+ }
+
+ function readFloat_f32_rev(buf, pos) {
+ f8b[3] = buf[pos ];
+ f8b[2] = buf[pos + 1];
+ f8b[1] = buf[pos + 2];
+ f8b[0] = buf[pos + 3];
+ return f32[0];
+ }
+
+ /* istanbul ignore next */
+ exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;
+ /* istanbul ignore next */
+ exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;
+
+ // float: ieee754
+ })(); else (function() {
+
+ function writeFloat_ieee754(writeUint, val, buf, pos) {
+ var sign = val < 0 ? 1 : 0;
+ if (sign)
+ val = -val;
+ if (val === 0)
+ writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);
+ else if (isNaN(val))
+ writeUint(2143289344, buf, pos);
+ else if (val > 3.4028234663852886e+38) // +-Infinity
+ writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);
+ else if (val < 1.1754943508222875e-38) // denormal
+ writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);
+ else {
+ var exponent = Math.floor(Math.log(val) / Math.LN2),
+ mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;
+ writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
+ }
+ }
+
+ exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);
+ exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);
+
+ function readFloat_ieee754(readUint, buf, pos) {
+ var uint = readUint(buf, pos),
+ sign = (uint >> 31) * 2 + 1,
+ exponent = uint >>> 23 & 255,
+ mantissa = uint & 8388607;
+ return exponent === 255
+ ? mantissa
+ ? NaN
+ : sign * Infinity
+ : exponent === 0 // denormal
+ ? sign * 1.401298464324817e-45 * mantissa
+ : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);
+ }
+
+ exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);
+ exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);
+
+ })();
+
+ // double: typed array
+ if (typeof Float64Array !== "undefined") (function() {
+
+ var f64 = new Float64Array([-0]),
+ f8b = new Uint8Array(f64.buffer),
+ le = f8b[7] === 128;
+
+ function writeDouble_f64_cpy(val, buf, pos) {
+ f64[0] = val;
+ buf[pos ] = f8b[0];
+ buf[pos + 1] = f8b[1];
+ buf[pos + 2] = f8b[2];
+ buf[pos + 3] = f8b[3];
+ buf[pos + 4] = f8b[4];
+ buf[pos + 5] = f8b[5];
+ buf[pos + 6] = f8b[6];
+ buf[pos + 7] = f8b[7];
+ }
+
+ function writeDouble_f64_rev(val, buf, pos) {
+ f64[0] = val;
+ buf[pos ] = f8b[7];
+ buf[pos + 1] = f8b[6];
+ buf[pos + 2] = f8b[5];
+ buf[pos + 3] = f8b[4];
+ buf[pos + 4] = f8b[3];
+ buf[pos + 5] = f8b[2];
+ buf[pos + 6] = f8b[1];
+ buf[pos + 7] = f8b[0];
+ }
+
+ /* istanbul ignore next */
+ exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;
+ /* istanbul ignore next */
+ exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;
+
+ function readDouble_f64_cpy(buf, pos) {
+ f8b[0] = buf[pos ];
+ f8b[1] = buf[pos + 1];
+ f8b[2] = buf[pos + 2];
+ f8b[3] = buf[pos + 3];
+ f8b[4] = buf[pos + 4];
+ f8b[5] = buf[pos + 5];
+ f8b[6] = buf[pos + 6];
+ f8b[7] = buf[pos + 7];
+ return f64[0];
+ }
+
+ function readDouble_f64_rev(buf, pos) {
+ f8b[7] = buf[pos ];
+ f8b[6] = buf[pos + 1];
+ f8b[5] = buf[pos + 2];
+ f8b[4] = buf[pos + 3];
+ f8b[3] = buf[pos + 4];
+ f8b[2] = buf[pos + 5];
+ f8b[1] = buf[pos + 6];
+ f8b[0] = buf[pos + 7];
+ return f64[0];
+ }
+
+ /* istanbul ignore next */
+ exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;
+ /* istanbul ignore next */
+ exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;
+
+ // double: ieee754
+ })(); else (function() {
+
+ function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {
+ var sign = val < 0 ? 1 : 0;
+ if (sign)
+ val = -val;
+ if (val === 0) {
+ writeUint(0, buf, pos + off0);
+ writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);
+ } else if (isNaN(val)) {
+ writeUint(0, buf, pos + off0);
+ writeUint(2146959360, buf, pos + off1);
+ } else if (val > 1.7976931348623157e+308) { // +-Infinity
+ writeUint(0, buf, pos + off0);
+ writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);
+ } else {
+ var mantissa;
+ if (val < 2.2250738585072014e-308) { // denormal
+ mantissa = val / 5e-324;
+ writeUint(mantissa >>> 0, buf, pos + off0);
+ writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);
+ } else {
+ var exponent = Math.floor(Math.log(val) / Math.LN2);
+ if (exponent === 1024)
+ exponent = 1023;
+ mantissa = val * Math.pow(2, -exponent);
+ writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
+ writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
+ }
+ }
+ }
+
+ exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);
+ exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);
+
+ function readDouble_ieee754(readUint, off0, off1, buf, pos) {
+ var lo = readUint(buf, pos + off0),
+ hi = readUint(buf, pos + off1);
+ var sign = (hi >> 31) * 2 + 1,
+ exponent = hi >>> 20 & 2047,
+ mantissa = 4294967296 * (hi & 1048575) + lo;
+ return exponent === 2047
+ ? mantissa
+ ? NaN
+ : sign * Infinity
+ : exponent === 0 // denormal
+ ? sign * 5e-324 * mantissa
+ : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
+ }
+
+ exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);
+ exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);
+
+ })();
+
+ return exports;
+}
+
+// uint helpers
+
+function writeUintLE(val, buf, pos) {
+ buf[pos ] = val & 255;
+ buf[pos + 1] = val >>> 8 & 255;
+ buf[pos + 2] = val >>> 16 & 255;
+ buf[pos + 3] = val >>> 24;
+}
+
+function writeUintBE(val, buf, pos) {
+ buf[pos ] = val >>> 24;
+ buf[pos + 1] = val >>> 16 & 255;
+ buf[pos + 2] = val >>> 8 & 255;
+ buf[pos + 3] = val & 255;
+}
+
+function readUintLE(buf, pos) {
+ return (buf[pos ]
+ | buf[pos + 1] << 8
+ | buf[pos + 2] << 16
+ | buf[pos + 3] << 24) >>> 0;
+}
+
+function readUintBE(buf, pos) {
+ return (buf[pos ] << 24
+ | buf[pos + 1] << 16
+ | buf[pos + 2] << 8
+ | buf[pos + 3]) >>> 0;
+}
diff --git a/node_modules/@protobufjs/float/package.json b/node_modules/@protobufjs/float/package.json
new file mode 100644
index 00000000000..fcb9d916a25
--- /dev/null
+++ b/node_modules/@protobufjs/float/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "@protobufjs/float",
+ "description": "Reads / writes floats / doubles from / to buffers in both modern and ancient browsers.",
+ "version": "1.0.2",
+ "author": "Daniel Wirtz ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "dependencies": {},
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "devDependencies": {
+ "benchmark": "^2.1.4",
+ "chalk": "^1.1.3",
+ "ieee754": "^1.1.8",
+ "istanbul": "^0.4.5",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "tape tests/*.js",
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js",
+ "bench": "node bench"
+ }
+
+,"_resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz"
+,"_integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E="
+,"_from": "@protobufjs/float@1.0.2"
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/float/tests/index.js b/node_modules/@protobufjs/float/tests/index.js
new file mode 100644
index 00000000000..62f08275f8a
--- /dev/null
+++ b/node_modules/@protobufjs/float/tests/index.js
@@ -0,0 +1,100 @@
+var tape = require("tape");
+
+var float = require("..");
+
+tape.test("float", function(test) {
+
+ // default
+ test.test(test.name + " - typed array", function(test) {
+ runTest(float, test);
+ });
+
+ // ieee754
+ test.test(test.name + " - fallback", function(test) {
+ var F32 = global.Float32Array,
+ F64 = global.Float64Array;
+ delete global.Float32Array;
+ delete global.Float64Array;
+ runTest(float({}), test);
+ global.Float32Array = F32;
+ global.Float64Array = F64;
+ });
+});
+
+function runTest(float, test) {
+
+ var common = [
+ 0,
+ -0,
+ Infinity,
+ -Infinity,
+ 0.125,
+ 1024.5,
+ -4096.5,
+ NaN
+ ];
+
+ test.test(test.name + " - using 32 bits", function(test) {
+ common.concat([
+ 3.4028234663852886e+38,
+ 1.1754943508222875e-38,
+ 1.1754946310819804e-39
+ ])
+ .forEach(function(value) {
+ var strval = value === 0 && 1 / value < 0 ? "-0" : value.toString();
+ test.ok(
+ checkValue(value, 4, float.readFloatLE, float.writeFloatLE, Buffer.prototype.writeFloatLE),
+ "should write and read back " + strval + " (32 bit LE)"
+ );
+ test.ok(
+ checkValue(value, 4, float.readFloatBE, float.writeFloatBE, Buffer.prototype.writeFloatBE),
+ "should write and read back " + strval + " (32 bit BE)"
+ );
+ });
+ test.end();
+ });
+
+ test.test(test.name + " - using 64 bits", function(test) {
+ common.concat([
+ 1.7976931348623157e+308,
+ 2.2250738585072014e-308,
+ 2.2250738585072014e-309
+ ])
+ .forEach(function(value) {
+ var strval = value === 0 && 1 / value < 0 ? "-0" : value.toString();
+ test.ok(
+ checkValue(value, 8, float.readDoubleLE, float.writeDoubleLE, Buffer.prototype.writeDoubleLE),
+ "should write and read back " + strval + " (64 bit LE)"
+ );
+ test.ok(
+ checkValue(value, 8, float.readDoubleBE, float.writeDoubleBE, Buffer.prototype.writeDoubleBE),
+ "should write and read back " + strval + " (64 bit BE)"
+ );
+ });
+ test.end();
+ });
+
+ test.end();
+}
+
+function checkValue(value, size, read, write, write_comp) {
+ var buffer = new Buffer(size);
+ write(value, buffer, 0);
+ var value_comp = read(buffer, 0);
+ var strval = value === 0 && 1 / value < 0 ? "-0" : value.toString();
+ if (value !== value) {
+ if (value_comp === value_comp)
+ return false;
+ } else if (value_comp !== value)
+ return false;
+
+ var buffer_comp = new Buffer(size);
+ write_comp.call(buffer_comp, value, 0);
+ for (var i = 0; i < size; ++i)
+ if (buffer[i] !== buffer_comp[i]) {
+ console.error(">", buffer, buffer_comp);
+ return false;
+ }
+
+ return true;
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/inquire/.npmignore b/node_modules/@protobufjs/inquire/.npmignore
new file mode 100644
index 00000000000..c3fc82ecb37
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/.npmignore
@@ -0,0 +1,3 @@
+npm-debug.*
+node_modules/
+coverage/
diff --git a/node_modules/@protobufjs/inquire/LICENSE b/node_modules/@protobufjs/inquire/LICENSE
new file mode 100644
index 00000000000..be2b397e3c3
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@protobufjs/inquire/README.md b/node_modules/@protobufjs/inquire/README.md
new file mode 100644
index 00000000000..3eabd864f00
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/README.md
@@ -0,0 +1,13 @@
+@protobufjs/inquire
+===================
+[![npm](https://img.shields.io/npm/v/@protobufjs/inquire.svg)](https://www.npmjs.com/package/@protobufjs/inquire)
+
+Requires a module only if available and hides the require call from bundlers.
+
+API
+---
+
+* **inquire(moduleName: `string`): `?Object`**
+ Requires a module only if available.
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/node_modules/@protobufjs/inquire/index.d.ts b/node_modules/@protobufjs/inquire/index.d.ts
new file mode 100644
index 00000000000..1f5a865c900
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/index.d.ts
@@ -0,0 +1,9 @@
+export = inquire;
+
+/**
+ * Requires a module only if available.
+ * @memberof util
+ * @param {string} moduleName Module to require
+ * @returns {?Object} Required module if available and not empty, otherwise `null`
+ */
+declare function inquire(moduleName: string): Object;
diff --git a/node_modules/@protobufjs/inquire/index.js b/node_modules/@protobufjs/inquire/index.js
new file mode 100644
index 00000000000..1a1f238a42e
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/index.js
@@ -0,0 +1,17 @@
+"use strict";
+module.exports = inquire;
+
+/**
+ * Requires a module only if available.
+ * @memberof util
+ * @param {string} moduleName Module to require
+ * @returns {?Object} Required module if available and not empty, otherwise `null`
+ */
+function inquire(moduleName) {
+ try {
+ var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
+ if (mod && (mod.length || Object.keys(mod).length))
+ return mod;
+ } catch (e) {} // eslint-disable-line no-empty
+ return null;
+}
diff --git a/node_modules/@protobufjs/inquire/package.json b/node_modules/@protobufjs/inquire/package.json
new file mode 100644
index 00000000000..16dc06eecae
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@protobufjs/inquire",
+ "description": "Requires a module only if available and hides the require call from bundlers.",
+ "version": "1.1.0",
+ "author": "Daniel Wirtz ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "devDependencies": {
+ "istanbul": "^0.4.5",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "tape tests/*.js",
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
+ }
+
+,"_resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz"
+,"_integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik="
+,"_from": "@protobufjs/inquire@1.1.0"
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/inquire/tests/data/array.js b/node_modules/@protobufjs/inquire/tests/data/array.js
new file mode 100644
index 00000000000..0847b28b2f3
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/tests/data/array.js
@@ -0,0 +1 @@
+module.exports = [1];
diff --git a/node_modules/@protobufjs/inquire/tests/data/emptyArray.js b/node_modules/@protobufjs/inquire/tests/data/emptyArray.js
new file mode 100644
index 00000000000..e0a30c5dfa3
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/tests/data/emptyArray.js
@@ -0,0 +1 @@
+module.exports = [];
diff --git a/node_modules/@protobufjs/inquire/tests/data/emptyObject.js b/node_modules/@protobufjs/inquire/tests/data/emptyObject.js
new file mode 100644
index 00000000000..f053ebf7976
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/tests/data/emptyObject.js
@@ -0,0 +1 @@
+module.exports = {};
diff --git a/node_modules/@protobufjs/inquire/tests/data/object.js b/node_modules/@protobufjs/inquire/tests/data/object.js
new file mode 100644
index 00000000000..3b75bcaca3e
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/tests/data/object.js
@@ -0,0 +1 @@
+module.exports = { a: 1 };
diff --git a/node_modules/@protobufjs/inquire/tests/index.js b/node_modules/@protobufjs/inquire/tests/index.js
new file mode 100644
index 00000000000..4a555ca2249
--- /dev/null
+++ b/node_modules/@protobufjs/inquire/tests/index.js
@@ -0,0 +1,20 @@
+var tape = require("tape");
+
+var inquire = require("..");
+
+tape.test("inquire", function(test) {
+
+ test.equal(inquire("buffer").Buffer, Buffer, "should be able to require \"buffer\"");
+
+ test.equal(inquire("%invalid"), null, "should not be able to require \"%invalid\"");
+
+ test.equal(inquire("./tests/data/emptyObject"), null, "should return null when requiring a module exporting an empty object");
+
+ test.equal(inquire("./tests/data/emptyArray"), null, "should return null when requiring a module exporting an empty array");
+
+ test.same(inquire("./tests/data/object"), { a: 1 }, "should return the object if a non-empty object");
+
+ test.same(inquire("./tests/data/array"), [ 1 ], "should return the module if a non-empty array");
+
+ test.end();
+});
diff --git a/node_modules/@protobufjs/path/LICENSE b/node_modules/@protobufjs/path/LICENSE
new file mode 100644
index 00000000000..be2b397e3c3
--- /dev/null
+++ b/node_modules/@protobufjs/path/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@protobufjs/path/README.md b/node_modules/@protobufjs/path/README.md
new file mode 100644
index 00000000000..1c1a2ba2f5e
--- /dev/null
+++ b/node_modules/@protobufjs/path/README.md
@@ -0,0 +1,19 @@
+@protobufjs/path
+================
+[![npm](https://img.shields.io/npm/v/@protobufjs/path.svg)](https://www.npmjs.com/package/@protobufjs/path)
+
+A minimal path module to resolve Unix, Windows and URL paths alike.
+
+API
+---
+
+* **path.isAbsolute(path: `string`): `boolean`**
+ Tests if the specified path is absolute.
+
+* **path.normalize(path: `string`): `string`**
+ Normalizes the specified path.
+
+* **path.resolve(originPath: `string`, includePath: `string`, [alreadyNormalized=false: `boolean`]): `string`**
+ Resolves the specified include path against the specified origin path.
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/node_modules/@protobufjs/path/index.d.ts b/node_modules/@protobufjs/path/index.d.ts
new file mode 100644
index 00000000000..b664d81f63e
--- /dev/null
+++ b/node_modules/@protobufjs/path/index.d.ts
@@ -0,0 +1,22 @@
+/**
+ * Tests if the specified path is absolute.
+ * @param {string} path Path to test
+ * @returns {boolean} `true` if path is absolute
+ */
+export function isAbsolute(path: string): boolean;
+
+/**
+ * Normalizes the specified path.
+ * @param {string} path Path to normalize
+ * @returns {string} Normalized path
+ */
+export function normalize(path: string): string;
+
+/**
+ * Resolves the specified include path against the specified origin path.
+ * @param {string} originPath Path to the origin file
+ * @param {string} includePath Include path relative to origin path
+ * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
+ * @returns {string} Path to the include file
+ */
+export function resolve(originPath: string, includePath: string, alreadyNormalized?: boolean): string;
diff --git a/node_modules/@protobufjs/path/index.js b/node_modules/@protobufjs/path/index.js
new file mode 100644
index 00000000000..7c7fb723e93
--- /dev/null
+++ b/node_modules/@protobufjs/path/index.js
@@ -0,0 +1,65 @@
+"use strict";
+
+/**
+ * A minimal path module to resolve Unix, Windows and URL paths alike.
+ * @memberof util
+ * @namespace
+ */
+var path = exports;
+
+var isAbsolute =
+/**
+ * Tests if the specified path is absolute.
+ * @param {string} path Path to test
+ * @returns {boolean} `true` if path is absolute
+ */
+path.isAbsolute = function isAbsolute(path) {
+ return /^(?:\/|\w+:)/.test(path);
+};
+
+var normalize =
+/**
+ * Normalizes the specified path.
+ * @param {string} path Path to normalize
+ * @returns {string} Normalized path
+ */
+path.normalize = function normalize(path) {
+ path = path.replace(/\\/g, "/")
+ .replace(/\/{2,}/g, "/");
+ var parts = path.split("/"),
+ absolute = isAbsolute(path),
+ prefix = "";
+ if (absolute)
+ prefix = parts.shift() + "/";
+ for (var i = 0; i < parts.length;) {
+ if (parts[i] === "..") {
+ if (i > 0 && parts[i - 1] !== "..")
+ parts.splice(--i, 2);
+ else if (absolute)
+ parts.splice(i, 1);
+ else
+ ++i;
+ } else if (parts[i] === ".")
+ parts.splice(i, 1);
+ else
+ ++i;
+ }
+ return prefix + parts.join("/");
+};
+
+/**
+ * Resolves the specified include path against the specified origin path.
+ * @param {string} originPath Path to the origin file
+ * @param {string} includePath Include path relative to origin path
+ * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
+ * @returns {string} Path to the include file
+ */
+path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
+ if (!alreadyNormalized)
+ includePath = normalize(includePath);
+ if (isAbsolute(includePath))
+ return includePath;
+ if (!alreadyNormalized)
+ originPath = normalize(originPath);
+ return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
+};
diff --git a/node_modules/@protobufjs/path/package.json b/node_modules/@protobufjs/path/package.json
new file mode 100644
index 00000000000..39060cd6fad
--- /dev/null
+++ b/node_modules/@protobufjs/path/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@protobufjs/path",
+ "description": "A minimal path module to resolve Unix, Windows and URL paths alike.",
+ "version": "1.1.2",
+ "author": "Daniel Wirtz ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "devDependencies": {
+ "istanbul": "^0.4.5",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "tape tests/*.js",
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
+ }
+
+,"_resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz"
+,"_integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0="
+,"_from": "@protobufjs/path@1.1.2"
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/path/tests/index.js b/node_modules/@protobufjs/path/tests/index.js
new file mode 100644
index 00000000000..9c23bc9697e
--- /dev/null
+++ b/node_modules/@protobufjs/path/tests/index.js
@@ -0,0 +1,60 @@
+var tape = require("tape");
+
+var path = require("..");
+
+tape.test("path", function(test) {
+
+ test.ok(path.isAbsolute("X:\\some\\path\\file.js"), "should identify absolute windows paths");
+ test.ok(path.isAbsolute("/some/path/file.js"), "should identify absolute unix paths");
+
+ test.notOk(path.isAbsolute("some\\path\\file.js"), "should identify relative windows paths");
+ test.notOk(path.isAbsolute("some/path/file.js"), "should identify relative unix paths");
+
+ var paths = [
+ {
+ actual: "X:\\some\\..\\.\\path\\\\file.js",
+ normal: "X:/path/file.js",
+ resolve: {
+ origin: "X:/path/origin.js",
+ expected: "X:/path/file.js"
+ }
+ }, {
+ actual: "some\\..\\.\\path\\\\file.js",
+ normal: "path/file.js",
+ resolve: {
+ origin: "X:/path/origin.js",
+ expected: "X:/path/path/file.js"
+ }
+ }, {
+ actual: "/some/.././path//file.js",
+ normal: "/path/file.js",
+ resolve: {
+ origin: "/path/origin.js",
+ expected: "/path/file.js"
+ }
+ }, {
+ actual: "some/.././path//file.js",
+ normal: "path/file.js",
+ resolve: {
+ origin: "",
+ expected: "path/file.js"
+ }
+ }, {
+ actual: ".././path//file.js",
+ normal: "../path/file.js"
+ }, {
+ actual: "/.././path//file.js",
+ normal: "/path/file.js"
+ }
+ ];
+
+ paths.forEach(function(p) {
+ test.equal(path.normalize(p.actual), p.normal, "should normalize " + p.actual);
+ if (p.resolve) {
+ test.equal(path.resolve(p.resolve.origin, p.actual), p.resolve.expected, "should resolve " + p.actual);
+ test.equal(path.resolve(p.resolve.origin, p.normal, true), p.resolve.expected, "should resolve " + p.normal + " (already normalized)");
+ }
+ });
+
+ test.end();
+});
diff --git a/node_modules/@protobufjs/pool/.npmignore b/node_modules/@protobufjs/pool/.npmignore
new file mode 100644
index 00000000000..c3fc82ecb37
--- /dev/null
+++ b/node_modules/@protobufjs/pool/.npmignore
@@ -0,0 +1,3 @@
+npm-debug.*
+node_modules/
+coverage/
diff --git a/node_modules/@protobufjs/pool/LICENSE b/node_modules/@protobufjs/pool/LICENSE
new file mode 100644
index 00000000000..be2b397e3c3
--- /dev/null
+++ b/node_modules/@protobufjs/pool/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@protobufjs/pool/README.md b/node_modules/@protobufjs/pool/README.md
new file mode 100644
index 00000000000..9fb0e9734d3
--- /dev/null
+++ b/node_modules/@protobufjs/pool/README.md
@@ -0,0 +1,13 @@
+@protobufjs/pool
+================
+[![npm](https://img.shields.io/npm/v/@protobufjs/pool.svg)](https://www.npmjs.com/package/@protobufjs/pool)
+
+A general purpose buffer pool.
+
+API
+---
+
+* **pool(alloc: `function(size: number): Uint8Array`, slice: `function(this: Uint8Array, start: number, end: number): Uint8Array`, [size=8192: `number`]): `function(size: number): Uint8Array`**
+ Creates a pooled allocator.
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/node_modules/@protobufjs/pool/index.d.ts b/node_modules/@protobufjs/pool/index.d.ts
new file mode 100644
index 00000000000..23fe38c5a0e
--- /dev/null
+++ b/node_modules/@protobufjs/pool/index.d.ts
@@ -0,0 +1,32 @@
+export = pool;
+
+/**
+ * An allocator as used by {@link util.pool}.
+ * @typedef PoolAllocator
+ * @type {function}
+ * @param {number} size Buffer size
+ * @returns {Uint8Array} Buffer
+ */
+type PoolAllocator = (size: number) => Uint8Array;
+
+/**
+ * A slicer as used by {@link util.pool}.
+ * @typedef PoolSlicer
+ * @type {function}
+ * @param {number} start Start offset
+ * @param {number} end End offset
+ * @returns {Uint8Array} Buffer slice
+ * @this {Uint8Array}
+ */
+type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array;
+
+/**
+ * A general purpose buffer pool.
+ * @memberof util
+ * @function
+ * @param {PoolAllocator} alloc Allocator
+ * @param {PoolSlicer} slice Slicer
+ * @param {number} [size=8192] Slab size
+ * @returns {PoolAllocator} Pooled allocator
+ */
+declare function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator;
diff --git a/node_modules/@protobufjs/pool/index.js b/node_modules/@protobufjs/pool/index.js
new file mode 100644
index 00000000000..6c666f652b2
--- /dev/null
+++ b/node_modules/@protobufjs/pool/index.js
@@ -0,0 +1,48 @@
+"use strict";
+module.exports = pool;
+
+/**
+ * An allocator as used by {@link util.pool}.
+ * @typedef PoolAllocator
+ * @type {function}
+ * @param {number} size Buffer size
+ * @returns {Uint8Array} Buffer
+ */
+
+/**
+ * A slicer as used by {@link util.pool}.
+ * @typedef PoolSlicer
+ * @type {function}
+ * @param {number} start Start offset
+ * @param {number} end End offset
+ * @returns {Uint8Array} Buffer slice
+ * @this {Uint8Array}
+ */
+
+/**
+ * A general purpose buffer pool.
+ * @memberof util
+ * @function
+ * @param {PoolAllocator} alloc Allocator
+ * @param {PoolSlicer} slice Slicer
+ * @param {number} [size=8192] Slab size
+ * @returns {PoolAllocator} Pooled allocator
+ */
+function pool(alloc, slice, size) {
+ var SIZE = size || 8192;
+ var MAX = SIZE >>> 1;
+ var slab = null;
+ var offset = SIZE;
+ return function pool_alloc(size) {
+ if (size < 1 || size > MAX)
+ return alloc(size);
+ if (offset + size > SIZE) {
+ slab = alloc(SIZE);
+ offset = 0;
+ }
+ var buf = slice.call(slab, offset, offset += size);
+ if (offset & 7) // align to 32 bit
+ offset = (offset | 7) + 1;
+ return buf;
+ };
+}
diff --git a/node_modules/@protobufjs/pool/package.json b/node_modules/@protobufjs/pool/package.json
new file mode 100644
index 00000000000..feb66c62119
--- /dev/null
+++ b/node_modules/@protobufjs/pool/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@protobufjs/pool",
+ "description": "A general purpose buffer pool.",
+ "version": "1.1.0",
+ "author": "Daniel Wirtz ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "devDependencies": {
+ "istanbul": "^0.4.5",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "tape tests/*.js",
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
+ }
+
+,"_resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz"
+,"_integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q="
+,"_from": "@protobufjs/pool@1.1.0"
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/pool/tests/index.js b/node_modules/@protobufjs/pool/tests/index.js
new file mode 100644
index 00000000000..5d1a921fe43
--- /dev/null
+++ b/node_modules/@protobufjs/pool/tests/index.js
@@ -0,0 +1,33 @@
+var tape = require("tape");
+
+var pool = require("..");
+
+if (typeof Uint8Array !== "undefined")
+tape.test("pool", function(test) {
+
+ var alloc = pool(function(size) { return new Uint8Array(size); }, Uint8Array.prototype.subarray);
+
+ var buf1 = alloc(0);
+ test.equal(buf1.length, 0, "should allocate a buffer of size 0");
+
+ var buf2 = alloc(1);
+ test.equal(buf2.length, 1, "should allocate a buffer of size 1 (initializes slab)");
+
+ test.notEqual(buf2.buffer, buf1.buffer, "should not reference the same backing buffer if previous buffer had size 0");
+ test.equal(buf2.byteOffset, 0, "should allocate at byteOffset 0 when using a new slab");
+
+ buf1 = alloc(1);
+ test.equal(buf1.buffer, buf2.buffer, "should reference the same backing buffer when allocating a chunk fitting into the slab");
+ test.equal(buf1.byteOffset, 8, "should align slices to 32 bit and this allocate at byteOffset 8");
+
+ var buf3 = alloc(4097);
+ test.notEqual(buf3.buffer, buf2.buffer, "should not reference the same backing buffer when allocating a buffer larger than half the backing buffer's size");
+
+ buf2 = alloc(4096);
+ test.equal(buf2.buffer, buf1.buffer, "should reference the same backing buffer when allocating a buffer smaller or equal than half the backing buffer's size");
+
+ buf1 = alloc(4096);
+ test.notEqual(buf1.buffer, buf2.buffer, "should not reference the same backing buffer when the slab is exhausted (initializes new slab)");
+
+ test.end();
+});
\ No newline at end of file
diff --git a/node_modules/@protobufjs/utf8/.npmignore b/node_modules/@protobufjs/utf8/.npmignore
new file mode 100644
index 00000000000..c3fc82ecb37
--- /dev/null
+++ b/node_modules/@protobufjs/utf8/.npmignore
@@ -0,0 +1,3 @@
+npm-debug.*
+node_modules/
+coverage/
diff --git a/node_modules/@protobufjs/utf8/LICENSE b/node_modules/@protobufjs/utf8/LICENSE
new file mode 100644
index 00000000000..be2b397e3c3
--- /dev/null
+++ b/node_modules/@protobufjs/utf8/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@protobufjs/utf8/README.md b/node_modules/@protobufjs/utf8/README.md
new file mode 100644
index 00000000000..c936d9b041a
--- /dev/null
+++ b/node_modules/@protobufjs/utf8/README.md
@@ -0,0 +1,20 @@
+@protobufjs/utf8
+================
+[![npm](https://img.shields.io/npm/v/@protobufjs/utf8.svg)](https://www.npmjs.com/package/@protobufjs/utf8)
+
+A minimal UTF8 implementation for number arrays.
+
+API
+---
+
+* **utf8.length(string: `string`): `number`**
+ Calculates the UTF8 byte length of a string.
+
+* **utf8.read(buffer: `Uint8Array`, start: `number`, end: `number`): `string`**
+ Reads UTF8 bytes as a string.
+
+* **utf8.write(string: `string`, buffer: `Uint8Array`, offset: `number`): `number`**
+ Writes a string as UTF8 bytes.
+
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/node_modules/@protobufjs/utf8/index.d.ts b/node_modules/@protobufjs/utf8/index.d.ts
new file mode 100644
index 00000000000..2f1d0ab1cb6
--- /dev/null
+++ b/node_modules/@protobufjs/utf8/index.d.ts
@@ -0,0 +1,24 @@
+/**
+ * Calculates the UTF8 byte length of a string.
+ * @param {string} string String
+ * @returns {number} Byte length
+ */
+export function length(string: string): number;
+
+/**
+ * Reads UTF8 bytes as a string.
+ * @param {Uint8Array} buffer Source buffer
+ * @param {number} start Source start
+ * @param {number} end Source end
+ * @returns {string} String read
+ */
+export function read(buffer: Uint8Array, start: number, end: number): string;
+
+/**
+ * Writes a string as UTF8 bytes.
+ * @param {string} string Source string
+ * @param {Uint8Array} buffer Destination buffer
+ * @param {number} offset Destination offset
+ * @returns {number} Bytes written
+ */
+export function write(string: string, buffer: Uint8Array, offset: number): number;
diff --git a/node_modules/@protobufjs/utf8/index.js b/node_modules/@protobufjs/utf8/index.js
new file mode 100644
index 00000000000..43c529812f9
--- /dev/null
+++ b/node_modules/@protobufjs/utf8/index.js
@@ -0,0 +1,105 @@
+"use strict";
+
+/**
+ * A minimal UTF8 implementation for number arrays.
+ * @memberof util
+ * @namespace
+ */
+var utf8 = exports;
+
+/**
+ * Calculates the UTF8 byte length of a string.
+ * @param {string} string String
+ * @returns {number} Byte length
+ */
+utf8.length = function utf8_length(string) {
+ var len = 0,
+ c = 0;
+ for (var i = 0; i < string.length; ++i) {
+ c = string.charCodeAt(i);
+ if (c < 128)
+ len += 1;
+ else if (c < 2048)
+ len += 2;
+ else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {
+ ++i;
+ len += 4;
+ } else
+ len += 3;
+ }
+ return len;
+};
+
+/**
+ * Reads UTF8 bytes as a string.
+ * @param {Uint8Array} buffer Source buffer
+ * @param {number} start Source start
+ * @param {number} end Source end
+ * @returns {string} String read
+ */
+utf8.read = function utf8_read(buffer, start, end) {
+ var len = end - start;
+ if (len < 1)
+ return "";
+ var parts = null,
+ chunk = [],
+ i = 0, // char offset
+ t; // temporary
+ while (start < end) {
+ t = buffer[start++];
+ if (t < 128)
+ chunk[i++] = t;
+ else if (t > 191 && t < 224)
+ chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
+ else if (t > 239 && t < 365) {
+ t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;
+ chunk[i++] = 0xD800 + (t >> 10);
+ chunk[i++] = 0xDC00 + (t & 1023);
+ } else
+ chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
+ if (i > 8191) {
+ (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
+ i = 0;
+ }
+ }
+ if (parts) {
+ if (i)
+ parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
+ return parts.join("");
+ }
+ return String.fromCharCode.apply(String, chunk.slice(0, i));
+};
+
+/**
+ * Writes a string as UTF8 bytes.
+ * @param {string} string Source string
+ * @param {Uint8Array} buffer Destination buffer
+ * @param {number} offset Destination offset
+ * @returns {number} Bytes written
+ */
+utf8.write = function utf8_write(string, buffer, offset) {
+ var start = offset,
+ c1, // character 1
+ c2; // character 2
+ for (var i = 0; i < string.length; ++i) {
+ c1 = string.charCodeAt(i);
+ if (c1 < 128) {
+ buffer[offset++] = c1;
+ } else if (c1 < 2048) {
+ buffer[offset++] = c1 >> 6 | 192;
+ buffer[offset++] = c1 & 63 | 128;
+ } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
+ c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);
+ ++i;
+ buffer[offset++] = c1 >> 18 | 240;
+ buffer[offset++] = c1 >> 12 & 63 | 128;
+ buffer[offset++] = c1 >> 6 & 63 | 128;
+ buffer[offset++] = c1 & 63 | 128;
+ } else {
+ buffer[offset++] = c1 >> 12 | 224;
+ buffer[offset++] = c1 >> 6 & 63 | 128;
+ buffer[offset++] = c1 & 63 | 128;
+ }
+ }
+ return offset - start;
+};
diff --git a/node_modules/@protobufjs/utf8/package.json b/node_modules/@protobufjs/utf8/package.json
new file mode 100644
index 00000000000..0010eaa7f7c
--- /dev/null
+++ b/node_modules/@protobufjs/utf8/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@protobufjs/utf8",
+ "description": "A minimal UTF8 implementation for number arrays.",
+ "version": "1.1.0",
+ "author": "Daniel Wirtz ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "devDependencies": {
+ "istanbul": "^0.4.5",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "tape tests/*.js",
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
+ }
+
+,"_resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz"
+,"_integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
+,"_from": "@protobufjs/utf8@1.1.0"
+}
\ No newline at end of file
diff --git a/node_modules/@protobufjs/utf8/tests/data/utf8.txt b/node_modules/@protobufjs/utf8/tests/data/utf8.txt
new file mode 100644
index 00000000000..580b4c4e624
--- /dev/null
+++ b/node_modules/@protobufjs/utf8/tests/data/utf8.txt
@@ -0,0 +1,216 @@
+UTF-8 encoded sample plain-text file
+‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
+
+Markus Kuhn [ˈmaʳkʊs kuːn] — 2002-07-25 CC BY
+
+
+The ASCII compatible UTF-8 encoding used in this plain-text file
+is defined in Unicode, ISO 10646-1, and RFC 2279.
+
+
+Using Unicode/UTF-8, you can write in emails and source code things such as
+
+Mathematics and sciences:
+
+ ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ⎧⎡⎛┌─────┐⎞⎤⎫
+ ⎪⎢⎜│a²+b³ ⎟⎥⎪
+ ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), ⎪⎢⎜│───── ⎟⎥⎪
+ ⎪⎢⎜⎷ c₈ ⎟⎥⎪
+ ℕ ⊆ ℕ₀ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ, ⎨⎢⎜ ⎟⎥⎬
+ ⎪⎢⎜ ∞ ⎟⎥⎪
+ ⊥ < a ≠ b ≡ c ≤ d ≪ ⊤ ⇒ (⟦A⟧ ⇔ ⟪B⟫), ⎪⎢⎜ ⎲ ⎟⎥⎪
+ ⎪⎢⎜ ⎳aⁱ-bⁱ⎟⎥⎪
+ 2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm ⎩⎣⎝i=1 ⎠⎦⎭
+
+Linguistics and dictionaries:
+
+ ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn
+ Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ]
+
+APL:
+
+ ((V⍳V)=⍳⍴V)/V←,V ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈
+
+Nicer typography in plain text files:
+
+ ╔══════════════════════════════════════════╗
+ ║ ║
+ ║ • ‘single’ and “double” quotes ║
+ ║ ║
+ ║ • Curly apostrophes: “We’ve been here” ║
+ ║ ║
+ ║ • Latin-1 apostrophe and accents: '´` ║
+ ║ ║
+ ║ • ‚deutsche‘ „Anführungszeichen“ ║
+ ║ ║
+ ║ • †, ‡, ‰, •, 3–4, —, −5/+5, ™, … ║
+ ║ ║
+ ║ • ASCII safety test: 1lI|, 0OD, 8B ║
+ ║ ╭─────────╮ ║
+ ║ • the euro symbol: │ 14.95 € │ ║
+ ║ ╰─────────╯ ║
+ ╚══════════════════════════════════════════╝
+
+Combining characters:
+
+ STARGΛ̊TE SG-1, a = v̇ = r̈, a⃑ ⊥ b⃑
+
+Greek (in Polytonic):
+
+ The Greek anthem:
+
+ Σὲ γνωρίζω ἀπὸ τὴν κόψη
+ τοῦ σπαθιοῦ τὴν τρομερή,
+ σὲ γνωρίζω ἀπὸ τὴν ὄψη
+ ποὺ μὲ βία μετράει τὴ γῆ.
+
+ ᾿Απ᾿ τὰ κόκκαλα βγαλμένη
+ τῶν ῾Ελλήνων τὰ ἱερά
+ καὶ σὰν πρῶτα ἀνδρειωμένη
+ χαῖρε, ὦ χαῖρε, ᾿Ελευθεριά!
+
+ From a speech of Demosthenes in the 4th century BC:
+
+ Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν, ὦ ἄνδρες ᾿Αθηναῖοι,
+ ὅταν τ᾿ εἰς τὰ πράγματα ἀποβλέψω καὶ ὅταν πρὸς τοὺς
+ λόγους οὓς ἀκούω· τοὺς μὲν γὰρ λόγους περὶ τοῦ
+ τιμωρήσασθαι Φίλιππον ὁρῶ γιγνομένους, τὰ δὲ πράγματ᾿
+ εἰς τοῦτο προήκοντα, ὥσθ᾿ ὅπως μὴ πεισόμεθ᾿ αὐτοὶ
+ πρότερον κακῶς σκέψασθαι δέον. οὐδέν οὖν ἄλλο μοι δοκοῦσιν
+ οἱ τὰ τοιαῦτα λέγοντες ἢ τὴν ὑπόθεσιν, περὶ ἧς βουλεύεσθαι,
+ οὐχὶ τὴν οὖσαν παριστάντες ὑμῖν ἁμαρτάνειν. ἐγὼ δέ, ὅτι μέν
+ ποτ᾿ ἐξῆν τῇ πόλει καὶ τὰ αὑτῆς ἔχειν ἀσφαλῶς καὶ Φίλιππον
+ τιμωρήσασθαι, καὶ μάλ᾿ ἀκριβῶς οἶδα· ἐπ᾿ ἐμοῦ γάρ, οὐ πάλαι
+ γέγονεν ταῦτ᾿ ἀμφότερα· νῦν μέντοι πέπεισμαι τοῦθ᾿ ἱκανὸν
+ προλαβεῖν ἡμῖν εἶναι τὴν πρώτην, ὅπως τοὺς συμμάχους
+ σώσομεν. ἐὰν γὰρ τοῦτο βεβαίως ὑπάρξῃ, τότε καὶ περὶ τοῦ
+ τίνα τιμωρήσεταί τις καὶ ὃν τρόπον ἐξέσται σκοπεῖν· πρὶν δὲ
+ τὴν ἀρχὴν ὀρθῶς ὑποθέσθαι, μάταιον ἡγοῦμαι περὶ τῆς
+ τελευτῆς ὁντινοῦν ποιεῖσθαι λόγον.
+
+ Δημοσθένους, Γ´ ᾿Ολυνθιακὸς
+
+Georgian:
+
+ From a Unicode conference invitation:
+
+ გთხოვთ ახლავე გაიაროთ რეგისტრაცია Unicode-ის მეათე საერთაშორისო
+ კონფერენციაზე დასასწრებად, რომელიც გაიმართება 10-12 მარტს,
+ ქ. მაინცში, გერმანიაში. კონფერენცია შეჰკრებს ერთად მსოფლიოს
+ ექსპერტებს ისეთ დარგებში როგორიცაა ინტერნეტი და Unicode-ი,
+ ინტერნაციონალიზაცია და ლოკალიზაცია, Unicode-ის გამოყენება
+ ოპერაციულ სისტემებსა, და გამოყენებით პროგრამებში, შრიფტებში,
+ ტექსტების დამუშავებასა და მრავალენოვან კომპიუტერულ სისტემებში.
+
+Russian:
+
+ From a Unicode conference invitation:
+
+ Зарегистрируйтесь сейчас на Десятую Международную Конференцию по
+ Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии.
+ Конференция соберет широкий круг экспертов по вопросам глобального
+ Интернета и Unicode, локализации и интернационализации, воплощению и
+ применению Unicode в различных операционных системах и программных
+ приложениях, шрифтах, верстке и многоязычных компьютерных системах.
+
+Thai (UCS Level 2):
+
+ Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese
+ classic 'San Gua'):
+
+ [----------------------------|------------------------]
+ ๏ แผ่นดินฮั่นเสื่อมโทรมแสนสังเวช พระปกเกศกองบู๊กู้ขึ้นใหม่
+ สิบสองกษัตริย์ก่อนหน้าแลถัดไป สององค์ไซร้โง่เขลาเบาปัญญา
+ ทรงนับถือขันทีเป็นที่พึ่ง บ้านเมืองจึงวิปริตเป็นนักหนา
+ โฮจิ๋นเรียกทัพทั่วหัวเมืองมา หมายจะฆ่ามดชั่วตัวสำคัญ
+ เหมือนขับไสไล่เสือจากเคหา รับหมาป่าเข้ามาเลยอาสัญ
+ ฝ่ายอ้องอุ้นยุแยกให้แตกกัน ใช้สาวนั้นเป็นชนวนชื่นชวนใจ
+ พลันลิฉุยกุยกีกลับก่อเหตุ ช่างอาเพศจริงหนาฟ้าร้องไห้
+ ต้องรบราฆ่าฟันจนบรรลัย ฤๅหาใครค้ำชูกู้บรรลังก์ ฯ
+
+ (The above is a two-column text. If combining characters are handled
+ correctly, the lines of the second column should be aligned with the
+ | character above.)
+
+Ethiopian:
+
+ Proverbs in the Amharic language:
+
+ ሰማይ አይታረስ ንጉሥ አይከሰስ።
+ ብላ ካለኝ እንደአባቴ በቆመጠኝ።
+ ጌጥ ያለቤቱ ቁምጥና ነው።
+ ደሀ በሕልሙ ቅቤ ባይጠጣ ንጣት በገደለው።
+ የአፍ ወለምታ በቅቤ አይታሽም።
+ አይጥ በበላ ዳዋ ተመታ።
+ ሲተረጉሙ ይደረግሙ።
+ ቀስ በቀስ፥ ዕንቁላል በእግሩ ይሄዳል።
+ ድር ቢያብር አንበሳ ያስር።
+ ሰው እንደቤቱ እንጅ እንደ ጉረቤቱ አይተዳደርም።
+ እግዜር የከፈተውን ጉሮሮ ሳይዘጋው አይድርም።
+ የጎረቤት ሌባ፥ ቢያዩት ይስቅ ባያዩት ያጠልቅ።
+ ሥራ ከመፍታት ልጄን ላፋታት።
+ ዓባይ ማደሪያ የለው፥ ግንድ ይዞ ይዞራል።
+ የእስላም አገሩ መካ የአሞራ አገሩ ዋርካ።
+ ተንጋሎ ቢተፉ ተመልሶ ባፉ።
+ ወዳጅህ ማር ቢሆን ጨርስህ አትላሰው።
+ እግርህን በፍራሽህ ልክ ዘርጋ።
+
+Runes:
+
+ ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ
+
+ (Old English, which transcribed into Latin reads 'He cwaeth that he
+ bude thaem lande northweardum with tha Westsae.' and means 'He said
+ that he lived in the northern land near the Western Sea.')
+
+Braille:
+
+ ⡌⠁⠧⠑ ⠼⠁⠒ ⡍⠜⠇⠑⠹⠰⠎ ⡣⠕⠌
+
+ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠙⠑⠁⠙⠒ ⠞⠕ ⠃⠑⠛⠔ ⠺⠊⠹⠲ ⡹⠻⠑ ⠊⠎ ⠝⠕ ⠙⠳⠃⠞
+ ⠱⠁⠞⠑⠧⠻ ⠁⠃⠳⠞ ⠹⠁⠞⠲ ⡹⠑ ⠗⠑⠛⠊⠌⠻ ⠕⠋ ⠙⠊⠎ ⠃⠥⠗⠊⠁⠇ ⠺⠁⠎
+ ⠎⠊⠛⠝⠫ ⠃⠹ ⠹⠑ ⠊⠇⠻⠛⠹⠍⠁⠝⠂ ⠹⠑ ⠊⠇⠻⠅⠂ ⠹⠑ ⠥⠝⠙⠻⠞⠁⠅⠻⠂
+ ⠁⠝⠙ ⠹⠑ ⠡⠊⠑⠋ ⠍⠳⠗⠝⠻⠲ ⡎⠊⠗⠕⠕⠛⠑ ⠎⠊⠛⠝⠫ ⠊⠞⠲ ⡁⠝⠙
+ ⡎⠊⠗⠕⠕⠛⠑⠰⠎ ⠝⠁⠍⠑ ⠺⠁⠎ ⠛⠕⠕⠙ ⠥⠏⠕⠝ ⠰⡡⠁⠝⠛⠑⠂ ⠋⠕⠗ ⠁⠝⠹⠹⠔⠛ ⠙⠑
+ ⠡⠕⠎⠑ ⠞⠕ ⠏⠥⠞ ⠙⠊⠎ ⠙⠁⠝⠙ ⠞⠕⠲
+
+ ⡕⠇⠙ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
+
+ ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞ ⠍⠑⠁⠝ ⠞⠕ ⠎⠁⠹ ⠹⠁⠞ ⡊ ⠅⠝⠪⠂ ⠕⠋ ⠍⠹
+ ⠪⠝ ⠅⠝⠪⠇⠫⠛⠑⠂ ⠱⠁⠞ ⠹⠻⠑ ⠊⠎ ⠏⠜⠞⠊⠊⠥⠇⠜⠇⠹ ⠙⠑⠁⠙ ⠁⠃⠳⠞
+ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ ⡊ ⠍⠊⠣⠞ ⠙⠁⠧⠑ ⠃⠑⠲ ⠔⠊⠇⠔⠫⠂ ⠍⠹⠎⠑⠇⠋⠂ ⠞⠕
+ ⠗⠑⠛⠜⠙ ⠁ ⠊⠕⠋⠋⠔⠤⠝⠁⠊⠇ ⠁⠎ ⠹⠑ ⠙⠑⠁⠙⠑⠌ ⠏⠊⠑⠊⠑ ⠕⠋ ⠊⠗⠕⠝⠍⠕⠝⠛⠻⠹
+ ⠔ ⠹⠑ ⠞⠗⠁⠙⠑⠲ ⡃⠥⠞ ⠹⠑ ⠺⠊⠎⠙⠕⠍ ⠕⠋ ⠳⠗ ⠁⠝⠊⠑⠌⠕⠗⠎
+ ⠊⠎ ⠔ ⠹⠑ ⠎⠊⠍⠊⠇⠑⠆ ⠁⠝⠙ ⠍⠹ ⠥⠝⠙⠁⠇⠇⠪⠫ ⠙⠁⠝⠙⠎
+ ⠩⠁⠇⠇ ⠝⠕⠞ ⠙⠊⠌⠥⠗⠃ ⠊⠞⠂ ⠕⠗ ⠹⠑ ⡊⠳⠝⠞⠗⠹⠰⠎ ⠙⠕⠝⠑ ⠋⠕⠗⠲ ⡹⠳
+ ⠺⠊⠇⠇ ⠹⠻⠑⠋⠕⠗⠑ ⠏⠻⠍⠊⠞ ⠍⠑ ⠞⠕ ⠗⠑⠏⠑⠁⠞⠂ ⠑⠍⠏⠙⠁⠞⠊⠊⠁⠇⠇⠹⠂ ⠹⠁⠞
+ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
+
+ (The first couple of paragraphs of "A Christmas Carol" by Dickens)
+
+Compact font selection example text:
+
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789
+ abcdefghijklmnopqrstuvwxyz £©µÀÆÖÞßéöÿ
+ –—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд
+ ∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა
+
+Greetings in various languages:
+
+ Hello world, Καλημέρα κόσμε, コンニチハ
+
+Box drawing alignment tests: █
+ ▉
+ ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
+ ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
+ ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
+ ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
+ ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
+ ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
+ ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
+ ▝▀▘▙▄▟
+
+Surrogates:
+
+𠜎 𠜱 𠝹 𠱓 𠱸 𠲖 𠳏 𠳕 𠴕 𠵼 𠵿 𠸎 𠸏 𠹷 𠺝 𠺢 𠻗 𠻹 𠻺 𠼭 𠼮 𠽌 𠾴 𠾼 𠿪 𡁜 𡁯 𡁵 𡁶 𡁻 𡃁
+𡃉 𡇙 𢃇 𢞵 𢫕 𢭃 𢯊 𢱑 𢱕 𢳂 𢴈 𢵌 𢵧 𢺳 𣲷 𤓓 𤶸 𤷪 𥄫 𦉘 𦟌 𦧲 𦧺 𧨾 𨅝 𨈇 𨋢 𨳊 𨳍 𨳒 𩶘
diff --git a/node_modules/@protobufjs/utf8/tests/index.js b/node_modules/@protobufjs/utf8/tests/index.js
new file mode 100644
index 00000000000..16d169e02ea
--- /dev/null
+++ b/node_modules/@protobufjs/utf8/tests/index.js
@@ -0,0 +1,57 @@
+var tape = require("tape");
+
+var utf8 = require("..");
+
+var data = require("fs").readFileSync(require.resolve("./data/utf8.txt")),
+ dataStr = data.toString("utf8");
+
+tape.test("utf8", function(test) {
+
+ test.test(test.name + " - length", function(test) {
+ test.equal(utf8.length(""), 0, "should return a byte length of zero for an empty string");
+
+ test.equal(utf8.length(dataStr), Buffer.byteLength(dataStr), "should return the same byte length as node buffers");
+
+ test.end();
+ });
+
+ test.test(test.name + " - read", function(test) {
+ var comp = utf8.read([], 0, 0);
+ test.equal(comp, "", "should decode an empty buffer to an empty string");
+
+ comp = utf8.read(data, 0, data.length);
+ test.equal(comp, data.toString("utf8"), "should decode to the same byte data as node buffers");
+
+ var longData = Buffer.concat([data, data, data, data]);
+ comp = utf8.read(longData, 0, longData.length);
+ test.equal(comp, longData.toString("utf8"), "should decode to the same byte data as node buffers (long)");
+
+ var chunkData = new Buffer(data.toString("utf8").substring(0, 8192));
+ comp = utf8.read(chunkData, 0, chunkData.length);
+ test.equal(comp, chunkData.toString("utf8"), "should decode to the same byte data as node buffers (chunk size)");
+
+ test.end();
+ });
+
+ test.test(test.name + " - write", function(test) {
+ var buf = new Buffer(0);
+ test.equal(utf8.write("", buf, 0), 0, "should encode an empty string to an empty buffer");
+
+ var len = utf8.length(dataStr);
+ buf = new Buffer(len);
+ test.equal(utf8.write(dataStr, buf, 0), len, "should encode to exactly " + len + " bytes");
+
+ test.equal(buf.length, data.length, "should encode to a buffer length equal to that of node buffers");
+
+ for (var i = 0; i < buf.length; ++i) {
+ if (buf[i] !== data[i]) {
+ test.fail("should encode to the same buffer data as node buffers (offset " + i + ")");
+ return;
+ }
+ }
+ test.pass("should encode to the same buffer data as node buffers");
+
+ test.end();
+ });
+
+});
diff --git a/node_modules/@types/long/LICENSE b/node_modules/@types/long/LICENSE
new file mode 100644
index 00000000000..21071075c24
--- /dev/null
+++ b/node_modules/@types/long/LICENSE
@@ -0,0 +1,21 @@
+ MIT License
+
+ Copyright (c) Microsoft Corporation. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE
diff --git a/node_modules/@types/long/README.md b/node_modules/@types/long/README.md
new file mode 100644
index 00000000000..df7297cb714
--- /dev/null
+++ b/node_modules/@types/long/README.md
@@ -0,0 +1,16 @@
+# Installation
+> `npm install --save @types/long`
+
+# Summary
+This package contains type definitions for long.js (https://github.com/dcodeIO/long.js).
+
+# Details
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/long.
+
+### Additional Details
+ * Last updated: Wed, 22 Jan 2020 19:19:46 GMT
+ * Dependencies: none
+ * Global values: `Long`
+
+# Credits
+These definitions were written by Peter Kooijmans (https://github.com/peterkooijmans).
diff --git a/node_modules/@types/long/index.d.ts b/node_modules/@types/long/index.d.ts
new file mode 100644
index 00000000000..39f8ab508ee
--- /dev/null
+++ b/node_modules/@types/long/index.d.ts
@@ -0,0 +1,389 @@
+// Type definitions for long.js 4.0.0
+// Project: https://github.com/dcodeIO/long.js
+// Definitions by: Peter Kooijmans
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// Definitions by: Denis Cappellin
+
+export = Long;
+export as namespace Long;
+
+declare const Long: Long.LongConstructor;
+type Long = Long.Long;
+declare namespace Long {
+ interface LongConstructor {
+ /**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs.
+ */
+ new( low: number, high?: number, unsigned?: boolean ): Long;
+ prototype: Long;
+ /**
+ * Maximum unsigned value.
+ */
+ MAX_UNSIGNED_VALUE: Long;
+
+ /**
+ * Maximum signed value.
+ */
+ MAX_VALUE: Long;
+
+ /**
+ * Minimum signed value.
+ */
+ MIN_VALUE: Long;
+
+ /**
+ * Signed negative one.
+ */
+ NEG_ONE: Long;
+
+ /**
+ * Signed one.
+ */
+ ONE: Long;
+
+ /**
+ * Unsigned one.
+ */
+ UONE: Long;
+
+ /**
+ * Unsigned zero.
+ */
+ UZERO: Long;
+
+ /**
+ * Signed zero
+ */
+ ZERO: Long;
+
+ /**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
+ */
+ fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long;
+
+ /**
+ * Returns a Long representing the given 32 bit integer value.
+ */
+ fromInt( value: number, unsigned?: boolean ): Long;
+
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ */
+ fromNumber( value: number, unsigned?: boolean ): Long;
+
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ */
+ fromString( str: string, unsigned?: boolean | number, radix?: number ): Long;
+
+ /**
+ * Creates a Long from its byte representation.
+ */
+ fromBytes( bytes: number[], unsigned?: boolean, le?: boolean ): Long;
+
+ /**
+ * Creates a Long from its little endian byte representation.
+ */
+ fromBytesLE( bytes: number[], unsigned?: boolean ): Long;
+
+ /**
+ * Creates a Long from its little endian byte representation.
+ */
+ fromBytesBE( bytes: number[], unsigned?: boolean ): Long;
+
+ /**
+ * Tests if the specified object is a Long.
+ */
+ isLong( obj: any ): obj is Long;
+
+ /**
+ * Converts the specified value to a Long.
+ */
+ fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long;
+ }
+ interface Long
+ {
+ /**
+ * The high 32 bits as a signed value.
+ */
+ high: number;
+
+ /**
+ * The low 32 bits as a signed value.
+ */
+ low: number;
+
+ /**
+ * Whether unsigned or not.
+ */
+ unsigned: boolean;
+
+ /**
+ * Returns the sum of this and the specified Long.
+ */
+ add( addend: number | Long | string ): Long;
+
+ /**
+ * Returns the bitwise AND of this Long and the specified.
+ */
+ and( other: Long | number | string ): Long;
+
+ /**
+ * Compares this Long's value with the specified's.
+ */
+ compare( other: Long | number | string ): number;
+
+ /**
+ * Compares this Long's value with the specified's.
+ */
+ comp( other: Long | number | string ): number;
+
+ /**
+ * Returns this Long divided by the specified.
+ */
+ divide( divisor: Long | number | string ): Long;
+
+ /**
+ * Returns this Long divided by the specified.
+ */
+ div( divisor: Long | number | string ): Long;
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ */
+ equals( other: Long | number | string ): boolean;
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ */
+ eq( other: Long | number | string ): boolean;
+
+ /**
+ * Gets the high 32 bits as a signed integer.
+ */
+ getHighBits(): number;
+
+ /**
+ * Gets the high 32 bits as an unsigned integer.
+ */
+ getHighBitsUnsigned(): number;
+
+ /**
+ * Gets the low 32 bits as a signed integer.
+ */
+ getLowBits(): number;
+
+ /**
+ * Gets the low 32 bits as an unsigned integer.
+ */
+ getLowBitsUnsigned(): number;
+
+ /**
+ * Gets the number of bits needed to represent the absolute value of this Long.
+ */
+ getNumBitsAbs(): number;
+
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ */
+ greaterThan( other: Long | number | string ): boolean;
+
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ */
+ gt( other: Long | number | string ): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ greaterThanOrEqual( other: Long | number | string ): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ gte( other: Long | number | string ): boolean;
+
+ /**
+ * Tests if this Long's value is even.
+ */
+ isEven(): boolean;
+
+ /**
+ * Tests if this Long's value is negative.
+ */
+ isNegative(): boolean;
+
+ /**
+ * Tests if this Long's value is odd.
+ */
+ isOdd(): boolean;
+
+ /**
+ * Tests if this Long's value is positive.
+ */
+ isPositive(): boolean;
+
+ /**
+ * Tests if this Long's value equals zero.
+ */
+ isZero(): boolean;
+
+ /**
+ * Tests if this Long's value is less than the specified's.
+ */
+ lessThan( other: Long | number | string ): boolean;
+
+ /**
+ * Tests if this Long's value is less than the specified's.
+ */
+ lt( other: Long | number | string ): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ lessThanOrEqual( other: Long | number | string ): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ lte( other: Long | number | string ): boolean;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ modulo( other: Long | number | string ): Long;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ mod( other: Long | number | string ): Long;
+
+ /**
+ * Returns the product of this and the specified Long.
+ */
+ multiply( multiplier: Long | number | string ): Long;
+
+ /**
+ * Returns the product of this and the specified Long.
+ */
+ mul( multiplier: Long | number | string ): Long;
+
+ /**
+ * Negates this Long's value.
+ */
+ negate(): Long;
+
+ /**
+ * Negates this Long's value.
+ */
+ neg(): Long;
+
+ /**
+ * Returns the bitwise NOT of this Long.
+ */
+ not(): Long;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ notEquals( other: Long | number | string ): boolean;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ neq( other: Long | number | string ): boolean;
+
+ /**
+ * Returns the bitwise OR of this Long and the specified.
+ */
+ or( other: Long | number | string ): Long;
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ */
+ shiftLeft( numBits: number | Long ): Long;
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ */
+ shl( numBits: number | Long ): Long;
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ */
+ shiftRight( numBits: number | Long ): Long;
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ */
+ shr( numBits: number | Long ): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shiftRightUnsigned( numBits: number | Long ): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shru( numBits: number | Long ): Long;
+
+ /**
+ * Returns the difference of this and the specified Long.
+ */
+ subtract( subtrahend: number | Long | string ): Long;
+
+ /**
+ * Returns the difference of this and the specified Long.
+ */
+ sub( subtrahend: number | Long |string ): Long;
+
+ /**
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+ */
+ toInt(): number;
+
+ /**
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+ */
+ toNumber(): number;
+
+ /**
+ * Converts this Long to its byte representation.
+ */
+
+ toBytes( le?: boolean ): number[];
+
+ /**
+ * Converts this Long to its little endian byte representation.
+ */
+
+ toBytesLE(): number[];
+
+ /**
+ * Converts this Long to its big endian byte representation.
+ */
+
+ toBytesBE(): number[];
+
+ /**
+ * Converts this Long to signed.
+ */
+ toSigned(): Long;
+
+ /**
+ * Converts the Long to a string written in the specified radix.
+ */
+ toString( radix?: number ): string;
+
+ /**
+ * Converts this Long to unsigned.
+ */
+ toUnsigned(): Long;
+
+ /**
+ * Returns the bitwise XOR of this Long and the given one.
+ */
+ xor( other: Long | number | string ): Long;
+ }
+}
diff --git a/node_modules/@types/long/package.json b/node_modules/@types/long/package.json
new file mode 100644
index 00000000000..78dd5c42fe0
--- /dev/null
+++ b/node_modules/@types/long/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "@types/long",
+ "version": "4.0.1",
+ "description": "TypeScript definitions for long.js",
+ "license": "MIT",
+ "contributors": [
+ {
+ "name": "Peter Kooijmans",
+ "url": "https://github.com/peterkooijmans",
+ "githubUsername": "peterkooijmans"
+ }
+ ],
+ "main": "",
+ "types": "index.d.ts",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
+ "directory": "types/long"
+ },
+ "scripts": {},
+ "dependencies": {},
+ "typesPublisherContentHash": "5a2ae1424989c49d7303e1f5cc510288bfab1e71e0e2143cdcb9d24ff1c3dc8e",
+ "typeScriptVersion": "2.8"
+
+,"_resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz"
+,"_integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w=="
+,"_from": "@types/long@4.0.1"
+}
\ No newline at end of file
diff --git a/node_modules/@types/node/LICENSE b/node_modules/@types/node/LICENSE
new file mode 100644
index 00000000000..21071075c24
--- /dev/null
+++ b/node_modules/@types/node/LICENSE
@@ -0,0 +1,21 @@
+ MIT License
+
+ Copyright (c) Microsoft Corporation. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE
diff --git a/node_modules/@types/node/README.md b/node_modules/@types/node/README.md
new file mode 100644
index 00000000000..83121185bbe
--- /dev/null
+++ b/node_modules/@types/node/README.md
@@ -0,0 +1,16 @@
+# Installation
+> `npm install --save @types/node`
+
+# Summary
+This package contains type definitions for Node.js (http://nodejs.org/).
+
+# Details
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v10.
+
+### Additional Details
+ * Last updated: Fri, 28 Feb 2020 18:57:47 GMT
+ * Dependencies: none
+ * Global values: `Buffer`, `NodeJS`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `require`, `setImmediate`, `setInterval`, `setTimeout`
+
+# Credits
+These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alexander T.](https://github.com/a-tarasyuk), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [Christian Vaagland Tellnes](https://github.com/tellnes), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Flarna](https://github.com/Flarna), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nicolas Voigt](https://github.com/octo-sniffle), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Zane Hannan AU](https://github.com/ZaneHannanAU), [Jeremie Rodriguez](https://github.com/jeremiergz), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Jordi Oliveras Rovira](https://github.com/j-oliveras), [Thanik Bhongbhibhat](https://github.com/bhongy), [Minh Son Nguyen](https://github.com/nguymin4), and [ExE Boss](https://github.com/ExE-Boss).
diff --git a/node_modules/@types/node/assert.d.ts b/node_modules/@types/node/assert.d.ts
new file mode 100644
index 00000000000..d73353c5d80
--- /dev/null
+++ b/node_modules/@types/node/assert.d.ts
@@ -0,0 +1,52 @@
+declare module "assert" {
+ function internal(value: any, message?: string | Error): void;
+ namespace internal {
+ class AssertionError implements Error {
+ name: string;
+ message: string;
+ actual: any;
+ expected: any;
+ operator: string;
+ generatedMessage: boolean;
+ code: 'ERR_ASSERTION';
+
+ constructor(options?: {
+ message?: string; actual?: any; expected?: any;
+ operator?: string; stackStartFn?: Function
+ });
+ }
+
+ function fail(message?: string | Error): never;
+ /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
+ function fail(actual: any, expected: any, message?: string | Error, operator?: string, stackStartFn?: Function): never;
+ function ok(value: any, message?: string | Error): void;
+ /** @deprecated since v9.9.0 - use strictEqual() instead. */
+ function equal(actual: any, expected: any, message?: string | Error): void;
+ /** @deprecated since v9.9.0 - use notStrictEqual() instead. */
+ function notEqual(actual: any, expected: any, message?: string | Error): void;
+ /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
+ function deepEqual(actual: any, expected: any, message?: string | Error): void;
+ /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
+ function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
+ function strictEqual(actual: any, expected: any, message?: string | Error): void;
+ function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
+ function deepStrictEqual(actual: any, expected: any, message?: string | Error): void;
+ function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
+
+ function throws(block: Function, message?: string | Error): void;
+ function throws(block: Function, error: RegExp | Function | Object | Error, message?: string | Error): void;
+ function doesNotThrow(block: Function, message?: string | Error): void;
+ function doesNotThrow(block: Function, error: RegExp | Function, message?: string | Error): void;
+
+ function ifError(value: any): void;
+
+ function rejects(block: Function | Promise, message?: string | Error): Promise;
+ function rejects(block: Function | Promise, error: RegExp | Function | Object | Error, message?: string | Error): Promise;
+ function doesNotReject(block: Function | Promise, message?: string | Error): Promise;
+ function doesNotReject(block: Function | Promise, error: RegExp | Function, message?: string | Error): Promise;
+
+ const strict: typeof internal;
+ }
+
+ export = internal;
+}
diff --git a/node_modules/@types/node/async_hooks.d.ts b/node_modules/@types/node/async_hooks.d.ts
new file mode 100644
index 00000000000..2c77932ecd7
--- /dev/null
+++ b/node_modules/@types/node/async_hooks.d.ts
@@ -0,0 +1,144 @@
+/**
+ * Async Hooks module: https://nodejs.org/api/async_hooks.html
+ */
+declare module "async_hooks" {
+ /**
+ * Returns the asyncId of the current execution context.
+ */
+ function executionAsyncId(): number;
+
+ /**
+ * Returns the ID of the resource responsible for calling the callback that is currently being executed.
+ */
+ function triggerAsyncId(): number;
+
+ interface HookCallbacks {
+ /**
+ * Called when a class is constructed that has the possibility to emit an asynchronous event.
+ * @param asyncId a unique ID for the async resource
+ * @param type the type of the async resource
+ * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
+ * @param resource reference to the resource representing the async operation, needs to be released during destroy
+ */
+ init?(asyncId: number, type: string, triggerAsyncId: number, resource: Object): void;
+
+ /**
+ * When an asynchronous operation is initiated or completes a callback is called to notify the user.
+ * The before callback is called just before said callback is executed.
+ * @param asyncId the unique identifier assigned to the resource about to execute the callback.
+ */
+ before?(asyncId: number): void;
+
+ /**
+ * Called immediately after the callback specified in before is completed.
+ * @param asyncId the unique identifier assigned to the resource which has executed the callback.
+ */
+ after?(asyncId: number): void;
+
+ /**
+ * Called when a promise has resolve() called. This may not be in the same execution id
+ * as the promise itself.
+ * @param asyncId the unique id for the promise that was resolve()d.
+ */
+ promiseResolve?(asyncId: number): void;
+
+ /**
+ * Called after the resource corresponding to asyncId is destroyed
+ * @param asyncId a unique ID for the async resource
+ */
+ destroy?(asyncId: number): void;
+ }
+
+ interface AsyncHook {
+ /**
+ * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
+ */
+ enable(): this;
+
+ /**
+ * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
+ */
+ disable(): this;
+ }
+
+ /**
+ * Registers functions to be called for different lifetime events of each async operation.
+ * @param options the callbacks to register
+ * @return an AsyncHooks instance used for disabling and enabling hooks
+ */
+ function createHook(options: HookCallbacks): AsyncHook;
+
+ interface AsyncResourceOptions {
+ /**
+ * The ID of the execution context that created this async event.
+ * Default: `executionAsyncId()`
+ */
+ triggerAsyncId?: number;
+
+ /**
+ * Disables automatic `emitDestroy` when the object is garbage collected.
+ * This usually does not need to be set (even if `emitDestroy` is called
+ * manually), unless the resource's `asyncId` is retrieved and the
+ * sensitive API's `emitDestroy` is called with it.
+ * Default: `false`
+ */
+ requireManualDestroy?: boolean;
+ }
+
+ /**
+ * The class AsyncResource was designed to be extended by the embedder's async resources.
+ * Using this users can easily trigger the lifetime events of their own resources.
+ */
+ class AsyncResource {
+ /**
+ * AsyncResource() is meant to be extended. Instantiating a
+ * new AsyncResource() also triggers init. If triggerAsyncId is omitted then
+ * async_hook.executionAsyncId() is used.
+ * @param type The type of async event.
+ * @param triggerAsyncId The ID of the execution context that created
+ * this async event (default: `executionAsyncId()`), or an
+ * AsyncResourceOptions object (since 9.3)
+ */
+ constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions);
+
+ /**
+ * Call AsyncHooks before callbacks.
+ * @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead.
+ */
+ emitBefore(): void;
+
+ /**
+ * Call AsyncHooks after callbacks.
+ * @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead.
+ */
+ emitAfter(): void;
+
+ /**
+ * Call the provided function with the provided arguments in the
+ * execution context of the async resource. This will establish the
+ * context, trigger the AsyncHooks before callbacks, call the function,
+ * trigger the AsyncHooks after callbacks, and then restore the original
+ * execution context.
+ * @param fn The function to call in the execution context of this
+ * async resource.
+ * @param thisArg The receiver to be used for the function call.
+ * @param args Optional arguments to pass to the function.
+ */
+ runInAsyncScope(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
+
+ /**
+ * Call AsyncHooks destroy callbacks.
+ */
+ emitDestroy(): void;
+
+ /**
+ * @return the unique ID assigned to this AsyncResource instance.
+ */
+ asyncId(): number;
+
+ /**
+ * @return the trigger ID for this AsyncResource instance.
+ */
+ triggerAsyncId(): number;
+ }
+}
diff --git a/node_modules/@types/node/base.d.ts b/node_modules/@types/node/base.d.ts
new file mode 100644
index 00000000000..70983d95159
--- /dev/null
+++ b/node_modules/@types/node/base.d.ts
@@ -0,0 +1,41 @@
+// base definnitions for all NodeJS modules that are not specific to any version of TypeScript
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
diff --git a/node_modules/@types/node/buffer.d.ts b/node_modules/@types/node/buffer.d.ts
new file mode 100644
index 00000000000..0fe668b17d7
--- /dev/null
+++ b/node_modules/@types/node/buffer.d.ts
@@ -0,0 +1,16 @@
+declare module "buffer" {
+ export const INSPECT_MAX_BYTES: number;
+ const BuffType: typeof Buffer;
+
+ export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary";
+
+ export function transcode(source: Buffer | Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
+
+ export const SlowBuffer: {
+ /** @deprecated since v6.0.0, use Buffer.allocUnsafeSlow() */
+ new(size: number): Buffer;
+ prototype: Buffer;
+ };
+
+ export { BuffType as Buffer };
+}
diff --git a/node_modules/@types/node/child_process.d.ts b/node_modules/@types/node/child_process.d.ts
new file mode 100644
index 00000000000..fff2c902ebb
--- /dev/null
+++ b/node_modules/@types/node/child_process.d.ts
@@ -0,0 +1,366 @@
+declare module "child_process" {
+ import * as events from "events";
+ import * as stream from "stream";
+ import * as net from "net";
+
+ interface ChildProcess extends events.EventEmitter {
+ stdin: stream.Writable;
+ stdout: stream.Readable;
+ stderr: stream.Readable;
+ readonly channel?: stream.Pipe | null;
+ stdio: [stream.Writable, stream.Readable, stream.Readable];
+ killed: boolean;
+ pid: number;
+ kill(signal?: string): void;
+ send(message: any, callback?: (error: Error) => void): boolean;
+ send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error) => void): boolean;
+ send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error) => void): boolean;
+ connected: boolean;
+ disconnect(): void;
+ unref(): void;
+ ref(): void;
+
+ /**
+ * events.EventEmitter
+ * 1. close
+ * 2. disconnect
+ * 3. error
+ * 4. exit
+ * 5. message
+ */
+
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ addListener(event: "close", listener: (code: number, signal: string) => void): this;
+ addListener(event: "disconnect", listener: () => void): this;
+ addListener(event: "error", listener: (err: Error) => void): this;
+ addListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this;
+ addListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
+
+ emit(event: string | symbol, ...args: any[]): boolean;
+ emit(event: "close", code: number, signal: string): boolean;
+ emit(event: "disconnect"): boolean;
+ emit(event: "error", err: Error): boolean;
+ emit(event: "exit", code: number | null, signal: string | null): boolean;
+ emit(event: "message", message: any, sendHandle: net.Socket | net.Server): boolean;
+
+ on(event: string, listener: (...args: any[]) => void): this;
+ on(event: "close", listener: (code: number, signal: string) => void): this;
+ on(event: "disconnect", listener: () => void): this;
+ on(event: "error", listener: (err: Error) => void): this;
+ on(event: "exit", listener: (code: number | null, signal: string | null) => void): this;
+ on(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
+
+ once(event: string, listener: (...args: any[]) => void): this;
+ once(event: "close", listener: (code: number, signal: string) => void): this;
+ once(event: "disconnect", listener: () => void): this;
+ once(event: "error", listener: (err: Error) => void): this;
+ once(event: "exit", listener: (code: number | null, signal: string | null) => void): this;
+ once(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
+
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "close", listener: (code: number, signal: string) => void): this;
+ prependListener(event: "disconnect", listener: () => void): this;
+ prependListener(event: "error", listener: (err: Error) => void): this;
+ prependListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this;
+ prependListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
+
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "close", listener: (code: number, signal: string) => void): this;
+ prependOnceListener(event: "disconnect", listener: () => void): this;
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
+ prependOnceListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this;
+ prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
+ }
+
+ interface MessageOptions {
+ keepOpen?: boolean;
+ }
+
+ type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | stream.Stream | number | null | undefined)>;
+
+ interface SpawnOptions {
+ cwd?: string;
+ env?: NodeJS.ProcessEnv;
+ argv0?: string;
+ stdio?: StdioOptions;
+ detached?: boolean;
+ uid?: number;
+ gid?: number;
+ shell?: boolean | string;
+ windowsVerbatimArguments?: boolean;
+ windowsHide?: boolean;
+ }
+
+ function spawn(command: string, options?: SpawnOptions): ChildProcess;
+ function spawn(command: string, args?: ReadonlyArray, options?: SpawnOptions): ChildProcess;
+
+ interface ExecOptions {
+ cwd?: string;
+ env?: NodeJS.ProcessEnv;
+ shell?: string;
+ timeout?: number;
+ maxBuffer?: number;
+ killSignal?: string;
+ uid?: number;
+ gid?: number;
+ windowsHide?: boolean;
+ }
+
+ interface ExecOptionsWithStringEncoding extends ExecOptions {
+ encoding: BufferEncoding;
+ }
+
+ interface ExecOptionsWithBufferEncoding extends ExecOptions {
+ encoding: string | null; // specify `null`.
+ }
+
+ interface ExecException extends Error {
+ cmd?: string;
+ killed?: boolean;
+ code?: number;
+ signal?: string;
+ }
+
+ // no `options` definitely means stdout/stderr are `string`.
+ function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
+
+ // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
+ function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
+
+ // `options` with well known `encoding` means stdout/stderr are definitely `string`.
+ function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
+
+ // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
+ // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
+ function exec(command: string, options: { encoding: string } & ExecOptions, callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess;
+
+ // `options` without an `encoding` means stdout/stderr are definitely `string`.
+ function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
+
+ // fallback if nothing else matches. Worst case is always `string | Buffer`.
+ function exec(
+ command: string,
+ options: ({ encoding?: string | null } & ExecOptions) | undefined | null,
+ callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
+ ): ChildProcess;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace exec {
+ function __promisify__(command: string): Promise<{ stdout: string, stderr: string }>;
+ function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): Promise<{ stdout: Buffer, stderr: Buffer }>;
+ function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<{ stdout: string, stderr: string }>;
+ function __promisify__(command: string, options: ExecOptions): Promise<{ stdout: string, stderr: string }>;
+ function __promisify__(command: string, options?: ({ encoding?: string | null } & ExecOptions) | null): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
+ }
+
+ interface ExecFileOptions {
+ cwd?: string;
+ env?: NodeJS.ProcessEnv;
+ timeout?: number;
+ maxBuffer?: number;
+ killSignal?: string;
+ uid?: number;
+ gid?: number;
+ windowsHide?: boolean;
+ windowsVerbatimArguments?: boolean;
+ shell?: boolean | string;
+ }
+ interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
+ encoding: BufferEncoding;
+ }
+ interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
+ encoding: 'buffer' | null;
+ }
+ interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
+ encoding: string;
+ }
+
+ function execFile(file: string): ChildProcess;
+ function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
+ function execFile(file: string, args?: ReadonlyArray | null): ChildProcess;
+ function execFile(file: string, args: ReadonlyArray | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
+
+ // no `options` definitely means stdout/stderr are `string`.
+ function execFile(file: string, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
+ function execFile(file: string, args: ReadonlyArray | undefined | null, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
+
+ // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
+ function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
+ function execFile(
+ file: string,
+ args: ReadonlyArray | undefined | null,
+ options: ExecFileOptionsWithBufferEncoding,
+ callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
+ ): ChildProcess;
+
+ // `options` with well known `encoding` means stdout/stderr are definitely `string`.
+ function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
+ function execFile(
+ file: string,
+ args: ReadonlyArray | undefined | null,
+ options: ExecFileOptionsWithStringEncoding,
+ callback: (error: ExecException | null, stdout: string, stderr: string) => void,
+ ): ChildProcess;
+
+ // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
+ // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
+ function execFile(
+ file: string,
+ options: ExecFileOptionsWithOtherEncoding,
+ callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
+ ): ChildProcess;
+ function execFile(
+ file: string,
+ args: ReadonlyArray | undefined | null,
+ options: ExecFileOptionsWithOtherEncoding,
+ callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
+ ): ChildProcess;
+
+ // `options` without an `encoding` means stdout/stderr are definitely `string`.
+ function execFile(file: string, options: ExecFileOptions, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
+ function execFile(
+ file: string,
+ args: ReadonlyArray | undefined | null,
+ options: ExecFileOptions,
+ callback: (error: ExecException | null, stdout: string, stderr: string) => void
+ ): ChildProcess;
+
+ // fallback if nothing else matches. Worst case is always `string | Buffer`.
+ function execFile(
+ file: string,
+ options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
+ callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
+ ): ChildProcess;
+ function execFile(
+ file: string,
+ args: ReadonlyArray | undefined | null,
+ options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
+ callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
+ ): ChildProcess;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace execFile {
+ function __promisify__(file: string): Promise<{ stdout: string, stderr: string }>;
+ function __promisify__(file: string, args: string[] | undefined | null): Promise<{ stdout: string, stderr: string }>;
+ function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): Promise<{ stdout: Buffer, stderr: Buffer }>;
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding): Promise<{ stdout: Buffer, stderr: Buffer }>;
+ function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): Promise<{ stdout: string, stderr: string }>;
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding): Promise<{ stdout: string, stderr: string }>;
+ function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
+ function __promisify__(file: string, options: ExecFileOptions): Promise<{ stdout: string, stderr: string }>;
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptions): Promise<{ stdout: string, stderr: string }>;
+ function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
+ function __promisify__(
+ file: string,
+ args: string[] | undefined | null,
+ options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
+ ): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
+ }
+
+ interface ForkOptions {
+ cwd?: string;
+ env?: NodeJS.ProcessEnv;
+ execPath?: string;
+ execArgv?: string[];
+ silent?: boolean;
+ stdio?: StdioOptions;
+ detached?: boolean;
+ windowsVerbatimArguments?: boolean;
+ uid?: number;
+ gid?: number;
+ }
+ function fork(modulePath: string, args?: ReadonlyArray, options?: ForkOptions): ChildProcess;
+
+ interface SpawnSyncOptions {
+ argv0?: string; // Not specified in the docs
+ cwd?: string;
+ input?: string | Buffer | NodeJS.TypedArray | DataView;
+ stdio?: StdioOptions;
+ env?: NodeJS.ProcessEnv;
+ uid?: number;
+ gid?: number;
+ timeout?: number;
+ killSignal?: string | number;
+ maxBuffer?: number;
+ encoding?: string;
+ shell?: boolean | string;
+ windowsVerbatimArguments?: boolean;
+ windowsHide?: boolean;
+ }
+ interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
+ encoding: BufferEncoding;
+ }
+ interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
+ encoding: string; // specify `null`.
+ }
+ interface SpawnSyncReturns {
+ pid: number;
+ output: string[];
+ stdout: T;
+ stderr: T;
+ status: number | null;
+ signal: string | null;
+ error?: Error;
+ }
+ function spawnSync(command: string): SpawnSyncReturns;
+ function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns;
+ function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns;
+ function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns;
+ function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns;
+ function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns;
+ function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptions): SpawnSyncReturns;
+
+ interface ExecSyncOptions {
+ cwd?: string;
+ input?: string | Buffer | Uint8Array;
+ stdio?: StdioOptions;
+ env?: NodeJS.ProcessEnv;
+ shell?: string;
+ uid?: number;
+ gid?: number;
+ timeout?: number;
+ killSignal?: string | number;
+ maxBuffer?: number;
+ encoding?: string;
+ windowsHide?: boolean;
+ }
+ interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
+ encoding: BufferEncoding;
+ }
+ interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
+ encoding: string; // specify `null`.
+ }
+ function execSync(command: string): Buffer;
+ function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
+ function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer;
+ function execSync(command: string, options?: ExecSyncOptions): Buffer;
+
+ interface ExecFileSyncOptions {
+ cwd?: string;
+ input?: string | Buffer | NodeJS.TypedArray | DataView;
+ stdio?: StdioOptions;
+ env?: NodeJS.ProcessEnv;
+ uid?: number;
+ gid?: number;
+ timeout?: number;
+ killSignal?: string | number;
+ maxBuffer?: number;
+ encoding?: string;
+ windowsHide?: boolean;
+ shell?: boolean | string;
+ }
+ interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
+ encoding: BufferEncoding;
+ }
+ interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
+ encoding: string; // specify `null`.
+ }
+ function execFileSync(command: string): Buffer;
+ function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
+ function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
+ function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer;
+ function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithStringEncoding): string;
+ function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
+ function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptions): Buffer;
+}
diff --git a/node_modules/@types/node/cluster.d.ts b/node_modules/@types/node/cluster.d.ts
new file mode 100644
index 00000000000..f089a41ebb4
--- /dev/null
+++ b/node_modules/@types/node/cluster.d.ts
@@ -0,0 +1,260 @@
+declare module "cluster" {
+ import * as child from "child_process";
+ import * as events from "events";
+ import * as net from "net";
+
+ // interfaces
+ interface ClusterSettings {
+ execArgv?: string[]; // default: process.execArgv
+ exec?: string;
+ args?: string[];
+ silent?: boolean;
+ stdio?: any[];
+ uid?: number;
+ gid?: number;
+ inspectPort?: number | (() => number);
+ }
+
+ interface Address {
+ address: string;
+ port: number;
+ addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6"
+ }
+
+ class Worker extends events.EventEmitter {
+ id: number;
+ process: child.ChildProcess;
+ send(message: any, sendHandle?: any, callback?: (error: Error) => void): boolean;
+ kill(signal?: string): void;
+ destroy(signal?: string): void;
+ disconnect(): void;
+ isConnected(): boolean;
+ isDead(): boolean;
+ exitedAfterDisconnect: boolean;
+
+ /**
+ * events.EventEmitter
+ * 1. disconnect
+ * 2. error
+ * 3. exit
+ * 4. listening
+ * 5. message
+ * 6. online
+ */
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ addListener(event: "disconnect", listener: () => void): this;
+ addListener(event: "error", listener: (error: Error) => void): this;
+ addListener(event: "exit", listener: (code: number, signal: string) => void): this;
+ addListener(event: "listening", listener: (address: Address) => void): this;
+ addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ addListener(event: "online", listener: () => void): this;
+
+ emit(event: string | symbol, ...args: any[]): boolean;
+ emit(event: "disconnect"): boolean;
+ emit(event: "error", error: Error): boolean;
+ emit(event: "exit", code: number, signal: string): boolean;
+ emit(event: "listening", address: Address): boolean;
+ emit(event: "message", message: any, handle: net.Socket | net.Server): boolean;
+ emit(event: "online"): boolean;
+
+ on(event: string, listener: (...args: any[]) => void): this;
+ on(event: "disconnect", listener: () => void): this;
+ on(event: "error", listener: (error: Error) => void): this;
+ on(event: "exit", listener: (code: number, signal: string) => void): this;
+ on(event: "listening", listener: (address: Address) => void): this;
+ on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ on(event: "online", listener: () => void): this;
+
+ once(event: string, listener: (...args: any[]) => void): this;
+ once(event: "disconnect", listener: () => void): this;
+ once(event: "error", listener: (error: Error) => void): this;
+ once(event: "exit", listener: (code: number, signal: string) => void): this;
+ once(event: "listening", listener: (address: Address) => void): this;
+ once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ once(event: "online", listener: () => void): this;
+
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "disconnect", listener: () => void): this;
+ prependListener(event: "error", listener: (error: Error) => void): this;
+ prependListener(event: "exit", listener: (code: number, signal: string) => void): this;
+ prependListener(event: "listening", listener: (address: Address) => void): this;
+ prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ prependListener(event: "online", listener: () => void): this;
+
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "disconnect", listener: () => void): this;
+ prependOnceListener(event: "error", listener: (error: Error) => void): this;
+ prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this;
+ prependOnceListener(event: "listening", listener: (address: Address) => void): this;
+ prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ prependOnceListener(event: "online", listener: () => void): this;
+ }
+
+ interface Cluster extends events.EventEmitter {
+ Worker: Worker;
+ disconnect(callback?: Function): void;
+ fork(env?: any): Worker;
+ isMaster: boolean;
+ isWorker: boolean;
+ // TODO: cluster.schedulingPolicy
+ settings: ClusterSettings;
+ setupMaster(settings?: ClusterSettings): void;
+ worker?: Worker;
+ workers?: {
+ [index: string]: Worker | undefined
+ };
+
+ /**
+ * events.EventEmitter
+ * 1. disconnect
+ * 2. exit
+ * 3. fork
+ * 4. listening
+ * 5. message
+ * 6. online
+ * 7. setup
+ */
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ addListener(event: "disconnect", listener: (worker: Worker) => void): this;
+ addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
+ addListener(event: "fork", listener: (worker: Worker) => void): this;
+ addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
+ addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ addListener(event: "online", listener: (worker: Worker) => void): this;
+ addListener(event: "setup", listener: (settings: any) => void): this;
+
+ emit(event: string | symbol, ...args: any[]): boolean;
+ emit(event: "disconnect", worker: Worker): boolean;
+ emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
+ emit(event: "fork", worker: Worker): boolean;
+ emit(event: "listening", worker: Worker, address: Address): boolean;
+ emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
+ emit(event: "online", worker: Worker): boolean;
+ emit(event: "setup", settings: any): boolean;
+
+ on(event: string, listener: (...args: any[]) => void): this;
+ on(event: "disconnect", listener: (worker: Worker) => void): this;
+ on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
+ on(event: "fork", listener: (worker: Worker) => void): this;
+ on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
+ on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ on(event: "online", listener: (worker: Worker) => void): this;
+ on(event: "setup", listener: (settings: any) => void): this;
+
+ once(event: string, listener: (...args: any[]) => void): this;
+ once(event: "disconnect", listener: (worker: Worker) => void): this;
+ once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
+ once(event: "fork", listener: (worker: Worker) => void): this;
+ once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
+ once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ once(event: "online", listener: (worker: Worker) => void): this;
+ once(event: "setup", listener: (settings: any) => void): this;
+
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
+ prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
+ prependListener(event: "fork", listener: (worker: Worker) => void): this;
+ prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
+ prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ prependListener(event: "online", listener: (worker: Worker) => void): this;
+ prependListener(event: "setup", listener: (settings: any) => void): this;
+
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
+ prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
+ prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
+ prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
+ // the handle is a net.Socket or net.Server object, or undefined.
+ prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
+ prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
+ prependOnceListener(event: "setup", listener: (settings: any) => void): this;
+ }
+
+ function disconnect(callback?: Function): void;
+ function fork(env?: any): Worker;
+ const isMaster: boolean;
+ const isWorker: boolean;
+ // TODO: cluster.schedulingPolicy
+ const settings: ClusterSettings;
+ function setupMaster(settings?: ClusterSettings): void;
+ const worker: Worker;
+ const workers: {
+ [index: string]: Worker | undefined
+ };
+
+ /**
+ * events.EventEmitter
+ * 1. disconnect
+ * 2. exit
+ * 3. fork
+ * 4. listening
+ * 5. message
+ * 6. online
+ * 7. setup
+ */
+ function addListener(event: string, listener: (...args: any[]) => void): Cluster;
+ function addListener(event: "disconnect", listener: (worker: Worker) => void): Cluster;
+ function addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
+ function addListener(event: "fork", listener: (worker: Worker) => void): Cluster;
+ function addListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
+ // the handle is a net.Socket or net.Server object, or undefined.
+ function addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
+ function addListener(event: "online", listener: (worker: Worker) => void): Cluster;
+ function addListener(event: "setup", listener: (settings: any) => void): Cluster;
+
+ function emit(event: string | symbol, ...args: any[]): boolean;
+ function emit(event: "disconnect", worker: Worker): boolean;
+ function emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
+ function emit(event: "fork", worker: Worker): boolean;
+ function emit(event: "listening", worker: Worker, address: Address): boolean;
+ function emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
+ function emit(event: "online", worker: Worker): boolean;
+ function emit(event: "setup", settings: any): boolean;
+
+ function on(event: string, listener: (...args: any[]) => void): Cluster;
+ function on(event: "disconnect", listener: (worker: Worker) => void): Cluster;
+ function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
+ function on(event: "fork", listener: (worker: Worker) => void): Cluster;
+ function on(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
+ function on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined.
+ function on(event: "online", listener: (worker: Worker) => void): Cluster;
+ function on(event: "setup", listener: (settings: any) => void): Cluster;
+
+ function once(event: string, listener: (...args: any[]) => void): Cluster;
+ function once(event: "disconnect", listener: (worker: Worker) => void): Cluster;
+ function once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
+ function once(event: "fork", listener: (worker: Worker) => void): Cluster;
+ function once(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
+ function once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined.
+ function once(event: "online", listener: (worker: Worker) => void): Cluster;
+ function once(event: "setup", listener: (settings: any) => void): Cluster;
+
+ function removeListener(event: string, listener: (...args: any[]) => void): Cluster;
+ function removeAllListeners(event?: string): Cluster;
+ function setMaxListeners(n: number): Cluster;
+ function getMaxListeners(): number;
+ function listeners(event: string): Function[];
+ function listenerCount(type: string): number;
+
+ function prependListener(event: string, listener: (...args: any[]) => void): Cluster;
+ function prependListener(event: "disconnect", listener: (worker: Worker) => void): Cluster;
+ function prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
+ function prependListener(event: "fork", listener: (worker: Worker) => void): Cluster;
+ function prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
+ // the handle is a net.Socket or net.Server object, or undefined.
+ function prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
+ function prependListener(event: "online", listener: (worker: Worker) => void): Cluster;
+ function prependListener(event: "setup", listener: (settings: any) => void): Cluster;
+
+ function prependOnceListener(event: string, listener: (...args: any[]) => void): Cluster;
+ function prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): Cluster;
+ function prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
+ function prependOnceListener(event: "fork", listener: (worker: Worker) => void): Cluster;
+ function prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
+ // the handle is a net.Socket or net.Server object, or undefined.
+ function prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
+ function prependOnceListener(event: "online", listener: (worker: Worker) => void): Cluster;
+ function prependOnceListener(event: "setup", listener: (settings: any) => void): Cluster;
+
+ function eventNames(): string[];
+}
diff --git a/node_modules/@types/node/console.d.ts b/node_modules/@types/node/console.d.ts
new file mode 100644
index 00000000000..d30d13f8712
--- /dev/null
+++ b/node_modules/@types/node/console.d.ts
@@ -0,0 +1,3 @@
+declare module "console" {
+ export = console;
+}
diff --git a/node_modules/@types/node/constants.d.ts b/node_modules/@types/node/constants.d.ts
new file mode 100644
index 00000000000..626c6981721
--- /dev/null
+++ b/node_modules/@types/node/constants.d.ts
@@ -0,0 +1,449 @@
+/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
+declare module "constants" {
+ /** @deprecated since v6.3.0 - use `os.constants.errno.E2BIG` instead. */
+ const E2BIG: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EACCES` instead. */
+ const EACCES: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EADDRINUSE` instead. */
+ const EADDRINUSE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EADDRNOTAVAIL` instead. */
+ const EADDRNOTAVAIL: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EAFNOSUPPORT` instead. */
+ const EAFNOSUPPORT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EAGAIN` instead. */
+ const EAGAIN: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EALREADY` instead. */
+ const EALREADY: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EBADF` instead. */
+ const EBADF: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EBADMSG` instead. */
+ const EBADMSG: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EBUSY` instead. */
+ const EBUSY: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ECANCELED` instead. */
+ const ECANCELED: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ECHILD` instead. */
+ const ECHILD: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ECONNABORTED` instead. */
+ const ECONNABORTED: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ECONNREFUSED` instead. */
+ const ECONNREFUSED: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ECONNRESET` instead. */
+ const ECONNRESET: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EDEADLK` instead. */
+ const EDEADLK: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EDESTADDRREQ` instead. */
+ const EDESTADDRREQ: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EDOM` instead. */
+ const EDOM: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EEXIST` instead. */
+ const EEXIST: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EFAULT` instead. */
+ const EFAULT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EFBIG` instead. */
+ const EFBIG: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EHOSTUNREACH` instead. */
+ const EHOSTUNREACH: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EIDRM` instead. */
+ const EIDRM: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EILSEQ` instead. */
+ const EILSEQ: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EINPROGRESS` instead. */
+ const EINPROGRESS: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EINTR` instead. */
+ const EINTR: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EINVAL` instead. */
+ const EINVAL: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EIO` instead. */
+ const EIO: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EISCONN` instead. */
+ const EISCONN: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EISDIR` instead. */
+ const EISDIR: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ELOOP` instead. */
+ const ELOOP: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EMFILE` instead. */
+ const EMFILE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EMLINK` instead. */
+ const EMLINK: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EMSGSIZE` instead. */
+ const EMSGSIZE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENAMETOOLONG` instead. */
+ const ENAMETOOLONG: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENETDOWN` instead. */
+ const ENETDOWN: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENETRESET` instead. */
+ const ENETRESET: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENETUNREACH` instead. */
+ const ENETUNREACH: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENFILE` instead. */
+ const ENFILE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOBUFS` instead. */
+ const ENOBUFS: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENODATA` instead. */
+ const ENODATA: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENODEV` instead. */
+ const ENODEV: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOENT` instead. */
+ const ENOENT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOEXEC` instead. */
+ const ENOEXEC: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOLCK` instead. */
+ const ENOLCK: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOLINK` instead. */
+ const ENOLINK: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOMEM` instead. */
+ const ENOMEM: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOMSG` instead. */
+ const ENOMSG: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOPROTOOPT` instead. */
+ const ENOPROTOOPT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSPC` instead. */
+ const ENOSPC: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSR` instead. */
+ const ENOSR: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSTR` instead. */
+ const ENOSTR: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSYS` instead. */
+ const ENOSYS: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTCONN` instead. */
+ const ENOTCONN: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTDIR` instead. */
+ const ENOTDIR: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTEMPTY` instead. */
+ const ENOTEMPTY: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTSOCK` instead. */
+ const ENOTSOCK: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTSUP` instead. */
+ const ENOTSUP: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTTY` instead. */
+ const ENOTTY: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ENXIO` instead. */
+ const ENXIO: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EOPNOTSUPP` instead. */
+ const EOPNOTSUPP: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EOVERFLOW` instead. */
+ const EOVERFLOW: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EPERM` instead. */
+ const EPERM: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EPIPE` instead. */
+ const EPIPE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EPROTO` instead. */
+ const EPROTO: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EPROTONOSUPPORT` instead. */
+ const EPROTONOSUPPORT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EPROTOTYPE` instead. */
+ const EPROTOTYPE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ERANGE` instead. */
+ const ERANGE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EROFS` instead. */
+ const EROFS: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ESPIPE` instead. */
+ const ESPIPE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ESRCH` instead. */
+ const ESRCH: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ETIME` instead. */
+ const ETIME: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ETIMEDOUT` instead. */
+ const ETIMEDOUT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.ETXTBSY` instead. */
+ const ETXTBSY: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EWOULDBLOCK` instead. */
+ const EWOULDBLOCK: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.EXDEV` instead. */
+ const EXDEV: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINTR` instead. */
+ const WSAEINTR: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEBADF` instead. */
+ const WSAEBADF: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEACCES` instead. */
+ const WSAEACCES: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEFAULT` instead. */
+ const WSAEFAULT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINVAL` instead. */
+ const WSAEINVAL: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEMFILE` instead. */
+ const WSAEMFILE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEWOULDBLOCK` instead. */
+ const WSAEWOULDBLOCK: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINPROGRESS` instead. */
+ const WSAEINPROGRESS: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEALREADY` instead. */
+ const WSAEALREADY: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOTSOCK` instead. */
+ const WSAENOTSOCK: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEDESTADDRREQ` instead. */
+ const WSAEDESTADDRREQ: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEMSGSIZE` instead. */
+ const WSAEMSGSIZE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROTOTYPE` instead. */
+ const WSAEPROTOTYPE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOPROTOOPT` instead. */
+ const WSAENOPROTOOPT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROTONOSUPPORT` instead. */
+ const WSAEPROTONOSUPPORT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAESOCKTNOSUPPORT` instead. */
+ const WSAESOCKTNOSUPPORT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEOPNOTSUPP` instead. */
+ const WSAEOPNOTSUPP: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPFNOSUPPORT` instead. */
+ const WSAEPFNOSUPPORT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEAFNOSUPPORT` instead. */
+ const WSAEAFNOSUPPORT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEADDRINUSE` instead. */
+ const WSAEADDRINUSE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEADDRNOTAVAIL` instead. */
+ const WSAEADDRNOTAVAIL: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENETDOWN` instead. */
+ const WSAENETDOWN: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENETUNREACH` instead. */
+ const WSAENETUNREACH: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENETRESET` instead. */
+ const WSAENETRESET: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECONNABORTED` instead. */
+ const WSAECONNABORTED: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECONNRESET` instead. */
+ const WSAECONNRESET: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOBUFS` instead. */
+ const WSAENOBUFS: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEISCONN` instead. */
+ const WSAEISCONN: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOTCONN` instead. */
+ const WSAENOTCONN: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAESHUTDOWN` instead. */
+ const WSAESHUTDOWN: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAETOOMANYREFS` instead. */
+ const WSAETOOMANYREFS: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAETIMEDOUT` instead. */
+ const WSAETIMEDOUT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECONNREFUSED` instead. */
+ const WSAECONNREFUSED: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAELOOP` instead. */
+ const WSAELOOP: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENAMETOOLONG` instead. */
+ const WSAENAMETOOLONG: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEHOSTDOWN` instead. */
+ const WSAEHOSTDOWN: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEHOSTUNREACH` instead. */
+ const WSAEHOSTUNREACH: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOTEMPTY` instead. */
+ const WSAENOTEMPTY: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROCLIM` instead. */
+ const WSAEPROCLIM: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEUSERS` instead. */
+ const WSAEUSERS: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEDQUOT` instead. */
+ const WSAEDQUOT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAESTALE` instead. */
+ const WSAESTALE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEREMOTE` instead. */
+ const WSAEREMOTE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSASYSNOTREADY` instead. */
+ const WSASYSNOTREADY: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAVERNOTSUPPORTED` instead. */
+ const WSAVERNOTSUPPORTED: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSANOTINITIALISED` instead. */
+ const WSANOTINITIALISED: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEDISCON` instead. */
+ const WSAEDISCON: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOMORE` instead. */
+ const WSAENOMORE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECANCELLED` instead. */
+ const WSAECANCELLED: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINVALIDPROCTABLE` instead. */
+ const WSAEINVALIDPROCTABLE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINVALIDPROVIDER` instead. */
+ const WSAEINVALIDPROVIDER: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROVIDERFAILEDINIT` instead. */
+ const WSAEPROVIDERFAILEDINIT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSASYSCALLFAILURE` instead. */
+ const WSASYSCALLFAILURE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSASERVICE_NOT_FOUND` instead. */
+ const WSASERVICE_NOT_FOUND: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSATYPE_NOT_FOUND` instead. */
+ const WSATYPE_NOT_FOUND: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSA_E_NO_MORE` instead. */
+ const WSA_E_NO_MORE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSA_E_CANCELLED` instead. */
+ const WSA_E_CANCELLED: number;
+ /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEREFUSED` instead. */
+ const WSAEREFUSED: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGHUP` instead. */
+ const SIGHUP: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGINT` instead. */
+ const SIGINT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGILL` instead. */
+ const SIGILL: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGABRT` instead. */
+ const SIGABRT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGFPE` instead. */
+ const SIGFPE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGKILL` instead. */
+ const SIGKILL: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSEGV` instead. */
+ const SIGSEGV: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTERM` instead. */
+ const SIGTERM: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGBREAK` instead. */
+ const SIGBREAK: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGWINCH` instead. */
+ const SIGWINCH: number;
+ const SSL_OP_ALL: number;
+ const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number;
+ const SSL_OP_CIPHER_SERVER_PREFERENCE: number;
+ const SSL_OP_CISCO_ANYCONNECT: number;
+ const SSL_OP_COOKIE_EXCHANGE: number;
+ const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number;
+ const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number;
+ const SSL_OP_EPHEMERAL_RSA: number;
+ const SSL_OP_LEGACY_SERVER_CONNECT: number;
+ const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number;
+ const SSL_OP_MICROSOFT_SESS_ID_BUG: number;
+ const SSL_OP_MSIE_SSLV2_RSA_PADDING: number;
+ const SSL_OP_NETSCAPE_CA_DN_BUG: number;
+ const SSL_OP_NETSCAPE_CHALLENGE_BUG: number;
+ const SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number;
+ const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number;
+ const SSL_OP_NO_COMPRESSION: number;
+ const SSL_OP_NO_QUERY_MTU: number;
+ const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number;
+ const SSL_OP_NO_SSLv2: number;
+ const SSL_OP_NO_SSLv3: number;
+ const SSL_OP_NO_TICKET: number;
+ const SSL_OP_NO_TLSv1: number;
+ const SSL_OP_NO_TLSv1_1: number;
+ const SSL_OP_NO_TLSv1_2: number;
+ const SSL_OP_PKCS1_CHECK_1: number;
+ const SSL_OP_PKCS1_CHECK_2: number;
+ const SSL_OP_SINGLE_DH_USE: number;
+ const SSL_OP_SINGLE_ECDH_USE: number;
+ const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number;
+ const SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number;
+ const SSL_OP_TLS_BLOCK_PADDING_BUG: number;
+ const SSL_OP_TLS_D5_BUG: number;
+ const SSL_OP_TLS_ROLLBACK_BUG: number;
+ const ENGINE_METHOD_DSA: number;
+ const ENGINE_METHOD_DH: number;
+ const ENGINE_METHOD_RAND: number;
+ const ENGINE_METHOD_ECDH: number;
+ const ENGINE_METHOD_ECDSA: number;
+ const ENGINE_METHOD_CIPHERS: number;
+ const ENGINE_METHOD_DIGESTS: number;
+ const ENGINE_METHOD_STORE: number;
+ const ENGINE_METHOD_PKEY_METHS: number;
+ const ENGINE_METHOD_PKEY_ASN1_METHS: number;
+ const ENGINE_METHOD_ALL: number;
+ const ENGINE_METHOD_NONE: number;
+ const DH_CHECK_P_NOT_SAFE_PRIME: number;
+ const DH_CHECK_P_NOT_PRIME: number;
+ const DH_UNABLE_TO_CHECK_GENERATOR: number;
+ const DH_NOT_SUITABLE_GENERATOR: number;
+ const NPN_ENABLED: number;
+ const RSA_PKCS1_PADDING: number;
+ const RSA_SSLV23_PADDING: number;
+ const RSA_NO_PADDING: number;
+ const RSA_PKCS1_OAEP_PADDING: number;
+ const RSA_X931_PADDING: number;
+ const RSA_PKCS1_PSS_PADDING: number;
+ const POINT_CONVERSION_COMPRESSED: number;
+ const POINT_CONVERSION_UNCOMPRESSED: number;
+ const POINT_CONVERSION_HYBRID: number;
+ const O_RDONLY: number;
+ const O_WRONLY: number;
+ const O_RDWR: number;
+ const S_IFMT: number;
+ const S_IFREG: number;
+ const S_IFDIR: number;
+ const S_IFCHR: number;
+ const S_IFBLK: number;
+ const S_IFIFO: number;
+ const S_IFSOCK: number;
+ const S_IRWXU: number;
+ const S_IRUSR: number;
+ const S_IWUSR: number;
+ const S_IXUSR: number;
+ const S_IRWXG: number;
+ const S_IRGRP: number;
+ const S_IWGRP: number;
+ const S_IXGRP: number;
+ const S_IRWXO: number;
+ const S_IROTH: number;
+ const S_IWOTH: number;
+ const S_IXOTH: number;
+ const S_IFLNK: number;
+ const O_CREAT: number;
+ const O_EXCL: number;
+ const O_NOCTTY: number;
+ const O_DIRECTORY: number;
+ const O_NOATIME: number;
+ const O_NOFOLLOW: number;
+ const O_SYNC: number;
+ const O_DSYNC: number;
+ const O_SYMLINK: number;
+ const O_DIRECT: number;
+ const O_NONBLOCK: number;
+ const O_TRUNC: number;
+ const O_APPEND: number;
+ const F_OK: number;
+ const R_OK: number;
+ const W_OK: number;
+ const X_OK: number;
+ const COPYFILE_EXCL: number;
+ const COPYFILE_FICLONE: number;
+ const COPYFILE_FICLONE_FORCE: number;
+ const UV_UDP_REUSEADDR: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGQUIT` instead. */
+ const SIGQUIT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTRAP` instead. */
+ const SIGTRAP: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGIOT` instead. */
+ const SIGIOT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGBUS` instead. */
+ const SIGBUS: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGUSR1` instead. */
+ const SIGUSR1: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGUSR2` instead. */
+ const SIGUSR2: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPIPE` instead. */
+ const SIGPIPE: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGALRM` instead. */
+ const SIGALRM: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGCHLD` instead. */
+ const SIGCHLD: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSTKFLT` instead. */
+ const SIGSTKFLT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGCONT` instead. */
+ const SIGCONT: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSTOP` instead. */
+ const SIGSTOP: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTSTP` instead. */
+ const SIGTSTP: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTTIN` instead. */
+ const SIGTTIN: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTTOU` instead. */
+ const SIGTTOU: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGURG` instead. */
+ const SIGURG: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGXCPU` instead. */
+ const SIGXCPU: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGXFSZ` instead. */
+ const SIGXFSZ: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGVTALRM` instead. */
+ const SIGVTALRM: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPROF` instead. */
+ const SIGPROF: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGIO` instead. */
+ const SIGIO: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPOLL` instead. */
+ const SIGPOLL: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPWR` instead. */
+ const SIGPWR: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSYS` instead. */
+ const SIGSYS: number;
+ /** @deprecated since v6.3.0 - use `os.constants.signals.SIGUNUSED` instead. */
+ const SIGUNUSED: number;
+ const defaultCoreCipherList: string;
+ const defaultCipherList: string;
+ const ENGINE_METHOD_RSA: number;
+ const ALPN_ENABLED: number;
+}
diff --git a/node_modules/@types/node/crypto.d.ts b/node_modules/@types/node/crypto.d.ts
new file mode 100644
index 00000000000..07100326787
--- /dev/null
+++ b/node_modules/@types/node/crypto.d.ts
@@ -0,0 +1,371 @@
+declare module "crypto" {
+ import * as stream from "stream";
+
+ interface Certificate {
+ exportChallenge(spkac: string | Buffer | NodeJS.TypedArray | DataView): Buffer;
+ exportPublicKey(spkac: string | Buffer | NodeJS.TypedArray | DataView): Buffer;
+ verifySpkac(spkac: Buffer | NodeJS.TypedArray | DataView): boolean;
+ }
+ const Certificate: {
+ new(): Certificate;
+ (): Certificate;
+ };
+
+ /** @deprecated since v10.0.0 */
+ const fips: boolean;
+
+ interface CredentialDetails {
+ pfx: string;
+ key: string;
+ passphrase: string;
+ cert: string;
+ ca: string | string[];
+ crl: string | string[];
+ ciphers: string;
+ }
+ /** @deprecated since v0.11.13 - use tls.SecureContext instead. */
+ interface Credentials { context?: any; }
+ /** @deprecated since v0.11.13 - use tls.createSecureContext instead. */
+ function createCredentials(details: CredentialDetails): Credentials;
+ function createHash(algorithm: string, options?: stream.TransformOptions): Hash;
+ function createHmac(algorithm: string, key: string | Buffer | NodeJS.TypedArray | DataView, options?: stream.TransformOptions): Hmac;
+
+ type Utf8AsciiLatin1Encoding = "utf8" | "ascii" | "latin1";
+ type HexBase64Latin1Encoding = "latin1" | "hex" | "base64";
+ type Utf8AsciiBinaryEncoding = "utf8" | "ascii" | "binary";
+ type HexBase64BinaryEncoding = "binary" | "base64" | "hex";
+ type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
+
+ interface Hash extends stream.Transform {
+ update(data: string | Buffer | NodeJS.TypedArray | DataView): Hash;
+ update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hash;
+ digest(): Buffer;
+ digest(encoding: HexBase64Latin1Encoding): string;
+ }
+ interface Hmac extends stream.Transform {
+ update(data: string | Buffer | NodeJS.TypedArray | DataView): Hmac;
+ update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hmac;
+ digest(): Buffer;
+ digest(encoding: HexBase64Latin1Encoding): string;
+ }
+ type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm';
+ type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm';
+ interface CipherCCMOptions extends stream.TransformOptions {
+ authTagLength: number;
+ }
+ interface CipherGCMOptions extends stream.TransformOptions {
+ authTagLength?: number;
+ }
+ /** @deprecated since v10.0.0 use createCipheriv() */
+ function createCipher(algorithm: CipherCCMTypes, password: string | Buffer | NodeJS.TypedArray | DataView, options: CipherCCMOptions): CipherCCM;
+ /** @deprecated since v10.0.0 use createCipheriv() */
+ function createCipher(algorithm: CipherGCMTypes, password: string | Buffer | NodeJS.TypedArray | DataView, options?: CipherGCMOptions): CipherGCM;
+ /** @deprecated since v10.0.0 use createCipheriv() */
+ function createCipher(algorithm: string, password: string | Buffer | NodeJS.TypedArray | DataView, options?: stream.TransformOptions): Cipher;
+
+ function createCipheriv(algorithm: CipherCCMTypes, key: string | Buffer | NodeJS.TypedArray | DataView, iv: string | Buffer | NodeJS.TypedArray | DataView, options: CipherCCMOptions): CipherCCM;
+ function createCipheriv(algorithm: CipherGCMTypes, key: string | Buffer | NodeJS.TypedArray | DataView, iv: string | Buffer | NodeJS.TypedArray | DataView, options?: CipherGCMOptions): CipherGCM;
+ function createCipheriv(algorithm: string, key: string | Buffer | NodeJS.TypedArray | DataView, iv: string | Buffer | NodeJS.TypedArray | DataView, options?: stream.TransformOptions): Cipher;
+
+ interface Cipher extends stream.Transform {
+ update(data: string | Buffer | NodeJS.TypedArray | DataView): Buffer;
+ update(data: string, input_encoding: Utf8AsciiBinaryEncoding): Buffer;
+ update(data: Buffer | NodeJS.TypedArray | DataView, output_encoding: HexBase64BinaryEncoding): string;
+ update(data: Buffer | NodeJS.TypedArray | DataView, input_encoding: any, output_encoding: HexBase64BinaryEncoding): string;
+ // second arg ignored
+ update(data: string, input_encoding: Utf8AsciiBinaryEncoding, output_encoding: HexBase64BinaryEncoding): string;
+ final(): Buffer;
+ final(output_encoding: string): string;
+ setAutoPadding(auto_padding?: boolean): this;
+ // getAuthTag(): Buffer;
+ // setAAD(buffer: Buffer): this; // docs only say buffer
+ }
+ interface CipherCCM extends Cipher {
+ setAAD(buffer: Buffer, options: { plaintextLength: number }): this;
+ getAuthTag(): Buffer;
+ }
+ interface CipherGCM extends Cipher {
+ setAAD(buffer: Buffer, options?: { plaintextLength: number }): this;
+ getAuthTag(): Buffer;
+ }
+ /** @deprecated since v10.0.0 use createDecipheriv() */
+ function createDecipher(algorithm: CipherCCMTypes, password: string | Buffer | NodeJS.TypedArray | DataView, options: CipherCCMOptions): DecipherCCM;
+ /** @deprecated since v10.0.0 use createDecipheriv() */
+ function createDecipher(algorithm: CipherGCMTypes, password: string | Buffer | NodeJS.TypedArray | DataView, options?: CipherGCMOptions): DecipherGCM;
+ /** @deprecated since v10.0.0 use createDecipheriv() */
+ function createDecipher(algorithm: string, password: string | Buffer | NodeJS.TypedArray | DataView, options?: stream.TransformOptions): Decipher;
+
+ function createDecipheriv(
+ algorithm: CipherCCMTypes,
+ key: string | Buffer | NodeJS.TypedArray | DataView,
+ iv: string | Buffer | NodeJS.TypedArray | DataView,
+ options: CipherCCMOptions,
+ ): DecipherCCM;
+ function createDecipheriv(
+ algorithm: CipherGCMTypes,
+ key: string | Buffer | NodeJS.TypedArray | DataView,
+ iv: string | Buffer | NodeJS.TypedArray | DataView,
+ options?: CipherGCMOptions,
+ ): DecipherGCM;
+ function createDecipheriv(algorithm: string, key: string | Buffer | NodeJS.TypedArray | DataView, iv: string | Buffer | NodeJS.TypedArray | DataView, options?: stream.TransformOptions): Decipher;
+
+ interface Decipher extends stream.Transform {
+ update(data: Buffer | NodeJS.TypedArray | DataView): Buffer;
+ update(data: string, input_encoding: HexBase64BinaryEncoding): Buffer;
+ update(data: Buffer | NodeJS.TypedArray | DataView, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string;
+ // second arg is ignored
+ update(data: string, input_encoding: HexBase64BinaryEncoding, output_encoding: Utf8AsciiBinaryEncoding): string;
+ final(): Buffer;
+ final(output_encoding: string): string;
+ setAutoPadding(auto_padding?: boolean): this;
+ // setAuthTag(tag: Buffer | NodeJS.TypedArray | DataView): this;
+ // setAAD(buffer: Buffer | NodeJS.TypedArray | DataView): this;
+ }
+ interface DecipherCCM extends Decipher {
+ setAuthTag(buffer: Buffer | NodeJS.TypedArray | DataView): this;
+ setAAD(buffer: Buffer | NodeJS.TypedArray | DataView, options: { plaintextLength: number }): this;
+ }
+ interface DecipherGCM extends Decipher {
+ setAuthTag(buffer: Buffer | NodeJS.TypedArray | DataView): this;
+ setAAD(buffer: Buffer | NodeJS.TypedArray | DataView, options?: { plaintextLength: number }): this;
+ }
+
+ function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
+ interface Signer extends NodeJS.WritableStream {
+ update(data: string | Buffer | NodeJS.TypedArray | DataView): Signer;
+ update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Signer;
+ sign(private_key: string | { key: string; passphrase?: string, padding?: number, saltLength?: number }): Buffer;
+ sign(private_key: string | { key: string; passphrase?: string, padding?: number, saltLength?: number }, output_format: HexBase64Latin1Encoding): string;
+ }
+ function createVerify(algorith: string, options?: stream.WritableOptions): Verify;
+ interface Verify extends NodeJS.WritableStream {
+ update(data: string | Buffer | NodeJS.TypedArray | DataView): Verify;
+ update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Verify;
+ verify(object: string | Object, signature: Buffer | NodeJS.TypedArray | DataView): boolean;
+ verify(object: string | Object, signature: string, signature_format: HexBase64Latin1Encoding): boolean;
+ // https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format
+ // The signature field accepts a TypedArray type, but it is only available starting ES2017
+ }
+ function createDiffieHellman(prime_length: number, generator?: number | Buffer | NodeJS.TypedArray | DataView): DiffieHellman;
+ function createDiffieHellman(prime: Buffer | NodeJS.TypedArray | DataView): DiffieHellman;
+ function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding): DiffieHellman;
+ function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: number | Buffer | NodeJS.TypedArray | DataView): DiffieHellman;
+ function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: string, generator_encoding: HexBase64Latin1Encoding): DiffieHellman;
+ interface DiffieHellman {
+ generateKeys(): Buffer;
+ generateKeys(encoding: HexBase64Latin1Encoding): string;
+ computeSecret(other_public_key: Buffer | NodeJS.TypedArray | DataView): Buffer;
+ computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
+ computeSecret(other_public_key: Buffer | NodeJS.TypedArray | DataView, output_encoding: HexBase64Latin1Encoding): string;
+ computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string;
+ getPrime(): Buffer;
+ getPrime(encoding: HexBase64Latin1Encoding): string;
+ getGenerator(): Buffer;
+ getGenerator(encoding: HexBase64Latin1Encoding): string;
+ getPublicKey(): Buffer;
+ getPublicKey(encoding: HexBase64Latin1Encoding): string;
+ getPrivateKey(): Buffer;
+ getPrivateKey(encoding: HexBase64Latin1Encoding): string;
+ setPublicKey(public_key: Buffer | NodeJS.TypedArray | DataView): void;
+ setPublicKey(public_key: string, encoding: string): void;
+ setPrivateKey(private_key: Buffer | NodeJS.TypedArray | DataView): void;
+ setPrivateKey(private_key: string, encoding: string): void;
+ verifyError: number;
+ }
+ function getDiffieHellman(group_name: string): DiffieHellman;
+ function pbkdf2(
+ password: string | Buffer | NodeJS.TypedArray | DataView,
+ salt: string | Buffer | NodeJS.TypedArray | DataView,
+ iterations: number,
+ keylen: number,
+ digest: string,
+ callback: (err: Error | null, derivedKey: Buffer) => any,
+ ): void;
+ function pbkdf2Sync(password: string | Buffer | NodeJS.TypedArray | DataView, salt: string | Buffer | NodeJS.TypedArray | DataView, iterations: number, keylen: number, digest: string): Buffer;
+
+ function randomBytes(size: number): Buffer;
+ function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
+ function pseudoRandomBytes(size: number): Buffer;
+ function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
+
+ function randomFillSync(buffer: T, offset?: number, size?: number): T;
+ function randomFill(buffer: T, callback: (err: Error | null, buf: T) => void): void;
+ function randomFill(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
+ function randomFill(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void;
+
+ interface ScryptOptions {
+ N?: number;
+ r?: number;
+ p?: number;
+ maxmem?: number;
+ }
+ function scrypt(
+ password: string | Buffer | NodeJS.TypedArray | DataView,
+ salt: string | Buffer | NodeJS.TypedArray | DataView,
+ keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void,
+ ): void;
+ function scrypt(
+ password: string | Buffer | NodeJS.TypedArray | DataView,
+ salt: string | Buffer | NodeJS.TypedArray | DataView,
+ keylen: number,
+ options: ScryptOptions,
+ callback: (err: Error | null, derivedKey: Buffer) => void,
+ ): void;
+ function scryptSync(password: string | Buffer | NodeJS.TypedArray | DataView, salt: string | Buffer | NodeJS.TypedArray | DataView, keylen: number, options?: ScryptOptions): Buffer;
+
+ interface RsaPublicKey {
+ key: string;
+ padding?: number;
+ }
+ interface RsaPrivateKey {
+ key: string;
+ passphrase?: string;
+ padding?: number;
+ }
+ function publicEncrypt(public_key: string | RsaPublicKey, buffer: Buffer | NodeJS.TypedArray | DataView): Buffer;
+ function privateDecrypt(private_key: string | RsaPrivateKey, buffer: Buffer | NodeJS.TypedArray | DataView): Buffer;
+ function privateEncrypt(private_key: string | RsaPrivateKey, buffer: Buffer | NodeJS.TypedArray | DataView): Buffer;
+ function publicDecrypt(public_key: string | RsaPublicKey, buffer: Buffer | NodeJS.TypedArray | DataView): Buffer;
+ function getCiphers(): string[];
+ function getCurves(): string[];
+ function getHashes(): string[];
+ class ECDH {
+ static convertKey(
+ key: string | Buffer | NodeJS.TypedArray | DataView,
+ curve: string,
+ inputEncoding?: HexBase64Latin1Encoding,
+ outputEncoding?: "latin1" | "hex" | "base64",
+ format?: "uncompressed" | "compressed" | "hybrid",
+ ): Buffer | string;
+ generateKeys(): Buffer;
+ generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string;
+ computeSecret(other_public_key: Buffer | NodeJS.TypedArray | DataView): Buffer;
+ computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
+ computeSecret(other_public_key: Buffer | NodeJS.TypedArray | DataView, output_encoding: HexBase64Latin1Encoding): string;
+ computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string;
+ getPrivateKey(): Buffer;
+ getPrivateKey(encoding: HexBase64Latin1Encoding): string;
+ getPublicKey(): Buffer;
+ getPublicKey(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string;
+ setPrivateKey(private_key: Buffer | NodeJS.TypedArray | DataView): void;
+ setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void;
+ }
+ function createECDH(curve_name: string): ECDH;
+ function timingSafeEqual(a: Buffer | NodeJS.TypedArray | DataView, b: Buffer | NodeJS.TypedArray | DataView): boolean;
+ /** @deprecated since v10.0.0 */
+ const DEFAULT_ENCODING: string;
+
+ export type KeyType = 'rsa' | 'dsa' | 'ec';
+ export type KeyFormat = 'pem' | 'der';
+
+ interface BasePrivateKeyEncodingOptions {
+ format: T;
+ cipher?: string;
+ passphrase?: string;
+ }
+
+ interface RSAKeyPairOptions {
+ /**
+ * Key size in bits
+ */
+ modulusLength: number;
+ /**
+ * @default 0x10001
+ */
+ publicExponent?: number;
+
+ publicKeyEncoding: {
+ type: 'pkcs1' | 'spki';
+ format: PubF;
+ };
+ privateKeyEncoding: BasePrivateKeyEncodingOptions & {
+ type: 'pkcs1' | 'pkcs8';
+ };
+ }
+
+ interface DSAKeyPairOptions {
+ /**
+ * Key size in bits
+ */
+ modulusLength: number;
+ /**
+ * Size of q in bits
+ */
+ divisorLength: number;
+
+ publicKeyEncoding: {
+ type: 'spki';
+ format: PubF;
+ };
+ privateKeyEncoding: BasePrivateKeyEncodingOptions & {
+ type: 'pkcs8';
+ };
+ }
+
+ interface ECKeyPairOptions {
+ /**
+ * Name of the curve to use.
+ */
+ namedCurve: string;
+
+ publicKeyEncoding: {
+ type: 'pkcs1' | 'spki';
+ format: PubF;
+ };
+ privateKeyEncoding: BasePrivateKeyEncodingOptions & {
+ type: 'sec1' | 'pkcs8';
+ };
+ }
+
+ interface KeyPairSyncResult {
+ publicKey: T1;
+ privateKey: T2;
+ }
+
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult;
+
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult;
+
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult;
+
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
+
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
+
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
+
+ namespace generateKeyPair {
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
+ function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
+
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
+ function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
+
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
+ function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
+ }
+}
diff --git a/node_modules/@types/node/dgram.d.ts b/node_modules/@types/node/dgram.d.ts
new file mode 100644
index 00000000000..4b9fe012cc5
--- /dev/null
+++ b/node_modules/@types/node/dgram.d.ts
@@ -0,0 +1,97 @@
+declare module "dgram" {
+ import { AddressInfo } from "net";
+ import * as dns from "dns";
+ import * as events from "events";
+
+ interface RemoteInfo {
+ address: string;
+ family: string;
+ port: number;
+ }
+
+ interface BindOptions {
+ port: number;
+ address?: string;
+ exclusive?: boolean;
+ }
+
+ type SocketType = "udp4" | "udp6";
+
+ interface SocketOptions {
+ type: SocketType;
+ reuseAddr?: boolean;
+ recvBufferSize?: number;
+ sendBufferSize?: number;
+ lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
+ }
+
+ function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
+ function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
+
+ class Socket extends events.EventEmitter {
+ send(msg: Buffer | string | Uint8Array | any[], port: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
+ send(msg: Buffer | string | Uint8Array, offset: number, length: number, port: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
+ bind(port?: number, address?: string, callback?: () => void): void;
+ bind(port?: number, callback?: () => void): void;
+ bind(callback?: () => void): void;
+ bind(options: BindOptions, callback?: Function): void;
+ close(callback?: () => void): void;
+ address(): AddressInfo | string;
+ setBroadcast(flag: boolean): void;
+ setTTL(ttl: number): void;
+ setMulticastTTL(ttl: number): void;
+ setMulticastInterface(multicastInterface: string): void;
+ setMulticastLoopback(flag: boolean): void;
+ addMembership(multicastAddress: string, multicastInterface?: string): void;
+ dropMembership(multicastAddress: string, multicastInterface?: string): void;
+ ref(): this;
+ unref(): this;
+ setRecvBufferSize(size: number): void;
+ setSendBufferSize(size: number): void;
+ getRecvBufferSize(): number;
+ getSendBufferSize(): number;
+
+ /**
+ * events.EventEmitter
+ * 1. close
+ * 2. error
+ * 3. listening
+ * 4. message
+ */
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ addListener(event: "close", listener: () => void): this;
+ addListener(event: "error", listener: (err: Error) => void): this;
+ addListener(event: "listening", listener: () => void): this;
+ addListener(event: "message", listener: (msg: Buffer, rinfo: AddressInfo) => void): this;
+
+ emit(event: string | symbol, ...args: any[]): boolean;
+ emit(event: "close"): boolean;
+ emit(event: "error", err: Error): boolean;
+ emit(event: "listening"): boolean;
+ emit(event: "message", msg: Buffer, rinfo: AddressInfo): boolean;
+
+ on(event: string, listener: (...args: any[]) => void): this;
+ on(event: "close", listener: () => void): this;
+ on(event: "error", listener: (err: Error) => void): this;
+ on(event: "listening", listener: () => void): this;
+ on(event: "message", listener: (msg: Buffer, rinfo: AddressInfo) => void): this;
+
+ once(event: string, listener: (...args: any[]) => void): this;
+ once(event: "close", listener: () => void): this;
+ once(event: "error", listener: (err: Error) => void): this;
+ once(event: "listening", listener: () => void): this;
+ once(event: "message", listener: (msg: Buffer, rinfo: AddressInfo) => void): this;
+
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "close", listener: () => void): this;
+ prependListener(event: "error", listener: (err: Error) => void): this;
+ prependListener(event: "listening", listener: () => void): this;
+ prependListener(event: "message", listener: (msg: Buffer, rinfo: AddressInfo) => void): this;
+
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "close", listener: () => void): this;
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
+ prependOnceListener(event: "listening", listener: () => void): this;
+ prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: AddressInfo) => void): this;
+ }
+}
diff --git a/node_modules/@types/node/dns.d.ts b/node_modules/@types/node/dns.d.ts
new file mode 100644
index 00000000000..879d69053aa
--- /dev/null
+++ b/node_modules/@types/node/dns.d.ts
@@ -0,0 +1,366 @@
+declare module "dns" {
+ // Supported getaddrinfo flags.
+ const ADDRCONFIG: number;
+ const V4MAPPED: number;
+
+ interface LookupOptions {
+ family?: number;
+ hints?: number;
+ all?: boolean;
+ verbatim?: boolean;
+ }
+
+ interface LookupOneOptions extends LookupOptions {
+ all?: false;
+ }
+
+ interface LookupAllOptions extends LookupOptions {
+ all: true;
+ }
+
+ interface LookupAddress {
+ address: string;
+ family: number;
+ }
+
+ function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
+ function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
+ function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
+ function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
+ function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace lookup {
+ function __promisify__(hostname: string, options: LookupAllOptions): Promise<{ address: LookupAddress[] }>;
+ function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<{ address: string, family: number }>;
+ function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>;
+ }
+
+ function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
+
+ namespace lookupService {
+ function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
+ }
+
+ interface ResolveOptions {
+ ttl: boolean;
+ }
+
+ interface ResolveWithTtlOptions extends ResolveOptions {
+ ttl: true;
+ }
+
+ interface RecordWithTtl {
+ address: string;
+ ttl: number;
+ }
+
+ /** @deprecated Use AnyARecord or AnyAaaaRecord instead. */
+ type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
+
+ interface AnyARecord extends RecordWithTtl {
+ type: "A";
+ }
+
+ interface AnyAaaaRecord extends RecordWithTtl {
+ type: "AAAA";
+ }
+
+ interface MxRecord {
+ priority: number;
+ exchange: string;
+ }
+
+ interface AnyMxRecord extends MxRecord {
+ type: "MX";
+ }
+
+ interface NaptrRecord {
+ flags: string;
+ service: string;
+ regexp: string;
+ replacement: string;
+ order: number;
+ preference: number;
+ }
+
+ interface AnyNaptrRecord extends NaptrRecord {
+ type: "NAPTR";
+ }
+
+ interface SoaRecord {
+ nsname: string;
+ hostmaster: string;
+ serial: number;
+ refresh: number;
+ retry: number;
+ expire: number;
+ minttl: number;
+ }
+
+ interface AnySoaRecord extends SoaRecord {
+ type: "SOA";
+ }
+
+ interface SrvRecord {
+ priority: number;
+ weight: number;
+ port: number;
+ name: string;
+ }
+
+ interface AnySrvRecord extends SrvRecord {
+ type: "SRV";
+ }
+
+ interface AnyTxtRecord {
+ type: "TXT";
+ entries: string[];
+ }
+
+ interface AnyNsRecord {
+ type: "NS";
+ value: string;
+ }
+
+ interface AnyPtrRecord {
+ type: "PTR";
+ value: string;
+ }
+
+ interface AnyCnameRecord {
+ type: "CNAME";
+ value: string;
+ }
+
+ type AnyRecord = AnyARecord |
+ AnyAaaaRecord |
+ AnyCnameRecord |
+ AnyMxRecord |
+ AnyNaptrRecord |
+ AnyNsRecord |
+ AnyPtrRecord |
+ AnySoaRecord |
+ AnySrvRecord |
+ AnyTxtRecord;
+
+ function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
+ function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
+ function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
+ function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
+ function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
+ function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
+ function resolve(
+ hostname: string,
+ rrtype: string,
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void,
+ ): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace resolve {
+ function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise;
+ function __promisify__(hostname: string, rrtype: "ANY"): Promise;
+ function __promisify__(hostname: string, rrtype: "MX"): Promise;
+ function __promisify__(hostname: string, rrtype: "NAPTR"): Promise;
+ function __promisify__(hostname: string, rrtype: "SOA"): Promise;
+ function __promisify__(hostname: string, rrtype: "SRV"): Promise;
+ function __promisify__(hostname: string, rrtype: "TXT"): Promise;
+ function __promisify__(hostname: string, rrtype: string): Promise;
+ }
+
+ function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
+ function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace resolve4 {
+ function __promisify__(hostname: string): Promise;
+ function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise;
+ function __promisify__(hostname: string, options?: ResolveOptions): Promise;
+ }
+
+ function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
+ function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace resolve6 {
+ function __promisify__(hostname: string): Promise;
+ function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise;
+ function __promisify__(hostname: string, options?: ResolveOptions): Promise;
+ }
+
+ function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ namespace resolveCname {
+ function __promisify__(hostname: string): Promise;
+ }
+
+ function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
+ namespace resolveMx {
+ function __promisify__(hostname: string): Promise;
+ }
+
+ function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
+ namespace resolveNaptr {
+ function __promisify__(hostname: string): Promise;
+ }
+
+ function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ namespace resolveNs {
+ function __promisify__(hostname: string): Promise;
+ }
+
+ function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
+ namespace resolvePtr {
+ function __promisify__(hostname: string): Promise;
+ }
+
+ function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
+ namespace resolveSoa {
+ function __promisify__(hostname: string): Promise;
+ }
+
+ function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
+ namespace resolveSrv {
+ function __promisify__(hostname: string): Promise;
+ }
+
+ function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
+ namespace resolveTxt {
+ function __promisify__(hostname: string): Promise;
+ }
+
+ function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
+ namespace resolveAny {
+ function __promisify__(hostname: string): Promise;
+ }
+
+ function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
+ function setServers(servers: ReadonlyArray): void;
+ function getServers(): string[];
+
+ // Error codes
+ const NODATA: string;
+ const FORMERR: string;
+ const SERVFAIL: string;
+ const NOTFOUND: string;
+ const NOTIMP: string;
+ const REFUSED: string;
+ const BADQUERY: string;
+ const BADNAME: string;
+ const BADFAMILY: string;
+ const BADRESP: string;
+ const CONNREFUSED: string;
+ const TIMEOUT: string;
+ const EOF: string;
+ const FILE: string;
+ const NOMEM: string;
+ const DESTRUCTION: string;
+ const BADSTR: string;
+ const BADFLAGS: string;
+ const NONAME: string;
+ const BADHINTS: string;
+ const NOTINITIALIZED: string;
+ const LOADIPHLPAPI: string;
+ const ADDRGETNETWORKPARAMS: string;
+ const CANCELLED: string;
+
+ class Resolver {
+ getServers: typeof getServers;
+ setServers: typeof setServers;
+ resolve: typeof resolve;
+ resolve4: typeof resolve4;
+ resolve6: typeof resolve6;
+ resolveAny: typeof resolveAny;
+ resolveCname: typeof resolveCname;
+ resolveMx: typeof resolveMx;
+ resolveNaptr: typeof resolveNaptr;
+ resolveNs: typeof resolveNs;
+ resolvePtr: typeof resolvePtr;
+ resolveSoa: typeof resolveSoa;
+ resolveSrv: typeof resolveSrv;
+ resolveTxt: typeof resolveTxt;
+ reverse: typeof reverse;
+ cancel(): void;
+ }
+
+ namespace promises {
+ function getServers(): string[];
+
+ function lookup(hostname: string, family: number): Promise;
+ function lookup(hostname: string, options: LookupOneOptions): Promise;
+ function lookup(hostname: string, options: LookupAllOptions): Promise;
+ function lookup(hostname: string, options: LookupOptions): Promise;
+ function lookup(hostname: string): Promise;
+
+ function lookupService(address: string, port: number): Promise<{ hostname: string, service: string }>;
+
+ function resolve(hostname: string): Promise;
+ function resolve(hostname: string, rrtype: "A"): Promise;
+ function resolve(hostname: string, rrtype: "AAAA"): Promise;
+ function resolve(hostname: string, rrtype: "ANY"): Promise;
+ function resolve(hostname: string, rrtype: "CNAME"): Promise;
+ function resolve(hostname: string, rrtype: "MX"): Promise;
+ function resolve(hostname: string, rrtype: "NAPTR"): Promise;
+ function resolve(hostname: string, rrtype: "NS"): Promise;
+ function resolve(hostname: string, rrtype: "PTR"): Promise;
+ function resolve(hostname: string, rrtype: "SOA"): Promise;
+ function resolve(hostname: string, rrtype: "SRV"): Promise;
+ function resolve(hostname: string, rrtype: "TXT"): Promise;
+ function resolve(hostname: string, rrtype: string): Promise;
+
+ function resolve4(hostname: string): Promise;
+ function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise;
+ function resolve4(hostname: string, options: ResolveOptions): Promise;
+
+ function resolve6(hostname: string): Promise;
+ function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise;
+ function resolve6(hostname: string, options: ResolveOptions): Promise;
+
+ function resolveAny(hostname: string): Promise;
+
+ function resolveCname(hostname: string): Promise;
+
+ function resolveMx(hostname: string): Promise;
+
+ function resolveNaptr(hostname: string): Promise;
+
+ function resolveNs(hostname: string): Promise;
+
+ function resolvePtr(hostname: string): Promise;
+
+ function resolveSoa(hostname: string): Promise;
+
+ function resolveSrv(hostname: string): Promise;
+
+ function resolveTxt(hostname: string): Promise;
+
+ function reverse(ip: string): Promise;
+
+ function setServers(servers: ReadonlyArray): void;
+
+ class Resolver {
+ getServers: typeof getServers;
+ resolve: typeof resolve;
+ resolve4: typeof resolve4;
+ resolve6: typeof resolve6;
+ resolveAny: typeof resolveAny;
+ resolveCname: typeof resolveCname;
+ resolveMx: typeof resolveMx;
+ resolveNaptr: typeof resolveNaptr;
+ resolveNs: typeof resolveNs;
+ resolvePtr: typeof resolvePtr;
+ resolveSoa: typeof resolveSoa;
+ resolveSrv: typeof resolveSrv;
+ resolveTxt: typeof resolveTxt;
+ reverse: typeof reverse;
+ setServers: typeof setServers;
+ }
+ }
+}
diff --git a/node_modules/@types/node/domain.d.ts b/node_modules/@types/node/domain.d.ts
new file mode 100644
index 00000000000..6a30decfa56
--- /dev/null
+++ b/node_modules/@types/node/domain.d.ts
@@ -0,0 +1,16 @@
+declare module "domain" {
+ import * as events from "events";
+
+ class Domain extends events.EventEmitter implements NodeJS.Domain {
+ run(fn: Function): void;
+ add(emitter: events.EventEmitter): void;
+ remove(emitter: events.EventEmitter): void;
+ bind(cb: (err: Error, data: any) => any): any;
+ intercept(cb: (data: any) => any): any;
+ members: any[];
+ enter(): void;
+ exit(): void;
+ }
+
+ function create(): Domain;
+}
diff --git a/node_modules/@types/node/events.d.ts b/node_modules/@types/node/events.d.ts
new file mode 100644
index 00000000000..71684f4103b
--- /dev/null
+++ b/node_modules/@types/node/events.d.ts
@@ -0,0 +1,39 @@
+declare module "events" {
+ class internal extends NodeJS.EventEmitter { }
+
+ interface NodeEventTarget {
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
+ }
+
+ interface DOMEventTarget {
+ addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any;
+ }
+
+ namespace internal {
+ function once(emitter: NodeEventTarget, event: string | symbol): Promise;
+ function once(emitter: DOMEventTarget, event: string): Promise;
+ class EventEmitter extends internal {
+ /** @deprecated since v4.0.0 */
+ static listenerCount(emitter: EventEmitter, event: string | symbol): number;
+ static defaultMaxListeners: number;
+
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
+ off(event: string | symbol, listener: (...args: any[]) => void): this;
+ removeAllListeners(event?: string | symbol): this;
+ setMaxListeners(n: number): this;
+ getMaxListeners(): number;
+ listeners(event: string | symbol): Function[];
+ rawListeners(event: string | symbol): Function[];
+ emit(event: string | symbol, ...args: any[]): boolean;
+ eventNames(): Array;
+ listenerCount(type: string | symbol): number;
+ }
+ }
+
+ export = internal;
+}
diff --git a/node_modules/@types/node/fs.d.ts b/node_modules/@types/node/fs.d.ts
new file mode 100644
index 00000000000..ba6c999add0
--- /dev/null
+++ b/node_modules/@types/node/fs.d.ts
@@ -0,0 +1,2302 @@
+declare module "fs" {
+ import * as stream from "stream";
+ import * as events from "events";
+ import { URL } from "url";
+
+ /**
+ * Valid types for path values in "fs".
+ */
+ type PathLike = string | Buffer | URL;
+
+ type BinaryData = Buffer | DataView | NodeJS.TypedArray;
+ class Stats {
+ isFile(): boolean;
+ isDirectory(): boolean;
+ isBlockDevice(): boolean;
+ isCharacterDevice(): boolean;
+ isSymbolicLink(): boolean;
+ isFIFO(): boolean;
+ isSocket(): boolean;
+ dev: number;
+ ino: number;
+ mode: number;
+ nlink: number;
+ uid: number;
+ gid: number;
+ rdev: number;
+ size: number;
+ blksize: number;
+ blocks: number;
+ atimeMs: number;
+ mtimeMs: number;
+ ctimeMs: number;
+ birthtimeMs: number;
+ atime: Date;
+ mtime: Date;
+ ctime: Date;
+ birthtime: Date;
+ }
+
+ class Dirent {
+ isFile(): boolean;
+ isDirectory(): boolean;
+ isBlockDevice(): boolean;
+ isCharacterDevice(): boolean;
+ isSymbolicLink(): boolean;
+ isFIFO(): boolean;
+ isSocket(): boolean;
+ name: string;
+ }
+
+ interface FSWatcher extends events.EventEmitter {
+ close(): void;
+
+ /**
+ * events.EventEmitter
+ * 1. change
+ * 2. error
+ */
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
+ addListener(event: "error", listener: (error: Error) => void): this;
+ addListener(event: "close", listener: () => void): this;
+
+ on(event: string, listener: (...args: any[]) => void): this;
+ on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
+ on(event: "error", listener: (error: Error) => void): this;
+ on(event: "close", listener: () => void): this;
+
+ once(event: string, listener: (...args: any[]) => void): this;
+ once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
+ once(event: "error", listener: (error: Error) => void): this;
+ once(event: "close", listener: () => void): this;
+
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
+ prependListener(event: "error", listener: (error: Error) => void): this;
+ prependListener(event: "close", listener: () => void): this;
+
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
+ prependOnceListener(event: "error", listener: (error: Error) => void): this;
+ prependOnceListener(event: "close", listener: () => void): this;
+ }
+
+ class ReadStream extends stream.Readable {
+ close(): void;
+ bytesRead: number;
+ path: string | Buffer;
+
+ /**
+ * events.EventEmitter
+ * 1. open
+ * 2. close
+ */
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ addListener(event: "open", listener: (fd: number) => void): this;
+ addListener(event: "close", listener: () => void): this;
+
+ on(event: string, listener: (...args: any[]) => void): this;
+ on(event: "open", listener: (fd: number) => void): this;
+ on(event: "close", listener: () => void): this;
+
+ once(event: string, listener: (...args: any[]) => void): this;
+ once(event: "open", listener: (fd: number) => void): this;
+ once(event: "close", listener: () => void): this;
+
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "open", listener: (fd: number) => void): this;
+ prependListener(event: "close", listener: () => void): this;
+
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "open", listener: (fd: number) => void): this;
+ prependOnceListener(event: "close", listener: () => void): this;
+ }
+
+ class WriteStream extends stream.Writable {
+ close(): void;
+ bytesWritten: number;
+ path: string | Buffer;
+
+ /**
+ * events.EventEmitter
+ * 1. open
+ * 2. close
+ */
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ addListener(event: "open", listener: (fd: number) => void): this;
+ addListener(event: "close", listener: () => void): this;
+
+ on(event: string, listener: (...args: any[]) => void): this;
+ on(event: "open", listener: (fd: number) => void): this;
+ on(event: "close", listener: () => void): this;
+
+ once(event: string, listener: (...args: any[]) => void): this;
+ once(event: "open", listener: (fd: number) => void): this;
+ once(event: "close", listener: () => void): this;
+
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "open", listener: (fd: number) => void): this;
+ prependListener(event: "close", listener: () => void): this;
+
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "open", listener: (fd: number) => void): this;
+ prependOnceListener(event: "close", listener: () => void): this;
+ }
+
+ /**
+ * Asynchronous rename(2) - Change the name or location of a file or directory.
+ * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function rename(oldPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace rename {
+ /**
+ * Asynchronous rename(2) - Change the name or location of a file or directory.
+ * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function __promisify__(oldPath: PathLike, newPath: PathLike): Promise;
+ }
+
+ /**
+ * Synchronous rename(2) - Change the name or location of a file or directory.
+ * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function renameSync(oldPath: PathLike, newPath: PathLike): void;
+
+ /**
+ * Asynchronous truncate(2) - Truncate a file to a specified length.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param len If not specified, defaults to `0`.
+ */
+ function truncate(path: PathLike, len: number | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ /**
+ * Asynchronous truncate(2) - Truncate a file to a specified length.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function truncate(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace truncate {
+ /**
+ * Asynchronous truncate(2) - Truncate a file to a specified length.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param len If not specified, defaults to `0`.
+ */
+ function __promisify__(path: PathLike, len?: number | null): Promise;
+ }
+
+ /**
+ * Synchronous truncate(2) - Truncate a file to a specified length.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param len If not specified, defaults to `0`.
+ */
+ function truncateSync(path: PathLike, len?: number | null): void;
+
+ /**
+ * Asynchronous ftruncate(2) - Truncate a file to a specified length.
+ * @param fd A file descriptor.
+ * @param len If not specified, defaults to `0`.
+ */
+ function ftruncate(fd: number, len: number | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ /**
+ * Asynchronous ftruncate(2) - Truncate a file to a specified length.
+ * @param fd A file descriptor.
+ */
+ function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace ftruncate {
+ /**
+ * Asynchronous ftruncate(2) - Truncate a file to a specified length.
+ * @param fd A file descriptor.
+ * @param len If not specified, defaults to `0`.
+ */
+ function __promisify__(fd: number, len?: number | null): Promise;
+ }
+
+ /**
+ * Synchronous ftruncate(2) - Truncate a file to a specified length.
+ * @param fd A file descriptor.
+ * @param len If not specified, defaults to `0`.
+ */
+ function ftruncateSync(fd: number, len?: number | null): void;
+
+ /**
+ * Asynchronous chown(2) - Change ownership of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function chown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace chown {
+ /**
+ * Asynchronous chown(2) - Change ownership of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function __promisify__(path: PathLike, uid: number, gid: number): Promise;
+ }
+
+ /**
+ * Synchronous chown(2) - Change ownership of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function chownSync(path: PathLike, uid: number, gid: number): void;
+
+ /**
+ * Asynchronous fchown(2) - Change ownership of a file.
+ * @param fd A file descriptor.
+ */
+ function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace fchown {
+ /**
+ * Asynchronous fchown(2) - Change ownership of a file.
+ * @param fd A file descriptor.
+ */
+ function __promisify__(fd: number, uid: number, gid: number): Promise;
+ }
+
+ /**
+ * Synchronous fchown(2) - Change ownership of a file.
+ * @param fd A file descriptor.
+ */
+ function fchownSync(fd: number, uid: number, gid: number): void;
+
+ /**
+ * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function lchown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace lchown {
+ /**
+ * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function __promisify__(path: PathLike, uid: number, gid: number): Promise;
+ }
+
+ /**
+ * Synchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function lchownSync(path: PathLike, uid: number, gid: number): void;
+
+ /**
+ * Asynchronous chmod(2) - Change permissions of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function chmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace chmod {
+ /**
+ * Asynchronous chmod(2) - Change permissions of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function __promisify__(path: PathLike, mode: string | number): Promise;
+ }
+
+ /**
+ * Synchronous chmod(2) - Change permissions of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function chmodSync(path: PathLike, mode: string | number): void;
+
+ /**
+ * Asynchronous fchmod(2) - Change permissions of a file.
+ * @param fd A file descriptor.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function fchmod(fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace fchmod {
+ /**
+ * Asynchronous fchmod(2) - Change permissions of a file.
+ * @param fd A file descriptor.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function __promisify__(fd: number, mode: string | number): Promise;
+ }
+
+ /**
+ * Synchronous fchmod(2) - Change permissions of a file.
+ * @param fd A file descriptor.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function fchmodSync(fd: number, mode: string | number): void;
+
+ /**
+ * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function lchmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace lchmod {
+ /**
+ * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function __promisify__(path: PathLike, mode: string | number): Promise;
+ }
+
+ /**
+ * Synchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function lchmodSync(path: PathLike, mode: string | number): void;
+
+ /**
+ * Asynchronous stat(2) - Get file status.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace stat {
+ /**
+ * Asynchronous stat(2) - Get file status.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function __promisify__(path: PathLike): Promise;
+ }
+
+ /**
+ * Synchronous stat(2) - Get file status.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function statSync(path: PathLike): Stats;
+
+ /**
+ * Asynchronous fstat(2) - Get file status.
+ * @param fd A file descriptor.
+ */
+ function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace fstat {
+ /**
+ * Asynchronous fstat(2) - Get file status.
+ * @param fd A file descriptor.
+ */
+ function __promisify__(fd: number): Promise;
+ }
+
+ /**
+ * Synchronous fstat(2) - Get file status.
+ * @param fd A file descriptor.
+ */
+ function fstatSync(fd: number): Stats;
+
+ /**
+ * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace lstat {
+ /**
+ * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function __promisify__(path: PathLike): Promise;
+ }
+
+ /**
+ * Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function lstatSync(path: PathLike): Stats;
+
+ /**
+ * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
+ * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function link(existingPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace link {
+ /**
+ * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
+ * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function __promisify__(existingPath: PathLike, newPath: PathLike): Promise;
+ }
+
+ /**
+ * Synchronous link(2) - Create a new link (also known as a hard link) to an existing file.
+ * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function linkSync(existingPath: PathLike, newPath: PathLike): void;
+
+ /**
+ * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
+ * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
+ * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
+ * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
+ * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
+ */
+ function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ /**
+ * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
+ * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
+ * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
+ */
+ function symlink(target: PathLike, path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace symlink {
+ /**
+ * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
+ * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
+ * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
+ * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
+ * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
+ */
+ function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise;
+
+ type Type = "dir" | "file" | "junction";
+ }
+
+ /**
+ * Synchronous symlink(2) - Create a new symbolic link to an existing file.
+ * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
+ * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
+ * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
+ * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
+ */
+ function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
+
+ /**
+ * Asynchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readlink(
+ path: PathLike,
+ options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
+ callback: (err: NodeJS.ErrnoException | null, linkString: string) => void
+ ): void;
+
+ /**
+ * Asynchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void;
+
+ /**
+ * Asynchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void;
+
+ /**
+ * Asynchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace readlink {
+ /**
+ * Asynchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise;
+
+ /**
+ * Asynchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise;
+
+ /**
+ * Asynchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise;
+ }
+
+ /**
+ * Synchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readlinkSync(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
+
+ /**
+ * Synchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readlinkSync(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer;
+
+ /**
+ * Synchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readlinkSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
+
+ /**
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function realpath(
+ path: PathLike,
+ options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
+ ): void;
+
+ /**
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
+
+ /**
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
+
+ /**
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace realpath {
+ /**
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise;
+
+ /**
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise;
+
+ /**
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise;
+
+ function native(
+ path: PathLike,
+ options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
+ ): void;
+ function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
+ function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
+ function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
+ }
+
+ /**
+ * Synchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function realpathSync(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
+
+ /**
+ * Synchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function realpathSync(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer;
+
+ /**
+ * Synchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function realpathSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
+
+ namespace realpathSync {
+ function native(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
+ function native(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer;
+ function native(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
+ }
+
+ /**
+ * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function unlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace unlink {
+ /**
+ * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function __promisify__(path: PathLike): Promise;
+ }
+
+ /**
+ * Synchronous unlink(2) - delete a name and possibly the file it refers to.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function unlinkSync(path: PathLike): void;
+
+ /**
+ * Asynchronous rmdir(2) - delete a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function rmdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace rmdir {
+ /**
+ * Asynchronous rmdir(2) - delete a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function __promisify__(path: PathLike): Promise;
+ }
+
+ /**
+ * Synchronous rmdir(2) - delete a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function rmdirSync(path: PathLike): void;
+
+ export interface MakeDirectoryOptions {
+ /**
+ * Indicates whether parent folders should be created.
+ * @default false
+ */
+ recursive?: boolean;
+ /**
+ * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
+ * @default 0o777.
+ */
+ mode?: number;
+ }
+
+ /**
+ * Asynchronous mkdir(2) - create a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
+ */
+ function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ /**
+ * Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function mkdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace mkdir {
+ /**
+ * Asynchronous mkdir(2) - create a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
+ */
+ function __promisify__(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise;
+ }
+
+ /**
+ * Synchronous mkdir(2) - create a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
+ */
+ function mkdirSync(path: PathLike, options?: number | string | MakeDirectoryOptions | null): void;
+
+ /**
+ * Asynchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
+
+ /**
+ * Asynchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void;
+
+ /**
+ * Asynchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void;
+
+ /**
+ * Asynchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
+ */
+ function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace mkdtemp {
+ /**
+ * Asynchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise;
+
+ /**
+ * Asynchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise;
+
+ /**
+ * Asynchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(prefix: string, options?: { encoding?: string | null } | string | null): Promise;
+ }
+
+ /**
+ * Synchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function mkdtempSync(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
+
+ /**
+ * Synchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function mkdtempSync(prefix: string, options: { encoding: "buffer" } | "buffer"): Buffer;
+
+ /**
+ * Synchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function mkdtempSync(prefix: string, options?: { encoding?: string | null } | string | null): string | Buffer;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readdir(
+ path: PathLike,
+ options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null,
+ callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
+ ): void;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readdir(
+ path: PathLike,
+ options: { encoding?: string | null; withFileTypes?: false } | string | undefined | null,
+ callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
+ ): void;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
+ */
+ function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace readdir {
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false }): Promise;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function __promisify__(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options If called with `withFileTypes: true` the result data will be an array of Dirent
+ */
+ function __promisify__(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise;
+ }
+
+ /**
+ * Synchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): string[];
+
+ /**
+ * Synchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Buffer[];
+
+ /**
+ * Synchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readdirSync(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): string[] | Buffer[];
+
+ /**
+ * Synchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
+ */
+ function readdirSync(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Dirent[];
+
+ /**
+ * Asynchronous close(2) - close a file descriptor.
+ * @param fd A file descriptor.
+ */
+ function close(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace close {
+ /**
+ * Asynchronous close(2) - close a file descriptor.
+ * @param fd A file descriptor.
+ */
+ function __promisify__(fd: number): Promise;
+ }
+
+ /**
+ * Synchronous close(2) - close a file descriptor.
+ * @param fd A file descriptor.
+ */
+ function closeSync(fd: number): void;
+
+ /**
+ * Asynchronous open(2) - open and possibly create a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`.
+ */
+ function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
+
+ /**
+ * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace open {
+ /**
+ * Asynchronous open(2) - open and possibly create a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`.
+ */
+ function __promisify__(path: PathLike, flags: string | number, mode?: string | number | null): Promise;
+ }
+
+ /**
+ * Synchronous open(2) - open and possibly create a file, returning a file descriptor..
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`.
+ */
+ function openSync(path: PathLike, flags: string | number, mode?: string | number | null): number;
+
+ /**
+ * Asynchronously change file timestamps of the file referenced by the supplied path.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
+ */
+ function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace utimes {
+ /**
+ * Asynchronously change file timestamps of the file referenced by the supplied path.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
+ */
+ function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise;
+ }
+
+ /**
+ * Synchronously change file timestamps of the file referenced by the supplied path.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
+ */
+ function utimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
+
+ /**
+ * Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
+ */
+ function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace futimes {
+ /**
+ * Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
+ */
+ function __promisify__(fd: number, atime: string | number | Date, mtime: string | number | Date): Promise;
+ }
+
+ /**
+ * Synchronously change file timestamps of the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
+ */
+ function futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void;
+
+ /**
+ * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
+ * @param fd A file descriptor.
+ */
+ function fsync(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace fsync {
+ /**
+ * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
+ * @param fd A file descriptor.
+ */
+ function __promisify__(fd: number): Promise;
+ }
+
+ /**
+ * Synchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
+ * @param fd A file descriptor.
+ */
+ function fsyncSync(fd: number): void;
+
+ /**
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ */
+ function write(
+ fd: number,
+ buffer: TBuffer,
+ offset: number | undefined | null,
+ length: number | undefined | null,
+ position: number | undefined | null,
+ callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
+ ): void;
+
+ /**
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
+ */
+ function write(
+ fd: number,
+ buffer: TBuffer,
+ offset: number | undefined | null,
+ length: number | undefined | null,
+ callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
+ ): void;
+
+ /**
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
+ */
+ function write(
+ fd: number,
+ buffer: TBuffer,
+ offset: number | undefined | null,
+ callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void
+ ): void;
+
+ /**
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ */
+ function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void;
+
+ /**
+ * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ * @param encoding The expected string encoding.
+ */
+ function write(
+ fd: number,
+ string: any,
+ position: number | undefined | null,
+ encoding: string | undefined | null,
+ callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
+ ): void;
+
+ /**
+ * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ */
+ function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
+
+ /**
+ * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
+ */
+ function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace write {
+ /**
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ */
+ function __promisify__(
+ fd: number,
+ buffer?: TBuffer,
+ offset?: number,
+ length?: number,
+ position?: number | null,
+ ): Promise<{ bytesWritten: number, buffer: TBuffer }>;
+
+ /**
+ * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ * @param encoding The expected string encoding.
+ */
+ function __promisify__(fd: number, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>;
+ }
+
+ /**
+ * Synchronously writes `buffer` to the file referenced by the supplied file descriptor, returning the number of bytes written.
+ * @param fd A file descriptor.
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ */
+ function writeSync(fd: number, buffer: BinaryData, offset?: number | null, length?: number | null, position?: number | null): number;
+
+ /**
+ * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written.
+ * @param fd A file descriptor.
+ * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ * @param encoding The expected string encoding.
+ */
+ function writeSync(fd: number, string: any, position?: number | null, encoding?: string | null): number;
+
+ /**
+ * Asynchronously reads data from the file referenced by the supplied file descriptor.
+ * @param fd A file descriptor.
+ * @param buffer The buffer that the data will be written to.
+ * @param offset The offset in the buffer at which to start writing.
+ * @param length The number of bytes to read.
+ * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
+ */
+ function read(
+ fd: number,
+ buffer: TBuffer,
+ offset: number,
+ length: number,
+ position: number | null,
+ callback?: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
+ ): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace read {
+ /**
+ * @param fd A file descriptor.
+ * @param buffer The buffer that the data will be written to.
+ * @param offset The offset in the buffer at which to start writing.
+ * @param length The number of bytes to read.
+ * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
+ */
+ function __promisify__(fd: number, buffer: TBuffer, offset: number, length: number, position: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>;
+ }
+
+ /**
+ * Synchronously reads data from the file referenced by the supplied file descriptor, returning the number of bytes read.
+ * @param fd A file descriptor.
+ * @param buffer The buffer that the data will be written to.
+ * @param offset The offset in the buffer at which to start writing.
+ * @param length The number of bytes to read.
+ * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
+ */
+ function readSync(fd: number, buffer: BinaryData, offset: number, length: number, position: number | null): number;
+
+ /**
+ * Asynchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param options An object that may contain an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
+
+ /**
+ * Asynchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
+
+ /**
+ * Asynchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function readFile(
+ path: PathLike | number,
+ options: { encoding?: string | null; flag?: string; } | string | undefined | null,
+ callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
+ ): void;
+
+ /**
+ * Asynchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ */
+ function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace readFile {
+ /**
+ * Asynchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param options An object that may contain an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise;
+
+ /**
+ * Asynchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function __promisify__(path: PathLike | number, options: { encoding: string; flag?: string; } | string): Promise;
+
+ /**
+ * Asynchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function __promisify__(path: PathLike | number, options?: { encoding?: string | null; flag?: string; } | string | null): Promise;
+ }
+
+ /**
+ * Synchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
+ */
+ function readFileSync(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Buffer;
+
+ /**
+ * Synchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function readFileSync(path: PathLike | number, options: { encoding: string; flag?: string; } | string): string;
+
+ /**
+ * Synchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function readFileSync(path: PathLike | number, options?: { encoding?: string | null; flag?: string; } | string | null): string | Buffer;
+
+ type WriteFileOptions = { encoding?: string | null; mode?: number | string; flag?: string; } | string | null;
+
+ /**
+ * Asynchronously writes data to a file, replacing the file if it already exists.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `mode` is not supplied, the default of `0o666` is used.
+ * If `mode` is a string, it is parsed as an octal integer.
+ * If `flag` is not supplied, the default of `'w'` is used.
+ */
+ function writeFile(path: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ /**
+ * Asynchronously writes data to a file, replacing the file if it already exists.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
+ */
+ function writeFile(path: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace writeFile {
+ /**
+ * Asynchronously writes data to a file, replacing the file if it already exists.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `mode` is not supplied, the default of `0o666` is used.
+ * If `mode` is a string, it is parsed as an octal integer.
+ * If `flag` is not supplied, the default of `'w'` is used.
+ */
+ function __promisify__(path: PathLike | number, data: any, options?: WriteFileOptions): Promise;
+ }
+
+ /**
+ * Synchronously writes data to a file, replacing the file if it already exists.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `mode` is not supplied, the default of `0o666` is used.
+ * If `mode` is a string, it is parsed as an octal integer.
+ * If `flag` is not supplied, the default of `'w'` is used.
+ */
+ function writeFileSync(path: PathLike | number, data: any, options?: WriteFileOptions): void;
+
+ /**
+ * Asynchronously append data to a file, creating the file if it does not exist.
+ * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `mode` is not supplied, the default of `0o666` is used.
+ * If `mode` is a string, it is parsed as an octal integer.
+ * If `flag` is not supplied, the default of `'a'` is used.
+ */
+ function appendFile(file: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ /**
+ * Asynchronously append data to a file, creating the file if it does not exist.
+ * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
+ */
+ function appendFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace appendFile {
+ /**
+ * Asynchronously append data to a file, creating the file if it does not exist.
+ * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `mode` is not supplied, the default of `0o666` is used.
+ * If `mode` is a string, it is parsed as an octal integer.
+ * If `flag` is not supplied, the default of `'a'` is used.
+ */
+ function __promisify__(file: PathLike | number, data: any, options?: WriteFileOptions): Promise;
+ }
+
+ /**
+ * Synchronously append data to a file, creating the file if it does not exist.
+ * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `mode` is not supplied, the default of `0o666` is used.
+ * If `mode` is a string, it is parsed as an octal integer.
+ * If `flag` is not supplied, the default of `'a'` is used.
+ */
+ function appendFileSync(file: PathLike | number, data: any, options?: WriteFileOptions): void;
+
+ /**
+ * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
+ */
+ function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
+
+ /**
+ * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;
+
+ /**
+ * Stop watching for changes on `filename`.
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
+
+ /**
+ * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `persistent` is not supplied, the default of `true` is used.
+ * If `recursive` is not supplied, the default of `false` is used.
+ */
+ function watch(
+ filename: PathLike,
+ options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | BufferEncoding | undefined | null,
+ listener?: (event: string, filename: string) => void,
+ ): FSWatcher;
+
+ /**
+ * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `persistent` is not supplied, the default of `true` is used.
+ * If `recursive` is not supplied, the default of `false` is used.
+ */
+ function watch(filename: PathLike, options: { encoding: "buffer", persistent?: boolean, recursive?: boolean } | "buffer", listener?: (event: string, filename: Buffer) => void): FSWatcher;
+
+ /**
+ * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `persistent` is not supplied, the default of `true` is used.
+ * If `recursive` is not supplied, the default of `false` is used.
+ */
+ function watch(
+ filename: PathLike,
+ options: { encoding?: string | null, persistent?: boolean, recursive?: boolean } | string | null,
+ listener?: (event: string, filename: string | Buffer) => void,
+ ): FSWatcher;
+
+ /**
+ * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function watch(filename: PathLike, listener?: (event: string, filename: string) => any): FSWatcher;
+
+ /**
+ * Asynchronously tests whether or not the given path exists by checking with the file system.
+ * @deprecated
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function exists(path: PathLike, callback: (exists: boolean) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace exists {
+ /**
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function __promisify__(path: PathLike): Promise;
+ }
+
+ /**
+ * Synchronously tests whether or not the given path exists by checking with the file system.
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function existsSync(path: PathLike): boolean;
+
+ namespace constants {
+ // File Access Constants
+
+ /** Constant for fs.access(). File is visible to the calling process. */
+ const F_OK: number;
+
+ /** Constant for fs.access(). File can be read by the calling process. */
+ const R_OK: number;
+
+ /** Constant for fs.access(). File can be written by the calling process. */
+ const W_OK: number;
+
+ /** Constant for fs.access(). File can be executed by the calling process. */
+ const X_OK: number;
+
+ // File Copy Constants
+
+ /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */
+ const COPYFILE_EXCL: number;
+
+ /**
+ * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink.
+ * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used.
+ */
+ const COPYFILE_FICLONE: number;
+
+ /**
+ * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink.
+ * If the underlying platform does not support copy-on-write, then the operation will fail with an error.
+ */
+ const COPYFILE_FICLONE_FORCE: number;
+
+ // File Open Constants
+
+ /** Constant for fs.open(). Flag indicating to open a file for read-only access. */
+ const O_RDONLY: number;
+
+ /** Constant for fs.open(). Flag indicating to open a file for write-only access. */
+ const O_WRONLY: number;
+
+ /** Constant for fs.open(). Flag indicating to open a file for read-write access. */
+ const O_RDWR: number;
+
+ /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */
+ const O_CREAT: number;
+
+ /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */
+ const O_EXCL: number;
+
+ /**
+ * Constant for fs.open(). Flag indicating that if path identifies a terminal device,
+ * opening the path shall not cause that terminal to become the controlling terminal for the process
+ * (if the process does not already have one).
+ */
+ const O_NOCTTY: number;
+
+ /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */
+ const O_TRUNC: number;
+
+ /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */
+ const O_APPEND: number;
+
+ /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */
+ const O_DIRECTORY: number;
+
+ /**
+ * constant for fs.open().
+ * Flag indicating reading accesses to the file system will no longer result in
+ * an update to the atime information associated with the file.
+ * This flag is available on Linux operating systems only.
+ */
+ const O_NOATIME: number;
+
+ /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */
+ const O_NOFOLLOW: number;
+
+ /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */
+ const O_SYNC: number;
+
+ /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */
+ const O_DSYNC: number;
+
+ /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */
+ const O_SYMLINK: number;
+
+ /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */
+ const O_DIRECT: number;
+
+ /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */
+ const O_NONBLOCK: number;
+
+ // File Type Constants
+
+ /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */
+ const S_IFMT: number;
+
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */
+ const S_IFREG: number;
+
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */
+ const S_IFDIR: number;
+
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */
+ const S_IFCHR: number;
+
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */
+ const S_IFBLK: number;
+
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */
+ const S_IFIFO: number;
+
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */
+ const S_IFLNK: number;
+
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */
+ const S_IFSOCK: number;
+
+ // File Mode Constants
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */
+ const S_IRWXU: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */
+ const S_IRUSR: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */
+ const S_IWUSR: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */
+ const S_IXUSR: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */
+ const S_IRWXG: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */
+ const S_IRGRP: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */
+ const S_IWGRP: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */
+ const S_IXGRP: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */
+ const S_IRWXO: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */
+ const S_IROTH: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */
+ const S_IWOTH: number;
+
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */
+ const S_IXOTH: number;
+ }
+
+ /**
+ * Asynchronously tests a user's permissions for the file specified by path.
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function access(path: PathLike, mode: number | undefined, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ /**
+ * Asynchronously tests a user's permissions for the file specified by path.
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function access(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace access {
+ /**
+ * Asynchronously tests a user's permissions for the file specified by path.
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function __promisify__(path: PathLike, mode?: number): Promise;
+ }
+
+ /**
+ * Synchronously tests a user's permissions for the file specified by path.
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function accessSync(path: PathLike, mode?: number): void;
+
+ /**
+ * Returns a new `ReadStream` object.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function createReadStream(path: PathLike, options?: string | {
+ flags?: string;
+ encoding?: string;
+ fd?: number;
+ mode?: number;
+ autoClose?: boolean;
+ start?: number;
+ end?: number;
+ highWaterMark?: number;
+ }): ReadStream;
+
+ /**
+ * Returns a new `WriteStream` object.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function createWriteStream(path: PathLike, options?: string | {
+ flags?: string;
+ encoding?: string;
+ fd?: number;
+ mode?: number;
+ autoClose?: boolean;
+ start?: number;
+ highWaterMark?: number;
+ }): WriteStream;
+
+ /**
+ * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
+ * @param fd A file descriptor.
+ */
+ function fdatasync(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace fdatasync {
+ /**
+ * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
+ * @param fd A file descriptor.
+ */
+ function __promisify__(fd: number): Promise;
+ }
+
+ /**
+ * Synchronous fdatasync(2) - synchronize a file's in-core state with storage device.
+ * @param fd A file descriptor.
+ */
+ function fdatasyncSync(fd: number): void;
+
+ /**
+ * Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
+ * No arguments other than a possible exception are given to the callback function.
+ * Node.js makes no guarantees about the atomicity of the copy operation.
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
+ * to remove the destination.
+ * @param src A path to the source file.
+ * @param dest A path to the destination file.
+ */
+ function copyFile(src: PathLike, dest: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void;
+ /**
+ * Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
+ * No arguments other than a possible exception are given to the callback function.
+ * Node.js makes no guarantees about the atomicity of the copy operation.
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
+ * to remove the destination.
+ * @param src A path to the source file.
+ * @param dest A path to the destination file.
+ * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
+ */
+ function copyFile(src: PathLike, dest: PathLike, flags: number, callback: (err: NodeJS.ErrnoException | null) => void): void;
+
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
+ namespace copyFile {
+ /**
+ * Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
+ * No arguments other than a possible exception are given to the callback function.
+ * Node.js makes no guarantees about the atomicity of the copy operation.
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
+ * to remove the destination.
+ * @param src A path to the source file.
+ * @param dest A path to the destination file.
+ * @param flags An optional integer that specifies the behavior of the copy operation.
+ * The only supported flag is fs.constants.COPYFILE_EXCL,
+ * which causes the copy operation to fail if dest already exists.
+ */
+ function __promisify__(src: PathLike, dst: PathLike, flags?: number): Promise;
+ }
+
+ /**
+ * Synchronously copies src to dest. By default, dest is overwritten if it already exists.
+ * Node.js makes no guarantees about the atomicity of the copy operation.
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
+ * to remove the destination.
+ * @param src A path to the source file.
+ * @param dest A path to the destination file.
+ * @param flags An optional integer that specifies the behavior of the copy operation.
+ * The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
+ */
+ function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void;
+
+ namespace promises {
+ interface FileHandle {
+ /**
+ * Gets the file descriptor for this file handle.
+ */
+ readonly fd: number;
+
+ /**
+ * Asynchronously append data to a file, creating the file if it does not exist. The underlying file will _not_ be closed automatically.
+ * The `FileHandle` must have been opened for appending.
+ * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `mode` is not supplied, the default of `0o666` is used.
+ * If `mode` is a string, it is parsed as an octal integer.
+ * If `flag` is not supplied, the default of `'a'` is used.
+ */
+ appendFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise;
+
+ /**
+ * Asynchronous fchown(2) - Change ownership of a file.
+ */
+ chown(uid: number, gid: number): Promise;
+
+ /**
+ * Asynchronous fchmod(2) - Change permissions of a file.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ chmod(mode: string | number): Promise;
+
+ /**
+ * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
+ */
+ datasync(): Promise;
+
+ /**
+ * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
+ */
+ sync(): Promise;
+
+ /**
+ * Asynchronously reads data from the file.
+ * The `FileHandle` must have been opened for reading.
+ * @param buffer The buffer that the data will be written to.
+ * @param offset The offset in the buffer at which to start writing.
+ * @param length The number of bytes to read.
+ * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
+ */
+ read(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>;
+
+ /**
+ * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
+ * The `FileHandle` must have been opened for reading.
+ * @param options An object that may contain an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ readFile(options?: { encoding?: null, flag?: string | number } | null): Promise;
+
+ /**
+ * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
+ * The `FileHandle` must have been opened for reading.
+ * @param options An object that may contain an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ readFile(options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise;
+
+ /**
+ * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
+ * The `FileHandle` must have been opened for reading.
+ * @param options An object that may contain an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ readFile(options?: { encoding?: string | null, flag?: string | number } | string | null): Promise;
+
+ /**
+ * Asynchronous fstat(2) - Get file status.
+ */
+ stat(): Promise;
+
+ /**
+ * Asynchronous ftruncate(2) - Truncate a file to a specified length.
+ * @param len If not specified, defaults to `0`.
+ */
+ truncate(len?: number): Promise;
+
+ /**
+ * Asynchronously change file timestamps of the file.
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
+ */
+ utimes(atime: string | number | Date, mtime: string | number | Date): Promise;
+
+ /**
+ * Asynchronously writes `buffer` to the file.
+ * The `FileHandle` must have been opened for writing.
+ * @param buffer The buffer that the data will be written to.
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ */
+ write(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
+
+ /**
+ * Asynchronously writes `string` to the file.
+ * The `FileHandle` must have been opened for writing.
+ * It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise`
+ * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
+ * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ * @param encoding The expected string encoding.
+ */
+ write(data: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>;
+
+ /**
+ * Asynchronously writes data to a file, replacing the file if it already exists. The underlying file will _not_ be closed automatically.
+ * The `FileHandle` must have been opened for writing.
+ * It is unsafe to call `writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected).
+ * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `mode` is not supplied, the default of `0o666` is used.
+ * If `mode` is a string, it is parsed as an octal integer.
+ * If `flag` is not supplied, the default of `'w'` is used.
+ */
+ writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise;
+
+ /**
+ * Asynchronous close(2) - close a `FileHandle`.
+ */
+ close(): Promise;
+ }
+
+ /**
+ * Asynchronously tests a user's permissions for the file specified by path.
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function access(path: PathLike, mode?: number): Promise;
+
+ /**
+ * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists.
+ * Node.js makes no guarantees about the atomicity of the copy operation.
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
+ * to remove the destination.
+ * @param src A path to the source file.
+ * @param dest A path to the destination file.
+ * @param flags An optional integer that specifies the behavior of the copy operation. The only
+ * supported flag is `fs.constants.COPYFILE_EXCL`, which causes the copy operation to fail if
+ * `dest` already exists.
+ */
+ function copyFile(src: PathLike, dest: PathLike, flags?: number): Promise;
+
+ /**
+ * Asynchronous open(2) - open and possibly create a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not
+ * supplied, defaults to `0o666`.
+ */
+ function open(path: PathLike, flags: string | number, mode?: string | number): Promise;
+
+ /**
+ * Asynchronously reads data from the file referenced by the supplied `FileHandle`.
+ * @param handle A `FileHandle`.
+ * @param buffer The buffer that the data will be written to.
+ * @param offset The offset in the buffer at which to start writing.
+ * @param length The number of bytes to read.
+ * @param position The offset from the beginning of the file from which data should be read. If
+ * `null`, data will be read from the current position.
+ */
+ function read(
+ handle: FileHandle,
+ buffer: TBuffer,
+ offset?: number | null,
+ length?: number | null,
+ position?: number | null,
+ ): Promise<{ bytesRead: number, buffer: TBuffer }>;
+
+ /**
+ * Asynchronously writes `buffer` to the file referenced by the supplied `FileHandle`.
+ * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise`
+ * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
+ * @param handle A `FileHandle`.
+ * @param buffer The buffer that the data will be written to.
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ */
+ function write(
+ handle: FileHandle,
+ buffer: TBuffer,
+ offset?: number | null,
+ length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
+
+ /**
+ * Asynchronously writes `string` to the file referenced by the supplied `FileHandle`.
+ * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise`
+ * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
+ * @param handle A `FileHandle`.
+ * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
+ * @param encoding The expected string encoding.
+ */
+ function write(handle: FileHandle, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>;
+
+ /**
+ * Asynchronous rename(2) - Change the name or location of a file or directory.
+ * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ */
+ function rename(oldPath: PathLike, newPath: PathLike): Promise;
+
+ /**
+ * Asynchronous truncate(2) - Truncate a file to a specified length.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param len If not specified, defaults to `0`.
+ */
+ function truncate(path: PathLike, len?: number): Promise;
+
+ /**
+ * Asynchronous ftruncate(2) - Truncate a file to a specified length.
+ * @param handle A `FileHandle`.
+ * @param len If not specified, defaults to `0`.
+ */
+ function ftruncate(handle: FileHandle, len?: number): Promise;
+
+ /**
+ * Asynchronous rmdir(2) - delete a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function rmdir(path: PathLike): Promise;
+
+ /**
+ * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
+ * @param handle A `FileHandle`.
+ */
+ function fdatasync(handle: FileHandle): Promise;
+
+ /**
+ * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
+ * @param handle A `FileHandle`.
+ */
+ function fsync(handle: FileHandle): Promise;
+
+ /**
+ * Asynchronous mkdir(2) - create a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
+ */
+ function mkdir(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readdir(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise;
+
+ /**
+ * Asynchronous readdir(3) - read a directory.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
+ */
+ function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise;
+
+ /**
+ * Asynchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise;
+
+ /**
+ * Asynchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise;
+
+ /**
+ * Asynchronous readlink(2) - read value of a symbolic link.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise;
+
+ /**
+ * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
+ * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
+ * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
+ * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
+ * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
+ */
+ function symlink(target: PathLike, path: PathLike, type?: string | null): Promise;
+
+ /**
+ * Asynchronous fstat(2) - Get file status.
+ * @param handle A `FileHandle`.
+ */
+ function fstat(handle: FileHandle): Promise;
+
+ /**
+ * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function lstat(path: PathLike): Promise;
+
+ /**
+ * Asynchronous stat(2) - Get file status.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function stat(path: PathLike): Promise;
+
+ /**
+ * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
+ * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function link(existingPath: PathLike, newPath: PathLike): Promise;
+
+ /**
+ * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function unlink(path: PathLike): Promise;
+
+ /**
+ * Asynchronous fchmod(2) - Change permissions of a file.
+ * @param handle A `FileHandle`.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function fchmod(handle: FileHandle, mode: string | number): Promise;
+
+ /**
+ * Asynchronous chmod(2) - Change permissions of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function chmod(path: PathLike, mode: string | number): Promise;
+
+ /**
+ * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
+ */
+ function lchmod(path: PathLike, mode: string | number): Promise;
+
+ /**
+ * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function lchown(path: PathLike, uid: number, gid: number): Promise;
+
+ /**
+ * Asynchronous fchown(2) - Change ownership of a file.
+ * @param handle A `FileHandle`.
+ */
+ function fchown(handle: FileHandle, uid: number, gid: number): Promise;
+
+ /**
+ * Asynchronous chown(2) - Change ownership of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ */
+ function chown(path: PathLike, uid: number, gid: number): Promise;
+
+ /**
+ * Asynchronously change file timestamps of the file referenced by the supplied path.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
+ */
+ function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise;
+
+ /**
+ * Asynchronously change file timestamps of the file referenced by the supplied `FileHandle`.
+ * @param handle A `FileHandle`.
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
+ */
+ function futimes(handle: FileHandle, atime: string | number | Date, mtime: string | number | Date): Promise;
+
+ /**
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise;
+
+ /**
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise;
+
+ /**
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise;
+
+ /**
+ * Asynchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise;
+
+ /**
+ * Asynchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function mkdtemp(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise;
+
+ /**
+ * Asynchronously creates a unique temporary directory.
+ * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
+ */
+ function mkdtemp(prefix: string, options?: { encoding?: string | null } | string | null): Promise;
+
+ /**
+ * Asynchronously writes data to a file, replacing the file if it already exists.
+ * It is unsafe to call `fsPromises.writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected).
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
+ * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `mode` is not supplied, the default of `0o666` is used.
+ * If `mode` is a string, it is parsed as an octal integer.
+ * If `flag` is not supplied, the default of `'w'` is used.
+ */
+ function writeFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise;
+
+ /**
+ * Asynchronously append data to a file, creating the file if it does not exist.
+ * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * URL support is _experimental_.
+ * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
+ * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
+ * If `mode` is not supplied, the default of `0o666` is used.
+ * If `mode` is a string, it is parsed as an octal integer.
+ * If `flag` is not supplied, the default of `'a'` is used.
+ */
+ function appendFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise;
+
+ /**
+ * Asynchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
+ * @param options An object that may contain an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: string | number } | null): Promise;
+
+ /**
+ * Asynchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
+ * @param options An object that may contain an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise;
+
+ /**
+ * Asynchronously reads the entire contents of a file.
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
+ * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
+ * @param options An object that may contain an optional flag.
+ * If a flag is not provided, it defaults to `'r'`.
+ */
+ function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise;
+ }
+}
diff --git a/node_modules/@types/node/globals.d.ts b/node_modules/@types/node/globals.d.ts
new file mode 100644
index 00000000000..41447805a56
--- /dev/null
+++ b/node_modules/@types/node/globals.d.ts
@@ -0,0 +1,1006 @@
+// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
+interface Console {
+ Console: NodeJS.ConsoleConstructor;
+ /**
+ * A simple assertion test that verifies whether `value` is truthy.
+ * If it is not, an `AssertionError` is thrown.
+ * If provided, the error `message` is formatted using `util.format()` and used as the error message.
+ */
+ assert(value: any, message?: string, ...optionalParams: any[]): void;
+ /**
+ * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY.
+ * When `stdout` is not a TTY, this method does nothing.
+ */
+ clear(): void;
+ /**
+ * Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`.
+ */
+ count(label?: string): void;
+ /**
+ * Resets the internal counter specific to `label`.
+ */
+ countReset(label?: string): void;
+ /**
+ * The `console.debug()` function is an alias for {@link console.log()}.
+ */
+ debug(message?: any, ...optionalParams: any[]): void;
+ /**
+ * Uses {@link util.inspect()} on `obj` and prints the resulting string to `stdout`.
+ * This function bypasses any custom `inspect()` function defined on `obj`.
+ */
+ dir(obj: any, options?: NodeJS.InspectOptions): void;
+ /**
+ * This method calls {@link console.log()} passing it the arguments received. Please note that this method does not produce any XML formatting
+ */
+ dirxml(...data: any[]): void;
+ /**
+ * Prints to `stderr` with newline.
+ */
+ error(message?: any, ...optionalParams: any[]): void;
+ /**
+ * Increases indentation of subsequent lines by two spaces.
+ * If one or more `label`s are provided, those are printed first without the additional indentation.
+ */
+ group(...label: any[]): void;
+ /**
+ * The `console.groupCollapsed()` function is an alias for {@link console.group()}.
+ */
+ groupCollapsed(): void;
+ /**
+ * Decreases indentation of subsequent lines by two spaces.
+ */
+ groupEnd(): void;
+ /**
+ * The {@link console.info()} function is an alias for {@link console.log()}.
+ */
+ info(message?: any, ...optionalParams: any[]): void;
+ /**
+ * Prints to `stdout` with newline.
+ */
+ log(message?: any, ...optionalParams: any[]): void;
+ /**
+ * This method does not display anything unless used in the inspector.
+ * Prints to `stdout` the array `array` formatted as a table.
+ */
+ table(tabularData: any, properties?: string[]): void;
+ /**
+ * Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`.
+ */
+ time(label?: string): void;
+ /**
+ * Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`.
+ */
+ timeEnd(label?: string): void;
+ /**
+ * For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`.
+ */
+ timeLog(label?: string, ...data: any[]): void;
+ /**
+ * Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code.
+ */
+ trace(message?: any, ...optionalParams: any[]): void;
+ /**
+ * The {@link console.warn()} function is an alias for {@link console.error()}.
+ */
+ warn(message?: any, ...optionalParams: any[]): void;
+
+ // --- Inspector mode only ---
+ /**
+ * This method does not display anything unless used in the inspector.
+ * The console.markTimeline() method is the deprecated form of console.timeStamp().
+ *
+ * @deprecated Use console.timeStamp() instead.
+ */
+ markTimeline(label?: string): void;
+ /**
+ * This method does not display anything unless used in the inspector.
+ * Starts a JavaScript CPU profile with an optional label.
+ */
+ profile(label?: string): void;
+ /**
+ * This method does not display anything unless used in the inspector.
+ * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
+ */
+ profileEnd(label?: string): void;
+ /**
+ * This method does not display anything unless used in the inspector.
+ * Adds an event with the label `label` to the Timeline panel of the inspector.
+ */
+ timeStamp(label?: string): void;
+ /**
+ * This method does not display anything unless used in the inspector.
+ * The console.timeline() method is the deprecated form of console.time().
+ *
+ * @deprecated Use console.time() instead.
+ */
+ timeline(label?: string): void;
+ /**
+ * This method does not display anything unless used in the inspector.
+ * The console.timelineEnd() method is the deprecated form of console.timeEnd().
+ *
+ * @deprecated Use console.timeEnd() instead.
+ */
+ timelineEnd(label?: string): void;
+}
+
+interface Error {
+ stack?: string;
+}
+
+// Declare "static" methods in Error
+interface ErrorConstructor {
+ /** Create .stack property on a target object */
+ captureStackTrace(targetObject: Object, constructorOpt?: Function): void;
+
+ /**
+ * Optional override for formatting stack traces
+ *
+ * @see https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces
+ */
+ prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
+
+ stackTraceLimit: number;
+}
+
+interface SymbolConstructor {
+ readonly observable: symbol;
+}
+
+// Node.js ESNEXT support
+interface String {
+ /** Removes whitespace from the left end of a string. */
+ trimLeft(): string;
+ /** Removes whitespace from the right end of a string. */
+ trimRight(): string;
+}
+
+/*-----------------------------------------------*
+ * *
+ * GLOBAL *
+ * *
+ ------------------------------------------------*/
+declare var process: NodeJS.Process;
+declare var global: NodeJS.Global;
+declare var console: Console;
+
+declare var __filename: string;
+declare var __dirname: string;
+
+declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
+declare namespace setTimeout {
+ function __promisify__(ms: number): Promise;
+ function __promisify__(ms: number, value: T): Promise;
+}
+declare function clearTimeout(timeoutId: NodeJS.Timeout): void;
+declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
+declare function clearInterval(intervalId: NodeJS.Timeout): void;
+declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate;
+declare namespace setImmediate {
+ function __promisify__(): Promise;
+ function __promisify__(value: T): Promise;
+}
+declare function clearImmediate(immediateId: NodeJS.Immediate): void;
+
+// TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version.
+interface NodeRequireFunction {
+ /* tslint:disable-next-line:callable-types */
+ (id: string): any;
+}
+
+interface NodeRequire extends NodeRequireFunction {
+ resolve: RequireResolve;
+ cache: any;
+ extensions: NodeExtensions;
+ main: NodeModule | undefined;
+}
+
+interface RequireResolve {
+ (id: string, options?: { paths?: string[]; }): string;
+ paths(request: string): string[] | null;
+}
+
+interface NodeExtensions {
+ '.js': (m: NodeModule, filename: string) => any;
+ '.json': (m: NodeModule, filename: string) => any;
+ '.node': (m: NodeModule, filename: string) => any;
+ [ext: string]: (m: NodeModule, filename: string) => any;
+}
+
+declare var require: NodeRequire;
+
+interface NodeModule {
+ exports: any;
+ require: NodeRequireFunction;
+ id: string;
+ filename: string;
+ loaded: boolean;
+ parent: NodeModule | null;
+ children: NodeModule[];
+ paths: string[];
+}
+
+declare var module: NodeModule;
+
+// Same as module.exports
+declare var exports: any;
+
+// Buffer class
+type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex";
+interface Buffer extends Uint8Array {
+ constructor: typeof Buffer;
+ write(string: string, offset?: number, length?: number, encoding?: string): number;
+ toString(encoding?: string, start?: number, end?: number): string;
+ toJSON(): { type: 'Buffer', data: any[] };
+ equals(otherBuffer: Uint8Array): boolean;
+ compare(otherBuffer: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
+ copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
+ slice(start?: number, end?: number): Buffer;
+ writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
+ writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
+ writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
+ writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
+ readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
+ readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
+ readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
+ readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
+ readUInt8(offset: number, noAssert?: boolean): number;
+ readUInt16LE(offset: number, noAssert?: boolean): number;
+ readUInt16BE(offset: number, noAssert?: boolean): number;
+ readUInt32LE(offset: number, noAssert?: boolean): number;
+ readUInt32BE(offset: number, noAssert?: boolean): number;
+ readInt8(offset: number, noAssert?: boolean): number;
+ readInt16LE(offset: number, noAssert?: boolean): number;
+ readInt16BE(offset: number, noAssert?: boolean): number;
+ readInt32LE(offset: number, noAssert?: boolean): number;
+ readInt32BE(offset: number, noAssert?: boolean): number;
+ readFloatLE(offset: number, noAssert?: boolean): number;
+ readFloatBE(offset: number, noAssert?: boolean): number;
+ readDoubleLE(offset: number, noAssert?: boolean): number;
+ readDoubleBE(offset: number, noAssert?: boolean): number;
+ swap16(): Buffer;
+ swap32(): Buffer;
+ swap64(): Buffer;
+ writeUInt8(value: number, offset: number, noAssert?: boolean): number;
+ writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
+ writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
+ writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
+ writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
+ writeInt8(value: number, offset: number, noAssert?: boolean): number;
+ writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
+ writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
+ writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
+ writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
+ writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
+ writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
+ writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
+ writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
+ fill(value: any, offset?: number, end?: number): this;
+ indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: string): number;
+ lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: string): number;
+ entries(): IterableIterator<[number, number]>;
+ includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
+ keys(): IterableIterator