Odoo GraphQL Subscription using Node, Express JS for Sample
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
15 KiB

4 months ago
{"version":3,"file":"bundle.cjs","sources":["es5/slot.js","es5/index.js"],"sourcesContent":["// This currentContext variable will only be used if the makeSlotClass\n// function is called, which happens only if this is the first copy of the\n// @wry/context package to be imported.\nvar currentContext = null;\n// This unique internal object is used to denote the absence of a value\n// for a given Slot, and is never exposed to outside code.\nvar MISSING_VALUE = {};\nvar idCounter = 1;\n// Although we can't do anything about the cost of duplicated code from\n// accidentally bundling multiple copies of the @wry/context package, we can\n// avoid creating the Slot class more than once using makeSlotClass.\nvar makeSlotClass = function () { return /** @class */ (function () {\n function Slot() {\n // If you have a Slot object, you can find out its slot.id, but you cannot\n // guess the slot.id of a Slot you don't have access to, thanks to the\n // randomized suffix.\n this.id = [\n \"slot\",\n idCounter++,\n Date.now(),\n Math.random().toString(36).slice(2),\n ].join(\":\");\n }\n Slot.prototype.hasValue = function () {\n for (var context_1 = currentContext; context_1; context_1 = context_1.parent) {\n // We use the Slot object iself as a key to its value, which means the\n // value cannot be obtained without a reference to the Slot object.\n if (this.id in context_1.slots) {\n var value = context_1.slots[this.id];\n if (value === MISSING_VALUE)\n break;\n if (context_1 !== currentContext) {\n // Cache the value in currentContext.slots so the next lookup will\n // be faster. This caching is safe because the tree of contexts and\n // the values of the slots are logically immutable.\n currentContext.slots[this.id] = value;\n }\n return true;\n }\n }\n if (currentContext) {\n // If a value was not found for this Slot, it's never going to be found\n // no matter how many times we look it up, so we might as well cache\n // the absence of the value, too.\n currentContext.slots[this.id] = MISSING_VALUE;\n }\n return false;\n };\n Slot.prototype.getValue = function () {\n if (this.hasValue()) {\n return currentContext.slots[this.id];\n }\n };\n Slot.prototype.withValue = function (value, callback, \n // Given the prevalence of arrow functions, specifying arguments is likely\n // to be much more common than specifying `this`, hence this ordering:\n args, thisArg) {\n var _a;\n var slots = (_a = {\n __proto__: null\n },\n _a[this.id] = value,\n _a);\n var parent = currentContext;\n currentContext = { parent: parent, slots: slots };\n try {\n // Function.prototype.apply allows the arguments array argument to be\n // omitted or undefined, so args! is fine here.\n return callback.apply(thisArg, args);\n }\n finally {\n currentContext = parent;\n }\n };\n // Capture the current context and wrap a callback function so that it\n // reestablishes the captured context when called.\n Slot.bind = function (callback) {\n var context = currentContext;\n return function () {\n var saved = currentContext;\n try {\n currentContext = context;\n return callback.apply(this, arguments);\n }\n finally {\n currentContext = saved;\n }\n };\n };\n // Immediately run a callback function without any captured context.\n Slot.noContext = function (callback, \n // Given the prevalence of arrow functions, specifying arguments is likely\n // to be much more