code: function(copy) {
          if (copy === undefined) copy = true;
  
          const data = this._syncAccumulator.getJSON();
          if (!data.nextBatch) return Promise.resolve(null);
          if (copy) {
              // We must deep copy the stored data so that the /sync processing code doesn't
              // corrupt the internal state of the sync accumulator (it adds non-clonable keys)
              return Promise.resolve(utils.deepCopy(data));
          } else {
              return Promise.resolve(data);
          }
      }
docs: @param {boolean=} copy If false, the data returned is from internal
  buffers and must not be mutated. Otherwise, a copy is made before
  returning such that the data can be safely mutated. Default: true.
  
  @return {Promise} Resolves with a sync response to restore the
  client state to where it was at the last save, or null if there
  is no saved sync data.