WIP - add extractor, generate snippet_data
This commit is contained in:
48
node_modules/relay-runtime/lib/RelayNetwork.js
generated
vendored
Normal file
48
node_modules/relay-runtime/lib/RelayNetwork.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* strict-local
|
||||
* @format
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Creates an implementation of the `Network` interface defined in
|
||||
* `RelayNetworkTypes` given `fetch` and `subscribe` functions.
|
||||
*/
|
||||
function create(fetchFn, subscribeFn) {
|
||||
// Convert to functions that returns RelayObservable.
|
||||
var observeFetch = require("./ConvertToExecuteFunction").convertFetch(fetchFn);
|
||||
|
||||
var observeSubscribe = subscribeFn ? require("./ConvertToExecuteFunction").convertSubscribe(subscribeFn) : undefined;
|
||||
|
||||
function execute(request, variables, cacheConfig, uploadables) {
|
||||
if (request.operationKind === 'subscription') {
|
||||
!observeSubscribe ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'RelayNetwork: This network layer does not support Subscriptions. ' + 'To use Subscriptions, provide a custom network layer.') : require("fbjs/lib/invariant")(false) : void 0;
|
||||
!!uploadables ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'RelayNetwork: Cannot provide uploadables while subscribing.') : require("fbjs/lib/invariant")(false) : void 0;
|
||||
return observeSubscribe(request, variables, cacheConfig);
|
||||
}
|
||||
|
||||
var pollInterval = cacheConfig.poll;
|
||||
|
||||
if (pollInterval != null) {
|
||||
!!uploadables ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'RelayNetwork: Cannot provide uploadables while polling.') : require("fbjs/lib/invariant")(false) : void 0;
|
||||
return observeFetch(request, variables, {
|
||||
force: true
|
||||
}).poll(pollInterval);
|
||||
}
|
||||
|
||||
return observeFetch(request, variables, cacheConfig, uploadables);
|
||||
}
|
||||
|
||||
return {
|
||||
execute: execute
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
create: create
|
||||
};
|
||||
Reference in New Issue
Block a user