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.2.1 to 1.3.0

20

dist/esm/query/client/epics.js

@@ -5,3 +5,3 @@ import { from, fromEvent, Observable, of, timer } from 'rxjs';

import { filterAction } from '../../operators';
const requestProcessor = (action$) => (action, cb) => {
const requestProcessor = (action$, state$) => (action, cb) => {
return new Observable((subscriber) => {

@@ -17,7 +17,11 @@ const { controller, transaction } = action.meta;

}
subscriber.add(action$.pipe(filterAction('cancel')).subscribe(() => {
if (!controller.signal.aborted) {
controller.abort();
subscriber.add(action$
.pipe(filterAction('cancel'), withLatestFrom(state$))
.subscribe(([action, state]) => {
if (!action.payload || action.payload === state.transaction) {
if (!controller.signal.aborted) {
controller.abort();
}
subscriber.complete();
}
subscriber.complete();
}));

@@ -40,3 +44,3 @@ subscriber.add(fromEvent(controller.signal, 'abort').subscribe(() => {

return (action$, state$) => {
const process = requestProcessor(action$);
const process = requestProcessor(action$, state$);
return action$.pipe(filterAction('failure'), withLatestFrom(state$), switchMap(([action, state]) => {

@@ -72,4 +76,4 @@ const { retryCount = 0 } = state;

};
export const handleRequests = (fetch) => (action$) => {
const process = requestProcessor(action$);
export const handleRequests = (fetch) => (action$, state$) => {
const process = requestProcessor(action$, state$);
return action$.pipe(filterAction('request'), switchMap((action) => {

@@ -76,0 +80,0 @@ return process(action, (subscriber) => {

10

dist/esm/query/client/QueryClient.js

@@ -78,8 +78,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
cancel(reason) {
cancel(transaction, reason) {
if (this.value.status !== 'canceled') {
reason !== null && reason !== void 0 ? reason : (reason = `request [${transaction || this.value.transaction}] was canceled!`);
__classPrivateFieldGet(this, _QueryClient_state$, "f").next({
type: 'cancel',
payload: reason || `request [${this.value.transaction}] was canceled!`,
meta: { request: undefined },
payload: transaction,
meta: {
request: undefined,
reason,
},
});

@@ -86,0 +90,0 @@ }

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

import { map } from 'rxjs';
export { default, Query } from './Query';
export const queryValue = (stream) => stream.pipe(map((entry) => entry.value));
//# sourceMappingURL=index.js.map

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

import { firstValueFrom, lastValueFrom, Observable, race, Subject, Subscription, } from 'rxjs';
import { filter, map, take, takeWhile } from 'rxjs/operators';
import { filter, map, take, takeWhile, tap } from 'rxjs/operators';
import { v4 as uuid } from 'uuid';

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

if (refresh) {
race(complete$, cancel$).subscribe(observer);
const cancelTransaction = () => __classPrivateFieldGet(this, _Query_client, "f").cancel(clientOptions.transaction);
observer.add(cancelTransaction);
race(complete$, cancel$)
.pipe(tap(() => observer.remove(cancelTransaction)))
.subscribe(observer);
}

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

@@ -13,4 +13,5 @@ import { ActionError } from '../..';

}>;
export declare type CancelAction<TArgs, TReason = string> = PayloadMetaAction<'cancel', TReason, {
export declare type CancelAction<TArgs, TTransaction = string | undefined> = PayloadMetaAction<'cancel', TTransaction, {
request?: RequestAction<TArgs>;
reason?: string;
}>;

@@ -17,0 +18,0 @@ export declare type FailureAction<TArgs, TType extends Error = Error> = PayloadMetaAction<'failure', ActionError<Action, TType>, {

@@ -23,3 +23,3 @@ import { Observable, Subscription } from 'rxjs';

nextAsync(args?: TArgs, opt?: Partial<QueryClientOptions>): Promise<TType | Error>;
cancel(reason?: string): void;
cancel(transaction?: string, reason?: string): void;
on<TAction extends ActionType<ActionTypes>>(type: TAction, cb: (action: ExtractAction<ActionTypes<TType, TArgs>, TAction>, subject: QueryClient<TType, TArgs>) => void): Subscription;

@@ -26,0 +26,0 @@ complete(): void;

@@ -0,1 +1,4 @@

import { Observable } from 'rxjs';
import Query from './Query';
export { default, Query, QueryCtorOptions, QueryOptions } from './Query';
export declare const queryValue: <TType, TArgs>(stream: Observable<import("./cache").QueryCacheRecord<TType, TArgs>>) => Observable<TType>;

@@ -39,3 +39,3 @@ import { MonoTypeOperatorFunction, Observable } from 'rxjs';

queryAsync(payload: TArgs, opt?: QueryOptions<TType, TArgs> & {
awaitResolve: false;
awaitResolve: boolean;
}): Promise<QueryCacheRecord<TType, TArgs>>;

@@ -42,0 +42,0 @@ complete(): void;

{
"name": "@equinor/fusion-observable",
"version": "1.2.1",
"version": "1.3.0",
"description": "WIP",

@@ -96,3 +96,3 @@ "private": false,

},
"gitHead": "2ad4d827ff390bbc3e45c2962598df918457f6e6"
"gitHead": "21ae1ec0a760c03a0887eced5532de8443274916"
}

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc