UNPKG

@pamlight/admin

Version:

The library for syncing data changes to multiple devices from your database

27 lines (26 loc) 853 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDefaultPrimaryIndex = function (adapterId) { adapterId = 'mongodb'; // only mongodb for now switch (adapterId) { case 'mongodb': { return { _id: 1 }; } default: { return { _id: 1 }; } } }; exports.isIndexRequired = function (options) { return !!options.sort; }; exports.getRandomString = function (size) { if (size === void 0) { size = 5; } var result = []; var possibleCharacters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var charSize = possibleCharacters.length; for (var i = 0; i < size; i++) { result.push(possibleCharacters.charAt(Math.floor(Math.random() * charSize))); } return result.join(''); };