(source, target, since, next)
| 1803 | |
| 1804 | const _since = {}; |
| 1805 | function replicate(source, target, since, next) { |
| 1806 | if (typeof since === 'function') { |
| 1807 | next = since; |
| 1808 | since = undefined; |
| 1809 | } |
| 1810 | |
| 1811 | const sinceIx = source.modelName + ':to:' + target.modelName; |
| 1812 | if (since === undefined) { |
| 1813 | since = useSinceFilter ? |
| 1814 | _since[sinceIx] || -1 : |
| 1815 | -1; |
| 1816 | } |
| 1817 | |
| 1818 | debug('replicate from %s to %s since %j', |
| 1819 | source.modelName, target.modelName, since); |
| 1820 | |
| 1821 | source.replicate(since, target, function(err, conflicts, cps) { |
| 1822 | if (err) return next(err); |
| 1823 | |
| 1824 | if (conflicts.length === 0) { |
| 1825 | _since[sinceIx] = cps; |
| 1826 | } |
| 1827 | |
| 1828 | next(err, conflicts, cps); |
| 1829 | }); |
| 1830 | } |
| 1831 | |
| 1832 | function createModel(Model, data) { |
| 1833 | return function create(next) { |
no test coverage detected
searching dependent graphs…