{"version":3,"sources":["jsdelivr-header.js","/npm/sails-hook-pagify@0.2.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aAGA,IAAI,KAAO,QAAQ,QACf,QAAU,KAAK,KAAK,UAAW,OAC/B,OAAS,QAAQ,KAAK,KAAK,QAAS,WAExC,OAAO,QAAU,SAAS,GAYtB,MAAO,CAEH,SAAU,CACN,cAAe,CACX,QAAS,KAIjB,WAAY,SAAS,GAEjB,IAAI,EAAa,GACd,EAAM,MAAM,KACX,EAAW,KAAK,mBAGhB,EAAM,MAAM,QACZ,EAAW,KAAK,sBAGpB,EAAM,MAAM,EAAY,WA7BhC,IAAe,IA8BG,KA7Bd,EAAE,QAAQ,EAAM,QAAQ,SAAS,GAG1B,EAAM,UACL,OAAO,EAAO,EAEtB,IAwBQ,GACJ,EAAE,KAAK,MACX,EAER","file":"/npm/sails-hook-pagify@0.2.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/sails-hook-pagify@0.2.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\n//dependencies\nvar path = require('path');\nvar libPath = path.join(__dirname, 'lib');\nvar pagify = require(path.join(libPath, 'pagify'));\n\nmodule.exports = function(sails){\n\n    function patch(context){\n        _.forEach(sails.models, function(model){\n\n            // Add pagify method to all models. Ignoring associative tables\n            if(model.globalId){\n                pagify(model, context);\n            }\n        })\n    }\n\n    return {\n\n        defaults: {\n            __configKey__: {\n                perPage: 10\n            }\n        },\n\n        initialize: function(next){\n\n            var waitEvents = [];\n            if(sails.hooks.orm){\n                waitEvents.push('hook:orm:loaded');\n            }\n\n            if (sails.hooks.pubsub) {\n                waitEvents.push('hook:pubsub:loaded');\n            }\n\n            sails.after(waitEvents, function(){\n                patch(this);\n                next();\n            }.bind(this))\n        }\n    }\n}\n"]}