- 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.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
'use strict';
|
||
|
||
var $TypeError = require('es-errors/type');
|
||
|
||
var IsFixedLengthArrayBuffer = require('./IsFixedLengthArrayBuffer');
|
||
var IsViewOutOfBounds = require('./IsViewOutOfBounds');
|
||
|
||
var isDataViewWithBufferWitnessRecord = require('../helpers/records/data-view-with-buffer-witness-record');
|
||
|
||
var dataViewBuffer = require('data-view-buffer');
|
||
var dataViewByteLength = require('data-view-byte-length');
|
||
var dataViewByteOffset = require('data-view-byte-offset');
|
||
|
||
// https://262.ecma-international.org/15.0/#sec-getviewbytelength
|
||
|
||
module.exports = function GetViewByteLength(viewRecord) {
|
||
if (!isDataViewWithBufferWitnessRecord(viewRecord)) {
|
||
throw new $TypeError('Assertion failed: `viewRecord` must be a DataView with Buffer Witness Record');
|
||
}
|
||
|
||
if (IsViewOutOfBounds(viewRecord)) {
|
||
throw new $TypeError('Assertion failed: `viewRecord` is out of bounds'); // step 1
|
||
}
|
||
|
||
var view = viewRecord['[[Object]]']; // step 2
|
||
|
||
var isFixed = IsFixedLengthArrayBuffer(dataViewBuffer(view));
|
||
|
||
var viewByteLength = isFixed ? dataViewByteLength(view) : 'AUTO'; // view.[[ByteLength]]
|
||
if (viewByteLength !== 'AUTO') {
|
||
return viewByteLength; // step 3
|
||
}
|
||
|
||
if (isFixed) {
|
||
throw new $TypeError('Assertion failed: DataView’s ArrayBuffer is not fixed length'); // step 4
|
||
}
|
||
|
||
var byteOffset = dataViewByteOffset(view); // step 5
|
||
|
||
var byteLength = viewRecord['[[CachedBufferByteLength]]']; // step 6
|
||
|
||
if (byteLength === 'DETACHED') {
|
||
throw new $TypeError('Assertion failed: DataView’s ArrayBuffer is detached'); // step 7
|
||
}
|
||
|
||
return byteLength - byteOffset; // step 8
|
||
};
|