BVB Source Codes

waterline Show find.js Source code

Return Download waterline: download find.js Source code - Download waterline Source code - Type:.js
  1. /**
  2.  * Module dependencies
  3.  */
  4.  
  5. var util = require('util');
  6. var _ = require('@sailshq/lodash');
  7. var flaverr = require('flaverr');
  8. var Deferred = require('../utils/query/deferred');
  9. var forgeStageTwoQuery = require('../utils/query/forge-stage-two-query');
  10. var helpFind = require('../utils/query/help-find');
  11. var processAllRecords = require('../utils/records/process-all-records');
  12.  
  13.  
  14. /**
  15.  * find()
  16.  *
  17.  * Find records that match the specified criteria.
  18.  *
  19.  * ```
  20.  * // Look up all bank accounts with more than $32,000 in them.
  21.  * BankAccount.find().where({
  22.  *   balance: { '>': 32000 }
  23.  * }).exec(function(err, bankAccounts) {
  24.  *   // ...
  25.  * });
  26.  * ```
  27.  *
  28.  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  29.  *
  30.  * Usage without deferred object:
  31.  * ================================================
  32.  *
  33.  * @param {Dictionary?} criteria
  34.  *
  35.  * @param {Dictionary} populates
  36.  *
  37.  * @param {Function?} done
  38.  *        Callback function to run when query has either finished successfully or errored.
  39.  *        (If unspecified, will return a Deferred object instead of actually doing anything.)
  40.  *
  41.  * @param {Ref?} meta
  42.  *     For internal use.
  43.  *
  44.  * @returns {Ref?} Deferred object if no `done` callback was provided
  45.  *
  46.  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  47.  *
  48.  * The underlying query keys:
  49.  * ==============================
  50.  *
  51.  * @qkey {Dictionary?} criteria
  52.  * @qkey {Dictionary?} populates
  53.  *
  54.  * @qkey {Dictionary?} meta
  55.  * @qkey {String} using
  56.  * @qkey {String} method
  57.  *
  58.  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  59.  */
  60.  
  61. module.exports = function find( /* criteria?, populates?, done?, meta? */ ) {
  62.  
  63.   // Set up a few, common local vars for convenience / familiarity.
  64.   var WLModel = this;
  65.   var orm = this.waterline;
  66.   var modelIdentity = this.identity;
  67.  
  68.  
  69.   // Build query w/ initial, universal keys.
  70.   var query = {
  71.     method: 'find',
  72.     using: modelIdentity
  73.   };
  74.  
  75.  
  76.   //  鈻堚枅鈺   鈻堚枅鈺 鈻堚枅鈻堚枅鈻堚晽 鈻堚枅鈻堚枅鈻堚枅鈺 鈻堚枅鈺 鈻堚枅鈻堚枅鈻堚晽 鈻堚枅鈻堚枅鈻堚枅鈺 鈻堚枅鈺 鈻堚枅鈻堚枅鈻堚枅鈺椻枅鈻堚枅鈻堚枅鈻堚枅鈺
  77.   //  鈻堚枅鈺   鈻堚枅鈺戔枅鈻堚晹鈺愨晲鈻堚枅鈺椻枅鈻堚晹鈺愨晲鈻堚枅鈺椻枅鈻堚晳鈻堚枅鈺斺晲鈺愨枅鈻堚晽鈻堚枅鈺斺晲鈺愨枅鈻堚晽鈻堚枅鈺戔枅鈻堚晹鈺愨晲鈺愨晲鈺濃枅鈻堚晹鈺愨晲鈺愨晲鈺
  78.   //  鈻堚枅鈺   鈻堚枅鈺戔枅鈻堚枅鈻堚枅鈻堚枅鈺戔枅鈻堚枅鈻堚枅鈻堚晹鈺濃枅鈻堚晳鈻堚枅鈻堚枅鈻堚枅鈻堚晳鈻堚枅鈺  鈻堚枅鈺戔枅鈻堚晳鈻堚枅鈺     鈻堚枅鈻堚枅鈻堚枅鈻堚晽
  79.   //  鈺氣枅鈻堚晽 鈻堚枅鈺斺暆鈻堚枅鈺斺晲鈺愨枅鈻堚晳鈻堚枅鈺斺晲鈺愨枅鈻堚晽鈻堚枅鈺戔枅鈻堚晹鈺愨晲鈻堚枅鈺戔枅鈻堚晳  鈻堚枅鈺戔枅鈻堚晳鈻堚枅鈺     鈺氣晲鈺愨晲鈺愨枅鈻堚晳
  80.   //   鈺氣枅鈻堚枅鈻堚晹鈺 鈻堚枅鈺  鈻堚枅鈺戔枅鈻堚晳  鈻堚枅鈺戔枅鈻堚晳鈻堚枅鈺  鈻堚枅鈺戔枅鈻堚枅鈻堚枅鈻堚晹鈺濃枅鈻堚晳鈺氣枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈻堚枅鈻堚枅鈻堚晳
  81.   //    鈺氣晲鈺愨晲鈺  鈺氣晲鈺  鈺氣晲鈺濃暁鈺愨暆  鈺氣晲鈺濃暁鈺愨暆鈺氣晲鈺  鈺氣晲鈺濃暁鈺愨晲鈺愨晲鈺愨暆 鈺氣晲鈺 鈺氣晲鈺愨晲鈺愨晲鈺濃暁鈺愨晲鈺愨晲鈺愨晲鈺
  82.   //
  83.  
  84.   // The `done` callback, if one was provided.
  85.   var done;
  86.  
  87.   // Handle the various supported usage possibilities
  88.   // (locate the `done` callback, and extend the `query` dictionary)
  89.   //
  90.   // > Note that we define `args` so that we can insulate access
  91.   // > to the arguments provided to this function.
  92.   var args = arguments;
  93.   (function _handleVariadicUsage() {
  94.  
  95.     // The metadata container, if one was provided.
  96.     var _meta;
  97.  
  98.  
  99.     // Handle first argument:
  100.     //
  101.     // 鈥 find(criteria, ...)
  102.     query.criteria = args[0];
  103.  
  104.  
  105.     // Handle double meaning of second argument:
  106.     //
  107.     // 鈥 find(..., populates, done, _meta)
  108.     var is2ndArgDictionary = (_.isObject(args[1]) && !_.isFunction(args[1]) && !_.isArray(args[1]));
  109.     if (is2ndArgDictionary) {
  110.       query.populates = args[1];
  111.       done = args[2];
  112.       _meta = args[3];
  113.     }
  114.     // 鈥 find(..., done, _meta)
  115.     else {
  116.       done = args[1];
  117.       _meta = args[2];
  118.     }
  119.  
  120.     // Fold in `_meta`, if relevant.
  121.     if (_meta) {
  122.       query.meta = _meta;
  123.     } // >-
  124.  
  125.   })();
  126.  
  127.  
  128.  
  129.   //  鈻堚枅鈻堚枅鈻堚枅鈺 鈻堚枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈻堚枅鈻堚枅鈺
  130.   //  鈻堚枅鈺斺晲鈺愨枅鈻堚晽鈻堚枅鈺斺晲鈺愨晲鈺愨暆鈻堚枅鈺斺晲鈺愨晲鈺愨暆鈻堚枅鈺斺晲鈺愨晲鈺愨暆鈻堚枅鈺斺晲鈺愨枅鈻堚晽
  131.   //  鈻堚枅鈺  鈻堚枅鈺戔枅鈻堚枅鈻堚枅鈺  鈻堚枅鈻堚枅鈻堚晽  鈻堚枅鈻堚枅鈻堚晽  鈻堚枅鈻堚枅鈻堚枅鈺斺暆
  132.   //  鈻堚枅鈺  鈻堚枅鈺戔枅鈻堚晹鈺愨晲鈺  鈻堚枅鈺斺晲鈺愨暆  鈻堚枅鈺斺晲鈺愨暆  鈻堚枅鈺斺晲鈺愨枅鈻堚晽
  133.   //  鈻堚枅鈻堚枅鈻堚枅鈺斺暆鈻堚枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈺     鈻堚枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈺  鈻堚枅鈺
  134.   //  鈺氣晲鈺愨晲鈺愨晲鈺 鈺氣晲鈺愨晲鈺愨晲鈺愨暆鈺氣晲鈺     鈺氣晲鈺愨晲鈺愨晲鈺愨暆鈺氣晲鈺  鈺氣晲鈺
  135.   //
  136.   //   鈻堚枅鈺椻枅鈻堚枅鈺   鈻堚枅鈻堚晽 鈻堚枅鈻堚枅鈻堚晽 鈻堚枅鈺   鈻堚枅鈺椻枅鈻堚枅鈻堚枅鈻堚晽 鈻堚枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈺
  137.   //  鈻堚枅鈺斺暆鈻堚枅鈻堚枅鈺 鈻堚枅鈻堚枅鈺戔枅鈻堚晹鈺愨晲鈻堚枅鈺椻暁鈻堚枅鈺 鈻堚枅鈺斺暆鈻堚枅鈺斺晲鈺愨枅鈻堚晽鈻堚枅鈺斺晲鈺愨晲鈺愨暆鈺氣枅鈻堚晽
  138.   //  鈻堚枅鈺 鈻堚枅鈺斺枅鈻堚枅鈻堚晹鈻堚枅鈺戔枅鈻堚枅鈻堚枅鈻堚枅鈺 鈺氣枅鈻堚枅鈻堚晹鈺 鈻堚枅鈻堚枅鈻堚枅鈺斺暆鈻堚枅鈻堚枅鈻堚晽   鈻堚枅鈺
  139.   //  鈻堚枅鈺 鈻堚枅鈺戔暁鈻堚枅鈺斺暆鈻堚枅鈺戔枅鈻堚晹鈺愨晲鈻堚枅鈺  鈺氣枅鈻堚晹鈺  鈻堚枅鈺斺晲鈺愨枅鈻堚晽鈻堚枅鈺斺晲鈺愨暆   鈻堚枅鈺
  140.   //  鈺氣枅鈻堚晽鈻堚枅鈺 鈺氣晲鈺 鈻堚枅鈺戔枅鈻堚晳  鈻堚枅鈺   鈻堚枅鈺   鈻堚枅鈻堚枅鈻堚枅鈺斺暆鈻堚枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈺斺暆
  141.   //   鈺氣晲鈺濃暁鈺愨暆     鈺氣晲鈺濃暁鈺愨暆  鈺氣晲鈺   鈺氣晲鈺   鈺氣晲鈺愨晲鈺愨晲鈺 鈺氣晲鈺愨晲鈺愨晲鈺愨暆鈺氣晲鈺
  142.   //
  143.   //  鈹屸攼 鈹 鈹敩鈹  鈹屸敩鈹   鈹   鈹攢鈹愨攲鈹€鈹愨攲鈹攼鈹 鈹敩鈹€鈹愨攲鈹愨攲  鈹屸攼鈹屸攲鈹€鈹愨敩 鈹  鈹屸敩鈹愨攲鈹€鈹愨攲鈹€鈹愨攲鈹€鈹愨敩鈹€鈹愨敩鈹€鈹愨攲鈹€鈹愨攲鈹攼
  144.   //  鈹溾敶鈹愨攤 鈹傗攤鈹   鈹傗攤  鈹屸敿鈹€  鈹溾敩鈹樷敎鈹  鈹 鈹 鈹傗敎鈹敇鈹傗攤鈹  鈹傗攤鈹傗敎鈹 鈹傗攤鈹   鈹傗攤鈹溾敜 鈹溾敜 鈹溾敜 鈹溾敩鈹樷敎鈹敇鈹溾敜  鈹傗攤
  145.   //  鈹斺攢鈹樷敂鈹€鈹樷敶鈹粹攢鈹樷攢鈹粹敇  鈹斺敇   鈹粹敂鈹€鈹斺攢鈹 鈹 鈹斺攢鈹樷敶鈹斺攢鈹樷敂鈹  鈹樷敂鈹樷敂鈹€鈹樷敂鈹粹敇  鈹€鈹粹敇鈹斺攢鈹樷敂  鈹斺攢鈹樷敶鈹斺攢鈹粹敂鈹€鈹斺攢鈹樷攢鈹粹敇
  146.   //  鈹屸攢    鈹攲鈹€鈹  鈹攢鈹愨攲鈹€鈹愨敩  鈹屸攢鈹愨敩  鈹攲鈹€鈹愨攲鈹愨攲鈹屸敩鈹    鈹€鈹
  147.   //  鈹傗攢鈹€鈹€  鈹傗敎鈹   鈹溾敩鈹樷敎鈹 鈹  鈹溾敜 鈹斺攼鈹屸敇鈹溾攢鈹も攤鈹傗攤 鈹   鈹€鈹€鈹€鈹
  148.   //  鈹斺攢    鈹粹敂    鈹粹敂鈹€鈹斺攢鈹樷敶鈹€鈹樷敂鈹€鈹 鈹斺敇 鈹 鈹粹敇鈹斺敇 鈹     鈹€鈹
  149.   // If a callback function was not specified, then build a new `Deferred` and bail now.
  150.   //
  151.   // > This method will be called AGAIN automatically when the Deferred is executed.
  152.   // > and next time, it'll have a callback.
  153.   if (!done) {
  154.     return new Deferred(WLModel, find, query);
  155.   } // --鈥
  156.  
  157.  
  158.   // Otherwise, IWMIH, we know that a callback was specified.
  159.   // So...
  160.   //
  161.   //  鈻堚枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈺  鈻堚枅鈺椻枅鈻堚枅鈻堚枅鈻堚枅鈺 鈻堚枅鈻堚枅鈻堚枅鈺椻枅鈻堚晽   鈻堚枅鈺椻枅鈻堚枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈻堚枅鈻堚枅鈻堚晽
  162.   //  鈻堚枅鈺斺晲鈺愨晲鈺愨暆鈺氣枅鈻堚晽鈻堚枅鈺斺暆鈻堚枅鈺斺晲鈺愨晲鈺愨暆鈻堚枅鈺斺晲鈺愨晲鈺愨暆鈻堚枅鈺   鈻堚枅鈺戔暁鈺愨晲鈻堚枅鈺斺晲鈺愨暆鈻堚枅鈺斺晲鈺愨晲鈺愨暆
  163.   //  鈻堚枅鈻堚枅鈻堚晽   鈺氣枅鈻堚枅鈺斺暆 鈻堚枅鈻堚枅鈻堚晽  鈻堚枅鈺     鈻堚枅鈺   鈻堚枅鈺   鈻堚枅鈺   鈻堚枅鈻堚枅鈻堚晽
  164.   //  鈻堚枅鈺斺晲鈺愨暆   鈻堚枅鈺斺枅鈻堚晽 鈻堚枅鈺斺晲鈺愨暆  鈻堚枅鈺     鈻堚枅鈺   鈻堚枅鈺   鈻堚枅鈺   鈻堚枅鈺斺晲鈺愨暆
  165.   //  鈻堚枅鈻堚枅鈻堚枅鈻堚晽鈻堚枅鈺斺暆 鈻堚枅鈺椻枅鈻堚枅鈻堚枅鈻堚枅鈺椻暁鈻堚枅鈻堚枅鈻堚枅鈺椻暁鈻堚枅鈻堚枅鈻堚枅鈺斺暆   鈻堚枅鈺   鈻堚枅鈻堚枅鈻堚枅鈻堚晽
  166.   //  鈺氣晲鈺愨晲鈺愨晲鈺愨暆鈺氣晲鈺  鈺氣晲鈺濃暁鈺愨晲鈺愨晲鈺愨晲鈺 鈺氣晲鈺愨晲鈺愨晲鈺 鈺氣晲鈺愨晲鈺愨晲鈺    鈺氣晲鈺   鈺氣晲鈺愨晲鈺愨晲鈺愨暆
  167.  
  168.   //  鈺斺晲鈺椻晹鈺愨晽鈺︹晲鈺椻晹鈺愨晽鈺斺晲鈺  鈹屸攢鈹愨攲鈹攼鈹屸攢鈹愨攲鈹€鈹愨攲鈹€鈹  鈹屸敩鈹愨敩 鈹攲鈹€鈹  鈹屸攢鈹 鈹 鈹攲鈹€鈹愨敩鈹€鈹愨敩 鈹
  169.   //  鈺犫暎 鈺 鈺戔暊鈺︹暆鈺 鈺︹晳鈺   鈹斺攢鈹 鈹 鈹溾攢鈹も攤 鈹敎鈹    鈹 鈹傗攤鈹傗攤 鈹  鈹傗攢鈹尖攼鈹 鈹傗敎鈹 鈹溾敩鈹樷敂鈹敇
  170.   //  鈺  鈺氣晲鈺濃暕鈺氣晲鈺氣晲鈺濃暁鈺愨暆  鈹斺攢鈹 鈹 鈹 鈹粹敂鈹€鈹樷敂鈹€鈹   鈹 鈹斺敶鈹樷敂鈹€鈹  鈹斺攢鈹樷敂鈹斺攢鈹樷敂鈹€鈹樷敶鈹斺攢 鈹
  171.   //
  172.   // Forge a stage 2 query (aka logical protostatement)
  173.   try {
  174.     forgeStageTwoQuery(query, orm);
  175.   } catch (e) {
  176.     switch (e.code) {
  177.  
  178.       case 'E_INVALID_CRITERIA':
  179.         return done(
  180.           flaverr({
  181.               name: 'UsageError'
  182.             },
  183.             new Error(
  184.               'Invalid criteria.\n' +
  185.               'Details:\n' +
  186.               '  ' + e.details + '\n'
  187.             )
  188.           )
  189.         );
  190.  
  191.       case 'E_INVALID_POPULATES':
  192.         return done(
  193.           flaverr({
  194.               name: 'UsageError'
  195.             },
  196.             new Error(
  197.               'Invalid populate(s).\n' +
  198.               'Details:\n' +
  199.               '  ' + e.details + '\n'
  200.             )
  201.           )
  202.         );
  203.  
  204.       case 'E_NOOP':
  205.         return done(undefined, []);
  206.  
  207.       default:
  208.         return done(e);
  209.     }
  210.   } // >-鈥
  211.  
  212.  
  213.   //  鈹 鈹攲鈹€鈹愨攲鈹愨攲鈹屸敩鈹愨敩  鈹屸攢鈹  鈺斺晽 鈺斺晲鈺椻晹鈺愨晽鈺斺晲鈺椻暒鈺愨晽鈺斺晲鈺  鈹  鈹攲鈹€鈹愨攲鈹€鈹愨攲鈹€鈹愨敩 鈹攲鈹€鈹愨敩  鈹屸攢鈹  鈹屸攢鈹愨攲鈹€鈹愨敩  鈹  鈹屸攼 鈹屸攢鈹愨攲鈹€鈹愨敩鈹屸攢
  214.   //  鈹溾攢鈹も敎鈹€鈹も攤鈹傗攤 鈹傗攤鈹  鈹溾敜   鈺犫暕鈺椻晳鈺 鈺犫暎 鈺 鈺戔暊鈺︹暆鈺戔暎   鈹  鈹傗敎鈹 鈹溾敜 鈹  鈹斺敩鈹樷攤  鈹  鈹溾敜   鈹  鈹溾攢鈹も攤  鈹  鈹溾敶鈹愨敎鈹€鈹も攤  鈹溾敶鈹
  215.   //  鈹 鈹粹敶 鈹粹敇鈹斺敇鈹€鈹粹敇鈹粹攢鈹樷敂鈹€鈹  鈺氣晲鈺濃暁鈺愨暆鈺  鈺氣晲鈺濃暕鈺氣晲鈺氣晲鈺  鈹粹攢鈹樷敶鈹  鈹斺攢鈹樷敂鈹€鈹 鈹 鈹斺攢鈹樷敶鈹€鈹樷敂鈹€鈹  鈹斺攢鈹樷敶 鈹粹敶鈹€鈹樷敶鈹€鈹樷敂鈹€鈹樷敶 鈹粹敂鈹€鈹樷敶 鈹
  216.   // Determine what to do about running any lifecycle callbacks
  217.   (function _maybeRunBeforeLC(proceed) {
  218.     // If the `skipAllLifecycleCallbacks` meta flag was set, don't run any of
  219.     // the methods.
  220.     if (_.has(query.meta, 'skipAllLifecycleCallbacks') && query.meta.skipAllLifecycleCallbacks) {
  221.       return proceed(undefined, query);
  222.     }
  223.  
  224.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  225.     // FUTURE: This is where the `beforeFind()` lifecycle callback would go
  226.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  227.     return proceed(undefined, query);
  228.  
  229.   })(function _afterPotentiallyRunningBeforeLC(err, query) {
  230.     if (err) {
  231.       return done(err);
  232.     }
  233.  
  234.  
  235.     // ================================================================================
  236.     // FUTURE: potentially bring this back (but also would need the `omit clause`)
  237.     // ================================================================================
  238.     // // Before we get to forging again, save a copy of the stage 2 query's
  239.     // // `select` clause.  We'll need this later on when processing the resulting
  240.     // // records, and if we don't copy it now, it might be damaged by the forging.
  241.     // //
  242.     // // > Note that we don't need a deep clone.
  243.     // // > (That's because the `select` clause is only 1 level deep.)
  244.     // var s2QSelectClause = _.clone(query.criteria.select);
  245.     // ================================================================================
  246.  
  247.     //  鈹屸攢鈹愨攲鈹€鈹愨攲鈹愨攲鈹屸敩鈹  鈹屸敩鈹愨攲鈹€鈹  鈺斺晲鈺椻晹鈺︹晽鈺斺晲鈺椻晹鈺愨晽鈺斺暒鈺椻晹鈺愨晽鈺︹晲鈺
  248.     //  鈹斺攢鈹愨敎鈹 鈹傗攤鈹 鈹傗攤   鈹 鈹 鈹  鈺犫晲鈺 鈺戔晳鈺犫晲鈺b暊鈺愨暆 鈺 鈺戔暎 鈺犫暒鈺
  249.     //  鈹斺攢鈹樷敂鈹€鈹樷敇鈹斺敇鈹€鈹粹敇   鈹 鈹斺攢鈹  鈺 鈺┾晲鈺┾暆鈺 鈺┾暕   鈺 鈺氣晲鈺濃暕鈺氣晲
  250.     // Use `helpFind()` to forge stage 3 quer(y/ies) and then call the appropriate adapters' method(s).
  251.     // > Note: `helpFind` is responsible for running the `transformer`.
  252.     // > (i.e. so that column names are transformed back into attribute names)
  253.     helpFind(WLModel, query, function _afterFetchingRecords(err, populatedRecords) {
  254.       if (err) {
  255.         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  256.         // Note: Normally, in other model methods, we do this `isError` check + addition of the `modelIdentity` prop
  257.         // when we call the adapter method itself.  But since helpFind() is such a beast, both things are currently
  258.         // implemented here for simplicity.  This could change in the future as helpFind() is refined.
  259.         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  260.         if (!_.isError(err)) {
  261.           return done(new Error(
  262.             'If an error is sent back from the adapter, it should always be an Error instance.  '+
  263.             'But instead, got: '+util.inspect(err, {depth:5})+''
  264.           ));
  265.         }//-鈥
  266.         // Attach the identity of this model (for convenience).
  267.         err.modelIdentity = modelIdentity;
  268.         return done(err);
  269.       }//-鈥
  270.  
  271.       // Process the record to verify compliance with the adapter spec.
  272.       // Check the record to verify compliance with the adapter spec.,
  273.       // as well as any issues related to stale data that might not have been
  274.       // been migrated to keep up with the logical schema (`type`, etc. in
  275.       // attribute definitions).
  276.       try {
  277.         processAllRecords(populatedRecords, query.meta, modelIdentity, orm);
  278.       } catch (e) { return done(e); }
  279.  
  280.       //  鈹 鈹攲鈹€鈹愨攲鈹愨攲鈹屸敩鈹愨敩  鈹屸攢鈹  鈺斺晲鈺椻晹鈺愨晽鈺斺暒鈺椻晹鈺愨晽鈺︹晲鈺  鈹  鈹攲鈹€鈹愨攲鈹€鈹愨攲鈹€鈹愨敩 鈹攲鈹€鈹愨敩  鈹屸攢鈹  鈹屸攢鈹愨攲鈹€鈹愨敩  鈹  鈹屸攼 鈹屸攢鈹愨攲鈹€鈹愨敩鈹屸攢
  281.       //  鈹溾攢鈹も敎鈹€鈹も攤鈹傗攤 鈹傗攤鈹  鈹溾敜   鈺犫晲鈺b暊鈺  鈺 鈺戔暎 鈺犫暒鈺  鈹  鈹傗敎鈹 鈹溾敜 鈹  鈹斺敩鈹樷攤  鈹  鈹溾敜   鈹  鈹溾攢鈹も攤  鈹  鈹溾敶鈹愨敎鈹€鈹も攤  鈹溾敶鈹
  282.       //  鈹 鈹粹敶 鈹粹敇鈹斺敇鈹€鈹粹敇鈹粹攢鈹樷敂鈹€鈹  鈺 鈺┾暁   鈺 鈺氣晲鈺濃暕鈺氣晲  鈹粹攢鈹樷敶鈹  鈹斺攢鈹樷敂鈹€鈹 鈹 鈹斺攢鈹樷敶鈹€鈹樷敂鈹€鈹  鈹斺攢鈹樷敶 鈹粹敶鈹€鈹樷敶鈹€鈹樷敂鈹€鈹樷敶 鈹粹敂鈹€鈹樷敶 鈹
  283.       (function _maybeRunAfterLC(proceed){
  284.  
  285.         // If the `skipAllLifecycleCallbacks` meta key was enabled, then don't run this LC.
  286.         if (_.has(query.meta, 'skipAllLifecycleCallbacks') && query.meta.skipAllLifecycleCallbacks) {
  287.           return proceed(undefined, populatedRecords);
  288.         }//-鈥
  289.  
  290.         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  291.         // FUTURE: This is where the `afterFind()` lifecycle callback would go
  292.         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  293.         return proceed(undefined, populatedRecords);
  294.  
  295.       })(function _afterPotentiallyRunningAfterLC(err, populatedRecords) {
  296.         if (err) { return done(err); }
  297.  
  298.         // All done.
  299.         return done(undefined, populatedRecords);
  300.  
  301.       });//</ self-calling functionto handle "after" lifecycle callback >
  302.     }); //</ helpFind() >
  303.   }); //</ self-calling function to handle "before" lifecycle callback >
  304. };
  305.  
downloadfind.js Source code - Download waterline Source code
Related Source Codes/Software:
notepad-plus-plus - Notepad++ official repository h... 2017-01-10
che - Eclipse Che: Next-generation Eclipse IDE. Open sou... 2017-01-10
Gource - oftware version control visualization ... 2017-01-10
FDFullscreenPopGesture - A UINavigationController's category to enable full... 2017-01-10
node-style-guide - A guide for styling your node.js / JavaScript code... 2017-01-09
Workerman - An asynchronous event driven PHP framework for eas... 2017-01-10
structor - An advanced visual editor for React components ... 2017-01-10
golearn - Machine Learning for Go 2017-01-10
poisontap - Exploits locked/password protected computers over ... 2017-01-10
kcptun - A Simple UDP Tunnel Based On KCP 2017-01-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top