- 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
97 lines
2.1 KiB
JavaScript
97 lines
2.1 KiB
JavaScript
var Transform = require('readable-stream').Transform
|
|
, inherits = require('util').inherits
|
|
, xtend = require('xtend')
|
|
|
|
function DestroyableTransform(opts) {
|
|
Transform.call(this, opts)
|
|
this._destroyed = false
|
|
}
|
|
|
|
inherits(DestroyableTransform, Transform)
|
|
|
|
DestroyableTransform.prototype.destroy = function(err) {
|
|
if (this._destroyed) return
|
|
this._destroyed = true
|
|
|
|
var self = this
|
|
process.nextTick(function() {
|
|
if (err)
|
|
self.emit('error', err)
|
|
self.emit('close')
|
|
})
|
|
}
|
|
|
|
// a noop _transform function
|
|
function noop (chunk, enc, callback) {
|
|
callback(null, chunk)
|
|
}
|
|
|
|
|
|
// create a new export function, used by both the main export and
|
|
// the .ctor export, contains common logic for dealing with arguments
|
|
function through2 (construct) {
|
|
return function (options, transform, flush) {
|
|
if (typeof options == 'function') {
|
|
flush = transform
|
|
transform = options
|
|
options = {}
|
|
}
|
|
|
|
if (typeof transform != 'function')
|
|
transform = noop
|
|
|
|
if (typeof flush != 'function')
|
|
flush = null
|
|
|
|
return construct(options, transform, flush)
|
|
}
|
|
}
|
|
|
|
|
|
// main export, just make me a transform stream!
|
|
module.exports = through2(function (options, transform, flush) {
|
|
var t2 = new DestroyableTransform(options)
|
|
|
|
t2._transform = transform
|
|
|
|
if (flush)
|
|
t2._flush = flush
|
|
|
|
return t2
|
|
})
|
|
|
|
|
|
// make me a reusable prototype that I can `new`, or implicitly `new`
|
|
// with a constructor call
|
|
module.exports.ctor = through2(function (options, transform, flush) {
|
|
function Through2 (override) {
|
|
if (!(this instanceof Through2))
|
|
return new Through2(override)
|
|
|
|
this.options = xtend(options, override)
|
|
|
|
DestroyableTransform.call(this, this.options)
|
|
}
|
|
|
|
inherits(Through2, DestroyableTransform)
|
|
|
|
Through2.prototype._transform = transform
|
|
|
|
if (flush)
|
|
Through2.prototype._flush = flush
|
|
|
|
return Through2
|
|
})
|
|
|
|
|
|
module.exports.obj = through2(function (options, transform, flush) {
|
|
var t2 = new DestroyableTransform(xtend({ objectMode: true, highWaterMark: 16 }, options))
|
|
|
|
t2._transform = transform
|
|
|
|
if (flush)
|
|
t2._flush = flush
|
|
|
|
return t2
|
|
})
|