- 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
68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
declare namespace pMap {
|
|
interface Options {
|
|
/**
|
|
Number of concurrently pending promises returned by `mapper`.
|
|
|
|
Must be an integer from 1 and up or `Infinity`.
|
|
|
|
@default Infinity
|
|
*/
|
|
readonly concurrency?: number;
|
|
|
|
/**
|
|
When set to `false`, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an [aggregated error](https://github.com/sindresorhus/aggregate-error) containing all the errors from the rejected promises.
|
|
|
|
@default true
|
|
*/
|
|
readonly stopOnError?: boolean;
|
|
}
|
|
|
|
/**
|
|
Function which is called for every item in `input`. Expected to return a `Promise` or value.
|
|
|
|
@param element - Iterated element.
|
|
@param index - Index of the element in the source array.
|
|
*/
|
|
type Mapper<Element = any, NewElement = unknown> = (
|
|
element: Element,
|
|
index: number
|
|
) => NewElement | Promise<NewElement>;
|
|
}
|
|
|
|
/**
|
|
@param input - Iterated over concurrently in the `mapper` function.
|
|
@param mapper - Function which is called for every item in `input`. Expected to return a `Promise` or value.
|
|
@returns A `Promise` that is fulfilled when all promises in `input` and ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `mapper` in `input` order.
|
|
|
|
@example
|
|
```
|
|
import pMap = require('p-map');
|
|
import got = require('got');
|
|
|
|
const sites = [
|
|
getWebsiteFromUsername('https://sindresorhus'), //=> Promise
|
|
'https://ava.li',
|
|
'https://github.com'
|
|
];
|
|
|
|
(async () => {
|
|
const mapper = async site => {
|
|
const {requestUrl} = await got.head(site);
|
|
return requestUrl;
|
|
};
|
|
|
|
const result = await pMap(sites, mapper, {concurrency: 2});
|
|
|
|
console.log(result);
|
|
//=> ['https://sindresorhus.com/', 'https://ava.li/', 'https://github.com/']
|
|
})();
|
|
```
|
|
*/
|
|
declare function pMap<Element, NewElement>(
|
|
input: Iterable<Element>,
|
|
mapper: pMap.Mapper<Element, NewElement>,
|
|
options?: pMap.Options
|
|
): Promise<NewElement[]>;
|
|
|
|
export = pMap;
|