31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
/**
|
|
* 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';
|
|
|
|
function normalizeRelayPayload(selector, payload, errors) {
|
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
handleStrippedNulls: false
|
|
};
|
|
var source = new (require("./RelayInMemoryRecordSource"))();
|
|
source.set(require("./RelayStoreUtils").ROOT_ID, require("./RelayModernRecord").create(require("./RelayStoreUtils").ROOT_ID, require("./RelayStoreUtils").ROOT_TYPE));
|
|
|
|
var _RelayResponseNormali = require("./RelayResponseNormalizer").normalize(source, selector, payload, options),
|
|
fieldPayloads = _RelayResponseNormali.fieldPayloads,
|
|
matchPayloads = _RelayResponseNormali.matchPayloads;
|
|
|
|
return {
|
|
errors: errors,
|
|
fieldPayloads: fieldPayloads,
|
|
matchPayloads: matchPayloads,
|
|
source: source
|
|
};
|
|
}
|
|
|
|
module.exports = normalizeRelayPayload; |