- 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
93 lines
2.7 KiB
JavaScript
93 lines
2.7 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', {
|
|
value: true
|
|
});
|
|
exports.default = createCacheKey;
|
|
function _crypto() {
|
|
const data = require('crypto');
|
|
_crypto = function () {
|
|
return data;
|
|
};
|
|
return data;
|
|
}
|
|
function _fs() {
|
|
const data = require('fs');
|
|
_fs = function () {
|
|
return data;
|
|
};
|
|
return data;
|
|
}
|
|
function _path() {
|
|
const data = require('path');
|
|
_path = function () {
|
|
return data;
|
|
};
|
|
return data;
|
|
}
|
|
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
*/
|
|
|
|
// eslint-disable-next-line no-restricted-imports
|
|
|
|
// Should mirror `import('@jest/transform').TransformOptions`
|
|
|
|
// Should mirror `import('@jest/transform').Transformer['getCacheKey']`
|
|
|
|
const {NODE_ENV, BABEL_ENV} = process.env;
|
|
function getGlobalCacheKey(files, values, length) {
|
|
return [
|
|
NODE_ENV,
|
|
BABEL_ENV,
|
|
...values,
|
|
...files.map(file => (0, _fs().readFileSync)(file))
|
|
]
|
|
.reduce(
|
|
(hash, chunk) => hash.update('\0', 'utf8').update(chunk || ''),
|
|
(0, _crypto().createHash)('sha1')
|
|
)
|
|
.digest('hex')
|
|
.substring(0, length);
|
|
}
|
|
function getCacheKeyFunction(globalCacheKey, length) {
|
|
return (sourceText, sourcePath, configString, options) => {
|
|
// Jest 27 passes a single options bag which contains `configString` rather than as a separate argument.
|
|
// We can hide that API difference, though, so this module is usable for both jest@<27 and jest@>=27
|
|
const inferredOptions = options || configString;
|
|
const {config, instrument} = inferredOptions;
|
|
return (0, _crypto().createHash)('sha1')
|
|
.update(globalCacheKey)
|
|
.update('\0', 'utf8')
|
|
.update(sourceText)
|
|
.update('\0', 'utf8')
|
|
.update(
|
|
config.rootDir ? (0, _path().relative)(config.rootDir, sourcePath) : ''
|
|
)
|
|
.update('\0', 'utf8')
|
|
.update(instrument ? 'instrument' : '')
|
|
.digest('hex')
|
|
.substring(0, length);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Returns a function that can be used to generate cache keys based on source code of provided files and provided values.
|
|
*
|
|
* @param files - Array of absolute paths to files whose code should be accounted for when generating cache key
|
|
* @param values - Array of string values that should be accounted for when generating cache key
|
|
* @param length - Length of the resulting key. The default is `32`, or `16` on Windows.
|
|
* @returns A function that can be used to generate cache keys.
|
|
*/
|
|
function createCacheKey(
|
|
files = [],
|
|
values = [],
|
|
length = process.platform === 'win32' ? 16 : 32
|
|
) {
|
|
return getCacheKeyFunction(getGlobalCacheKey(files, values, length), length);
|
|
}
|