Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@orbit/record-cache

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orbit/record-cache - npm Package Compare versions

Comparing version 0.16.0-beta.1 to 0.16.0-beta.2

11

dist/commonjs/es2017/operators/async-query-operators.js

@@ -37,2 +37,8 @@ 'use strict';

const relatedIds = await cache.getRelatedRecordsAsync(record, relationship);
if (!relatedIds) {
if (!(await cache.getRecordAsync(record))) {
throw new _data.RecordNotFoundException(record.type, record.id);
}
return [];
}
return cache.getRecordsAsync(relatedIds);

@@ -46,2 +52,5 @@ },

} else {
if (!(await cache.getRecordAsync(record))) {
throw new _data.RecordNotFoundException(record.type, record.id);
}
return null;

@@ -150,2 +159,2 @@ }

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9hc3luYy1xdWVyeS1vcGVyYXRvcnMuanMiXSwibmFtZXMiOlsiQXN5bmNRdWVyeU9wZXJhdG9ycyIsImZpbmRSZWNvcmQiLCJjYWNoZSIsImV4cHJlc3Npb24iLCJyZWNvcmQiLCJjdXJyZW50UmVjb3JkIiwiZ2V0UmVjb3JkQXN5bmMiLCJSZWNvcmROb3RGb3VuZEV4Y2VwdGlvbiIsInR5cGUiLCJpZCIsImZpbmRSZWNvcmRzIiwicmVzdWx0cyIsImdldFJlY29yZHNBc3luYyIsInJlY29yZHMiLCJmaWx0ZXIiLCJmaWx0ZXJSZWNvcmRzIiwic29ydCIsInNvcnRSZWNvcmRzIiwicGFnZSIsInBhZ2luYXRlUmVjb3JkcyIsImZpbmRSZWxhdGVkUmVjb3JkcyIsInJlbGF0aW9uc2hpcCIsInJlbGF0ZWRJZHMiLCJnZXRSZWxhdGVkUmVjb3Jkc0FzeW5jIiwiZmluZFJlbGF0ZWRSZWNvcmQiLCJ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RXJyb3IoJ1NvcnQgc3BlY2lmaWVyICR7c29ydFNwZWNpZmllci5raW5kfSBub3QgcmVjb2duaXplZCBmb3IgU3RvcmUuJywgc29ydFNwZWNpZmllcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pKTtcbiAgICB9KTtcbiAgICBjb25zdCBjb21wYXJpc29uT3JkZXJzID0gc29ydFNwZWNpZmllcnMubWFwKHNvcnRFeHByZXNzaW9uID0+IHNvcnRFeHByZXNzaW9uLm9yZGVyID09PSAnZGVzY2VuZGluZycgPyAtMSA6IDEpO1xuICAgIHJldHVybiByZWNvcmRzLnNvcnQoKHJlY29yZDEsIHJlY29yZDIpID0+IHtcbiAgICAgICAgY29uc3QgdmFsdWVzMSA9IGNvbXBhcmlzb25WYWx1ZXMuZ2V0KHJlY29yZDEpO1xuICAgICAgICBjb25zdCB2YWx1ZXMyID0gY29tcGFyaXNvblZhbHVlcy5nZXQocmVjb3JkMik7XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc29ydFNwZWNpZmllcnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGlmICh2YWx1ZXMxW2ldIDwgdmFsdWVzMltpXSkge1xuICAgICAgICAgICAgICAgIHJldHVybiAtY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodmFsdWVzMVtpXSA+IHZhbHVlczJbaV0pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNOb25lKHZhbHVlczFbaV0pICYmICFpc05vbmUodmFsdWVzMltpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNOb25lKHZhbHVlczJbaV0pICYmICFpc05vbmUodmFsdWVzMVtpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4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kKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmICghKGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKHJlY29yZCkpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJlY29yZE5vdEZvdW5kRXhjZXB0aW9uKHJlY29yZC50eXBlLCByZWNvcmQuaWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgIH1cbiAgICB9XG59O1xuZnVuY3Rpb24gZmlsdGVyUmVjb3JkcyhyZWNvcmRzLCBmaWx0ZXJzKSB7XG4gICAgcmV0dXJuIHJlY29yZHMuZmlsdGVyKHJlY29yZCA9PiB7XG4gICAgICAgIGZvciAobGV0IGkgPSAwLCBsID0gZmlsdGVycy5sZW5ndGg7IGkgPCBsOyBpKyspIHtcbiAgICAgICAgICAgIGlmICghYXBwbHlGaWx0ZXIocmVjb3JkLCBmaWx0ZXJzW2ldKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9KTtcbn1cbmZ1bmN0aW9uIGFwcGx5RmlsdGVyKHJlY29yZCwgZmlsdGVyKSB7XG4gICAgaWYgKGZpbHRlci5raW5kID09PSAnYXR0cmlidXRlJykge1xuICAgICAgICBsZXQgYWN0dWFsID0gZGVlcEdldChyZWNvcmQsIFsnYXR0cmlidXRlcycsIGZpbHRlci5hdHRyaWJ1dGVdKTtcbiAgICAgICAgbGV0IGV4cGVjdGVkID0gZmlsdGVyLnZhbHVlO1xuICAgICAgICBzd2l0Y2ggKGZpbHRlci5vcCkge1xuICAgICAgICAgICAgY2FzZSAnZXF1YWwnOlxuICAgICAgICAgICAgICAgIHJldHVybiBhY3R1YWwgPT09IGV4cGVjdGVkO1xuICAgICAgICAgICAgY2FzZSAnZ3QnOlxuICAgICAgICAgICAgICAgIHJldHVybiBhY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gdGhyb3cgbmV3IFF1ZXJ5RXhwcmVzc2lvblBhcnNlRXJyb3IoJ1NvcnQgc3BlY2lmaWVyICR7c29ydFNwZWNpZmllci5raW5kfSBub3QgcmVjb2duaXplZCBmb3IgU3RvcmUuJywgc29ydFNwZWNpZmllcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pKTtcbiAgICB9KTtcbiAgICBjb25zdCBjb21wYXJpc29uT3JkZXJzID0gc29ydFNwZWNpZmllcnMubWFwKHNvcnRFeHByZXNzaW9uID0+IHNvcnRFeHByZXNzaW9uLm9yZGVyID09PSAnZGVzY2VuZGluZycgPyAtMSA6IDEpO1xuICAgIHJldHVybiByZWNvcmRzLnNvcnQoKHJlY29yZDEsIHJlY29yZDIpID0+IHtcbiAgICAgICAgY29uc3QgdmFsdWVzMSA9IGNvbXBhcmlzb25WYWx1ZXMuZ2V0KHJlY29yZDEpO1xuICAgICAgICBjb25zdCB2YWx1ZXMyID0gY29tcGFyaXNvblZhbHVlcy5nZXQocmVjb3JkMik7XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc29ydFNwZWNpZmllcnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGlmICh2YWx1ZXMxW2ldIDwgdmFsdWVzMltpXSkge1xuICAgICAgICAgICAgICAgIHJldHVybiAtY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodmFsdWVzMVtpXSA+IHZhbHVlczJbaV0pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNOb25lKHZhbHVlczFbaV0pICYmICFpc05vbmUodmFsdWVzMltpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNOb25lKHZhbHVlczJbaV0pICYmICFpc05vbmUodmFsdWVzMVtpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gLWNvbXBhcmlzb25PcmRlcnNbaV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIDA7XG4gICAgfSk7XG59XG5mdW5jdGlvbiBwYWdpbmF0ZVJlY29yZHMocmVjb3JkcywgcGFnaW5hdGlvbk9wdGlvbnMpIHtcbiAgICBpZiAocGFnaW5hdGlvbk9wdGlvbnMubGltaXQgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICBsZXQgb2Zmc2V0ID0gcGFnaW5hdGlvbk9wdGlvbnMub2Zmc2V0ID09PSB1bmRlZmluZWQgPyAwIDogcGFnaW5hdGlvbk9wdGlvbnMub2Zmc2V0O1xuICAgICAgICBsZXQgbGltaXQgPSBwYWdpbmF0aW9uT3B0aW9ucy5saW1pdDtcbiAgICAgICAgcmV0dXJuIHJlY29yZHMuc2xpY2Uob2Zmc2V0LCBvZmZzZXQgKyBsaW1pdCk7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgdGhyb3cgbmV3IFF1ZXJ5RXhwcmVzc2lvblBhcnNlRXJyb3IoJ1BhZ2luYXRpb24gb3B0aW9ucyBub3QgcmVjb2duaXplZCBmb3IgU3RvcmUuIFBsZWFzZSBzcGVjaWZ5IGBvZmZzZXRgIGFuZCBgbGltaXRgLicsIHBhZ2luYXRpb25PcHRpb25zKTtcbiAgICB9XG59Il19

@@ -37,2 +37,8 @@ 'use strict';

const relatedIds = cache.getRelatedRecordsSync(record, relationship);
if (!relatedIds) {
if (!cache.getRecordSync(record)) {
throw new _data.RecordNotFoundException(record.type, record.id);
}
return [];
}
return cache.getRecordsSync(relatedIds);

@@ -46,2 +52,5 @@ },

} else {
if (!cache.getRecordSync(record)) {
throw new _data.RecordNotFoundException(record.type, record.id);
}
return null;

@@ -150,2 +159,2 @@ }

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIj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JiYgIWlzTm9uZSh2YWx1ZXMyW2ldKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBjb21wYXJpc29uT3JkZXJzW2ldO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChpc05vbmUodmFsdWVzMltpXSkgJiYgIWlzTm9uZSh2YWx1ZXMxW2ldKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiAtY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gMDtcbiAgICB9KTtcbn1cbmZ1bmN0aW9uIHBhZ2luYXRlUmVjb3JkcyhyZWNvcmRzLCBwYWdpbmF0aW9uT3B0aW9ucykge1xuICAgIGlmIChwYWdpbmF0aW9uT3B0aW9ucy5saW1pdCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGxldCBvZmZzZXQgPSBwYWdpbmF0aW9uT3B0aW9ucy5vZmZzZXQgPT09IHVuZGVmaW5lZCA/IDAgOiBwYWdpbmF0aW9uT3B0aW9ucy5vZmZzZXQ7XG4gICAgICAgIGxldCBsaW1pdCA9IHBhZ2luYXRpb25PcHRpb25zLmxpbWl0O1xuICAgICAgICByZXR1cm4gcmVjb3Jkcy5zbGljZShvZmZzZXQsIG9mZnNldCArIGxpbWl0KTtcbiAgICB9IGVsc2Uge1xuICAgICAgICB0aHJvdyBuZXcgUXVlcnlFeHByZXNzaW9uUGFyc2VFcnJvcignUGFnaW5hdGlvbiBvcHRpb25zIG5vdCByZWNvZ25pemVkIGZvciBTdG9yZS4gUGxlYXNlIHNwZWNpZnkgYG9mZnNldGAgYW5kIGBsaW1pdGAuJywgcGFnaW5hdGlvbk9wdGlvbnMpO1xuICAgIH1cbn0iXX0=

@@ -40,2 +40,8 @@ 'use strict';

var relatedIds = await cache.getRelatedRecordsAsync(record, relationship);
if (!relatedIds) {
if (!(await cache.getRecordAsync(record))) {
throw new _data.RecordNotFoundException(record.type, record.id);
}
return [];
}
return cache.getRecordsAsync(relatedIds);

@@ -51,2 +57,5 @@ },

} else {
if (!(await cache.getRecordAsync(record))) {
throw new _data.RecordNotFoundException(record.type, record.id);
}
return null;

@@ -175,2 +184,2 @@ }

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9hc3luYy1xdWVyeS1vcGVyYXRvcnMuanMiXSwibmFtZXMiOlsiQXN5bmNRdWVyeU9wZXJhdG9ycyIsImN1cnJlbnRSZWNvcmQiLCJjYWNoZSIsInJlY29yZCIsInJlc3VsdHMiLCJleHByZXNzaW9uIiwiZmlsdGVyUmVjb3JkcyIsInNvcnRSZWNvcmRzIiwicGFnaW5hdGVSZWNvcmRzIiwicmVsYXRlZElkcyIsInJlbGF0ZWRJZCIsImkiLCJsIiwiZmlsdGVycyIsImFwcGx5RmlsdGVyIiwiZmlsdGVyIiwiYWN0dWFsIiwiZGVlcEdldCIsImV4cGVjdGVkIiwicmVsYXRpb24iLCJhIiwiZSIsIkFycmF5IiwiY29tcGFyaXNvblZhbHVlcyIsInJlY29yZHMiLCJzb3J0U3BlY2lmaWVyIiwiY29tcGFyaXNvbk9yZGVycyIsInNvcnRFeHByZXNzaW9uIiwidmFsdWVzMSIsInZhbHVlczIiLCJzb3J0U3BlY2lmaWVycyIsImlzTm9uZSIsInBhZ2luYXRpb25PcHRpb25zIiwib2Zmc2V0IiwibGltaXQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUNBOztBQUNPLElBQU1BLG9EQUFzQjtBQUFBLGdCQUFBLGdCQUFBLEtBQUEsRUFBQSxVQUFBLEVBQ0s7QUFBQSxZQUFBLFNBQUEsV0FBQSxNQUFBOztBQUVoQyxZQUFNQyxnQkFBZ0IsTUFBTUMsTUFBQUEsY0FBQUEsQ0FBNUIsTUFBNEJBLENBQTVCO0FBQ0EsWUFBSSxDQUFKLGFBQUEsRUFBb0I7QUFDaEIsa0JBQU0sSUFBQSw2QkFBQSxD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biAgICAgICAgc3dpdGNoIChmaWx0ZXIub3ApIHtcbiAgICAgICAgICAgIGNhc2UgJ2VxdWFsJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsID09PSBleHBlY3RlZDtcbiAgICAgICAgICAgIGNhc2UgJ2d0JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsID4gZXhwZWN0ZWQ7XG4gICAgICAgICAgICBjYXNlICdndGUnOlxuICAgICAgICAgICAgICAgIHJldHVybiBhY3R1YWwgPj0gZXhwZWN0ZWQ7XG4gICAgICAgICAgICBjYXNlICdsdCc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFjdHVhbCA8IGV4cGVjdGVkO1xuICAgICAgICAgICAgY2FzZSAnbHRlJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsIDw9IGV4cGVjdGVkO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUXVlcnlFeHByZXNzaW9uUGFyc2VFcnJvcignRmlsdGVyIG9wZXJhdGlvbiAke2ZpbHRlci5vcH0gbm90IHJlY29nbml6ZWQgZm9yIFN0b3JlLicsIGZpbHRlcik7XG4gICAgICAgIH1cbiAgICB9IGVsc2UgaWYgKGZpbHRlci5raW5kID09PSAncmVsYXRlZFJlY29yZHMnKSB7XG4gICAgICAgIGxldCByZWxhdGlvbiA9IGRlZXBHZXQocmVjb3JkLCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWx0ZXIucmVsYXRpb25dKTtcbiAgICAgICAgbGV0IGFjdHVhbCA9IHJlbGF0aW9uID09PSB1bmRlZmluZWQgPyBbXSA6IHJlbGF0aW9uLmRhdGE7XG4gICAgICAgIGxldCBleHBlY3RlZCA9IGZpbHRlci5yZWNvcmRzO1xuICAgICAgICBzd2l0Y2ggKGZpbHRlci5vcCkge1xuICAgICAgICAgICAgY2FzZSAnZXF1YWwnOlxuICAgICAgICAgICAgICAgIHJldHVybiBhY3R1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WYgKGlzTm9uZSh2YWx1ZXMxW2ldKSAmJiAhaXNOb25lKHZhbHVlczJbaV0pKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGNvbXBhcmlzb25PcmRlcnNbaV07XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlzTm9uZSh2YWx1ZXMyW2ldKSAmJiAhaXNOb25lKHZhbHVlczFbaV0pKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIC1jb21wYXJpc29uT3JkZXJzW2ldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiAwO1xuICAgIH0pO1xufVxuZnVuY3Rpb24gcGFnaW5hdGVSZWNvcmRzKHJlY29yZHMsIHBhZ2luYXRpb25PcHRpb25zKSB7XG4gICAgaWYgKHBhZ2luYXRpb25PcHRpb25zLmxpbWl0ICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgbGV0IG9mZnNldCA9IHBhZ2luYXRpb25PcHRpb25zLm9mZnNldCA9PT0gdW5kZWZpbmVkID8gMCA6IHBhZ2luYXRpb25PcHRpb25zLm9mZnNldDtcbiAgICAgICAgbGV0IGxpbWl0ID0gcGFnaW5hdGlvbk9wdGlvbnMubGltaXQ7XG4gICAgICAgIHJldHVybiByZWNvcmRzLnNsaWNlKG9mZnNldCwgb2Zmc2V0ICsgbGltaXQpO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHRocm93IG5ldyBRdWVyeUV4cHJlc3Npb25QYXJzZUVycm9yKCdQYWdpbmF0aW9uIG9wdGlvbnMgbm90IHJlY29nbml6ZWQgZm9yIFN0b3JlLiBQbGVhc2Ugc3BlY2lmeSBgb2Zmc2V0YCBhbmQgYGxpbWl0YC4nLCBwYWdpbmF0aW9uT3B0aW9ucyk7XG4gICAgfVxufSJdfQ==
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9hc3luYy1xdWVyeS1vcGVyYXRv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AgICBjb25zdCBjb21wYXJpc29uT3JkZXJzID0gc29ydFNwZWNpZmllcnMubWFwKHNvcnRFeHByZXNzaW9uID0+IHNvcnRFeHByZXNzaW9uLm9yZGVyID09PSAnZGVzY2VuZGluZycgPyAtMSA6IDEpO1xuICAgIHJldHVybiByZWNvcmRzLnNvcnQoKHJlY29yZDEsIHJlY29yZDIpID0+IHtcbiAgICAgICAgY29uc3QgdmFsdWVzMSA9IGNvbXBhcmlzb25WYWx1ZXMuZ2V0KHJlY29yZDEpO1xuICAgICAgICBjb25zdCB2YWx1ZXMyID0gY29tcGFyaXNvblZhbHVlcy5nZXQocmVjb3JkMik7XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc29ydFNwZWNpZmllcnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGlmICh2YWx1ZXMxW2ldIDwgdmFsdWVzMltpXSkge1xuICAgICAgICAgICAgICAgIHJldHVybiAtY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodmFsdWVzMVtpXSA+IHZhbHVlczJbaV0pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNOb25lKHZhbHVlczFbaV0pICYmICFpc05vbmUodmFsdWVzMltpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNOb25lKHZhbHVlczJbaV0pICYmICFpc05vbmUodmFsdWVzMVtpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gLWNvbXBhcmlzb25PcmRlcnNbaV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIDA7XG4gICAgfSk7XG59XG5mdW5jdGlvbiBwYWdpbmF0ZVJlY29yZHMocmVjb3JkcywgcGFnaW5hdGlvbk9wdGlvbnMpIHtcbiAgICBpZiAocGFnaW5hdGlvbk9wdGlvbnMubGltaXQgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICBsZXQgb2Zmc2V0ID0gcGFnaW5hdGlvbk9wdGlvbnMub2Zmc2V0ID09PSB1bmRlZmluZWQgPyAwIDogcGFnaW5hdGlvbk9wdGlvbnMub2Zmc2V0O1xuICAgICAgICBsZXQgbGltaXQgPSBwYWdpbmF0aW9uT3B0aW9ucy5saW1pdDtcbiAgICAgICAgcmV0dXJuIHJlY29yZHMuc2xpY2Uob2Zmc2V0LCBvZmZzZXQgKyBsaW1pdCk7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgdGhyb3cgbmV3IFF1ZXJ5RXhwcmVzc2lvblBhcnNlRXJyb3IoJ1BhZ2luYXRpb24gb3B0aW9ucyBub3QgcmVjb2duaXplZCBmb3IgU3RvcmUuIFBsZWFzZSBzcGVjaWZ5IGBvZmZzZXRgIGFuZCBgbGltaXRgLicsIHBhZ2luYXRpb25PcHRpb25zKTtcbiAgICB9XG59Il19

@@ -40,2 +40,8 @@ 'use strict';

var relatedIds = cache.getRelatedRecordsSync(record, relationship);
if (!relatedIds) {
if (!cache.getRecordSync(record)) {
throw new _data.RecordNotFoundException(record.type, record.id);
}
return [];
}
return cache.getRecordsSync(relatedIds);

@@ -51,2 +57,5 @@ },

} else {
if (!cache.getRecordSync(record)) {
throw new _data.RecordNotFoundException(record.type, record.id);
}
return null;

@@ -175,2 +184,2 @@ }

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9zeW5jLXF1ZXJ5LW9wZXJhdG9ycy5qcyJdLCJuYW1lcyI6WyJTeW5jUXVlcnlPcGVyYXRvcnMiLCJjdXJyZW50UmVjb3JkIiwiY2FjaGUiLCJyZWNvcmQiLCJyZXN1bHRzIiwiZXhwcmVzc2lvbiIsImZpbHRlclJlY29yZHMiLCJzb3J0Um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ZXNzaW9uID0+IHNvcnRFeHByZXNzaW9uLm9yZGVyID09PSAnZGVzY2VuZGluZycgPyAtMSA6IDEpO1xuICAgIHJldHVybiByZWNvcmRzLnNvcnQoKHJlY29yZDEsIHJlY29yZDIpID0+IHtcbiAgICAgICAgY29uc3QgdmFsdWVzMSA9IGNvbXBhcmlzb25WYWx1ZXMuZ2V0KHJlY29yZDEpO1xuICAgICAgICBjb25zdCB2YWx1ZXMyID0gY29tcGFyaXNvblZhbHVlcy5nZXQocmVjb3JkMik7XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc29ydFNwZWNpZmllcnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGlmICh2YWx1ZXMxW2ldIDwgdmFsdWVzMltpXSkge1xuICAgICAgICAgICAgICAgIHJldHVybiAtY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodmFsdWVzMVtpXSA+IHZhbHVlczJbaV0pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNOb25lKHZhbHVlczFbaV0pICYmICFpc05vbmUodmFsdWVzMltpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNOb25lKHZhbHVlczJbaV0pICYmICFpc05vbmUodmFsdWVzMVtpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gLWNvbXBhcmlzb25PcmRlcnNbaV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIDA7XG4gICAgfSk7XG59XG5mdW5jdGlvbiBwYWdpbmF0ZVJlY29yZHMocmVjb3JkcywgcGFnaW5hdGlvbk9wdGlvbnMpIHtcbiAgICBpZiAocGFnaW5hdGlvbk9wdGlvbnMubGltaXQgIT09IHVuZGV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J0U3BlY2lmaWVycy5tYXAoc29ydFNwZWNpZmllciA9PiB7XG4gICAgICAgICAgICBpZiAoc29ydFNwZWNpZmllci5raW5kID09PSAnYXR0cmlidXRlJykge1xuICAgICAgICAgICAgICAgIHJldHVybiBkZWVwR2V0KHJlY29yZCwgWydhdHRyaWJ1dGVzJywgc29ydFNwZWNpZmllci5hdHRyaWJ1dGVdKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFF1ZXJ5RXhwcmVzc2lvblBhcnNlRXJyb3IoJ1NvcnQgc3BlY2lmaWVyICR7c29ydFNwZWNpZmllci5raW5kfSBub3QgcmVjb2duaXplZCBmb3IgU3RvcmUuJywgc29ydFNwZWNpZmllcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pKTtcbiAgICB9KTtcbiAgICBjb25zdCBjb21wYXJpc29uT3JkZXJzID0gc29ydFNwZWNpZmllcnMubWFwKHNvcnRFeHByZXNzaW9uID0+IHNvcnRFeHByZXNzaW9uLm9yZGVyID09PSAnZGVzY2VuZGluZycgPyAtMSA6IDEpO1xuICAgIHJldHVybiByZWNvcmRzLnNvcnQoKHJlY29yZDEsIHJlY29yZDIpID0+IHtcbiAgICAgICAgY29uc3QgdmFsdWVzMSA9IGNvbXBhcmlzb25WYWx1ZXMuZ2V0KHJlY29yZDEpO1xuICAgICAgICBjb25zdCB2YWx1ZXMyID0gY29tcGFyaXNvblZhbHVlcy5nZXQocmVjb3JkMik7XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc29ydFNwZWNpZmllcnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGlmICh2YWx1ZXMxW2ldIDwgdmFsdWVzMltpXSkge1xuICAgICAgICAgICAgICAgIHJldHVybiAtY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodmFsdWVzMVtpXSA+IHZhbHVlczJbaV0pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNOb25lKHZhbHVlczFbaV0pICYmICFpc05vbmUodmFsdWVzMltpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyaXNvbk9yZGVyc1tpXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNOb25lKHZhbHVlczJbaV0pICYmICFpc05vbmUodmFsdWVzMVtpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gLWNvbXBhcmlzb25PcmRlcnNbaV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIDA7XG4gICAgfSk7XG59XG5mdW5jdGlvbiBwYWdpbmF0ZVJlY29yZHMocmVjb3JkcywgcGFnaW5hdGlvbk9wdGlvbnMpIHtcbiAgICBpZiAocGFnaW5hdGlvbk9wdGlvbnMubGltaXQgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICBsZXQgb2Zmc2V0ID0gcGFnaW5hdGlvbk9wdGlvbnMub2Zmc2V0ID09PSB1bmRlZmluZWQgPyAwIDogcGFnaW5hdGlvbk9wdGlvbnMub2Zmc2V0O1xuICAgICAgICBsZXQgbGltaXQgPSBwYWdpbmF0aW9uT3B0aW9ucy5saW1pdDtcbiAgICAgICAgcmV0dXJuIHJlY29yZHMuc2xpY2Uob2Zmc2V0LCBvZmZzZXQgKyBsaW1pdCk7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgdGhyb3cgbmV3IFF1ZXJ5RXhwcmVzc2lvblBhcnNlRXJyb3IoJ1BhZ2luYXRpb24gb3B0aW9ucyBub3QgcmVjb2duaXplZCBmb3IgU3RvcmUuIFBsZWFzZSBzcGVjaWZ5IGBvZmZzZXRgIGFuZCBgbGltaXRgLicsIHBhZ2luYXRpb25PcHRpb25zKTtcbiAgICB9XG59Il19

@@ -28,2 +28,8 @@ import { deepGet, isNone } from '@orbit/utils';

const relatedIds = await cache.getRelatedRecordsAsync(record, relationship);
if (!relatedIds) {
if (!(await cache.getRecordAsync(record))) {
throw new RecordNotFoundException(record.type, record.id);
}
return [];
}
return cache.getRecordsAsync(relatedIds);

@@ -37,2 +43,5 @@ },

} else {
if (!(await cache.getRecordAsync(record))) {
throw new RecordNotFoundException(record.type, record.id);
}
return null;

@@ -39,0 +48,0 @@ }

@@ -28,2 +28,8 @@ import { deepGet, isNone } from '@orbit/utils';

const relatedIds = cache.getRelatedRecordsSync(record, relationship);
if (!relatedIds) {
if (!cache.getRecordSync(record)) {
throw new RecordNotFoundException(record.type, record.id);
}
return [];
}
return cache.getRecordsSync(relatedIds);

@@ -37,2 +43,5 @@ },

} else {
if (!cache.getRecordSync(record)) {
throw new RecordNotFoundException(record.type, record.id);
}
return null;

@@ -39,0 +48,0 @@ }

@@ -31,2 +31,8 @@ import { deepGet, isNone } from '@orbit/utils';

var relatedIds = await cache.getRelatedRecordsAsync(record, relationship);
if (!relatedIds) {
if (!(await cache.getRecordAsync(record))) {
throw new RecordNotFoundException(record.type, record.id);
}
return [];
}
return cache.getRecordsAsync(relatedIds);

@@ -42,2 +48,5 @@ },

} else {
if (!(await cache.getRecordAsync(record))) {
throw new RecordNotFoundException(record.type, record.id);
}
return null;

@@ -166,2 +175,2 @@ }

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9hc3luYy1xdWVyeS1vcGVyYXRvcnMuanMiXSwibmFtZXMiOlsiZGVlcEdldCIsImlzTm9uZSIsIlJlY29yZE5vdEZvdW5kRXhjZXB0aW9uIiwiUXVlcnlFeHByZXNzaW9uUGFyc2VFcnJvciIsIkFzeW5jUXVlcnlPcGVyYXRvcnMiLCJmaW5kUmVjb3JkIiwiY2FjaGUiLCJleHByZXNzaW9uIiwicmVjb3JkIiwiY3VycmVudFJlY29yZCIsImdldFJlY29yZEFzeW5jIiwidHlwZSIsImlkIiw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dlKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0cztcbiAgICB9LFxuICAgIGFzeW5jIGZpbmRSZWxhdGVkUmVjb3JkcyhjYWNoZSwgZXhwcmVzc2lvbikge1xuICAgICAgICBjb25zdCB7IHJlY29yZCwgcmVsYXRpb25zaGlwIH0gPSBleHByZXNzaW9uO1xuICAgICAgICBjb25zdCByZWxhdGVkSWRzID0gYXdhaXQgY2FjaGUuZ2V0UmVsYXRlZFJlY29yZHNBc3luYyhyZWNvcmQsIHJlbGF0aW9uc2hpcCk7XG4gICAgICAgIHJldHVybiBjYWNoZS5nZXRSZWNvcmRzQXN5bmMocmVsYXRlZElkcyk7XG4gICAgfSxcbiAgICBhc3luYyBmaW5kUmVsYXRlZFJlY29yZChjYWNoZSwgZXhwcmVzc2lvbikge1xuICAgICAgICBjb25zdCB7IHJlY29yZCwgcmVsYXRpb25zaGlwIH0gPSBleHByZXNzaW9uO1xuICAgICAgICBjb25zdCByZWxhdGVkSWQgPSBhd2FpdCBjYWNoZS5nZXRSZWxhdGVkUmVjb3JkQXN5bmMocmVjb3JkLCByZWxhdGlvbnNoaXApO1xuICAgICAgICBpZiAocmVsYXRlZElkKSB7XG4gICAgICAgICAgICByZXR1cm4gYXdhaXQgY2FjaGUuZ2V0UmVjb3JkQXN5bmMocmVsYXRlZElkKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgfVxufTtcbmZ1bmN0aW9uIGZpbHRlclJlY29yZHMocmVjb3JkcywgZmlsdGVycykge1xuICAgIHJldHVybiByZWNvcmRzLmZpbHRlcihyZWNvcmQgPT4ge1xuICAgICAgICBmb3IgKGxldCBpID0gMCwgbCA9IGZpbHRlcnMubGVuZ3RoOyBpIDwgbDsgaSsrKSB7XG4gICAgICAgICAgICBpZiAoIWFwcGx5RmlsdGVyKHJlY29yZCwgZmlsdGVyc1tpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgfSk7XG59XG5mdW5jdGlvbiBhcHBseUZpbHRlcihyZWNvcmQsIGZpbHRlcikge1xuICAgIGlmIChmaWx0ZXIua2luZCA9PT0gJ2F0dHJpYnV0ZScpIHtcbiAgICAgICAgbGV0IGFjdHVhbCA9IGRlZXBHZXQocmVjb3JkLCBbJ2F0dHJpYnV0ZXMnLCBmaWx0ZXIuYXR0cmlidXRlXSk7XG4gICAgICAgIGxldCBleHBlY3RlZCA9IGZpbHRlci52YWx1ZTtcbiAgICAgICAgc3dpdGNoIChmaWx0ZXIub3ApIHtcbiAgICAgICAgICAgIGNhc2UgJ2VxdWFsJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsID09PSBleHBlY3RlZDtcbiAgICAgICAgICAgIGNhc2UgJ2d0JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsID4gZXhwZWN0ZWQ7XG4gICAgICAgICAgICBjYXNlICdndGUnOlxuICAgICAgICAgICAgICAgIHJldHVybiBhY3R1YWwgPj0gZXhwZWN0ZWQ7XG4gICAgICAgICAgICBjYXNlICdsdCc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFjdHVhbCA8IGV4cGVjdGVkO1xuICAgICAgICAgICAgY2FzZSAnbHRlJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsIDw9IGV4cGVjdGVkO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUXVlcnlFeHByZXNzaW9uUGFyc2VFcnJvcignRmlsdGVyIG9wZXJhdGlvbiAke2ZpbHRlci5vcH0gbm90IHJlY29nbml6ZWQgZm9yIFN0b3JlLicsIGZpbHRlcik7XG4gICAgICAgIH1cbiAgICB9IGVsc2UgaWYgKGZpbHRlci5raW5kID09PSAncmVsYXRlZFJlY29yZHMnK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mF0aW9uICR7ZmlsdGVyLm9wfSBub3QgcmVjb2duaXplZCBmb3IgU3RvcmUuJywgZmlsdGVyKTtcbiAgICAgICAgfVxuICAgIH0gZWxzZSBpZiAoZmlsdGVyLmtpbmQgPT09ICdyZWxhdGVkUmVjb3JkJykge1xuICAgICAgICBsZXQgcmVsYXRpb24gPSBkZWVwR2V0KHJlY29yZCwgW1wicmVsYXRpb25zaGlwc1wiLCBmaWx0ZXIucmVsYXRpb25dKTtcbiAgICAgICAgbGV0IGFjdHVhbCA9IHJlbGF0aW9uID09PSB1bmRlZmluZWQgPyB1bmRlZmluZWQgOiByZWxhdGlvbi5kYXRhO1xuICAgICAgICBsZXQgZXhwZWN0ZWQgPSBmaWx0ZXIucmVjb3JkO1xuICAgICAgICBzd2l0Y2ggKGZpbHRlci5vcCkge1xuICAgICAgICAgICAgY2FzZSAnZXF1YWwnOlxuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGV4cGVjdGVkKSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsICE9PSB1bmRlZmluZWQgJiYgZXhwZWN0ZWQuc29tZShlID0+IGFjdHVhbC50eXBlID09PSBlLnR5cGUgJiYgYWN0dWFsLmlkID09PSBlLmlkKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsICE9PSB1bmRlZmluZWQgJiYgYWN0dWFsLnR5cGUgPT09IGV4cGVjdGVkLnR5cGUgJiYgYWN0dWFsLmlkID09PSBleHBlY3RlZC5pZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBRdWVyeUV4cHJlc3Npb25QYXJzZUVycm9yKCdGaWx0ZXIgb3BlcmF0aW9uICR7ZmlsdGVyLm9wfSBub3QgcmVjb2duaXplZCBmb3IgU3RvcmUuJywgZmlsdGVyKTtcbiAgICAgICAgfVxu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vcmRBc3luYyhyZWNvcmQpKSkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBSZWNvcmROb3RGb3VuZEV4Y2VwdGlvbihyZWNvcmQudHlwZSwgcmVjb3JkLmlkKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgfVxufTtcbmZ1bmN0aW9uIGZpbHRlclJlY29yZHMocmVjb3JkcywgZmlsdGVycykge1xuICAgIHJldHVybiByZWNvcmRzLmZpbHRlcihyZWNvcmQgPT4ge1xuICAgICAgICBmb3IgKGxldCBpID0gMCwgbCA9IGZpbHRlcnMubGVuZ3RoOyBpIDwgbDsgaSsrKSB7XG4gICAgICAgICAgICBpZiAoIWFwcGx5RmlsdGVyKHJlY29yZCwgZmlsdGVyc1tpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgfSk7XG59XG5mdW5jdGlvbiBhcHBseUZpbHRlcihyZWNvcmQsIGZpbHRlcikge1xuICAgIGlmIChmaWx0ZXIua2luZCA9PT0gJ2F0dHJpYnV0ZScpIHtcbiAgICAgICAgbGV0IGFjdHVhbCA9IGRlZXBHZXQocmVjb3JkLCBbJ2F0dHJpYnV0ZXMnLCBmaWx0ZXIuYXR0cmlidXRlXSk7XG4gICAgICAgIGxldCBleHBlY3RlZCA9IGZpbHRlci52YWx1ZTtcbiAgICAgICAgc3dpdGNoIChmaWx0ZXIub3ApIHtcbiAgICAgICAgICAgIGNhc2UgJ2VxdWFsJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsID09PSBleHBlY3RlZDtcbiAgICAgICAgICAgIGNhc2UgJ2d0JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsID4gZXhwZWN0ZWQ7XG4gICAgICAgICAgICBjYXNlICdndGUnOlxuICAgICAgICAgICAgICAgIH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09PSBlLmlkICYmIGEudHlwZSA9PT0gZS50eXBlKSk7XG4gICAgICAgICAgICBjYXNlICdzb21lJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gZXhwZWN0ZWQuc29tZShlID0+IGFjdHVhbC5zb21lKGEgPT4gYS5pZCA9PT0gZS5pZCAmJiBhLnR5cGUgPT09IGUudHlwZSkpO1xuICAgICAgICAgICAgY2FzZSAnbm9uZSc6XG4gICAgICAgICAgICAgICAgcmV0dXJuICFleHBlY3RlZC5zb21lKGUgPT4gYWN0dWFsLnNvbWUoYSA9PiBhLmlkID09PSBlLmlkICYmIGEudHlwZSA9PT0gZS50eXBlKSk7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBRdWVyeUV4cHJlc3Npb25QYXJzZUVycm9yKCdGaWx0ZXIgb3BlcmF0aW9uICR7ZmlsdGVyLm9wfSBub3QgcmVjb2duaXplZCBmb3IgU3RvcmUuJywgZmlsdGVyKTtcbiAgICAgICAgfVxuICAgIH0gZWxzZSBpZiAoZmlsdGVyLmtpbmQgPT09ICdyZWxhdGVkUmVjb3JkJykge1xuICAgICAgICBsZXQgcmVsYXRpb24gPSBkZWVwR2V0KHJlY29yZCwgW1wicmVsYXRpb25zaGlwc1wiLCBmaWx0ZXIucmVsYXRpb25dKTtcbiAgICAgICAgbGV0IGFjdHVhbCA9IHJlbGF0aW9uID09PSB1bmRlZmluZWQgPyB1bmRlZmluZWQgOiByZWxhdGlvbi5kYXRhO1xuICAgICAgICBsZXQgZXhwZWN0ZWQgPSBmaWx0ZXIucmVjb3JkO1xuICAgICAgICBzd2l0Y2ggKGZpbHRlci5vcCkge1xuICAgICAgICAgICAgY2FzZSAnZXF1YWwnOlxuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGV4cGVjdGVkKSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsICE9PSB1bmRlZmluZWQgJiYgZXhwZWN0ZWQuc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zW2ldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiAwO1xuICAgIH0pO1xufVxuZnVuY3Rpb24gcGFnaW5hdGVSZWNvcmRzKHJlY29yZHMsIHBhZ2luYXRpb25PcHRpb25zKSB7XG4gICAgaWYgKHBhZ2luYXRpb25PcHRpb25zLmxpbWl0ICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgbGV0IG9mZnNldCA9IHBhZ2luYXRpb25PcHRpb25zLm9mZnNldCA9PT0gdW5kZWZpbmVkID8gMCA6IHBhZ2luYXRpb25PcHRpb25zLm9mZnNldDtcbiAgICAgICAgbGV0IGxpbWl0ID0gcGFnaW5hdGlvbk9wdGlvbnMubGltaXQ7XG4gICAgICAgIHJldHVybiByZWNvcmRzLnNsaWNlKG9mZnNldCwgb2Zmc2V0ICsgbGltaXQpO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHRocm93IG5ldyBRdWVyeUV4cHJlc3Npb25QYXJzZUVycm9yKCdQYWdpbmF0aW9uIG9wdGlvbnMgbm90IHJlY29nbml6ZWQgZm9yIFN0b3JlLiBQbGVhc2Ugc3BlY2lmeSBgb2Zmc2V0YCBhbmQgYGxpbWl0YC4nLCBwYWdpbmF0aW9uT3B0aW9ucyk7XG4gICAgfVxufSJdfQ==

@@ -31,2 +31,8 @@ import { deepGet, isNone } from '@orbit/utils';

var relatedIds = cache.getRelatedRecordsSync(record, relationship);
if (!relatedIds) {
if (!cache.getRecordSync(record)) {
throw new RecordNotFoundException(record.type, record.id);
}
return [];
}
return cache.getRecordsSync(relatedIds);

@@ -42,2 +48,5 @@ },

} else {
if (!cache.getRecordSync(record)) {
throw new RecordNotFoundException(record.type, record.id);
}
return null;

@@ -166,2 +175,2 @@ }

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9zeW5jLXF1ZXJ5LW9wZXJhdG9ycy5qcyJdLCJuYW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AgICAgIGZvciAobGV0IGkgPSAwLCBsID0gZmlsdGVycy5sZW5ndGg7IGkgPCBsOyBpKyspIHtcbiAgICAgICAgICAgIGlmICghYXBwbHlGaWx0ZXIocmVjb3JkLCBmaWx0ZXJzW2ldKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9KTtcbn1cbmZ1bmN0aW9uIGFwcGx5RmlsdGVyKHJlY29yZCwgZmlsdGVyKSB7XG4gICAgaWYgKGZpbHRlci5raW5kID09PSAnYXR0cmlidXRlJykge1xuICAgICAgICBsZXQgYWN0dWFsID0gZGVlcEdldChyZWNvcmQsIFsnYXR0cmlidXRlcycsIGZpbHRlci5hdHRyaWJ1dGVdKTtcbiAgICAgICAgbGV0IGV4cGVjdGVkID0gZmlsdGVyLnZhbHVlO1xuICAgICAgICBzd2l0Y2ggKGZpbHRlci5vcCkge1xuICAgICAgICAgICAgY2FzZSAnZXF1YWwnOlxuICAgICAgICAgICAgICAgIHJldHVybiBhY3R1YWwgPT09IGV4cGVjdGVkO1xuICAgICAgICAgICAgY2FzZSAnZ3QnOlxuICAgICAgICAgICAgICAgIHJldHVybiBhY3R1YWwgPiBleHBlY3RlZDtcbiAgICAgICAgICAgIGNhc2UgJ2d0ZSc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFjdHVhbCA+PSBleHBlY3RlZDtcbiAgICAgICAgICAgIGNhc2UgJ2x0JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsIDwgZXhwZWN0ZWQ7XG4gICAgICAgICAgICBjYXNlICdsdGUnOlxuICAgICAgICAgICAgICAgIHJldHVybiBhY3R1YWwgPD0gZXhwZWN0ZWQ7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBRdWVyeUV4cHJlc3Npb25QYXJzZUVycm9yKCdGaWx0ZXIgb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wYWdlKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0cztcbiAgICB9LFxuICAgIGZpbmRSZWxhdGVkUmVjb3JkcyhjYWNoZSwgZXhwcmVzc2lvbikge1xuICAgICAgICBjb25zdCB7IHJlY29yZCwgcmVsYXRpb25zaGlwIH0gPSBleHByZXNzaW9uO1xuICAgICAgICBjb25zdCByZWxhdGVkSWRzID0gY2FjaGUuZ2V0UmVsYXRlZFJlY29yZHNTeW5jKHJlY29yZCwgcmVsYXRpb25zaGlwKTtcbiAgICAgICAgaWYgKCFyZWxhdGVkSWRzKSB7XG4gICAgICAgICAgICBpZiAoIWNhY2hlLmdldFJlY29yZFN5bmMocmVjb3JkKSkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBSZWNvcmROb3RGb3VuZEV4Y2VwdGlvbihyZWNvcmQudHlwZSwgcmVjb3JkLmlkKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBbXTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY2FjaGUuZ2V0UmVjb3Jkc1N5bmMocmVsYXRlZElkcyk7XG4gICAgfSxcbiAgICBmaW5kUmVsYXRlZFJlY29yZChjYWNoZSwgZXhwcmVzc2lvbikge1xuICAgICAgICBjb25zdCB7IHJlY29yZCwgcmVsYXRpb25zaGlwIH0gPSBleHByZXNzaW9uO1xuICAgICAgICBjb25zdCByZWxhdGVkSWQgPSBjYWNoZS5nZXRSZWxhdGVkUmVjb3JkU3luYyhyZWNvcmQsIHJlbGF0aW9uc2hpcCk7XG4gICAgICAgIGlmIChyZWxhdGVkSWQpIHtcbiAgICAgICAgICAgIHJldHVybiBjYWNoZS5nZXRSZWNvcmRTeW5jKHJlbGF0ZWRJZCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAoIWNhY2hlLmdldFJlY29yZFN5bmMocmVjb3JkKSkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBSZWNvcmROb3RGb3VuZEV4Y2VwdGlvbihyZWNvcmQudHlwZSwgcmVjb3JkLmlkKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgfVxufTtcbmZ1bmN0aW9uIGZpbHRlclJlY29yZHMocmVjb3JkcywgZmlsdGVycykge1xuICAgIHJldHVybiByZWNvcmRzLmZpbHRlcihyZWNvcmQgPT4ge1xuICAgICAgICBmb3IgKGxldCBpID0gMCwgbCA9IGZpbHRlcnMubGVuZ3RoOyBpIDwgbDsgaSsrKSB7XG4gICAgICAgICAgICBpZiAoIWFwcGx5RmlsdGVyKHJlY29yZCwgZmlsdGVyc1tpXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgfSk7XG59XG5mdW5jdGlvbiBhcHBseUZpbHRlcihyZWNvcmQsIGZpbHRlcikge1xuICAgIGlmIChmaWx0ZXIua2luZCA9PT0gJ2F0dHJpYnV0ZScpIHtcbiAgICAgICAgbGV0IGFjdHVhbCA9IGRlZXBHZXQocmVjb3JkLCBbJ2F0dHJpYnV0ZXMnLCBmaWx0ZXIuYXR0cmlidXRlXSk7XG4gICAgICAgIGxldCBleHBlY3RlZCA9IGZpbHRlci52YWx1ZTtcbiAgICAgICAgc3dpdGNoIChmaWx0ZXIub3ApIHtcbiAgICAgICAgICAgIGNhc2UgJ2VxdWFsJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsID09PSBleHBlY3RlZDtcbiAgICAgICAgICAgIGNhc2UgJ2d0JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gYWN0dWFsID4gZXhwZWN0ZWQ7XG4gICAgICAgICAgICBjYXNlICdndGUnOlxuICAgICAgICAgICAgICAgIHJldHVybiBhY3R1YWwgPj0gZXhwZWN0ZWQ7XG4gICAgICAgICAgICBjYXNlICdsdCc6XG4gICA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xufVxuZnVuY3Rpb24gcGFnaW5hdGVSZWNvcmRzKHJlY29yZHMsIHBhZ2luYXRpb25PcHRpb25zKSB7XG4gICAgaWYgKHBhZ2luYXRpb25PcHRpb25zLmxpbWl0ICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgbGV0IG9mZnNldCA9IHBhZ2luYXRpb25PcHRpb25zLm9mZnNldCA9PT0gdW5kZWZpbmVkID8gMCA6IHBhZ2luYXRpb25PcHRpb25zLm9mZnNldDtcbiAgICAgICAgbGV0IGxpbWl0ID0gcGFnaW5hdGlvbk9wdGlvbnMubGltaXQ7XG4gICAgICAgIHJldHVybiByZWNvcmRzLnNsaWNlKG9mZnNldCwgb2Zmc2V0ICsgbGltaXQpO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHRocm93IG5ldyBRdWVyeUV4cHJlc3Npb25QYXJzZUVycm9yKCdQYWdpbmF0aW9uIG9wdGlvbnMgbm90IHJlY29nbml6ZWQgZm9yIFN0b3JlLiBQbGVhc2Ugc3BlY2lmeSBgb2Zmc2V0YCBhbmQgYGxpbWl0YC4nLCBwYWdpbmF0aW9uT3B0aW9ucyk7XG4gICAgfVxufSJdfQ==

2

package.json
{
"name": "@orbit/record-cache",
"version": "0.16.0-beta.1",
"version": "0.16.0-beta.2",
"description": "Orbit base classes used to access and maintain a set of records.",

@@ -5,0 +5,0 @@ "contributors": [

@@ -51,2 +51,10 @@ import { Dict, deepGet, isNone } from '@orbit/utils';

const relatedIds = await cache.getRelatedRecordsAsync(record, relationship);
if (!relatedIds) {
if (!(await cache.getRecordAsync(record))) {
throw new RecordNotFoundException(record.type, record.id);
}
return [];
}
return cache.getRecordsAsync(relatedIds);

@@ -58,5 +66,10 @@ },

const relatedId = await cache.getRelatedRecordAsync(record, relationship);
if (relatedId) {
return await cache.getRecordAsync(relatedId);
} else {
if (!(await cache.getRecordAsync(record))) {
throw new RecordNotFoundException(record.type, record.id);
}
return null;

@@ -63,0 +76,0 @@ }

@@ -51,2 +51,10 @@ import { Dict, deepGet, isNone } from '@orbit/utils';

const relatedIds = cache.getRelatedRecordsSync(record, relationship);
if (!relatedIds) {
if (!cache.getRecordSync(record)) {
throw new RecordNotFoundException(record.type, record.id);
}
return [];
}
return cache.getRecordsSync(relatedIds);

@@ -61,2 +69,6 @@ },

} else {
if (!cache.getRecordSync(record)) {
throw new RecordNotFoundException(record.type, record.id);
}
return null;

@@ -63,0 +75,0 @@ }

Sorry, the diff of this file is too big to display

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