feat(smart-app): implement complete mobile app MVP

- 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
This commit is contained in:
Eric FELIXINE
2026-06-01 18:00:35 -04:00
parent 08ca495bde
commit e30ae8ed09
35578 changed files with 3703534 additions and 43 deletions

View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,29 @@
<!-- Title -->
<h1 align="center">
👋 Welcome to <br><code>@expo/json-file</code>
</h1>
<p align="center">A library for reading and writing JSON files.</p>
<!-- Body -->
## 🏁 Setup
Install `@expo/json-file` in your project.
```sh
yarn add @expo/json-file
```
## ⚽️ Usage
```ts
import JsonFile, { JSONObject } from '@expo/json-file';
// Create a file instance
const jsonFile = new JsonFile<JSONObject>(filePath);
// Interact with the file
await jsonFile.readAsync();
await jsonFile.writeAsync({ some: 'data' });
```

View File

@@ -0,0 +1,61 @@
export type JSONValue = boolean | number | string | null | JSONArray | JSONObject;
export interface JSONArray extends Array<JSONValue> {
}
export interface JSONObject {
[key: string]: JSONValue | undefined;
}
type Defined<T> = T extends undefined ? never : T;
type Options<TJSONObject extends JSONObject> = {
badJsonDefault?: TJSONObject;
jsonParseErrorDefault?: TJSONObject;
cantReadFileDefault?: TJSONObject;
ensureDir?: boolean;
default?: TJSONObject;
json5?: boolean;
space?: number;
addNewLineAtEOF?: boolean;
};
/**
* The JsonFile class represents the contents of json file.
*
* It's polymorphic on "JSONObject", which is a simple type representing
* and object with string keys and either objects or primitive types as values.
* @type {[type]}
*/
export default class JsonFile<TJSONObject extends JSONObject> {
file: string;
options: Options<TJSONObject>;
static read: typeof read;
static readAsync: typeof readAsync;
static parseJsonString: typeof parseJsonString;
static writeAsync: typeof writeAsync;
static getAsync: typeof getAsync;
static setAsync: typeof setAsync;
static mergeAsync: typeof mergeAsync;
static deleteKeyAsync: typeof deleteKeyAsync;
static deleteKeysAsync: typeof deleteKeysAsync;
static rewriteAsync: typeof rewriteAsync;
constructor(file: string, options?: Options<TJSONObject>);
read(options?: Options<TJSONObject>): TJSONObject;
readAsync(options?: Options<TJSONObject>): Promise<TJSONObject>;
writeAsync(object: TJSONObject, options?: Options<TJSONObject>): Promise<TJSONObject>;
parseJsonString(json: string, options?: Options<TJSONObject>): TJSONObject;
getAsync<K extends keyof TJSONObject, TDefault extends TJSONObject[K] | null>(key: K, defaultValue: TDefault, options?: Options<TJSONObject>): Promise<Defined<TJSONObject[K]> | TDefault>;
setAsync(key: string, value: unknown, options?: Options<TJSONObject>): Promise<TJSONObject>;
mergeAsync(sources: Partial<TJSONObject> | Partial<TJSONObject>[], options?: Options<TJSONObject>): Promise<TJSONObject>;
deleteKeyAsync(key: string, options?: Options<TJSONObject>): Promise<TJSONObject>;
deleteKeysAsync(keys: string[], options?: Options<TJSONObject>): Promise<TJSONObject>;
rewriteAsync(options?: Options<TJSONObject>): Promise<TJSONObject>;
_getOptions(options?: Options<TJSONObject>): Options<TJSONObject>;
}
declare function read<TJSONObject extends JSONObject>(file: string, options?: Options<TJSONObject>): TJSONObject;
declare function readAsync<TJSONObject extends JSONObject>(file: string, options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function parseJsonString<TJSONObject extends JSONObject>(json: string, options?: Options<TJSONObject>, fileName?: string): TJSONObject;
declare function getAsync<TJSONObject extends JSONObject, K extends keyof TJSONObject, DefaultValue>(file: string, key: K, defaultValue: DefaultValue, options?: Options<TJSONObject>): Promise<any>;
declare function writeAsync<TJSONObject extends JSONObject>(file: string, object: TJSONObject, options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function setAsync<TJSONObject extends JSONObject>(file: string, key: string, value: unknown, options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function mergeAsync<TJSONObject extends JSONObject>(file: string, sources: Partial<TJSONObject> | Partial<TJSONObject>[], options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function deleteKeyAsync<TJSONObject extends JSONObject>(file: string, key: string, options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function deleteKeysAsync<TJSONObject extends JSONObject>(file: string, keys: string[], options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function rewriteAsync<TJSONObject extends JSONObject>(file: string, options?: Options<TJSONObject>): Promise<TJSONObject>;
export {};

View File

@@ -0,0 +1,283 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const code_frame_1 = require("@babel/code-frame");
const fs_1 = __importDefault(require("fs"));
const json5_1 = __importDefault(require("json5"));
const path_1 = __importDefault(require("path"));
const util_1 = require("util");
const write_file_atomic_1 = __importDefault(require("write-file-atomic"));
const JsonFileError_1 = __importStar(require("./JsonFileError"));
const writeFileAtomicAsync = (0, util_1.promisify)(write_file_atomic_1.default);
const DEFAULT_OPTIONS = {
badJsonDefault: undefined,
jsonParseErrorDefault: undefined,
cantReadFileDefault: undefined,
ensureDir: false,
default: undefined,
json5: false,
space: 2,
addNewLineAtEOF: true,
};
/**
* The JsonFile class represents the contents of json file.
*
* It's polymorphic on "JSONObject", which is a simple type representing
* and object with string keys and either objects or primitive types as values.
* @type {[type]}
*/
class JsonFile {
file;
options;
static read = read;
static readAsync = readAsync;
static parseJsonString = parseJsonString;
static writeAsync = writeAsync;
static getAsync = getAsync;
static setAsync = setAsync;
static mergeAsync = mergeAsync;
static deleteKeyAsync = deleteKeyAsync;
static deleteKeysAsync = deleteKeysAsync;
static rewriteAsync = rewriteAsync;
constructor(file, options = {}) {
this.file = file;
this.options = options;
}
read(options) {
return read(this.file, this._getOptions(options));
}
async readAsync(options) {
return readAsync(this.file, this._getOptions(options));
}
async writeAsync(object, options) {
return writeAsync(this.file, object, this._getOptions(options));
}
parseJsonString(json, options) {
return parseJsonString(json, options);
}
async getAsync(key, defaultValue, options) {
return getAsync(this.file, key, defaultValue, this._getOptions(options));
}
async setAsync(key, value, options) {
return setAsync(this.file, key, value, this._getOptions(options));
}
async mergeAsync(sources, options) {
return mergeAsync(this.file, sources, this._getOptions(options));
}
async deleteKeyAsync(key, options) {
return deleteKeyAsync(this.file, key, this._getOptions(options));
}
async deleteKeysAsync(keys, options) {
return deleteKeysAsync(this.file, keys, this._getOptions(options));
}
async rewriteAsync(options) {
return rewriteAsync(this.file, this._getOptions(options));
}
_getOptions(options) {
return {
...this.options,
...options,
};
}
}
exports.default = JsonFile;
function read(file, options) {
let json;
try {
json = fs_1.default.readFileSync(file, 'utf8');
}
catch (error) {
assertEmptyJsonString(json, file);
const defaultValue = cantReadFileDefault(options);
if (defaultValue === undefined) {
throw new JsonFileError_1.default(`Can't read JSON file: ${file}`, error, error.code, file);
}
else {
return defaultValue;
}
}
return parseJsonString(json, options, file);
}
async function readAsync(file, options) {
let json;
try {
json = await fs_1.default.promises.readFile(file, 'utf8');
}
catch (error) {
assertEmptyJsonString(json, file);
const defaultValue = cantReadFileDefault(options);
if (defaultValue === undefined) {
throw new JsonFileError_1.default(`Can't read JSON file: ${file}`, error, error.code);
}
else {
return defaultValue;
}
}
return parseJsonString(json, options);
}
function parseJsonString(json, options, fileName) {
assertEmptyJsonString(json, fileName);
try {
if (_getOption(options, 'json5')) {
return json5_1.default.parse(json);
}
else {
return JSON.parse(json);
}
}
catch (e) {
const defaultValue = jsonParseErrorDefault(options);
if (defaultValue === undefined) {
const location = locationFromSyntaxError(e, json);
if (location) {
const codeFrame = (0, code_frame_1.codeFrameColumns)(json, { start: location });
e.codeFrame = codeFrame;
e.message += `\n${codeFrame}`;
}
throw new JsonFileError_1.default(`Error parsing JSON: ${json}`, e, 'EJSONPARSE', fileName);
}
else {
return defaultValue;
}
}
}
async function getAsync(file, key, defaultValue, options) {
const object = await readAsync(file, options);
if (key in object) {
return object[key];
}
if (defaultValue === undefined) {
throw new JsonFileError_1.default(`No value at key path "${String(key)}" in JSON object from: ${file}`);
}
return defaultValue;
}
async function writeAsync(file, object, options) {
if (options?.ensureDir) {
await fs_1.default.promises.mkdir(path_1.default.dirname(file), { recursive: true });
}
const space = _getOption(options, 'space');
const json5 = _getOption(options, 'json5');
const addNewLineAtEOF = _getOption(options, 'addNewLineAtEOF');
let json;
try {
if (json5) {
json = json5_1.default.stringify(object, null, space);
}
else {
json = JSON.stringify(object, null, space);
}
}
catch (e) {
throw new JsonFileError_1.default(`Couldn't JSON.stringify object for file: ${file}`, e);
}
const data = addNewLineAtEOF ? `${json}\n` : json;
await writeFileAtomicAsync(file, data, {});
return object;
}
async function setAsync(file, key, value, options) {
// TODO: Consider implementing some kind of locking mechanism, but
// it's not critical for our use case, so we'll leave it out for now
const object = await readAsync(file, options);
return writeAsync(file, { ...object, [key]: value }, options);
}
async function mergeAsync(file, sources, options) {
const object = await readAsync(file, options);
if (Array.isArray(sources)) {
Object.assign(object, ...sources);
}
else {
Object.assign(object, sources);
}
return writeAsync(file, object, options);
}
async function deleteKeyAsync(file, key, options) {
return deleteKeysAsync(file, [key], options);
}
async function deleteKeysAsync(file, keys, options) {
const object = await readAsync(file, options);
let didDelete = false;
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (object.hasOwnProperty(key)) {
delete object[key];
didDelete = true;
}
}
if (didDelete) {
return writeAsync(file, object, options);
}
return object;
}
async function rewriteAsync(file, options) {
const object = await readAsync(file, options);
return writeAsync(file, object, options);
}
function jsonParseErrorDefault(options = {}) {
if (options.jsonParseErrorDefault === undefined) {
return options.default;
}
else {
return options.jsonParseErrorDefault;
}
}
function cantReadFileDefault(options = {}) {
if (options.cantReadFileDefault === undefined) {
return options.default;
}
else {
return options.cantReadFileDefault;
}
}
function _getOption(options, field) {
if (options) {
if (options[field] !== undefined) {
return options[field];
}
}
return DEFAULT_OPTIONS[field];
}
function locationFromSyntaxError(error, sourceString) {
// JSON5 SyntaxError has lineNumber and columnNumber.
if ('lineNumber' in error && 'columnNumber' in error) {
return { line: error.lineNumber, column: error.columnNumber };
}
// JSON SyntaxError only includes the index in the message.
const match = /at position (\d+)/.exec(error.message);
if (match) {
const index = parseInt(match[1], 10);
const lines = sourceString.slice(0, index + 1).split('\n');
return { line: lines.length, column: lines[lines.length - 1].length };
}
return null;
}
function assertEmptyJsonString(json, file) {
if (json?.trim() === '') {
throw new JsonFileError_1.EmptyJsonFileError(file);
}
}
//# sourceMappingURL=JsonFile.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
/**
* Note that instances of this class do NOT pass `instanceof JsonFileError`.
*/
export default class JsonFileError extends Error {
cause: Error | undefined;
code: string | undefined;
fileName: string | undefined;
isJsonFileError: true;
constructor(message: string, cause?: Error, code?: string, fileName?: string);
}
export declare class EmptyJsonFileError extends JsonFileError {
constructor(fileName?: string);
}

View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmptyJsonFileError = void 0;
/**
* Note that instances of this class do NOT pass `instanceof JsonFileError`.
*/
class JsonFileError extends Error {
cause;
code;
fileName;
isJsonFileError;
constructor(message, cause, code, fileName) {
let fullMessage = message;
if (fileName) {
fullMessage += `\n${cause ? '├' : '└'}─ File: ${fileName}`;
}
if (cause) {
fullMessage += `\n└─ Cause: ${cause.name}: ${cause.message}`;
}
super(fullMessage);
this.name = this.constructor.name;
this.cause = cause;
this.code = code;
this.fileName = fileName;
this.isJsonFileError = true;
}
}
exports.default = JsonFileError;
class EmptyJsonFileError extends JsonFileError {
constructor(fileName) {
super(`Cannot parse an empty JSON string`, undefined, 'EJSONEMPTY', fileName);
}
}
exports.EmptyJsonFileError = EmptyJsonFileError;
//# sourceMappingURL=JsonFileError.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"JsonFileError.js","sourceRoot":"","sources":["../src/JsonFileError.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAqB,aAAc,SAAQ,KAAK;IAC9C,KAAK,CAAoB;IACzB,IAAI,CAAqB;IACzB,QAAQ,CAAqB;IAC7B,eAAe,CAAO;IAEtB,YAAY,OAAe,EAAE,KAAa,EAAE,IAAa,EAAE,QAAiB;QAC1E,IAAI,WAAW,GAAG,OAAO,CAAC;QAC1B,IAAI,QAAQ,EAAE;YACZ,WAAW,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,QAAQ,EAAE,CAAC;SAC5D;QACD,IAAI,KAAK,EAAE;YACT,WAAW,IAAI,eAAe,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;SAC9D;QACD,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AArBD,gCAqBC;AAED,MAAa,kBAAmB,SAAQ,aAAa;IACnD,YAAY,QAAiB;QAC3B,KAAK,CAAC,mCAAmC,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IAChF,CAAC;CACF;AAJD,gDAIC"}

View File

@@ -0,0 +1,47 @@
{
"name": "@expo/json-file",
"version": "8.3.3",
"description": "A module for reading, writing, and manipulating JSON files",
"main": "build/JsonFile.js",
"scripts": {
"build": "expo-module tsc",
"clean": "expo-module clean",
"lint": "expo-module lint",
"prepare": "expo-module clean && expo-module tsc",
"prepublishOnly": "expo-module prepublishOnly",
"test": "expo-module test",
"typecheck": "expo-module typecheck",
"watch": "expo-module tsc --watch --preserveWatchOutput"
},
"repository": {
"type": "git",
"url": "https://github.com/expo/expo.git",
"directory": "packages/@expo/json-file"
},
"keywords": [
"json"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/expo/expo/issues"
},
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/json-file#readme",
"files": [
"build"
],
"dependencies": {
"@babel/code-frame": "~7.10.4",
"json5": "^2.2.2",
"write-file-atomic": "^2.3.0"
},
"devDependencies": {
"@types/babel__code-frame": "^7.0.1",
"@types/json5": "^2.2.0",
"@types/write-file-atomic": "^2.1.1",
"expo-module-scripts": "^3.3.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "ee4f30ef3b5fa567ad1bf94794197f7683fdd481"
}