@apollo/client 3.6.3 → 3.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs +74 -14
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs.native.js +2289 -0
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +2141 -0
- package/errors/errors.cjs.native.js +48 -0
- package/invariantErrorCodes.js +1 -1
- package/link/batch/batch.cjs.native.js +161 -0
- package/link/batch-http/batch-http.cjs.native.js +127 -0
- package/link/context/context.cjs.native.js +38 -0
- package/link/core/core.cjs.native.js +121 -0
- package/link/error/error.cjs.native.js +90 -0
- package/link/http/http.cjs.native.js +320 -0
- package/link/persisted-queries/persisted-queries.cjs.native.js +174 -0
- package/link/retry/retry.cjs.native.js +170 -0
- package/link/schema/schema.cjs.native.js +56 -0
- package/link/subscriptions/subscriptions.cjs.native.js +45 -0
- package/link/utils/utils.cjs.native.js +115 -0
- package/link/ws/ws.cjs.native.js +28 -0
- package/main.cjs.native.js +16 -0
- package/package.json +13 -14
- package/react/components/components.cjs.native.js +79 -0
- package/react/context/context.cjs.native.js +67 -0
- package/react/hoc/hoc.cjs.native.js +325 -0
- package/react/hooks/hooks.cjs +99 -31
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +604 -0
- package/react/hooks/useQuery.js +1 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +17 -7
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSyncExternalStore.d.ts +4 -0
- package/react/hooks/useSyncExternalStore.d.ts.map +1 -0
- package/react/hooks/useSyncExternalStore.js +48 -0
- package/react/hooks/useSyncExternalStore.js.map +1 -0
- package/react/parser/parser.cjs.native.js +103 -0
- package/react/react.cjs.native.js +22 -0
- package/react/ssr/ssr.cjs.native.js +150 -0
- package/testing/core/core.cjs.native.js +288 -0
- package/testing/testing.cjs.native.js +58 -0
- package/utilities/common/canUse.d.ts +2 -0
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +6 -2
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/globals/globals.cjs.native.js +56 -0
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js +5 -2
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +9 -7
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/utilities.cjs +21 -11
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +1284 -0
- package/version.js +1 -1
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var globals = require('../../utilities/globals');
|
|
7
|
+
var graphql = require('graphql');
|
|
8
|
+
var equality = require('@wry/equality');
|
|
9
|
+
var core = require('../../link/core');
|
|
10
|
+
var utilities = require('../../utilities');
|
|
11
|
+
var core$1 = require('../../core');
|
|
12
|
+
var cache = require('../../cache');
|
|
13
|
+
|
|
14
|
+
function requestToKey(request, addTypename) {
|
|
15
|
+
var queryString = request.query &&
|
|
16
|
+
graphql.print(addTypename ? utilities.addTypenameToDocument(request.query) : request.query);
|
|
17
|
+
var requestKey = { query: queryString };
|
|
18
|
+
return JSON.stringify(requestKey);
|
|
19
|
+
}
|
|
20
|
+
var MockLink = (function (_super) {
|
|
21
|
+
tslib.__extends(MockLink, _super);
|
|
22
|
+
function MockLink(mockedResponses, addTypename) {
|
|
23
|
+
if (addTypename === void 0) { addTypename = true; }
|
|
24
|
+
var _this = _super.call(this) || this;
|
|
25
|
+
_this.addTypename = true;
|
|
26
|
+
_this.mockedResponsesByKey = {};
|
|
27
|
+
_this.addTypename = addTypename;
|
|
28
|
+
if (mockedResponses) {
|
|
29
|
+
mockedResponses.forEach(function (mockedResponse) {
|
|
30
|
+
_this.addMockedResponse(mockedResponse);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
MockLink.prototype.addMockedResponse = function (mockedResponse) {
|
|
36
|
+
var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse);
|
|
37
|
+
var key = requestToKey(normalizedMockedResponse.request, this.addTypename);
|
|
38
|
+
var mockedResponses = this.mockedResponsesByKey[key];
|
|
39
|
+
if (!mockedResponses) {
|
|
40
|
+
mockedResponses = [];
|
|
41
|
+
this.mockedResponsesByKey[key] = mockedResponses;
|
|
42
|
+
}
|
|
43
|
+
mockedResponses.push(normalizedMockedResponse);
|
|
44
|
+
};
|
|
45
|
+
MockLink.prototype.request = function (operation) {
|
|
46
|
+
var _this = this;
|
|
47
|
+
this.operation = operation;
|
|
48
|
+
var key = requestToKey(operation, this.addTypename);
|
|
49
|
+
var unmatchedVars = [];
|
|
50
|
+
var requestVariables = operation.variables || {};
|
|
51
|
+
var mockedResponses = this.mockedResponsesByKey[key];
|
|
52
|
+
var responseIndex = mockedResponses ? mockedResponses.findIndex(function (res, index) {
|
|
53
|
+
var mockedResponseVars = res.request.variables || {};
|
|
54
|
+
if (equality.equal(requestVariables, mockedResponseVars)) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
unmatchedVars.push(mockedResponseVars);
|
|
58
|
+
return false;
|
|
59
|
+
}) : -1;
|
|
60
|
+
var response = responseIndex >= 0
|
|
61
|
+
? mockedResponses[responseIndex]
|
|
62
|
+
: void 0;
|
|
63
|
+
var configError;
|
|
64
|
+
if (!response) {
|
|
65
|
+
configError = new Error("No more mocked responses for the query: ".concat(graphql.print(operation.query), "\nExpected variables: ").concat(utilities.stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0 ? "\nFailed to match ".concat(unmatchedVars.length, " mock").concat(unmatchedVars.length === 1 ? "" : "s", " for this query, which had the following variables:\n").concat(unmatchedVars.map(function (d) { return " ".concat(utilities.stringifyForDisplay(d)); }).join('\n'), "\n") : ""));
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
mockedResponses.splice(responseIndex, 1);
|
|
69
|
+
var newData = response.newData;
|
|
70
|
+
if (newData) {
|
|
71
|
+
response.result = newData();
|
|
72
|
+
mockedResponses.push(response);
|
|
73
|
+
}
|
|
74
|
+
if (!response.result && !response.error) {
|
|
75
|
+
configError = new Error("Mocked response should contain either result or error: ".concat(key));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return new utilities.Observable(function (observer) {
|
|
79
|
+
var timer = setTimeout(function () {
|
|
80
|
+
if (configError) {
|
|
81
|
+
try {
|
|
82
|
+
if (_this.onError(configError, observer) !== false) {
|
|
83
|
+
throw configError;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
observer.error(error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else if (response) {
|
|
91
|
+
if (response.error) {
|
|
92
|
+
observer.error(response.error);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
if (response.result) {
|
|
96
|
+
observer.next(typeof response.result === 'function'
|
|
97
|
+
? response.result()
|
|
98
|
+
: response.result);
|
|
99
|
+
}
|
|
100
|
+
observer.complete();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, response && response.delay || 0);
|
|
104
|
+
return function () {
|
|
105
|
+
clearTimeout(timer);
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {
|
|
110
|
+
var newMockedResponse = utilities.cloneDeep(mockedResponse);
|
|
111
|
+
var queryWithoutConnection = utilities.removeConnectionDirectiveFromDocument(newMockedResponse.request.query);
|
|
112
|
+
__DEV__ ? globals.invariant(queryWithoutConnection, "query is required") : globals.invariant(queryWithoutConnection, 35);
|
|
113
|
+
newMockedResponse.request.query = queryWithoutConnection;
|
|
114
|
+
var query = utilities.removeClientSetsFromDocument(newMockedResponse.request.query);
|
|
115
|
+
if (query) {
|
|
116
|
+
newMockedResponse.request.query = query;
|
|
117
|
+
}
|
|
118
|
+
return newMockedResponse;
|
|
119
|
+
};
|
|
120
|
+
return MockLink;
|
|
121
|
+
}(core.ApolloLink));
|
|
122
|
+
function mockSingleLink() {
|
|
123
|
+
var mockedResponses = [];
|
|
124
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
125
|
+
mockedResponses[_i] = arguments[_i];
|
|
126
|
+
}
|
|
127
|
+
var maybeTypename = mockedResponses[mockedResponses.length - 1];
|
|
128
|
+
var mocks = mockedResponses.slice(0, mockedResponses.length - 1);
|
|
129
|
+
if (typeof maybeTypename !== 'boolean') {
|
|
130
|
+
mocks = mockedResponses;
|
|
131
|
+
maybeTypename = true;
|
|
132
|
+
}
|
|
133
|
+
return new MockLink(mocks, maybeTypename);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
var MockSubscriptionLink = (function (_super) {
|
|
137
|
+
tslib.__extends(MockSubscriptionLink, _super);
|
|
138
|
+
function MockSubscriptionLink() {
|
|
139
|
+
var _this = _super.call(this) || this;
|
|
140
|
+
_this.unsubscribers = [];
|
|
141
|
+
_this.setups = [];
|
|
142
|
+
_this.observers = [];
|
|
143
|
+
return _this;
|
|
144
|
+
}
|
|
145
|
+
MockSubscriptionLink.prototype.request = function (operation) {
|
|
146
|
+
var _this = this;
|
|
147
|
+
this.operation = operation;
|
|
148
|
+
return new utilities.Observable(function (observer) {
|
|
149
|
+
_this.setups.forEach(function (x) { return x(); });
|
|
150
|
+
_this.observers.push(observer);
|
|
151
|
+
return function () {
|
|
152
|
+
_this.unsubscribers.forEach(function (x) { return x(); });
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
MockSubscriptionLink.prototype.simulateResult = function (result, complete) {
|
|
157
|
+
var _this = this;
|
|
158
|
+
if (complete === void 0) { complete = false; }
|
|
159
|
+
setTimeout(function () {
|
|
160
|
+
var observers = _this.observers;
|
|
161
|
+
if (!observers.length)
|
|
162
|
+
throw new Error('subscription torn down');
|
|
163
|
+
observers.forEach(function (observer) {
|
|
164
|
+
if (result.result && observer.next)
|
|
165
|
+
observer.next(result.result);
|
|
166
|
+
if (result.error && observer.error)
|
|
167
|
+
observer.error(result.error);
|
|
168
|
+
if (complete && observer.complete)
|
|
169
|
+
observer.complete();
|
|
170
|
+
});
|
|
171
|
+
}, result.delay || 0);
|
|
172
|
+
};
|
|
173
|
+
MockSubscriptionLink.prototype.simulateComplete = function () {
|
|
174
|
+
var observers = this.observers;
|
|
175
|
+
if (!observers.length)
|
|
176
|
+
throw new Error('subscription torn down');
|
|
177
|
+
observers.forEach(function (observer) {
|
|
178
|
+
if (observer.complete)
|
|
179
|
+
observer.complete();
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
MockSubscriptionLink.prototype.onSetup = function (listener) {
|
|
183
|
+
this.setups = this.setups.concat([listener]);
|
|
184
|
+
};
|
|
185
|
+
MockSubscriptionLink.prototype.onUnsubscribe = function (listener) {
|
|
186
|
+
this.unsubscribers = this.unsubscribers.concat([listener]);
|
|
187
|
+
};
|
|
188
|
+
return MockSubscriptionLink;
|
|
189
|
+
}(core.ApolloLink));
|
|
190
|
+
function mockObservableLink() {
|
|
191
|
+
return new MockSubscriptionLink();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function createMockClient(data, query, variables) {
|
|
195
|
+
if (variables === void 0) { variables = {}; }
|
|
196
|
+
return new core$1.ApolloClient({
|
|
197
|
+
link: mockSingleLink({
|
|
198
|
+
request: { query: query, variables: variables },
|
|
199
|
+
result: { data: data },
|
|
200
|
+
}).setOnError(function (error) { throw error; }),
|
|
201
|
+
cache: new cache.InMemoryCache({ addTypename: false }),
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function subscribeAndCount(reject, observable, cb) {
|
|
206
|
+
var queue = Promise.resolve();
|
|
207
|
+
var handleCount = 0;
|
|
208
|
+
var subscription = utilities.asyncMap(observable, function (result) {
|
|
209
|
+
return queue = queue.then(function () {
|
|
210
|
+
return cb(++handleCount, result);
|
|
211
|
+
}).catch(error);
|
|
212
|
+
}).subscribe({ error: error });
|
|
213
|
+
function error(e) {
|
|
214
|
+
subscription.unsubscribe();
|
|
215
|
+
reject(e);
|
|
216
|
+
}
|
|
217
|
+
return subscription;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function wrap(key) {
|
|
221
|
+
return function (message, callback, timeout) { return (key ? it[key] : it)(message, function () {
|
|
222
|
+
var _this = this;
|
|
223
|
+
return new Promise(function (resolve, reject) { return callback.call(_this, resolve, reject); });
|
|
224
|
+
}, timeout); };
|
|
225
|
+
}
|
|
226
|
+
var wrappedIt = wrap();
|
|
227
|
+
var itAsync = Object.assign(function () {
|
|
228
|
+
var args = [];
|
|
229
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
230
|
+
args[_i] = arguments[_i];
|
|
231
|
+
}
|
|
232
|
+
return wrappedIt.apply(this, args);
|
|
233
|
+
}, {
|
|
234
|
+
only: wrap("only"),
|
|
235
|
+
skip: wrap("skip"),
|
|
236
|
+
todo: wrap("todo"),
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
function wrapTestFunction(fn, consoleMethodName) {
|
|
240
|
+
return function () {
|
|
241
|
+
var _this = this;
|
|
242
|
+
var args = arguments;
|
|
243
|
+
var spy = jest.spyOn(console, consoleMethodName);
|
|
244
|
+
spy.mockImplementation(function () { });
|
|
245
|
+
return new Promise(function (resolve) {
|
|
246
|
+
resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args));
|
|
247
|
+
}).finally(function () {
|
|
248
|
+
expect(spy).toMatchSnapshot();
|
|
249
|
+
spy.mockReset();
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function withErrorSpy(it) {
|
|
254
|
+
var args = [];
|
|
255
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
256
|
+
args[_i - 1] = arguments[_i];
|
|
257
|
+
}
|
|
258
|
+
args[1] = wrapTestFunction(args[1], "error");
|
|
259
|
+
return it.apply(void 0, args);
|
|
260
|
+
}
|
|
261
|
+
function withWarningSpy(it) {
|
|
262
|
+
var args = [];
|
|
263
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
264
|
+
args[_i - 1] = arguments[_i];
|
|
265
|
+
}
|
|
266
|
+
args[1] = wrapTestFunction(args[1], "warn");
|
|
267
|
+
return it.apply(void 0, args);
|
|
268
|
+
}
|
|
269
|
+
function withLogSpy(it) {
|
|
270
|
+
var args = [];
|
|
271
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
272
|
+
args[_i - 1] = arguments[_i];
|
|
273
|
+
}
|
|
274
|
+
args[1] = wrapTestFunction(args[1], "log");
|
|
275
|
+
return it.apply(void 0, args);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
exports.MockLink = MockLink;
|
|
279
|
+
exports.MockSubscriptionLink = MockSubscriptionLink;
|
|
280
|
+
exports.createMockClient = createMockClient;
|
|
281
|
+
exports.itAsync = itAsync;
|
|
282
|
+
exports.mockObservableLink = mockObservableLink;
|
|
283
|
+
exports.mockSingleLink = mockSingleLink;
|
|
284
|
+
exports.subscribeAndCount = subscribeAndCount;
|
|
285
|
+
exports.withErrorSpy = withErrorSpy;
|
|
286
|
+
exports.withLogSpy = withLogSpy;
|
|
287
|
+
exports.withWarningSpy = withWarningSpy;
|
|
288
|
+
//# sourceMappingURL=core.cjs.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('../utilities/globals');
|
|
6
|
+
var tslib = require('tslib');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var core$1 = require('../core');
|
|
9
|
+
var cache = require('../cache');
|
|
10
|
+
var context = require('../react/context');
|
|
11
|
+
var core = require('./core');
|
|
12
|
+
|
|
13
|
+
function _interopNamespace(e) {
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
for (var k in e) {
|
|
18
|
+
n[k] = e[k];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
+
|
|
27
|
+
var MockedProvider = (function (_super) {
|
|
28
|
+
tslib.__extends(MockedProvider, _super);
|
|
29
|
+
function MockedProvider(props) {
|
|
30
|
+
var _this = _super.call(this, props) || this;
|
|
31
|
+
var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache$1 = _a.cache, resolvers = _a.resolvers, link = _a.link;
|
|
32
|
+
var client = new core$1.ApolloClient({
|
|
33
|
+
cache: cache$1 || new cache.InMemoryCache({ addTypename: addTypename }),
|
|
34
|
+
defaultOptions: defaultOptions,
|
|
35
|
+
link: link || new core.MockLink(mocks || [], addTypename),
|
|
36
|
+
resolvers: resolvers,
|
|
37
|
+
});
|
|
38
|
+
_this.state = { client: client };
|
|
39
|
+
return _this;
|
|
40
|
+
}
|
|
41
|
+
MockedProvider.prototype.render = function () {
|
|
42
|
+
var _a = this.props, children = _a.children, childProps = _a.childProps;
|
|
43
|
+
return React__namespace.isValidElement(children) ? (React__namespace.createElement(context.ApolloProvider, { client: this.state.client }, React__namespace.cloneElement(React__namespace.Children.only(children), tslib.__assign({}, childProps)))) : null;
|
|
44
|
+
};
|
|
45
|
+
MockedProvider.prototype.componentWillUnmount = function () {
|
|
46
|
+
this.state.client.stop();
|
|
47
|
+
};
|
|
48
|
+
MockedProvider.defaultProps = {
|
|
49
|
+
addTypename: true
|
|
50
|
+
};
|
|
51
|
+
return MockedProvider;
|
|
52
|
+
}(React__namespace.Component));
|
|
53
|
+
|
|
54
|
+
exports.MockedProvider = MockedProvider;
|
|
55
|
+
for (var k in core) {
|
|
56
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = core[k];
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=testing.cjs.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const canUseWeakMap: boolean;
|
|
2
2
|
export declare const canUseWeakSet: boolean;
|
|
3
3
|
export declare const canUseSymbol: boolean;
|
|
4
|
+
export declare const canUseDOM: boolean;
|
|
5
|
+
export declare const canUseLayoutEffect: boolean;
|
|
4
6
|
//# sourceMappingURL=canUse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canUse.d.ts","sourceRoot":"","sources":["../../../src/utilities/common/canUse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"canUse.d.ts","sourceRoot":"","sources":["../../../src/utilities/common/canUse.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,SAEwB,CAAC;AAEnD,eAAO,MAAM,aAAa,SAAgC,CAAC;AAE3D,eAAO,MAAM,YAAY,SAES,CAAC;AAEnC,eAAO,MAAM,SAAS,SAC4C,CAAC;AAmBnE,eAAO,MAAM,kBAAkB,SAA2B,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { maybe } from "../globals/index.js";
|
|
2
|
+
export var canUseWeakMap = typeof WeakMap === 'function' &&
|
|
3
|
+
maybe(function () { return navigator.product; }) !== 'ReactNative';
|
|
3
4
|
export var canUseWeakSet = typeof WeakSet === 'function';
|
|
4
5
|
export var canUseSymbol = typeof Symbol === 'function' &&
|
|
5
6
|
typeof Symbol.for === 'function';
|
|
7
|
+
export var canUseDOM = typeof maybe(function () { return window.document.createElement; }) === "function";
|
|
8
|
+
var usingJSDOM = maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false;
|
|
9
|
+
export var canUseLayoutEffect = canUseDOM && !usingJSDOM;
|
|
6
10
|
//# sourceMappingURL=canUse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canUse.js","sourceRoot":"","sources":["../../../src/utilities/common/canUse.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"canUse.js","sourceRoot":"","sources":["../../../src/utilities/common/canUse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,CAAC,IAAM,aAAa,GACxB,OAAO,OAAO,KAAK,UAAU;IAC7B,KAAK,CAAC,cAAM,OAAA,SAAS,CAAC,OAAO,EAAjB,CAAiB,CAAC,KAAK,aAAa,CAAC;AAEnD,MAAM,CAAC,IAAM,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,CAAC;AAE3D,MAAM,CAAC,IAAM,YAAY,GACvB,OAAO,MAAM,KAAK,UAAU;IAC5B,OAAO,MAAM,CAAC,GAAG,KAAK,UAAU,CAAC;AAEnC,MAAM,CAAC,IAAM,SAAS,GACpB,OAAO,KAAK,CAAC,cAAM,OAAA,MAAM,CAAC,QAAQ,CAAC,aAAa,EAA7B,CAA6B,CAAC,KAAK,UAAU,CAAC;AAEnE,IAAM,UAAU,GASd,KAAK,CAAC,cAAM,OAAA,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAzC,CAAyC,CAAC,IAAI,KAAK,CAAC;AAQlE,MAAM,CAAC,IAAM,kBAAkB,GAAG,SAAS,IAAI,CAAC,UAAU,CAAC","sourcesContent":["import { maybe } from \"../globals\";\n\nexport const canUseWeakMap =\n typeof WeakMap === 'function' &&\n maybe(() => navigator.product) !== 'ReactNative';\n\nexport const canUseWeakSet = typeof WeakSet === 'function';\n\nexport const canUseSymbol =\n typeof Symbol === 'function' &&\n typeof Symbol.for === 'function';\n\nexport const canUseDOM =\n typeof maybe(() => window.document.createElement) === \"function\";\n\nconst usingJSDOM: boolean =\n // Following advice found in this comment from @domenic (maintainer of jsdom):\n // https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327\n //\n // Since we control the version of Jest and jsdom used when running Apollo\n // Client tests, and that version is recent enought to include \" jsdom/x.y.z\"\n // at the end of the user agent string, I believe this case is all we need to\n // check. Testing for \"Node.js\" was recommended for backwards compatibility\n // with older version of jsdom, but we don't have that problem.\n maybe(() => navigator.userAgent.indexOf(\"jsdom\") >= 0) || false;\n\n// Our tests should all continue to pass if we remove this !usingJSDOM\n// condition, thereby allowing useLayoutEffect when using jsdom. Unfortunately,\n// if we allow useLayoutEffect, then useSyncExternalStore generates many\n// warnings about useLayoutEffect doing nothing on the server. While these\n// warnings are harmless, this !usingJSDOM condition seems to be the best way to\n// prevent them (i.e. skipping useLayoutEffect when using jsdom).\nexport const canUseLayoutEffect = canUseDOM && !usingJSDOM;\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tsInvariant = require('ts-invariant');
|
|
6
|
+
var process$1 = require('ts-invariant/process');
|
|
7
|
+
var graphql = require('graphql');
|
|
8
|
+
|
|
9
|
+
function maybe(thunk) {
|
|
10
|
+
try {
|
|
11
|
+
return thunk();
|
|
12
|
+
}
|
|
13
|
+
catch (_a) { }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var global$1 = (maybe(function () { return globalThis; }) ||
|
|
17
|
+
maybe(function () { return window; }) ||
|
|
18
|
+
maybe(function () { return self; }) ||
|
|
19
|
+
maybe(function () { return global; }) ||
|
|
20
|
+
maybe(function () { return maybe.constructor("return this")(); }));
|
|
21
|
+
|
|
22
|
+
var __ = "__";
|
|
23
|
+
var GLOBAL_KEY = [__, __].join("DEV");
|
|
24
|
+
function getDEV() {
|
|
25
|
+
try {
|
|
26
|
+
return Boolean(__DEV__);
|
|
27
|
+
}
|
|
28
|
+
catch (_a) {
|
|
29
|
+
Object.defineProperty(global$1, GLOBAL_KEY, {
|
|
30
|
+
value: maybe(function () { return process.env.NODE_ENV; }) !== "production",
|
|
31
|
+
enumerable: false,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
});
|
|
35
|
+
return global$1[GLOBAL_KEY];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
var DEV = getDEV();
|
|
39
|
+
|
|
40
|
+
function removeTemporaryGlobals() {
|
|
41
|
+
return typeof graphql.Source === "function" ? process$1.remove() : process$1.remove();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function checkDEV() {
|
|
45
|
+
__DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 36);
|
|
46
|
+
}
|
|
47
|
+
removeTemporaryGlobals();
|
|
48
|
+
checkDEV();
|
|
49
|
+
|
|
50
|
+
exports.InvariantError = tsInvariant.InvariantError;
|
|
51
|
+
exports.invariant = tsInvariant.invariant;
|
|
52
|
+
exports.DEV = DEV;
|
|
53
|
+
exports.checkDEV = checkDEV;
|
|
54
|
+
exports.global = global$1;
|
|
55
|
+
exports.maybe = maybe;
|
|
56
|
+
//# sourceMappingURL=globals.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Concast.d.ts","sourceRoot":"","sources":["../../../src/utilities/observables/Concast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAA0B,UAAU,EAAE,MAAM,cAAc,CAAC;AAIxF,aAAK,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAOxC,aAAK,MAAM,CAAC,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,C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AAC,CAAC;IAI3C,OAAO,CAAC,SAAS,CAA0B;IAM3C,OAAO,CAAC,GAAG,CAAC,CAAgC;gBAIhC,OAAO,EAAE,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IA8B1E,OAAO,CAAC,OAAO,CAAc;IAE7B,OAAO,CAAC,KAAK;IAeb,OAAO,CAAC,kBAAkB;IAmB1B,OAAO,CAAC,QAAQ,CAAK;IAEd,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAUjC,cAAc,CACnB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,OAAO,CAAC,EAAE,OAAO;IAenB,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,MAAM,CAAwB;IACtC,SAAgB,OAAO,aAGpB;IAIH,OAAO,CAAC,MAAM,CAAC,CAA0B;IAIzC,OAAO,CAAC,QAAQ,CAiDd;IAEK,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG;IA0B3B,MAAM,WAAY,GAAG,UAI3B;CACF"}
|
|
@@ -37,9 +37,12 @@ var Concast = (function (_super) {
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
complete: function () {
|
|
40
|
-
|
|
40
|
+
var sub = _this.sub;
|
|
41
|
+
if (sub !== null) {
|
|
41
42
|
var value = _this.sources.shift();
|
|
42
43
|
if (!value) {
|
|
44
|
+
if (sub)
|
|
45
|
+
setTimeout(function () { return sub.unsubscribe(); });
|
|
43
46
|
_this.sub = null;
|
|
44
47
|
if (_this.latest &&
|
|
45
48
|
_this.latest[0] === "next") {
|
|
@@ -107,7 +110,7 @@ var Concast = (function (_super) {
|
|
|
107
110
|
if (this.observers.delete(observer) &&
|
|
108
111
|
--this.addCount < 1 &&
|
|
109
112
|
!quietly) {
|
|
110
|
-
this.handlers.
|
|
113
|
+
this.handlers.complete();
|
|
111
114
|
}
|
|
112
115
|
};
|
|
113
116
|
Concast.prototype.cleanup = function (callback) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Concast.js","sourceRoot":"","sources":["../../../src/utilities/observables/Concast.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAgD,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAItD,SAAS,aAAa,CAAI,KAAoB;IAC5C,OAAO,KAAK,IAAI,OAAQ,KAAa,CAAC,IAAI,KAAK,UAAU,CAAC;AAC5D,CAAC;AAoCD;IAAgC,2BAAa;IAc3C,iBAAY,OAA8D;QAA1E,YACE,kBAAM,UAAA,QAAQ;YACZ,KAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC3B,OAAO,cAAM,OAAA,KAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAA7B,CAA6B,CAAC;QAC7C,CAAC,CAAC,SAsBH;QApCO,eAAS,GAAG,IAAI,GAAG,EAAe,CAAC;QA4EnC,cAAQ,GAAG,CAAC,CAAC;QA+BL,aAAO,GAAG,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM;YACvD,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC,CAAC,CAAC;QAQK,cAAQ,GAAG;YACjB,IAAI,EAAE,UAAC,MAAS;gBACd,IAAI,KAAI,CAAC,GAAG,KAAK,IAAI,EAAE;oBACrB,KAAI,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;oBAC/B,sBAAsB,CAAC,KAAI,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;iBACxD;YACH,CAAC;YAED,KAAK,EAAE,UAAC,KAAU;gBACR,IAAA,GAAG,GAAK,KAAI,IAAT,CAAU;gBACrB,IAAI,GAAG,KAAK,IAAI,EA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AC,AA1MD,CAAgC,UAAU,GA0MzC;;AAID,qBAAqB,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import { Observable, Observer, ObservableSubscription, Subscriber } from \"./Observable\";\nimport { iterateObserversSafely } from \"./iteration\";\nimport { fixObservableSubclass } from \"./subclassing\";\n\ntype MaybeAsync<T> = T | PromiseLike<T>;\n\nfunction isPromiseLike<T>(value: MaybeAsync<T>): value is PromiseLike<T> {\n return value && typeof (value as any).then === \"function\";\n}\n\n// Any individual Source<T> can be an Observable<T> or a promise for one.\ntype Source<T> = MaybeAsync<Observable<T>>;\n\nexport type ConcastSourcesIterable<T> = Iterable<Source<T>>;\n\n// A Concast<T> observable concatenates the given sources into a single\n// non-overlapping sequence of Ts, automatically unwrapping any promises,\n// and broadcasts the T elements of that sequence to any number of\n// subscribers, all without creating a bunch of intermediary Observable\n// wrapper objects.\n//\n// Even though any number of observers can subscribe to the Concast, each\n// source observable is guaranteed to receive at most one subscribe call,\n// and the results are multicast to all observers.\n//\n// In addition to broadcasting every next/error message to this.observers,\n// the Concast stores the most recent message using this.latest, so any\n// new observers can immediately receive the latest message, even if it\n// was originally delivered in the past. This behavior means we can assume\n// every active observer in this.observers has received the same most\n// recent message.\n//\n// With the exception of this.latest replay, a Concast is a \"hot\"\n// observable in the sense that it does not replay past results from the\n// beginning of time for each new observer.\n//\n// Could we have used some existing RxJS class instead? Concast<T> is\n// similar to a BehaviorSubject<T>, because it is multicast and redelivers\n// the latest next/error message to new subscribers. Unlike Subject<T>,\n// Concast<T> does not expose an Observer<T> interface (this.handlers is\n// intentionally private), since Concast<T> gets its inputs from the\n// concatenated sources. If we ever switch to RxJS, there may be some\n// value in reusing their code, but for now we use zen-observable, which\n// does not contain any Subject implementations.\nexport class Concast<T> extends Observable<T> {\n // Active observers receiving broadcast messages. Thanks to this.latest,\n // we can assume all observers in this Set have received the same most\n // recent message, though possibly at different times in the past.\n private observers = new Set<Observer<T>>();\n\n // This property starts off undefined to indicate the initial\n // subscription has not yet begun, then points to each source\n // subscription in turn, and finally becomes null after the sources have\n // been exhausted. After that, it stays null.\n private sub?: ObservableSubscription | null;\n\n // Not only can the individual elements of the iterable be promises, but\n // also the iterable itself can be wrapped in a promise.\n constructor(sources: MaybeAsync<ConcastSourcesIterable<T>> | Subscriber<T>) {\n super(observer => {\n this.addObserver(observer);\n return () => this.removeObserver(observer);\n });\n\n // Suppress rejection warnings for this.promise, since it's perfectly\n // acceptable to pay no attention to this.promise if you're consuming\n // the results through the normal observable API.\n this.promise.catch(_ => {});\n\n // If someone accidentally tries to create a Concast using a subscriber\n // function, recover by creating an Observable from that subscriber and\n // using it as the source.\n if (typeof sources === \"function\") {\n sources = [new Observable(sources)];\n }\n\n if (isPromiseLike(sources)) {\n sources.then(\n iterable => this.start(iterable),\n this.handlers.error,\n );\n } else {\n this.start(sources);\n }\n }\n\n // A consumable array of source observables, incrementally consumed\n // each time this.handlers.complete is called.\n private sources: Source<T>[];\n\n private start(sources: ConcastSourcesIterable<T>) {\n if (this.sub !== void 0) return;\n\n // In practice, sources is most often simply an Array of observables.\n // TODO Consider using sources[Symbol.iterator]() to take advantage\n // of the laziness of non-Array iterables.\n this.sources = Array.from(sources);\n\n // Calling this.handlers.complete() kicks off consumption of the first\n // source observable. It's tempting to do this step lazily in\n // addObserver, but this.promise can be accessed without calling\n // addObserver, so consumption needs to begin eagerly.\n this.handlers.complete();\n }\n\n private deliverLastMessage(observer: Observer<T>) {\n if (this.latest) {\n const nextOrError = this.latest[0];\n const method = observer[nextOrError];\n if (method) {\n method.call(observer, this.latest[1]);\n }\n // If the subscription is already closed, and the last message was\n // a 'next' message, simulate delivery of the final 'complete'\n // message again.\n if (this.sub === null &&\n nextOrError === \"next\" &&\n observer.complete) {\n observer.complete();\n }\n }\n }\n\n // Note: cleanup observers do not count towards this total.\n private addCount = 0;\n\n public addObserver(observer: Observer<T>) {\n if (!this.observers.has(observer)) {\n // Immediately deliver the most recent message, so we can always\n // be sure all observers have the latest information.\n this.deliverLastMessage(observer);\n this.observers.add(observer);\n ++this.addCount;\n }\n }\n\n public removeObserver(\n observer: Observer<T>,\n quietly?: boolean,\n ) {\n if (this.observers.delete(observer) &&\n --this.addCount < 1 &&\n !quietly) {\n // In case there are still any cleanup observers in this.observers,\n // and no error or completion has been broadcast yet, make sure\n // those observers receive an error that terminates them.\n this.handlers.error(new Error(\"Observable cancelled prematurely\"));\n }\n }\n\n // Any Concast object can be trivially converted to a Promise, without\n // having to create a new wrapper Observable. This promise provides an\n // easy way to observe the final state of the Concast.\n private resolve: (result?: T | PromiseLike<T>) => void;\n private reject: (reason: any) => void;\n public readonly promise = new Promise<T>((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n\n // Name and argument of the most recently invoked observer method, used\n // to deliver latest results immediately to new observers.\n private latest?: [\"next\" | \"error\", any];\n\n // Bound handler functions that can be reused for every internal\n // subscription.\n private handlers = {\n next: (result: T) => {\n if (this.sub !== null) {\n this.latest = [\"next\", result];\n iterateObserversSafely(this.observers, \"next\", result);\n }\n },\n\n error: (error: any) => {\n const { sub } = this;\n if (sub !== null) {\n // Delay unsubscribing from the underlying subscription slightly,\n // so that immediately subscribing another observer can keep the\n // subscription active.\n if (sub) setTimeout(() => sub.unsubscribe());\n this.sub = null;\n this.latest = [\"error\", error];\n this.reject(error);\n iterateObserversSafely(this.observers, \"error\", error);\n }\n },\n\n complete: () => {\n if (this.sub !== null) {\n const value = this.sources.shift();\n if (!value) {\n this.sub = null;\n if (this.latest &&\n this.latest[0] === \"next\") {\n this.resolve(this.latest[1]);\n } else {\n this.resolve();\n }\n // We do not store this.latest = [\"complete\"], because doing so\n // discards useful information about the previous next (or\n // error) message. Instead, if new observers subscribe after\n // this Concast has completed, they will receive the final\n // 'next' message (unless there was an error) immediately\n // followed by a 'complete' message (see addObserver).\n iterateObserversSafely(this.observers, \"complete\");\n } else if (isPromiseLike(value)) {\n value.then(obs => this.sub = obs.subscribe(this.handlers));\n } else {\n this.sub = value.subscribe(this.handlers);\n }\n }\n },\n };\n\n public cleanup(callback: () => any) {\n let called = false;\n const once = () => {\n if (!called) {\n called = true;\n // Removing a cleanup observer should not unsubscribe from the\n // underlying Observable, so the only removeObserver behavior we\n // need here is to delete observer from this.observers.\n this.observers.delete(observer);\n callback();\n }\n }\n const observer = {\n next: once,\n error: once,\n complete: once,\n };\n const count = this.addCount;\n this.addObserver(observer);\n // Normally addObserver increments this.addCount, but we can \"hide\"\n // cleanup observers by restoring this.addCount to its previous value\n // after adding any cleanup observer.\n this.addCount = count;\n }\n\n // A public way to abort observation and broadcast.\n public cancel = (reason: any) => {\n this.reject(reason);\n this.sources = [];\n this.handlers.complete();\n }\n}\n\n// Necessary because the Concast constructor has a different signature\n// than the Observable constructor.\nfixObservableSubclass(Concast);\n"]}
|
|
1
|
+
{"version":3,"file":"Concast.js","sourceRoot":"","sources":["../../../src/utilities/observables/Concast.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAgD,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAItD,SAAS,aAAa,CAAI,KAAoB;IAC5C,OAAO,KAAK,IAAI,OAAQ,KAAa,CAAC,IAAI,KAAK,UAAU,CAAC;AAC5D,CAAC;AAoCD;IAAgC,2BAAa;IAc3C,iBAAY,OAA8D;QAA1E,YACE,kBAAM,UAAA,QAAQ;YACZ,KAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC3B,OAAO,cAAM,OAAA,KAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAA7B,CAA6B,CAAC;QAC7C,CAAC,CAAC,SAsBH;QApCO,eAAS,GAAG,IAAI,GAAG,EAAe,CAAC;QA4EnC,cAAQ,GAAG,CAAC,CAAC;QA+BL,aAAO,GAAG,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM;YACvD,KAAI,CAAC,OAAO,GAAG,OAAO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QAAmB;QAAlC,iBAuBC;QAtBC,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAM,IAAI,GAAG;YACX,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,GAAG,IAAI,CAAC;gBAId,KAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAChC,QAAQ,EAAE,CAAC;aACZ;QACH,CAAC,CAAA;QACD,IAAM,QAAQ,GAAG;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC5B,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAI3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IAQH,cAAC;AAAD,CAAC,AA5MD,CAAgC,UAAU,GA4MzC;;AAID,qBAAqB,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import { Observable, Observer, ObservableSubscription, Subscriber } from \"./Observable\";\nimport { iterateObserversSafely } from \"./iteration\";\nimport { fixObservableSubclass } from \"./subclassing\";\n\ntype MaybeAsync<T> = T | PromiseLike<T>;\n\nfunction isPromiseLike<T>(value: MaybeAsync<T>): value is PromiseLike<T> {\n return value && typeof (value as any).then === \"function\";\n}\n\n// Any individual Source<T> can be an Observable<T> or a promise for one.\ntype Source<T> = MaybeAsync<Observable<T>>;\n\nexport type ConcastSourcesIterable<T> = Iterable<Source<T>>;\n\n// A Concast<T> observable concatenates the given sources into a single\n// non-overlapping sequence of Ts, automatically unwrapping any promises,\n// and broadcasts the T elements of that sequence to any number of\n// subscribers, all without creating a bunch of intermediary Observable\n// wrapper objects.\n//\n// Even though any number of observers can subscribe to the Concast, each\n// source observable is guaranteed to receive at most one subscribe call,\n// and the results are multicast to all observers.\n//\n// In addition to broadcasting every next/error message to this.observers,\n// the Concast stores the most recent message using this.latest, so any\n// new observers can immediately receive the latest message, even if it\n// was originally delivered in the past. This behavior means we can assume\n// every active observer in this.observers has received the same most\n// recent message.\n//\n// With the exception of this.latest replay, a Concast is a \"hot\"\n// observable in the sense that it does not replay past results from the\n// beginning of time for each new observer.\n//\n// Could we have used some existing RxJS class instead? Concast<T> is\n// similar to a BehaviorSubject<T>, because it is multicast and redelivers\n// the latest next/error message to new subscribers. Unlike Subject<T>,\n// Concast<T> does not expose an Observer<T> interface (this.handlers is\n// intentionally private), since Concast<T> gets its inputs from the\n// concatenated sources. If we ever switch to RxJS, there may be some\n// value in reusing their code, but for now we use zen-observable, which\n// does not contain any Subject implementations.\nexport class Concast<T> extends Observable<T> {\n // Active observers receiving broadcast messages. Thanks to this.latest,\n // we can assume all observers in this Set have received the same most\n // recent message, though possibly at different times in the past.\n private observers = new Set<Observer<T>>();\n\n // This property starts off undefined to indicate the initial\n // subscription has not yet begun, then points to each source\n // subscription in turn, and finally becomes null after the sources have\n // been exhausted. After that, it stays null.\n private sub?: ObservableSubscription | null;\n\n // Not only can the individual elements of the iterable be promises, but\n // also the iterable itself can be wrapped in a promise.\n constructor(sources: MaybeAsync<ConcastSourcesIterable<T>> | Subscriber<T>) {\n super(observer => {\n this.addObserver(observer);\n return () => this.removeObserver(observer);\n });\n\n // Suppress rejection warnings for this.promise, since it's perfectly\n // acceptable to pay no attention to this.promise if you're consuming\n // the results through the normal observable API.\n this.promise.catch(_ => {});\n\n // If someone accidentally tries to create a Concast using a subscriber\n // function, recover by creating an Observable from that subscriber and\n // using it as the source.\n if (typeof sources === \"function\") {\n sources = [new Observable(sources)];\n }\n\n if (isPromiseLike(sources)) {\n sources.then(\n iterable => this.start(iterable),\n this.handlers.error,\n );\n } else {\n this.start(sources);\n }\n }\n\n // A consumable array of source observables, incrementally consumed\n // each time this.handlers.complete is called.\n private sources: Source<T>[];\n\n private start(sources: ConcastSourcesIterable<T>) {\n if (this.sub !== void 0) return;\n\n // In practice, sources is most often simply an Array of observables.\n // TODO Consider using sources[Symbol.iterator]() to take advantage\n // of the laziness of non-Array iterables.\n this.sources = Array.from(sources);\n\n // Calling this.handlers.complete() kicks off consumption of the first\n // source observable. It's tempting to do this step lazily in\n // addObserver, but this.promise can be accessed without calling\n // addObserver, so consumption needs to begin eagerly.\n this.handlers.complete();\n }\n\n private deliverLastMessage(observer: Observer<T>) {\n if (this.latest) {\n const nextOrError = this.latest[0];\n const method = observer[nextOrError];\n if (method) {\n method.call(observer, this.latest[1]);\n }\n // If the subscription is already closed, and the last message was\n // a 'next' message, simulate delivery of the final 'complete'\n // message again.\n if (this.sub === null &&\n nextOrError === \"next\" &&\n observer.complete) {\n observer.complete();\n }\n }\n }\n\n // Note: cleanup observers do not count towards this total.\n private addCount = 0;\n\n public addObserver(observer: Observer<T>) {\n if (!this.observers.has(observer)) {\n // Immediately deliver the most recent message, so we can always\n // be sure all observers have the latest information.\n this.deliverLastMessage(observer);\n this.observers.add(observer);\n ++this.addCount;\n }\n }\n\n public removeObserver(\n observer: Observer<T>,\n quietly?: boolean,\n ) {\n if (this.observers.delete(observer) &&\n --this.addCount < 1 &&\n !quietly) {\n // In case there are still any cleanup observers in this.observers, and no\n // error or completion has been broadcast yet, make sure those observers\n // have a chance to run and then remove themselves from this.observers.\n this.handlers.complete();\n }\n }\n\n // Any Concast object can be trivially converted to a Promise, without\n // having to create a new wrapper Observable. This promise provides an\n // easy way to observe the final state of the Concast.\n private resolve: (result?: T | PromiseLike<T>) => void;\n private reject: (reason: any) => void;\n public readonly promise = new Promise<T>((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n\n // Name and argument of the most recently invoked observer method, used\n // to deliver latest results immediately to new observers.\n private latest?: [\"next\" | \"error\", any];\n\n // Bound handler functions that can be reused for every internal\n // subscription.\n private handlers = {\n next: (result: T) => {\n if (this.sub !== null) {\n this.latest = [\"next\", result];\n iterateObserversSafely(this.observers, \"next\", result);\n }\n },\n\n error: (error: any) => {\n const { sub } = this;\n if (sub !== null) {\n // Delay unsubscribing from the underlying subscription slightly,\n // so that immediately subscribing another observer can keep the\n // subscription active.\n if (sub) setTimeout(() => sub.unsubscribe());\n this.sub = null;\n this.latest = [\"error\", error];\n this.reject(error);\n iterateObserversSafely(this.observers, \"error\", error);\n }\n },\n\n complete: () => {\n const { sub } = this;\n if (sub !== null) {\n const value = this.sources.shift();\n if (!value) {\n if (sub) setTimeout(() => sub.unsubscribe());\n this.sub = null;\n if (this.latest &&\n this.latest[0] === \"next\") {\n this.resolve(this.latest[1]);\n } else {\n this.resolve();\n }\n // We do not store this.latest = [\"complete\"], because doing so\n // discards useful information about the previous next (or\n // error) message. Instead, if new observers subscribe after\n // this Concast has completed, they will receive the final\n // 'next' message (unless there was an error) immediately\n // followed by a 'complete' message (see addObserver).\n iterateObserversSafely(this.observers, \"complete\");\n } else if (isPromiseLike(value)) {\n value.then(obs => this.sub = obs.subscribe(this.handlers));\n } else {\n this.sub = value.subscribe(this.handlers);\n }\n }\n },\n };\n\n public cleanup(callback: () => any) {\n let called = false;\n const once = () => {\n if (!called) {\n called = true;\n // Removing a cleanup observer should not unsubscribe from the\n // underlying Observable, so the only removeObserver behavior we\n // need here is to delete observer from this.observers.\n this.observers.delete(observer);\n callback();\n }\n }\n const observer = {\n next: once,\n error: once,\n complete: once,\n };\n const count = this.addCount;\n this.addObserver(observer);\n // Normally addObserver increments this.addCount, but we can \"hide\"\n // cleanup observers by restoring this.addCount to its previous value\n // after adding any cleanup observer.\n this.addCount = count;\n }\n\n // A public way to abort observation and broadcast.\n public cancel = (reason: any) => {\n this.reject(reason);\n this.sources = [];\n this.handlers.complete();\n }\n}\n\n// Necessary because the Concast constructor has a different signature\n// than the Observable constructor.\nfixObservableSubclass(Concast);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/utilities/policies/pagination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGrD,aAAK,OAAO,GAA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;AAEH,oBAAY,cAAc,CAAC,KAAK,IAAI;IAClC,KAAK,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,oBAAY,gBAAgB,CAAC,KAAK,IAAI,WAAW,CAC/C,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,EAC5B,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,EAC5B,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAC7B,CAAC;AAKF,wBAAgB,oBAAoB,CAAC,KAAK,GAAG,SAAS,EACpD,OAAO,GAAE,OAAe,GACvB,gBAAgB,CAAC,KAAK,CAAC,CA2KzB"}
|
|
@@ -17,14 +17,16 @@ export function offsetLimitPagination(keyArgs) {
|
|
|
17
17
|
merge: function (existing, incoming, _a) {
|
|
18
18
|
var args = _a.args;
|
|
19
19
|
var merged = existing ? existing.slice(0) : [];
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
if (incoming) {
|
|
21
|
+
if (args) {
|
|
22
|
+
var _b = args.offset, offset = _b === void 0 ? 0 : _b;
|
|
23
|
+
for (var i = 0; i < incoming.length; ++i) {
|
|
24
|
+
merged[offset + i] = incoming[i];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
merged.push.apply(merged, incoming);
|
|
24
29
|
}
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
merged.push.apply(merged, incoming);
|
|
28
30
|
}
|
|
29
31
|
return merged;
|
|
30
32
|
},
|