Socket
Socket
Sign inDemoInstall

@iot-app-kit/core

Package Overview
Dependencies
147
Maintainers
8
Versions
94
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 10.0.0 to 10.1.0

dist/cjs/data-module/subscription-store/refreshRate.d.ts

2

dist/cjs/common/combineProviders.d.ts
import type { ProviderWithViewport } from './types';
export declare const combineProviders: <Result>(providers: ProviderWithViewport<Result[]>[]) => ProviderWithViewport<Result[]>;
export declare const combineProviders: <Result>(providers: ProviderWithViewport<Result[], import("..").DataStreamQuery>[]) => ProviderWithViewport<Result[], import("..").DataStreamQuery>;
//# sourceMappingURL=combineProviders.d.ts.map
import type { TimeSeriesDataRequest, Viewport } from '../data-module/data-cache/requestTypes';
import type { ComparisonOperator, DataStreamId, StatusIconType, TimeSeriesData } from '../data-module/types';
import type { ComparisonOperator, DataStreamId, DataStreamQuery, StatusIconType, TimeSeriesData } from '../data-module/types';
export type ErrorDetails<T = undefined> = T extends undefined ? {

@@ -17,7 +17,9 @@ msg: string;

}
export interface Provider<Result> {
export interface Provider<Result, Query extends DataStreamQuery = DataStreamQuery> {
subscribe(observer: ProviderObserver<Result>): void;
unsubscribe(): void;
getSubscriptionHash?: () => string;
createSubscriptionHash?: (queries: Query[]) => string;
}
export interface ProviderWithViewport<Result> extends Provider<Result> {
export interface ProviderWithViewport<Result, Query extends DataStreamQuery = DataStreamQuery> extends Provider<Result, Query> {
updateViewport(viewport: Viewport): void;

@@ -24,0 +26,0 @@ }

@@ -16,2 +16,3 @@ "use strict";

var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
let outGoingrequests = 0;
switch (action.type) {

@@ -50,3 +51,4 @@ case dataActions_1.REQUEST: {

isLoading,
isRefreshing: !!(streamStore === null || streamStore === void 0 ? void 0 : streamStore.isRefreshing),
isRefreshing: true,
numOutgoingRequests: ++outGoingrequests,
};

@@ -107,2 +109,3 @@ const newResolutions = numericResolution != 0 && aggregationType

const { data, ...restOfDataStream } = dataStream;
const noOfOutGoingrequest = --outGoingrequests;
const newStreamStore = {

@@ -125,3 +128,4 @@ ...streamStore,

isLoading: false,
isRefreshing: !!restOfDataStream.isRefreshing,
numOutgoingRequests: noOfOutGoingrequest,
isRefreshing: noOfOutGoingrequest > 0,
error: undefined,

@@ -164,2 +168,3 @@ };

isRefreshing: false,
numOutgoingRequests: --outGoingrequests,
};

@@ -166,0 +171,0 @@ const newResolutions = aggregationType

@@ -24,2 +24,3 @@ import { AggregateType } from '@aws-sdk/client-iotsitewise';

error?: ErrorDetails;
numOutgoingRequests?: number;
} & Omit<DataStream, 'data'>;

@@ -26,0 +27,0 @@ export type AggregationStreamStore = {

@@ -5,2 +5,3 @@ import { DataCache } from '../data-cache/dataCacheWrapped';

import type { CacheSettings } from '../data-cache/types';
import * as RefreshRate from './refreshRate';
/**

@@ -23,3 +24,4 @@ * Subscription store

});
addSubscription(subscriptionId: string, subscription: Subscription<Query>): Promise<void>;
getRefreshRate(subscription: Subscription): number;
addSubscription(subscriptionId: string, subscription: Subscription<Query | (Query & RefreshRate.QueryRequestSettings)>): Promise<void>;
updateSubscription(subscriptionId: string, subscriptionUpdate: SubscriptionUpdate<Query>): Promise<void>;

@@ -26,0 +28,0 @@ removeSubscription: (subscriptionId: string) => void;

"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) {

@@ -9,2 +32,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

const caching_1 = require("../data-cache/caching/caching");
const RefreshRate = __importStar(require("./refreshRate"));
/**

@@ -36,4 +60,10 @@ * Subscription store

}
getRefreshRate(subscription) {
var _a, _b;
const refreshRate = ((_a = subscription.queries
.filter(RefreshRate.isQueryWithRequestSettings)
.find((q) => q.requestSettings.refreshRate != null)) === null || _a === void 0 ? void 0 : _a.requestSettings.refreshRate) || ((_b = subscription.request.settings) === null || _b === void 0 ? void 0 : _b.refreshRate);
return RefreshRate.getValidRefreshRate(refreshRate);
}
async addSubscription(subscriptionId, subscription) {
var _a, _b;
if (this.subscriptions[subscriptionId] == null) {

@@ -45,2 +75,3 @@ /**

subscription.fulfill();
const refreshRate = this.getRefreshRate(subscription);
if ('duration' in subscription.request.viewport) {

@@ -51,3 +82,3 @@ /** has a duration, so periodically request for data without a deadline */

cb: () => subscription.fulfill(),
refreshRate: (_a = subscription.request.settings) === null || _a === void 0 ? void 0 : _a.refreshRate,
refreshRate,
});

@@ -60,3 +91,3 @@ }

cb: () => subscription.fulfill(),
refreshRate: (_b = subscription.request.settings) === null || _b === void 0 ? void 0 : _b.refreshRate,
refreshRate,
refreshExpiration: (0, viewport_1.viewportEndDate)(subscription.request.viewport).getTime() +

@@ -63,0 +94,0 @@ Math.max(...subscription.queries.map((query) => (0, caching_1.maxCacheDuration)({

@@ -17,3 +17,3 @@ "use strict";

ttlDurationMapping: {
[1.2 * time_1.MINUTE_IN_MS]: time_1.SECOND_IN_MS * 1.5,
[1.2 * time_1.MINUTE_IN_MS]: time_1.SECOND_IN_MS,
[3 * time_1.MINUTE_IN_MS]: 30 * time_1.SECOND_IN_MS,

@@ -20,0 +20,0 @@ [20 * time_1.MINUTE_IN_MS]: 5 * time_1.MINUTE_IN_MS,

@@ -1,2 +0,2 @@

import { AggregateType } from '@aws-sdk/client-iotsitewise';
import { AggregateType, Quality } from '@aws-sdk/client-iotsitewise';
import type { TimeSeriesDataRequest, Viewport } from './data-cache/requestTypes';

@@ -16,2 +16,3 @@ import type { CacheSettings } from './data-cache/types';

x: Timestamp;
quality?: Quality;
}

@@ -69,2 +70,3 @@ export type Resolution = number;

isRefreshing?: boolean;
numOutgoingRequests?: number;
}

@@ -71,0 +73,0 @@ export type DataSource<Query extends DataStreamQuery = AnyDataStreamQuery> = {

import type { ProviderWithViewport } from './types';
export declare const combineProviders: <Result>(providers: ProviderWithViewport<Result[]>[]) => ProviderWithViewport<Result[]>;
export declare const combineProviders: <Result>(providers: ProviderWithViewport<Result[], import("..").DataStreamQuery>[]) => ProviderWithViewport<Result[], import("..").DataStreamQuery>;
//# sourceMappingURL=combineProviders.d.ts.map
import type { TimeSeriesDataRequest, Viewport } from '../data-module/data-cache/requestTypes';
import type { ComparisonOperator, DataStreamId, StatusIconType, TimeSeriesData } from '../data-module/types';
import type { ComparisonOperator, DataStreamId, DataStreamQuery, StatusIconType, TimeSeriesData } from '../data-module/types';
export type ErrorDetails<T = undefined> = T extends undefined ? {

@@ -17,7 +17,9 @@ msg: string;

}
export interface Provider<Result> {
export interface Provider<Result, Query extends DataStreamQuery = DataStreamQuery> {
subscribe(observer: ProviderObserver<Result>): void;
unsubscribe(): void;
getSubscriptionHash?: () => string;
createSubscriptionHash?: (queries: Query[]) => string;
}
export interface ProviderWithViewport<Result> extends Provider<Result> {
export interface ProviderWithViewport<Result, Query extends DataStreamQuery = DataStreamQuery> extends Provider<Result, Query> {
updateViewport(viewport: Viewport): void;

@@ -24,0 +26,0 @@ }

@@ -13,2 +13,3 @@ import { ERROR, REQUEST, SUCCESS } from './dataActions';

var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
let outGoingrequests = 0;
switch (action.type) {

@@ -47,3 +48,4 @@ case REQUEST: {

isLoading,
isRefreshing: !!(streamStore === null || streamStore === void 0 ? void 0 : streamStore.isRefreshing),
isRefreshing: true,
numOutgoingRequests: ++outGoingrequests,
};

@@ -104,2 +106,3 @@ const newResolutions = numericResolution != 0 && aggregationType

const { data, ...restOfDataStream } = dataStream;
const noOfOutGoingrequest = --outGoingrequests;
const newStreamStore = {

@@ -122,3 +125,4 @@ ...streamStore,

isLoading: false,
isRefreshing: !!restOfDataStream.isRefreshing,
numOutgoingRequests: noOfOutGoingrequest,
isRefreshing: noOfOutGoingrequest > 0,
error: undefined,

@@ -161,2 +165,3 @@ };

isRefreshing: false,
numOutgoingRequests: --outGoingrequests,
};

@@ -163,0 +168,0 @@ const newResolutions = aggregationType

@@ -24,2 +24,3 @@ import { AggregateType } from '@aws-sdk/client-iotsitewise';

error?: ErrorDetails;
numOutgoingRequests?: number;
} & Omit<DataStream, 'data'>;

@@ -26,0 +27,0 @@ export type AggregationStreamStore = {

@@ -5,2 +5,3 @@ import { DataCache } from '../data-cache/dataCacheWrapped';

import type { CacheSettings } from '../data-cache/types';
import * as RefreshRate from './refreshRate';
/**

@@ -23,3 +24,4 @@ * Subscription store

});
addSubscription(subscriptionId: string, subscription: Subscription<Query>): Promise<void>;
getRefreshRate(subscription: Subscription): number;
addSubscription(subscriptionId: string, subscription: Subscription<Query | (Query & RefreshRate.QueryRequestSettings)>): Promise<void>;
updateSubscription(subscriptionId: string, subscriptionUpdate: SubscriptionUpdate<Query>): Promise<void>;

@@ -26,0 +28,0 @@ removeSubscription: (subscriptionId: string) => void;

import RequestScheduler from '../request-scheduler/requestScheduler';
import { viewportEndDate } from '../../common/viewport';
import { maxCacheDuration } from '../data-cache/caching/caching';
import * as RefreshRate from './refreshRate';
/**

@@ -30,4 +31,10 @@ * Subscription store

}
getRefreshRate(subscription) {
var _a, _b;
const refreshRate = ((_a = subscription.queries
.filter(RefreshRate.isQueryWithRequestSettings)
.find((q) => q.requestSettings.refreshRate != null)) === null || _a === void 0 ? void 0 : _a.requestSettings.refreshRate) || ((_b = subscription.request.settings) === null || _b === void 0 ? void 0 : _b.refreshRate);
return RefreshRate.getValidRefreshRate(refreshRate);
}
async addSubscription(subscriptionId, subscription) {
var _a, _b;
if (this.subscriptions[subscriptionId] == null) {

@@ -39,2 +46,3 @@ /**

subscription.fulfill();
const refreshRate = this.getRefreshRate(subscription);
if ('duration' in subscription.request.viewport) {

@@ -45,3 +53,3 @@ /** has a duration, so periodically request for data without a deadline */

cb: () => subscription.fulfill(),
refreshRate: (_a = subscription.request.settings) === null || _a === void 0 ? void 0 : _a.refreshRate,
refreshRate,
});

@@ -54,3 +62,3 @@ }

cb: () => subscription.fulfill(),
refreshRate: (_b = subscription.request.settings) === null || _b === void 0 ? void 0 : _b.refreshRate,
refreshRate,
refreshExpiration: viewportEndDate(subscription.request.viewport).getTime() +

@@ -57,0 +65,0 @@ Math.max(...subscription.queries.map((query) => maxCacheDuration({

@@ -11,3 +11,3 @@ import { v4 } from 'uuid';

ttlDurationMapping: {
[1.2 * MINUTE_IN_MS]: SECOND_IN_MS * 1.5,
[1.2 * MINUTE_IN_MS]: SECOND_IN_MS,
[3 * MINUTE_IN_MS]: 30 * SECOND_IN_MS,

@@ -14,0 +14,0 @@ [20 * MINUTE_IN_MS]: 5 * MINUTE_IN_MS,

@@ -1,2 +0,2 @@

import { AggregateType } from '@aws-sdk/client-iotsitewise';
import { AggregateType, Quality } from '@aws-sdk/client-iotsitewise';
import type { TimeSeriesDataRequest, Viewport } from './data-cache/requestTypes';

@@ -16,2 +16,3 @@ import type { CacheSettings } from './data-cache/types';

x: Timestamp;
quality?: Quality;
}

@@ -69,2 +70,3 @@ export type Resolution = number;

isRefreshing?: boolean;
numOutgoingRequests?: number;
}

@@ -71,0 +73,0 @@ export type DataSource<Query extends DataStreamQuery = AnyDataStreamQuery> = {

@@ -7,3 +7,3 @@ {

},
"version": "10.0.0",
"version": "10.1.0",
"description": "IoT Application Kit core",

@@ -62,8 +62,8 @@ "main": "./dist/cjs/index.js",

"devDependencies": {
"@iot-app-kit/jest-config": "10.0.0",
"@iot-app-kit/ts-config": "10.0.0",
"@iot-app-kit/jest-config": "10.1.0",
"@iot-app-kit/ts-config": "10.1.0",
"@types/d3-array": "^3.0.5",
"@types/jest": "^29.4.0",
"@types/uuid": "^9.0.2",
"eslint-config-iot-app-kit": "10.0.0",
"eslint-config-iot-app-kit": "10.1.0",
"flush-promises": "^1.0.2",

@@ -70,0 +70,0 @@ "jest": "^29.5.0",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc