New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nocobase/cache

Package Overview
Dependencies
Maintainers
1
Versions
452
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nocobase/cache - npm Package Compare versions

Comparing version 0.13.0-alpha.4 to 0.13.0-alpha.5

84

lib/index.js

@@ -1,38 +0,37 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export(src_exports, {
createCache: () => createCache,
createDefaultCacheConfig: () => createDefaultCacheConfig
});
exports.createCache = createCache;
exports.createDefaultCacheConfig = createDefaultCacheConfig;
function _cacheManager() {
const data = require("cache-manager");
_cacheManager = function _cacheManager() {
return data;
};
return data;
}
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
/**
* create a default cache config object
* @returns {ICacheConfig}
*/
module.exports = __toCommonJS(src_exports);
var import_cache_manager = require("cache-manager");
function createDefaultCacheConfig() {
return {
ttl: 86400,
max: 1000,
store: 'memory'
// seconds
max: 1e3,
store: "memory"
};
}
/**
* create cache
* <br/> if cacheConfig is array and length gt 1 then will be return multi cache, else will be return cache
* @param {ICacheConfig | ICacheConfig[]} cacheConfig
* @returns {Cache}
*/
__name(createDefaultCacheConfig, "createDefaultCacheConfig");
function createCache(cacheConfig = createDefaultCacheConfig()) {
if (Array.isArray(cacheConfig)) {
// multi cache
if (cacheConfig.length === 1) {

@@ -42,15 +41,6 @@ return createCacheByICacheConfig(cacheConfig[0]);

const caches = [];
var _iterator = _createForOfIteratorHelper(cacheConfig),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
const cacheConfigEle = _step.value;
caches.push(createCacheByICacheConfig(cacheConfigEle));
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
for (const cacheConfigEle of cacheConfig) {
caches.push(createCacheByICacheConfig(cacheConfigEle));
}
return (0, _cacheManager().multiCaching)(caches);
return (0, import_cache_manager.multiCaching)(caches);
}

@@ -61,8 +51,14 @@ } else {

}
__name(createCache, "createCache");
function createCacheByICacheConfig(cacheConfig) {
// if storePackage exist then load storePackage and instead store
if (cacheConfig.storePackage) {
cacheConfig.store = require(cacheConfig.storePackage);
}
return (0, _cacheManager().caching)(cacheConfig);
}
return (0, import_cache_manager.caching)(cacheConfig);
}
__name(createCacheByICacheConfig, "createCacheByICacheConfig");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createCache,
createDefaultCacheConfig
});
{
"name": "@nocobase/cache",
"version": "0.13.0-alpha.4",
"version": "0.13.0-alpha.5",
"description": "",

@@ -20,3 +20,3 @@ "license": "Apache-2.0",

},
"gitHead": "29594e9dbb2455e2f3f6bea95340c4ed75789b61"
"gitHead": "9eabe607b4a20c356fdb2fd95e40fa476986dcb0"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc