- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
85 lines
2.0 KiB
JavaScript
85 lines
2.0 KiB
JavaScript
'use strict'
|
|
|
|
const DuplexStream = require('readable-stream').Duplex
|
|
const inherits = require('inherits')
|
|
const BufferList = require('./BufferList')
|
|
|
|
function BufferListStream (callback) {
|
|
if (!(this instanceof BufferListStream)) {
|
|
return new BufferListStream(callback)
|
|
}
|
|
|
|
if (typeof callback === 'function') {
|
|
this._callback = callback
|
|
|
|
const piper = function piper (err) {
|
|
if (this._callback) {
|
|
this._callback(err)
|
|
this._callback = null
|
|
}
|
|
}.bind(this)
|
|
|
|
this.on('pipe', function onPipe (src) {
|
|
src.on('error', piper)
|
|
})
|
|
this.on('unpipe', function onUnpipe (src) {
|
|
src.removeListener('error', piper)
|
|
})
|
|
|
|
callback = null
|
|
}
|
|
|
|
BufferList._init.call(this, callback)
|
|
DuplexStream.call(this)
|
|
}
|
|
|
|
inherits(BufferListStream, DuplexStream)
|
|
Object.assign(BufferListStream.prototype, BufferList.prototype)
|
|
|
|
BufferListStream.prototype._new = function _new (callback) {
|
|
return new BufferListStream(callback)
|
|
}
|
|
|
|
BufferListStream.prototype._write = function _write (buf, encoding, callback) {
|
|
this._appendBuffer(buf)
|
|
|
|
if (typeof callback === 'function') {
|
|
callback()
|
|
}
|
|
}
|
|
|
|
BufferListStream.prototype._read = function _read (size) {
|
|
if (!this.length) {
|
|
return this.push(null)
|
|
}
|
|
|
|
size = Math.min(size, this.length)
|
|
this.push(this.slice(0, size))
|
|
this.consume(size)
|
|
}
|
|
|
|
BufferListStream.prototype.end = function end (chunk) {
|
|
DuplexStream.prototype.end.call(this, chunk)
|
|
|
|
if (this._callback) {
|
|
this._callback(null, this.slice())
|
|
this._callback = null
|
|
}
|
|
}
|
|
|
|
BufferListStream.prototype._destroy = function _destroy (err, cb) {
|
|
this._bufs.length = 0
|
|
this.length = 0
|
|
cb(err)
|
|
}
|
|
|
|
BufferListStream.prototype._isBufferList = function _isBufferList (b) {
|
|
return b instanceof BufferListStream || b instanceof BufferList || BufferListStream.isBufferList(b)
|
|
}
|
|
|
|
BufferListStream.isBufferList = BufferList.isBufferList
|
|
|
|
module.exports = BufferListStream
|
|
module.exports.BufferListStream = BufferListStream
|
|
module.exports.BufferList = BufferList
|