Creates a multi-records response for the given type and records array

@method createMultiRecordsResponse
@param {DS.Store} store
@param {DS.Model} type
@param {Array.<Object>} records
@return {Object}
772807
function (store, type, records) {
    var json = {};
    type = this._parseModelOrType(store, type);
    json[pluralize(type.typeKey)] = records;
    this._injectFixturesInResponse.apply(this, [store, json].concat(slice.call(arguments, 3)));
    return this.completeJsonResponse(store, json);
  }
1022909
def all(options = {})
      begin
        response = Api.post("/models/#{id}/records", body: options).parsed_response
        ((view_id = options.delete(:view_id) || options.delete('view_id')).nil? ? response : response['records']).map do |data|
          load data
        end
      rescue MultiJson::DecodeError
      end
    end
102570
function (store, json) {
    var handledRecords = [], key, records, handleRecord, Model;
    handleRecord = function (record) {
      this.completeJsonForRecord(store, record, Model, json, handledRecords);
    };
    for (key in json) {
      if (json.hasOwnProperty(key)) {
        records = json[key];
        Model = store.modelFor(singularize(key));
        forEach(records, handleRecord, this);
      }
    }
    return json;
  }
919904
function _dispatchServiceResponse({ node, type, status, callerId }, json) {
    const isMultiNode = Array.isArray(node);
    const data = isMultiNode ? json : { [node]: json };
    const postStatus = { name: status, isLoading: false };
    let newStatus = {};
    if (isMultiNode) {
        node.forEach((nd) => { newStatus[nd] = postStatus; });
    } else {
        newStatus[node] = postStatus;
    }
    dispatcher.handleServerAction({
        data,
        type,
        status: newStatus,
        callerId
    });

    // Update information similar to store::afterChange
    return {
        properties: Object.keys(data),
        data,
        status: newStatus,
        informations: { callerId }
    };
}
784902
def create(from_records, to_records, index_columns, ignore_columns=None):
    
    from_indexed = records.index(from_records, index_columns)
    to_indexed = records.index(to_records, index_columns)

    if ignore_columns is not None:
        from_indexed = records.filter_ignored(from_indexed, ignore_columns)
        to_indexed = records.filter_ignored(to_indexed, ignore_columns)

    return create_indexed(from_indexed, to_indexed, index_columns)
613050
function makeSimpleStore(baseConnection) {
    baseConnection.constructor = makeSimpleStore;
    var behavior = Object.create(baseConnection);

    // this stores data like:
    // queries: {[queryKey]: {queryKey, query, recordIds}}
    // records
    return canReflect.assignMap(behavior, {
        getRecordFromParams: function(record) {
        	var id = canReflect.getIdentity(record, this.queryLogic.schema);
        	return this.getRecord(id);
        },

        log: function(){
			this._log = true;
		},

        getSets: function(){
			return this.getQueries();
		},
		getQueries: function(){
			return Promise.resolve(this.getQueriesSync());
		},
		getQueriesSync: function(){
			return this.getQueryDataSync().map(function(queryData){
				return queryData.query;
			});
		},

        getListData: function(query){
        	query = query || {};
        	var listData = this.getListDataSync(query);
        	if(listData) {
        		return Promise.resolve(listData);
        	}
        	return Promise.reject({
        		title: "no data",
        		status: "404",
        		detail: "No data available for this query.\nAvailable queries: "+
        			JSON.stringify(this.getQueriesSync())
        	});
        },
		getPaginatedListDataSync: function(superSetQueryData) {
			var records = this.getAllRecords();
			var queryWithoutPagination = this.queryLogic.removePagination(superSetQueryData.query);
			var matchingSuperRecordsNoPagination = this.queryLogic.filterMembersAndGetCount(queryWithoutPagination, {}, records);
			var startIndex = indexOf(matchingSuperRecordsNoPagination.data, superSetQueryData.startIdentity, this.queryLogic);
			var matchingSuperRecords = matchingSuperRecordsNoPagination.data.slice(startIndex, startIndex+ this.queryLogic.count(superSetQueryData.query));
			return {
				count: matchingSuperRecordsNoPagination.data.length,
				data: matchingSuperRecords
			};
		},
        getListDataSync: function(query){
			var queryData = this.getQueryDataSync(),
				superSetQueryData,
				isPaginated = this.queryLogic.isPaginated(query);

			for(var i = 0; i < queryData.length; i++) {
        		var checkSet = queryData[i].query;
        		if( this.queryLogic.isSubset(query, checkSet) ) {
					superSetQueryData = queryData[i];
        		}
        	}
			var records = this.getAllRecords();

			if(isPaginated && this.queryLogic.isPaginated(superSetQueryData.query) ) {
				var result = this.getPaginatedListDataSync(superSetQueryData);
				return this.queryLogic.filterMembersAndGetCount(query, superSetQueryData.query, result.data);
			}

            var matching = this.queryLogic.filterMembersAndGetCount(query, {}, records);
            if(matching && matching.count) {
                return matching;
            }
            // now check if we have a query  for it
        	if(superSetQueryData) {
				return {count: 0, data: []};
			}
        },

        updateListData: function(data, query){
			var queryData = this.getQueryDataSync();
        	query = query || {};
            var clonedData = canReflect.serialize(data);
        	var records = getItems(clonedData);
			// Update or create all records
			this.updateRecordsSync(records);
			var isPaginated = this.queryLogic.isPaginated(query);
			var identity = records.length ? canReflect.getIdentity(records[0],  this.queryLogic.schema) : undefined;
			if(isPaginated) {
				// we are going to merge with some paginated set
				for(var i = 0; i < queryData.length; i++) {
	        		var checkSet = queryData[i].query;
					var union = this.queryLogic.union(checkSet, query);
					if( this.queryLogic.isDefinedAndHasMembers(union)  ) {
						var siblingRecords = this.getPaginatedListDataSync(queryData[i]);
						var res = this.queryLogic.unionMembers(checkSet, query, siblingRecords.data, records );
						identity = canReflect.getIdentity(res[0],  this.queryLogic.schema);
						queryData[i] = {
							query: union,
							startIdentity: identity
						};
						this.updateQueryDataSync(queryData);
						return Promise.resolve();
					}
	        	}

				queryData.push({
					query: query,
					startIdentity: identity
				});
				this.updateQueryDataSync(queryData);
				return Promise.resolve();
			}

            // we need to remove everything that would have matched this query before, but that's not in data
            // but what if it's in another set -> we remove it
            var allRecords = this.getAllRecords();
            var curretMatching = this.queryLogic.filterMembers(query, allRecords);
            if(curretMatching.length) {
                var toBeDeleted = new Map();
                curretMatching.forEach(function(record){
                    toBeDeleted.set( canReflect.getIdentity(record, this.queryLogic.schema), record );
                }, this);

                // remove what's in records
                records.forEach(function(record){
                    toBeDeleted.delete( canReflect.getIdentity(record, this.queryLogic.schema) );
                }, this);

                this.destroyRecords( canReflect.toArray(toBeDeleted) );
            }

            // the queries that are not consumed by query
            var allQueries = this.getQueryDataSync();
            var notSubsets = allQueries.filter(function(existingQueryData){
                    return !this.queryLogic.isSubset(existingQueryData.query, query);
                }, this),
                superSets = notSubsets.filter(function(existingQueryData){
                    return this.queryLogic.isSubset(query, existingQueryData.query);
                }, this);

			// would need to note the first record ... so we can do a query w/o pagination
			//

            // if there are sets that are parents of query
            if(superSets.length) {
                this.updateQueryDataSync(notSubsets);
            } else {
                this.updateQueryDataSync(notSubsets.concat([{
					query: query,
					startIdentity:identity
				}]));
            }

        	// setData.push({query: query, items: data});
        	return Promise.resolve();
        },

        getData: function(params){
        	var id = canReflect.getIdentity(params, canReflect.getSchema( this.queryLogic ) );
        	var res = this.getRecord(id);
        	if(res){
        		return Promise.resolve( res );
        	} else {
        		return Promise.reject({
        			title: "no data",
        			status: "404",
        			detail: "No record with matching identity ("+id+")."
        		});
        	}
        },
        createData: function(record){
			this.updateRecordsSync([record]);

			return Promise.resolve(canReflect.assignMap({}, this.getRecordFromParams(record) ));
		},

		updateData: function(record){

			if(this.errorOnMissingRecord && !this.getRecordFromParams(record)) {
				var id = canReflect.getIdentity(record, this.queryLogic.schema);
				return Promise.reject({
					title: "no data",
					status: "404",
					detail: "No record with matching identity ("+id+")."
				});
			}

			this.updateRecordsSync([record]);

			return Promise.resolve(canReflect.assignMap({},this.getRecordFromParams(record) ));
		},

		destroyData: function(record){
			var id = canReflect.getIdentity(record,  this.queryLogic.schema),
				savedRecord = this.getRecordFromParams(record);

			if(this.errorOnMissingRecord && !savedRecord) {

				return Promise.reject({
					title: "no data",
					status: "404",
					detail: "No record with matching identity ("+id+")."
				});
			}
            this.destroyRecords([record]);
			return Promise.resolve(canReflect.assignMap({},savedRecord || record));
		}
    });
}
784049
function flattenRecord(record) {
    var data = {
        __internal: {
            id: record.id,
            type: record.type,
        },
    };
    objectForEach(record.attributes, function (key) {
        data[key] = record.attributes[key];
    });
    objectForEach(record.relationships, function (key) {
        var rel = record.relationships[key];
        if (rel.meta) {
            data[key + "Meta"] = rel.meta;
        }
        if (rel.links) {
            data.__internal.relationships = data.__internal.relationships || {};
            data.__internal.relationships[key] = rel.links;
        }
    });
    objectForEach(record.links, function (key) {
        /* istanbul ignore else */
        if (record.links[key]) {
            data.__internal.links = data.__internal.links || {};
            data.__internal.links[key] = record.links[key];
        }
    });
    objectForEach(record.meta, function (key) {
        /* istanbul ignore else */
        if (record.meta[key] !== undefined) {
            data.__internal.meta = data.__internal.meta || {};
            data.__internal.meta[key] = record.meta[key];
        }
    });
    return data;
}
880656
function (store, type, fixtureRecord) {
    var fixture = fixtureRecord || {};
    type = this._parseModelOrType(store, type);
    if (!fixtureRecord.id) {
      fixtureRecord.id = this.generateId(store, type);
    }
    if (this.fixtureForId(store, type, fixture.id)) {
      throw new Error('Fixture `' + type.typeKey + '` with id `' + fixture.id + '` already exists.');
    }
    return this.updateFixtures(store, type, fixture);
  }
138037
function( err ){
        if( err ) return cb( err );

        consolelog( rnd, "Multiple record lookup in insert done. At this point, recordWithLookups is:", recordWithLookups );

        // Cycle through each lookup child of the current record,
        async.eachSeries(
          Object.keys( self.lookupChildrenTablesHash ),

          function( recordKey, cb ){

            consolelog( rnd, "Working on lookup table:", recordKey);

            var childTableData = self.lookupChildrenTablesHash[ recordKey ];

            var childLayer = childTableData.layer;
            var nestedParams = childTableData.nestedParams;

            consolelog( rnd, "Working on ", childTableData.layer.table );
            consolelog( rnd, "Getting children data (lookup) in child table ", childTableData.layer.table," for field ", nestedParams.localField ," for record", recordWithLookups );

            // EXCEPTION: check if the record being looked up isn't the same as the one
            // being added. This is an edge case, but it's nice to cover it
            if( childLayer.table === self.table && recordWithLookups[ self.idProperty ] === recordWithLookups[ recordKey ] ){

              // Make up a temporary copy of the record, to which _children and __uc__ fields
              // will be added
              var t = {};
              for( var k in record ){
                if( !record.hasOwnProperty( k ) ) continue;
                t[ k ] = record[ k ];
              }
              childLayer._addUcFields( t );
              t._children = {};
              recordWithLookups._children[ recordKey ] = t;

              return cb( null );
            }

            // Get children data for that child table
            // ROOT to _getChildrenData
            self._getChildrenData( recordWithLookups, recordKey, function( err, childData){
              if( err ) return cb( err );

              if( childData ){

                childLayer._addUcFields( childData );
                childData._children = {};

                consolelog( rnd, "The childData data is:", childData );

                 // Make the record uppercase since it's for a search
                recordWithLookups._children[ recordKey ] = childData;
              }

              // That's it!
              cb( null );
            });
          },

          // 

          function( err ){
            if( err ) return cb( err );

            consolelog( rnd, "completeRecord done. At this point, recordWithLookups is:", recordWithLookups );

            cb( null, recordWithLookups );
          }
        );

      }
1174074
def save_records(self, records):
        '''
        
        '''
        for record in records:
            if not isinstance(record, Record):
                record = Record(*record)
            self.save_record(*record)
54033
function(storerecord, feedQueue) {
		var r = [],
			i = 0,
			l = 0,
			firstQueueitem = feedQueue[0];
		
		var filterFunc = function(elem) {
			if (storerecord === null) {
				return true;
			}
			return (elem.b >= storerecord.v);
		};
		
		for (i=0, l=feedQueue.length; i<l; i++) {
			if (
				(feedQueue[i].s != firstQueueitem.s) ||
				(feedQueue[i].k != firstQueueitem.k)
			) {
				return _filter(r,filterFunc);
			}
			r.push(feedQueue[i]);
		}
		return _filter(r,filterFunc);
	}
319165
function DataStore ( obj ) {
	this.autosave    = false;
	this.callback    = null;
	this.collections = [];
	this.credentials = null;
	this.datalists   = [];
	this.depth       = 0;
	this.events      = false;
	this.expires     = null;
	this.headers     = {Accept: "application/json"};
	this.ignore      = [];
	this.key         = null;
	this.keys        = {};
	this.leafs       = [];
	this.loaded      = false;
	this.maxDepth    = 0;
	this.mongodb     = "";
	this.parentNode  = obj;
	this.pointer     = null;
	this.records     = [];
	this.retrieve    = false;
	this.source      = null;
	this.total       = 0;
	this.views       = {};
	this.versions    = {};
	this.versioning  = true;
	this.uri         = null;
}
1239992
public function multiRewrite($records)
    {
        $ids = [];

        foreach ($records as $record) {
            if (!isset($record[$this->getIdentifier()])) {
                throw new DataStoreException("Identifier is required in 'multiRewrite' action for each record");
            }

            try {
                $rewroteRecord = $this->rewrite($record);
                $ids[] = $rewroteRecord[$this->getIdentifier()];
            } catch (\Throwable $e) {
                // TODO: need to log record that was not rewrote
                continue;
            }
        }

        return $ids;
    }
45568
function(records) {
    var self = this.chain()
    var relation = self.getInternal('relation')
    var parentRecord = self.getInternal('relation_to')

    if (!records) return self
    if (!Array.isArray(records)) records = [records]

    // build a map to check if existing records were added - via primary key
    const primaryKeys = self.definition.primaryKeys
    const map = {}
    self.forEach(function(record) {
      var mapKey = []
      primaryKeys.forEach(function(key) {
        if (record[key]) mapKey.push(record[key])
      })
      if (mapKey.length > 0) map[mapKey.join('|')] = record
    })

    records.forEach(function(record) {
      var fromKeys = false
      var mapKey = []

      if (record) {
        // check if `records` is a primitive, or an array of primitives with the same amount of elements as our primary keys
        if (
          typeof record !== 'object' ||
          (Array.isArray(record) &&
            record.length === primaryKeys.length &&
            typeof record[0] !== 'object')
        ) {
          // not a record/object... so it must be a primary key!
          if (self.options.polymorph)
            throw new Error('Polymorphic relations need to add a record!')

          var keys = record
          const tmpRecord = {}

          if (!Array.isArray(keys)) keys = [keys]

          primaryKeys.forEach(function(key, index) {
            if (keys[index]) {
              tmpRecord[key] = keys[index]
              mapKey.push(keys[index])
            }
          })

          if (mapKey.length > 0 && map[mapKey.join('|')]) {
            // found a record no update needed, because we only got the id...
            return
          }

          record = tmpRecord
          fromKeys = true
        }

        primaryKeys.forEach(function(key) {
          if (record[key]) mapKey.push(record[key])
        })

        if (mapKey.length > 0 && map[mapKey.join('|')]) {
          // found a record for update!
          map[mapKey.join('|')].set(record)
          return
        }

        const originalInput = record
        // convert object to a record
        if (self.options.polymorph) {
          if (record.model && !(record instanceof record.model))
            throw new Error(
              'Record/Model instance expected in polymorphic relation!'
            )
        } else {
          if (!(record instanceof self.model)) record = self.model.new(record)
        }

        record.__chainedModel = self

        if (fromKeys) {
          record._exists()
        } else {
          if (mapKey.length > 0 && mapKey.length === primaryKeys.length) {
            record._exists()
            if (!(originalInput instanceof self.model)) {
              // set changes. if for example the record is not loaded, but we now have the primary keys. Only the given fields are changes.
              // all fields that are not present in the original input, must not be changed, because we dont now their value.
              Object.keys(originalInput).forEach(function(key) {
                // ignore primary keys
                if (primaryKeys.indexOf(key) === -1) {
                  record.changes[key] = [undefined, originalInput[key]]
                }
              })
            }
          }
        }

        // a new one
        self.push(record)

        if (relation && parentRecord) {
          if (record && typeof relation.add === 'function') {
            relation.add.call(self, parentRecord, record)
          }
        }
      }
    })

    return self
  }
770749
def _get_record(self, record_type):
        
        if (not self.has_record_type(record_type) and
                record_type.get_identifier() not in self._record_type_data_sets):
            raise errors.Unsupported()
        if str(record_type) not in self._records:
            record_initialized = self._init_record(str(record_type))
            if record_initialized and str(record_type) not in self._my_map['recordTypeIds']:
                self._my_map['recordTypeIds'].append(str(record_type))
        return self._records[str(record_type)]
1104299
private String encodeRecord (String record)throws  IOException {
    // Convert original json object to a new json object with format {"Body": "originalJson"}
    // Add new json object to an array and send the whole array to eventhub using REST api
    // Refer to https://docs.microsoft.com/en-us/rest/api/eventhub/send-batch-events
    ArrayList<EventhubRequest> arrayList = new ArrayList<>();
    arrayList.add(new EventhubRequest(record));

    return mapper.writeValueAsString (arrayList);
  }
271770
function (ndefRecords) {

        var encoded = [],
            tnf_byte,
            record_type,
            payload_length,
            id_length,
            i,
            mb, me, // messageBegin, messageEnd
            cf = false, // chunkFlag TODO implement
            sr, // boolean shortRecord
            il; // boolean idLengthFieldIsPresent

        for(i = 0; i < ndefRecords.length; i++) {

            mb = (i === 0);
            me = (i === (ndefRecords.length - 1));
            sr = (ndefRecords[i].payload.length < 0xFF);
            il = (ndefRecords[i].id.length > 0);
            tnf_byte = ndef.encodeTnf(mb, me, cf, sr, il, ndefRecords[i].tnf);
            encoded.push(tnf_byte);

            // type is stored as String, converting to bytes for storage
            record_type = util.stringToBytes(ndefRecords[i].type);
            encoded.push(record_type.length);

            if (sr) {
                payload_length = ndefRecords[i].payload.length;
                encoded.push(payload_length);
            } else {
                payload_length = ndefRecords[i].payload.length;
                // 4 bytes
                encoded.push((payload_length >> 24));
                encoded.push((payload_length >> 16));
                encoded.push((payload_length >> 8));
                encoded.push((payload_length & 0xFF));
            }

            if (il) {
                id_length = ndefRecords[i].id.length;
                encoded.push(id_length);
            }

            encoded = encoded.concat(record_type);

            if (il) {
                encoded = encoded.concat(ndefRecords[i].id);
            }

            encoded = encoded.concat(ndefRecords[i].payload);
        }

        return encoded;
    }