can-query-logic.js
function QueryLogic(Type, options){
    Type = Type || {};
    var passedHydrator = options && options.toQuery;
    var passedSerializer = options && options.toParams;
    var schema;
    if(Type[schemaSymbol]) {
        schema = Type[schemaSymbol]();
    } else {
        schema = Type;
    }

    // check that the basics are here

    var id = schema.identity && schema.identity[0];
    if(!id) {
        //console.warn("can-query given a type without an identity schema.  Using `id` as the identity id.");
        schema.identity = ["id"];
    }

    var converter = makeBasicQueryConvert(schema),
        hydrate,
        serialize;

    if(passedHydrator) {
        hydrate = function(query){
            return converter.hydrate(passedHydrator(query));
        };
    } else {
        hydrate = converter.hydrate;
    }

    if(passedSerializer) {
        serialize = function(query){
            return passedSerializer(converter.serializer.serialize(query));
        };
    } else {
        serialize = converter.serializer.serialize;
    }
    this.hydrate = hydrate;
    this.serialize = serialize;
    this.schema = schema;

}
function QueryLogic(Type, options){
    Type = Type || {};
    var passedHydrator = options && options.toQuery;
    var passedSerializer = options && options.toParams;
    var schema;
    if(Type[schemaSymbol]) {
        schema = Type[schemaSymbol]();
    } else {
        schema = Type;
    }

    // check that the basics are here

    var id = schema.identity && schema.identity[0];
    if(!id) {
        //console.warn("can-query given a type without an identity schema.  Using `id` as the identity id.");
        schema.identity = ["id"];
    }

    var converter = makeBasicQueryConvert(schema),
        hydrate,
        serialize;

    if(passedHydrator) {
        hydrate = function(query){
            return converter.hydrate(passedHydrator(query));
        };
    } else {
        hydrate = converter.hydrate;
    }

    if(passedSerializer) {
        serialize = function(query){
            return passedSerializer(converter.serializer.serialize(query));
        };
    } else {
        serialize = converter.serializer.serialize;
    }
    this.hydrate = hydrate;
    this.serialize = serialize;
    this.schema = schema;

}
function QueryLogic ( Type , options ) { Type = Type || { } ; var passedHydrator = options && options . toQuery ; var passedSerializer = options && options . toParams ; var schema ; if ( Type [ schemaSymbol ] ) { schema = Type [ schemaSymbol ] ( ) ; } else { schema = Type ; } // check that the basics are here var id = schema . identity && schema . identity [ 0 ] ; if ( ! id ) { //console.warn("can-query given a type without an identity schema.  Using `id` as the identity id."); schema . identity = [ "id" ] ; } var converter = makeBasicQueryConvert ( schema ) , hydrate , serialize ; if ( passedHydrator ) { hydrate = function ( query ) { return converter . hydrate ( passedHydrator ( query ) ) ; } ; } else { hydrate = converter . hydrate ; } if ( passedSerializer ) { serialize = function ( query ) { return passedSerializer ( converter . serializer . serialize ( query ) ) ; } ; } else { serialize = converter . serializer . serialize ; } this . hydrate = hydrate ; this . serialize = serialize ; this . schema = schema ; }
Creates an algebra used to convert primitives to types and back
Creates an algebra used to convert primitives to types and back