Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@equinor/fusion-observable

Package Overview
Dependencies
Maintainers
3
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/fusion-observable - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

4

dist/esm/query/cache/QueryCache.js

@@ -6,5 +6,7 @@ import { map } from 'rxjs/operators';

const transaction = state.lastTransaction;
const items = Object.values(state.data);
if (transaction) {
return Object.values(state.data).find((x) => x.transaction === transaction);
return items.find((x) => x.transaction === transaction);
}
return items.sort((a, b) => { var _a, _b; return ((_a = a.updated) !== null && _a !== void 0 ? _a : 0) - ((_b = b.updated) !== null && _b !== void 0 ? _b : 0); }).pop();
};

@@ -11,0 +13,0 @@ export class QueryCache extends ReactiveObservable {

@@ -24,4 +24,4 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {

var _Query_subscription, _Query_client, _Query_cache, _Query_queryQueue$, _Query_generateCacheKey, _Query_validateCacheEntry;
import { firstValueFrom, interval, lastValueFrom, merge, Observable, race, Subject, Subscription, } from 'rxjs';
import { debounce, filter, withLatestFrom, map, take } from 'rxjs/operators';
import { firstValueFrom, lastValueFrom, Observable, race, Subject, Subscription, } from 'rxjs';
import { filter, map, take, takeWhile } from 'rxjs/operators';
import { v4 as uuid } from 'uuid';

@@ -34,3 +34,3 @@ import { filterAction } from '../operators';

constructor(options) {
var _a;
var _a, _b;
super((subscriber) => __classPrivateFieldGet(this, _Query_cache, "f").pipe(map(({ data }) => data)).subscribe(subscriber));

@@ -59,2 +59,3 @@ _Query_subscription.set(this, new Subscription());

}
const queueOperator = (_b = options.queueOperator) !== null && _b !== void 0 ? _b : (() => ($) => $);
__classPrivateFieldGet(this, _Query_subscription, "f").add(__classPrivateFieldGet(this, _Query_client, "f").on('success', (action) => {

@@ -71,7 +72,3 @@ const { payload: value, meta: { request }, } = action;

__classPrivateFieldGet(this, _Query_subscription, "f").add(__classPrivateFieldGet(this, _Query_queryQueue$, "f")
.pipe(withLatestFrom(__classPrivateFieldGet(this, _Query_cache, "f")), debounce(([query, state]) => {
return typeof (options === null || options === void 0 ? void 0 : options.debounce) === 'function'
? options === null || options === void 0 ? void 0 : options.debounce(query.args, state)
: interval(Number(options === null || options === void 0 ? void 0 : options.debounce));
}), map(([value]) => value), filter(() => !__classPrivateFieldGet(this, _Query_client, "f").closed))
.pipe(queueOperator(__classPrivateFieldGet(this, _Query_cache, "f").value), takeWhile(() => !__classPrivateFieldGet(this, _Query_client, "f").closed))
.subscribe(({ args, options }) => __classPrivateFieldGet(this, _Query_client, "f").next(args, options)));

@@ -96,11 +93,7 @@ }

if (refresh) {
this.next(args, clientOptions);
(options === null || options === void 0 ? void 0 : options.skipQueue)
? __classPrivateFieldGet(this, _Query_client, "f").next(args, clientOptions)
: this.next(args, clientOptions);
}
const cancel$ = __classPrivateFieldGet(this, _Query_client, "f").action$.pipe(filterAction('cancel'), filter((x) => { var _a; return ((_a = x.meta.request) === null || _a === void 0 ? void 0 : _a.meta.transaction) === clientOptions.transaction; }));
const skipped$ = __classPrivateFieldGet(this, _Query_queryQueue$, "f").pipe(map((next) => ({
type: 'skipped',
payload: args,
meta: { options, next },
})));
const reject$ = merge(skipped$, cancel$).pipe(map((cause) => {
const cancel$ = __classPrivateFieldGet(this, _Query_client, "f").action$.pipe(filterAction('cancel'), filter((x) => { var _a; return ((_a = x.meta.request) === null || _a === void 0 ? void 0 : _a.meta.transaction) === clientOptions.transaction; }), map((cause) => {
throw new Error('query was canceled', { cause });

@@ -112,3 +105,3 @@ }));

if (refresh) {
race(complete$, reject$).subscribe(observer);
race(complete$, cancel$).subscribe(observer);
}

@@ -115,0 +108,0 @@ else {

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

import { Observable, ObservableInput } from 'rxjs';
import { MonoTypeOperatorFunction, Observable } from 'rxjs';
import { QueryClient, QueryClientCtorOptions, QueryClientOptions } from './client';

@@ -10,6 +10,10 @@ import { QueryCache, QueryCacheRecord, QueryCacheState, QueryCacheStateData } from './cache';

};
declare type Debounce<TType, TArgs = unknown> = ((value: TArgs, data: QueryCacheState<TType, TArgs>) => ObservableInput<unknown>) | number;
declare type QueryQueueItem<TArgs> = {
args: TArgs;
options?: Partial<QueryClientOptions>;
};
export declare type QueryOptions<TType, TArgs = unknown> = {
client?: Partial<QueryClientOptions>;
cache?: Partial<CacheOptions<TType, TArgs>>;
skipQueue?: boolean;
};

@@ -25,3 +29,3 @@ export declare type QueryCtorOptions<TType, TArgs> = {

expire?: number;
debounce?: Debounce<TType, TArgs>;
queueOperator?: (state: QueryCacheState<TType, TArgs>) => MonoTypeOperatorFunction<QueryQueueItem<TArgs>>;
};

@@ -28,0 +32,0 @@ declare type CacheValidator<TType, TArgs> = (entry: QueryCacheRecord<TType, TArgs>, args: TArgs) => boolean;

{
"name": "@equinor/fusion-observable",
"version": "1.1.0",
"description": "WIP",
"private": false,
"keywords": [
"observable",
"react",
"fusion",
"equinor"
],
"homepage": "https://github.com/equinor/fusion-framework/tree/master/packages/observable#readme",
"license": "ISC",
"main": "dist/esm/index.js",
"exports": {
".": "./dist/esm/index.js",
"./operators": "./dist/esm/operators/index.js",
"./query": "./dist/esm/query/index.js",
"./query/actions": "./dist/esm/query/actions.js",
"./query/client": "./dist/esm/query/client/index.js",
"./query/cache": "./dist/esm/query/cache/index.js",
"./react": "./dist/esm/react/index.js"
},
"types": "dist/types/index.d.ts",
"typesVersions": {
"*": {
"operators": [
"dist/types/operators/index.d.ts"
],
"query": [
"dist/types/query/index.d.ts"
],
"query/actions": [
"dist/types/query/actions.d.ts"
],
"query/client": [
"dist/types/query/client/index.d.ts"
],
"query/cache": [
"dist/types/query/cache/index.d.ts"
],
"react": [
"dist/types/react/index.d.ts"
]
}
},
"directories": {
"dist": "dist"
},
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/equinor/fusion-framework.git"
},
"scripts": {
"build": "tsc -b",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "npm test -- --coverage ",
"test:show": "http-server coverage/lcov-report",
"lint": "eslint --ext .ts,.tsx,.js src/",
"lint:fix": "eslint --ext .ts,.tsx,.js src/ --fix"
},
"bugs": {
"url": "https://github.com/equinor/fusion-framework/issues"
},
"dependencies": {
"rxjs": "^7.5.6",
"uuid": "^8.3.2"
},
"devDependencies": {
"@testing-library/react-hooks": "^8.0.1",
"@types/jest": "^27.4.1",
"@types/react": "^17.0.2",
"@types/uuid": "^8.3.4",
"jest": "^27.5.1",
"react": "^17.0.2",
"react-test-renderer": "^17.0.2",
"ts-jest": "^27.1.4",
"typescript": "^4.8.4"
},
"peerDependencies": {
"@types/react": "^16.9.0 || ^17.0.0 || ^18.0.0",
"react": "^16.9.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"gitHead": "cd1b66fb82f94ad95b60c92b3a657a10b9a87756"
"name": "@equinor/fusion-observable",
"version": "1.2.0",
"description": "WIP",
"private": false,
"keywords": [
"observable",
"react",
"fusion",
"equinor"
],
"homepage": "https://github.com/equinor/fusion-framework/tree/master/packages/observable#readme",
"license": "ISC",
"main": "dist/esm/index.js",
"exports": {
".": "./dist/esm/index.js",
"./operators": "./dist/esm/operators/index.js",
"./query": "./dist/esm/query/index.js",
"./query/actions": "./dist/esm/query/actions.js",
"./query/client": "./dist/esm/query/client/index.js",
"./query/cache": "./dist/esm/query/cache/index.js",
"./react": "./dist/esm/react/index.js"
},
"types": "dist/types/index.d.ts",
"typesVersions": {
"*": {
"operators": [
"dist/types/operators/index.d.ts"
],
"query": [
"dist/types/query/index.d.ts"
],
"query/actions": [
"dist/types/query/actions.d.ts"
],
"query/client": [
"dist/types/query/client/index.d.ts"
],
"query/cache": [
"dist/types/query/cache/index.d.ts"
],
"react": [
"dist/types/react/index.d.ts"
]
}
},
"directories": {
"dist": "dist"
},
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/equinor/fusion-framework.git"
},
"scripts": {
"build": "tsc -b",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "npm test -- --coverage ",
"test:show": "http-server coverage/lcov-report",
"lint": "eslint --ext .ts,.tsx,.js src/",
"lint:fix": "eslint --ext .ts,.tsx,.js src/ --fix"
},
"bugs": {
"url": "https://github.com/equinor/fusion-framework/issues"
},
"dependencies": {
"rxjs": "^7.5.6",
"uuid": "^8.3.2"
},
"devDependencies": {
"@testing-library/react-hooks": "^8.0.1",
"@types/jest": "^27.4.1",
"@types/react": "^17.0.2",
"@types/uuid": "^8.3.4",
"jest": "^27.5.1",
"react": "^17.0.2",
"react-test-renderer": "^17.0.2",
"ts-jest": "^27.1.4",
"typescript": "^4.8.4"
},
"peerDependencies": {
"@types/react": "^16.9.0 || ^17.0.0 || ^18.0.0",
"react": "^16.9.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"gitHead": "13033f00659f1a687e31e366625f2fcf8d7cc116"
}

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc