UNPKG

@wordpress/core-data

Version:
56 lines (54 loc) 1.94 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; 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); // packages/core-data/src/locks/selectors.js var selectors_exports = {}; __export(selectors_exports, { getPendingLockRequests: () => getPendingLockRequests, isLockAvailable: () => isLockAvailable }); module.exports = __toCommonJS(selectors_exports); var import_utils = require("./utils"); function getPendingLockRequests(state) { return state.requests; } function isLockAvailable(state, store, path, { exclusive }) { const storePath = [store, ...path]; const locks = state.tree; for (const node2 of (0, import_utils.iteratePath)(locks, storePath)) { if ((0, import_utils.hasConflictingLock)({ exclusive }, node2.locks)) { return false; } } const node = (0, import_utils.getNode)(locks, storePath); if (!node) { return true; } for (const descendant of (0, import_utils.iterateDescendants)(node)) { if ((0, import_utils.hasConflictingLock)({ exclusive }, descendant.locks)) { return false; } } return true; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { getPendingLockRequests, isLockAvailable }); //# sourceMappingURL=selectors.js.map