- 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
72 lines
2.6 KiB
JavaScript
72 lines
2.6 KiB
JavaScript
'use strict';
|
|
|
|
var identity = require('../../nodes/identity.js');
|
|
var Scalar = require('../../nodes/Scalar.js');
|
|
|
|
// If the value associated with a merge key is a single mapping node, each of
|
|
// its key/value pairs is inserted into the current mapping, unless the key
|
|
// already exists in it. If the value associated with the merge key is a
|
|
// sequence, then this sequence is expected to contain mapping nodes and each
|
|
// of these nodes is merged in turn according to its order in the sequence.
|
|
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
const MERGE_KEY = '<<';
|
|
const merge = {
|
|
identify: value => value === MERGE_KEY ||
|
|
(typeof value === 'symbol' && value.description === MERGE_KEY),
|
|
default: 'key',
|
|
tag: 'tag:yaml.org,2002:merge',
|
|
test: /^<<$/,
|
|
resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {
|
|
addToJSMap: addMergeToJSMap
|
|
}),
|
|
stringify: () => MERGE_KEY
|
|
};
|
|
const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
(identity.isScalar(key) &&
|
|
(!key.type || key.type === Scalar.Scalar.PLAIN) &&
|
|
merge.identify(key.value))) &&
|
|
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
function addMergeToJSMap(ctx, map, value) {
|
|
const source = resolveAliasValue(ctx, value);
|
|
if (identity.isSeq(source))
|
|
for (const it of source.items)
|
|
mergeValue(ctx, map, it);
|
|
else if (Array.isArray(source))
|
|
for (const it of source)
|
|
mergeValue(ctx, map, it);
|
|
else
|
|
mergeValue(ctx, map, source);
|
|
}
|
|
function mergeValue(ctx, map, value) {
|
|
const source = resolveAliasValue(ctx, value);
|
|
if (!identity.isMap(source))
|
|
throw new Error('Merge sources must be maps or map aliases');
|
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
for (const [key, value] of srcMap) {
|
|
if (map instanceof Map) {
|
|
if (!map.has(key))
|
|
map.set(key, value);
|
|
}
|
|
else if (map instanceof Set) {
|
|
map.add(key);
|
|
}
|
|
else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
|
Object.defineProperty(map, key, {
|
|
value,
|
|
writable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
function resolveAliasValue(ctx, value) {
|
|
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
}
|
|
|
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
exports.isMergeKey = isMergeKey;
|
|
exports.merge = merge;
|