Initial Sample.
This commit is contained in:
28
graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.d.ts
generated
vendored
Normal file
28
graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { Observer, Subscriber } from "./Observable.js";
|
||||
import { Observable } from "./Observable.js";
|
||||
type MaybeAsync<T> = T | PromiseLike<T>;
|
||||
type Source<T> = MaybeAsync<Observable<T>>;
|
||||
export type ConcastSourcesIterable<T> = Iterable<Source<T>>;
|
||||
export type ConcastSourcesArray<T> = Array<Source<T>>;
|
||||
export declare class Concast<T> extends Observable<T> {
|
||||
private observers;
|
||||
private sub?;
|
||||
constructor(sources: MaybeAsync<ConcastSourcesIterable<T>> | Subscriber<T>);
|
||||
private sources;
|
||||
private start;
|
||||
private deliverLastMessage;
|
||||
addObserver(observer: Observer<T>): void;
|
||||
removeObserver(observer: Observer<T>): void;
|
||||
private resolve;
|
||||
private reject;
|
||||
readonly promise: Promise<T | undefined>;
|
||||
private latest?;
|
||||
private handlers;
|
||||
private nextResultListeners;
|
||||
private notify;
|
||||
beforeNext(callback: NextResultListener): void;
|
||||
cancel: (reason: any) => void;
|
||||
}
|
||||
type NextResultListener = (method: "next" | "error" | "complete", arg?: any) => any;
|
||||
export {};
|
||||
//# sourceMappingURL=Concast.d.ts.map
|
||||
216
graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js
generated
vendored
Normal file
216
graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js
generated
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
import { __extends } from "tslib";
|
||||
import { Observable } from "./Observable.js";
|
||||
import { iterateObserversSafely } from "./iteration.js";
|
||||
import { fixObservableSubclass } from "./subclassing.js";
|
||||
function isPromiseLike(value) {
|
||||
return value && typeof value.then === "function";
|
||||
}
|
||||
// A Concast<T> observable concatenates the given sources into a single
|
||||
// non-overlapping sequence of Ts, automatically unwrapping any promises,
|
||||
// and broadcasts the T elements of that sequence to any number of
|
||||
// subscribers, all without creating a bunch of intermediary Observable
|
||||
// wrapper objects.
|
||||
//
|
||||
// Even though any number of observers can subscribe to the Concast, each
|
||||
// source observable is guaranteed to receive at most one subscribe call,
|
||||
// and the results are multicast to all observers.
|
||||
//
|
||||
// In addition to broadcasting every next/error message to this.observers,
|
||||
// the Concast stores the most recent message using this.latest, so any
|
||||
// new observers can immediately receive the latest message, even if it
|
||||
// was originally delivered in the past. This behavior means we can assume
|
||||
// every active observer in this.observers has received the same most
|
||||
// recent message.
|
||||
//
|
||||
// With the exception of this.latest replay, a Concast is a "hot"
|
||||
// observable in the sense that it does not replay past results from the
|
||||
// beginning of time for each new observer.
|
||||
//
|
||||
// Could we have used some existing RxJS class instead? Concast<T> is
|
||||
// similar to a BehaviorSubject<T>, because it is multicast and redelivers
|
||||
// the latest next/error message to new subscribers. Unlike Subject<T>,
|
||||
// Concast<T> does not expose an Observer<T> interface (this.handlers is
|
||||
// intentionally private), since Concast<T> gets its inputs from the
|
||||
// concatenated sources. If we ever switch to RxJS, there may be some
|
||||
// value in reusing their code, but for now we use zen-observable, which
|
||||
// does not contain any Subject implementations.
|
||||
var Concast = /** @class */ (function (_super) {
|
||||
__extends(Concast, _super);
|
||||
// Not only can the individual elements of the iterable be promises, but
|
||||
// also the iterable itself can be wrapped in a promise.
|
||||
function Concast(sources) {
|
||||
var _this = _super.call(this, function (observer) {
|
||||
_this.addObserver(observer);
|
||||
return function () { return _this.removeObserver(observer); };
|
||||
}) || this;
|
||||
// Active observers receiving broadcast messages. Thanks to this.latest,
|
||||
// we can assume all observers in this Set have received the same most
|
||||
// recent message, though possibly at different times in the past.
|
||||
_this.observers = new Set();
|
||||
_this.promise = new Promise(function (resolve, reject) {
|
||||
_this.resolve = resolve;
|
||||
_this.reject = reject;
|
||||
});
|
||||
// Bound handler functions that can be reused for every internal
|
||||
// subscription.
|
||||
_this.handlers = {
|
||||
next: function (result) {
|
||||
if (_this.sub !== null) {
|
||||
_this.latest = ["next", result];
|
||||
_this.notify("next", result);
|
||||
iterateObserversSafely(_this.observers, "next", result);
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
var sub = _this.sub;
|
||||
if (sub !== null) {
|
||||
// Delay unsubscribing from the underlying subscription slightly,
|
||||
// so that immediately subscribing another observer can keep the
|
||||
// subscription active.
|
||||
if (sub)
|
||||
setTimeout(function () { return sub.unsubscribe(); });
|
||||
_this.sub = null;
|
||||
_this.latest = ["error", error];
|
||||
_this.reject(error);
|
||||
_this.notify("error", error);
|
||||
iterateObserversSafely(_this.observers, "error", error);
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
var _a = _this, sub = _a.sub, _b = _a.sources, sources = _b === void 0 ? [] : _b;
|
||||
if (sub !== null) {
|
||||
// If complete is called before concast.start, this.sources may be
|
||||
// undefined, so we use a default value of [] for sources. That works
|
||||
// here because it falls into the if (!value) {...} block, which
|
||||
// appropriately terminates the Concast, even if this.sources might
|
||||
// eventually have been initialized to a non-empty array.
|
||||
var value = sources.shift();
|
||||
if (!value) {
|
||||
if (sub)
|
||||
setTimeout(function () { return sub.unsubscribe(); });
|
||||
_this.sub = null;
|
||||
if (_this.latest && _this.latest[0] === "next") {
|
||||
_this.resolve(_this.latest[1]);
|
||||
}
|
||||
else {
|
||||
_this.resolve();
|
||||
}
|
||||
_this.notify("complete");
|
||||
// We do not store this.latest = ["complete"], because doing so
|
||||
// discards useful information about the previous next (or
|
||||
// error) message. Instead, if new observers subscribe after
|
||||
// this Concast has completed, they will receive the final
|
||||
// 'next' message (unless there was an error) immediately
|
||||
// followed by a 'complete' message (see addObserver).
|
||||
iterateObserversSafely(_this.observers, "complete");
|
||||
}
|
||||
else if (isPromiseLike(value)) {
|
||||
value.then(function (obs) { return (_this.sub = obs.subscribe(_this.handlers)); }, _this.handlers.error);
|
||||
}
|
||||
else {
|
||||
_this.sub = value.subscribe(_this.handlers);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
_this.nextResultListeners = new Set();
|
||||
// A public way to abort observation and broadcast.
|
||||
_this.cancel = function (reason) {
|
||||
_this.reject(reason);
|
||||
_this.sources = [];
|
||||
_this.handlers.complete();
|
||||
};
|
||||
// Suppress rejection warnings for this.promise, since it's perfectly
|
||||
// acceptable to pay no attention to this.promise if you're consuming
|
||||
// the results through the normal observable API.
|
||||
_this.promise.catch(function (_) { });
|
||||
// If someone accidentally tries to create a Concast using a subscriber
|
||||
// function, recover by creating an Observable from that subscriber and
|
||||
// using it as the source.
|
||||
if (typeof sources === "function") {
|
||||
sources = [new Observable(sources)];
|
||||
}
|
||||
if (isPromiseLike(sources)) {
|
||||
sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error);
|
||||
}
|
||||
else {
|
||||
_this.start(sources);
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
Concast.prototype.start = function (sources) {
|
||||
if (this.sub !== void 0)
|
||||
return;
|
||||
// In practice, sources is most often simply an Array of observables.
|
||||
// TODO Consider using sources[Symbol.iterator]() to take advantage
|
||||
// of the laziness of non-Array iterables.
|
||||
this.sources = Array.from(sources);
|
||||
// Calling this.handlers.complete() kicks off consumption of the first
|
||||
// source observable. It's tempting to do this step lazily in
|
||||
// addObserver, but this.promise can be accessed without calling
|
||||
// addObserver, so consumption needs to begin eagerly.
|
||||
this.handlers.complete();
|
||||
};
|
||||
Concast.prototype.deliverLastMessage = function (observer) {
|
||||
if (this.latest) {
|
||||
var nextOrError = this.latest[0];
|
||||
var method = observer[nextOrError];
|
||||
if (method) {
|
||||
method.call(observer, this.latest[1]);
|
||||
}
|
||||
// If the subscription is already closed, and the last message was
|
||||
// a 'next' message, simulate delivery of the final 'complete'
|
||||
// message again.
|
||||
if (this.sub === null && nextOrError === "next" && observer.complete) {
|
||||
observer.complete();
|
||||
}
|
||||
}
|
||||
};
|
||||
Concast.prototype.addObserver = function (observer) {
|
||||
if (!this.observers.has(observer)) {
|
||||
// Immediately deliver the most recent message, so we can always
|
||||
// be sure all observers have the latest information.
|
||||
this.deliverLastMessage(observer);
|
||||
this.observers.add(observer);
|
||||
}
|
||||
};
|
||||
Concast.prototype.removeObserver = function (observer) {
|
||||
if (this.observers.delete(observer) && this.observers.size < 1) {
|
||||
// In case there are still any listeners in this.nextResultListeners, and
|
||||
// no error or completion has been broadcast yet, make sure those
|
||||
// observers have a chance to run and then remove themselves from
|
||||
// this.observers.
|
||||
this.handlers.complete();
|
||||
}
|
||||
};
|
||||
Concast.prototype.notify = function (method, arg) {
|
||||
var nextResultListeners = this.nextResultListeners;
|
||||
if (nextResultListeners.size) {
|
||||
// Replacing this.nextResultListeners first ensures it does not grow while
|
||||
// we are iterating over it, potentially leading to infinite loops.
|
||||
this.nextResultListeners = new Set();
|
||||
nextResultListeners.forEach(function (listener) { return listener(method, arg); });
|
||||
}
|
||||
};
|
||||
// We need a way to run callbacks just *before* the next result (or error or
|
||||
// completion) is delivered by this Concast, so we can be sure any code that
|
||||
// runs as a result of delivering that result/error observes the effects of
|
||||
// running the callback(s). It was tempting to reuse the Observer type instead
|
||||
// of introducing NextResultListener, but that messes with the sizing and
|
||||
// maintenance of this.observers, and ends up being more code overall.
|
||||
Concast.prototype.beforeNext = function (callback) {
|
||||
var called = false;
|
||||
this.nextResultListeners.add(function (method, arg) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
callback(method, arg);
|
||||
}
|
||||
});
|
||||
};
|
||||
return Concast;
|
||||
}(Observable));
|
||||
export { Concast };
|
||||
// Necessary because the Concast constructor has a different signature
|
||||
// than the Observable constructor.
|
||||
fixObservableSubclass(Concast);
|
||||
//# sourceMappingURL=Concast.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.d.ts
generated
vendored
Normal file
6
graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { Observer, Subscription as ObservableSubscription, Subscriber } from "zen-observable-ts";
|
||||
import { Observable } from "zen-observable-ts";
|
||||
import "symbol-observable";
|
||||
export type { Observer, ObservableSubscription, Subscriber };
|
||||
export { Observable };
|
||||
//# sourceMappingURL=Observable.d.ts.map
|
||||
17
graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js
generated
vendored
Normal file
17
graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Observable } from "zen-observable-ts";
|
||||
// This simplified polyfill attempts to follow the ECMAScript Observable
|
||||
// proposal (https://github.com/zenparsing/es-observable)
|
||||
import "symbol-observable";
|
||||
// The zen-observable package defines Observable.prototype[Symbol.observable]
|
||||
// when Symbol is supported, but RxJS interop depends on also setting this fake
|
||||
// '@@observable' string as a polyfill for Symbol.observable.
|
||||
var prototype = Observable.prototype;
|
||||
var fakeObsSymbol = "@@observable";
|
||||
if (!prototype[fakeObsSymbol]) {
|
||||
// @ts-expect-error
|
||||
prototype[fakeObsSymbol] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
export { Observable };
|
||||
//# sourceMappingURL=Observable.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Observable.js","sourceRoot":"","sources":["../../../src/utilities/observables/Observable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,wEAAwE;AACxE,yDAAyD;AACzD,OAAO,mBAAmB,CAAC;AAI3B,6EAA6E;AAC7E,+EAA+E;AAC/E,6DAA6D;AACrD,IAAA,SAAS,GAAK,UAAU,UAAf,CAAgB;AACjC,IAAM,aAAa,GAAG,cAAwC,CAAC;AAC/D,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC;IAC9B,mBAAmB;IACnB,SAAS,CAAC,aAAa,CAAC,GAAG;QACzB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type {\n Observer,\n Subscription as ObservableSubscription,\n Subscriber,\n} from \"zen-observable-ts\";\nimport { Observable } from \"zen-observable-ts\";\n\n// This simplified polyfill attempts to follow the ECMAScript Observable\n// proposal (https://github.com/zenparsing/es-observable)\nimport \"symbol-observable\";\n\nexport type { Observer, ObservableSubscription, Subscriber };\n\n// The zen-observable package defines Observable.prototype[Symbol.observable]\n// when Symbol is supported, but RxJS interop depends on also setting this fake\n// '@@observable' string as a polyfill for Symbol.observable.\nconst { prototype } = Observable;\nconst fakeObsSymbol = \"@@observable\" as keyof typeof prototype;\nif (!prototype[fakeObsSymbol]) {\n // @ts-expect-error\n prototype[fakeObsSymbol] = function () {\n return this;\n };\n}\n\nexport { Observable };\n"]}
|
||||
3
graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.d.ts
generated
vendored
Normal file
3
graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Observable } from "./Observable.js";
|
||||
export declare function asyncMap<V, R>(observable: Observable<V>, mapFn: (value: V) => R | PromiseLike<R>, catchFn?: (error: any) => R | PromiseLike<R>): Observable<R>;
|
||||
//# sourceMappingURL=asyncMap.d.ts.map
|
||||
44
graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js
generated
vendored
Normal file
44
graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Observable } from "./Observable.js";
|
||||
// Like Observable.prototype.map, except that the mapping function can
|
||||
// optionally return a Promise (or be async).
|
||||
export function asyncMap(observable, mapFn, catchFn) {
|
||||
return new Observable(function (observer) {
|
||||
var promiseQueue = {
|
||||
// Normally we would initialize promiseQueue to Promise.resolve(), but
|
||||
// in this case, for backwards compatibility, we need to be careful to
|
||||
// invoke the first callback synchronously.
|
||||
then: function (callback) {
|
||||
return new Promise(function (resolve) { return resolve(callback()); });
|
||||
},
|
||||
};
|
||||
function makeCallback(examiner, key) {
|
||||
return function (arg) {
|
||||
if (examiner) {
|
||||
var both = function () {
|
||||
// If the observer is closed, we don't want to continue calling the
|
||||
// mapping function - it's result will be swallowed anyways.
|
||||
return observer.closed ?
|
||||
/* will be swallowed */ 0
|
||||
: examiner(arg);
|
||||
};
|
||||
promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); });
|
||||
}
|
||||
else {
|
||||
observer[key](arg);
|
||||
}
|
||||
};
|
||||
}
|
||||
var handler = {
|
||||
next: makeCallback(mapFn, "next"),
|
||||
error: makeCallback(catchFn, "error"),
|
||||
complete: function () {
|
||||
// no need to reassign `promiseQueue`, after `observer.complete`,
|
||||
// the observer will be closed and short-circuit everything anyways
|
||||
/*promiseQueue = */ promiseQueue.then(function () { return observer.complete(); });
|
||||
},
|
||||
};
|
||||
var sub = observable.subscribe(handler);
|
||||
return function () { return sub.unsubscribe(); };
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=asyncMap.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"asyncMap.js","sourceRoot":"","sources":["../../../src/utilities/observables/asyncMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,sEAAsE;AACtE,6CAA6C;AAC7C,MAAM,UAAU,QAAQ,CACtB,UAAyB,EACzB,KAAuC,EACvC,OAA4C;IAE5C,OAAO,IAAI,UAAU,CAAI,UAAC,QAAQ;QAChC,IAAI,YAAY,GAAG;YACjB,sEAAsE;YACtE,sEAAsE;YACtE,2CAA2C;YAC3C,IAAI,YAAC,QAAmB;gBACtB,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,IAAK,OAAA,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAnB,CAAmB,CAAC,CAAC;YACvD,CAAC;SACe,CAAC;QAEnB,SAAS,YAAY,CACnB,QAAuC,EACvC,GAAqB;YAErB,OAAO,UAAC,GAAG;gBACT,IAAI,QAAQ,EAAE,CAAC;oBACb,IAAM,IAAI,GAAG;wBACX,mEAAmE;wBACnE,4DAA4D;wBAC5D,OAAA,QAAQ,CAAC,MAAM,CAAC,CAAC;4BACf,uBAAuB,CAAE,CAAS;4BACpC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;oBAFf,CAEe,CAAC;oBAElB,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAC/C,UAAC,MAAM,IAAK,OAAA,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAArB,CAAqB,EACjC,UAAC,KAAK,IAAK,OAAA,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAArB,CAAqB,CACjC,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;gBACrB,CAAC;YACH,CAAC,CAAC;QACJ,CAAC;QAED,IAAM,OAAO,GAAgB;YAC3B,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC;YACjC,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;YACrC,QAAQ;gBACN,iEAAiE;gBACjE,mEAAmE;gBACnE,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,cAAM,OAAA,QAAQ,CAAC,QAAQ,EAAE,EAAnB,CAAmB,CAAC,CAAC;YACnE,CAAC;SACF,CAAC;QAEF,IAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,cAAM,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Observer } from \"./Observable.js\";\nimport { Observable } from \"./Observable.js\";\n\n// Like Observable.prototype.map, except that the mapping function can\n// optionally return a Promise (or be async).\nexport function asyncMap<V, R>(\n observable: Observable<V>,\n mapFn: (value: V) => R | PromiseLike<R>,\n catchFn?: (error: any) => R | PromiseLike<R>\n): Observable<R> {\n return new Observable<R>((observer) => {\n let promiseQueue = {\n // Normally we would initialize promiseQueue to Promise.resolve(), but\n // in this case, for backwards compatibility, we need to be careful to\n // invoke the first callback synchronously.\n then(callback: () => any) {\n return new Promise((resolve) => resolve(callback()));\n },\n } as Promise<void>;\n\n function makeCallback(\n examiner: typeof mapFn | typeof catchFn,\n key: \"next\" | \"error\"\n ): (arg: any) => void {\n return (arg) => {\n if (examiner) {\n const both = () =>\n // If the observer is closed, we don't want to continue calling the\n // mapping function - it's result will be swallowed anyways.\n observer.closed ?\n /* will be swallowed */ (0 as any)\n : examiner(arg);\n\n promiseQueue = promiseQueue.then(both, both).then(\n (result) => observer.next(result),\n (error) => observer.error(error)\n );\n } else {\n observer[key](arg);\n }\n };\n }\n\n const handler: Observer<V> = {\n next: makeCallback(mapFn, \"next\"),\n error: makeCallback(catchFn, \"error\"),\n complete() {\n // no need to reassign `promiseQueue`, after `observer.complete`,\n // the observer will be closed and short-circuit everything anyways\n /*promiseQueue = */ promiseQueue.then(() => observer.complete());\n },\n };\n\n const sub = observable.subscribe(handler);\n return () => sub.unsubscribe();\n });\n}\n"]}
|
||||
3
graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.d.ts
generated
vendored
Normal file
3
graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Observer } from "./Observable.js";
|
||||
export declare function iterateObserversSafely<E, A>(observers: Set<Observer<E>>, method: keyof Observer<E>, argument?: A): void;
|
||||
//# sourceMappingURL=iteration.d.ts.map
|
||||
9
graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js
generated
vendored
Normal file
9
graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export function iterateObserversSafely(observers, method, argument) {
|
||||
// In case observers is modified during iteration, we need to commit to the
|
||||
// original elements, which also provides an opportunity to filter them down
|
||||
// to just the observers with the given method.
|
||||
var observersWithMethod = [];
|
||||
observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); });
|
||||
observersWithMethod.forEach(function (obs) { return obs[method](argument); });
|
||||
}
|
||||
//# sourceMappingURL=iteration.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"iteration.js","sourceRoot":"","sources":["../../../src/utilities/observables/iteration.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CACpC,SAA2B,EAC3B,MAAyB,EACzB,QAAY;IAEZ,2EAA2E;IAC3E,4EAA4E;IAC5E,+CAA+C;IAC/C,IAAM,mBAAmB,GAAkB,EAAE,CAAC;IAC9C,SAAS,CAAC,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,MAAM,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAA5C,CAA4C,CAAC,CAAC;IACzE,mBAAmB,CAAC,OAAO,CAAC,UAAC,GAAG,IAAK,OAAC,GAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAA9B,CAA8B,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import type { Observer } from \"./Observable.js\";\n\nexport function iterateObserversSafely<E, A>(\n observers: Set<Observer<E>>,\n method: keyof Observer<E>,\n argument?: A\n) {\n // In case observers is modified during iteration, we need to commit to the\n // original elements, which also provides an opportunity to filter them down\n // to just the observers with the given method.\n const observersWithMethod: Observer<E>[] = [];\n observers.forEach((obs) => obs[method] && observersWithMethod.push(obs));\n observersWithMethod.forEach((obs) => (obs as any)[method](argument));\n}\n"]}
|
||||
3
graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.d.ts
generated
vendored
Normal file
3
graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Observable } from "./Observable.js";
|
||||
export declare function fixObservableSubclass<S extends new (...args: any[]) => Observable<any>>(subclass: S): S;
|
||||
//# sourceMappingURL=subclassing.d.ts.map
|
||||
27
graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js
generated
vendored
Normal file
27
graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Observable } from "./Observable.js";
|
||||
import { canUseSymbol } from "../common/canUse.js";
|
||||
// Generic implementations of Observable.prototype methods like map and
|
||||
// filter need to know how to create a new Observable from an Observable
|
||||
// subclass (like Concast or ObservableQuery). Those methods assume
|
||||
// (perhaps unwisely?) that they can call the subtype's constructor with a
|
||||
// Subscriber function, even though the subclass constructor might expect
|
||||
// different parameters. Defining this static Symbol.species property on
|
||||
// the subclass is a hint to generic Observable code to use the default
|
||||
// constructor instead of trying to do `new Subclass(observer => ...)`.
|
||||
export function fixObservableSubclass(subclass) {
|
||||
function set(key) {
|
||||
// Object.defineProperty is necessary because the Symbol.species
|
||||
// property is a getter by default in modern JS environments, so we
|
||||
// can't assign to it with a normal assignment expression.
|
||||
Object.defineProperty(subclass, key, { value: Observable });
|
||||
}
|
||||
if (canUseSymbol && Symbol.species) {
|
||||
set(Symbol.species);
|
||||
}
|
||||
// The "@@species" string is used as a fake Symbol.species value in some
|
||||
// polyfill systems (including the SymbolSpecies variable used by
|
||||
// zen-observable), so we should set it as well, to be safe.
|
||||
set("@@species");
|
||||
return subclass;
|
||||
}
|
||||
//# sourceMappingURL=subclassing.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"subclassing.js","sourceRoot":"","sources":["../../../src/utilities/observables/subclassing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,uEAAuE;AACvE,wEAAwE;AACxE,mEAAmE;AACnE,0EAA0E;AAC1E,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,uEAAuE;AACvE,MAAM,UAAU,qBAAqB,CAEnC,QAAW;IACX,SAAS,GAAG,CAAC,GAAoB;QAC/B,gEAAgE;QAChE,mEAAmE;QACnE,0DAA0D;QAC1D,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,YAAY,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IACD,wEAAwE;IACxE,iEAAiE;IACjE,4DAA4D;IAC5D,GAAG,CAAC,WAAW,CAAC,CAAC;IACjB,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { Observable } from \"./Observable.js\";\nimport { canUseSymbol } from \"../common/canUse.js\";\n\n// Generic implementations of Observable.prototype methods like map and\n// filter need to know how to create a new Observable from an Observable\n// subclass (like Concast or ObservableQuery). Those methods assume\n// (perhaps unwisely?) that they can call the subtype's constructor with a\n// Subscriber function, even though the subclass constructor might expect\n// different parameters. Defining this static Symbol.species property on\n// the subclass is a hint to generic Observable code to use the default\n// constructor instead of trying to do `new Subclass(observer => ...)`.\nexport function fixObservableSubclass<\n S extends new (...args: any[]) => Observable<any>,\n>(subclass: S): S {\n function set(key: symbol | string) {\n // Object.defineProperty is necessary because the Symbol.species\n // property is a getter by default in modern JS environments, so we\n // can't assign to it with a normal assignment expression.\n Object.defineProperty(subclass, key, { value: Observable });\n }\n if (canUseSymbol && Symbol.species) {\n set(Symbol.species);\n }\n // The \"@@species\" string is used as a fake Symbol.species value in some\n // polyfill systems (including the SymbolSpecies variable used by\n // zen-observable), so we should set it as well, to be safe.\n set(\"@@species\");\n return subclass;\n}\n"]}
|
||||
Reference in New Issue
Block a user