- 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
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
'use strict';
|
|
const indentString = require('indent-string');
|
|
const cleanStack = require('clean-stack');
|
|
|
|
const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, '');
|
|
|
|
class AggregateError extends Error {
|
|
constructor(errors) {
|
|
if (!Array.isArray(errors)) {
|
|
throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
|
|
}
|
|
|
|
errors = [...errors].map(error => {
|
|
if (error instanceof Error) {
|
|
return error;
|
|
}
|
|
|
|
if (error !== null && typeof error === 'object') {
|
|
// Handle plain error objects with message property and/or possibly other metadata
|
|
return Object.assign(new Error(error.message), error);
|
|
}
|
|
|
|
return new Error(error);
|
|
});
|
|
|
|
let message = errors
|
|
.map(error => {
|
|
// The `stack` property is not standardized, so we can't assume it exists
|
|
return typeof error.stack === 'string' ? cleanInternalStack(cleanStack(error.stack)) : String(error);
|
|
})
|
|
.join('\n');
|
|
message = '\n' + indentString(message, 4);
|
|
super(message);
|
|
|
|
this.name = 'AggregateError';
|
|
|
|
Object.defineProperty(this, '_errors', {value: errors});
|
|
}
|
|
|
|
* [Symbol.iterator]() {
|
|
for (const error of this._errors) {
|
|
yield error;
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = AggregateError;
|