UNPKG

veffect

Version:

powerful TypeScript validation library built on the robust foundation of Effect combining exceptional type safety, high performance, and developer experience. Taking inspiration from Effect's functional principles, VEffect delivers a balanced approach tha

114 lines (112 loc) 3.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.use = exports.make = exports.fork = exports.extend = exports.close = exports.addFinalizerExit = exports.addFinalizer = exports.ScopeTypeId = exports.Scope = exports.CloseableScopeTypeId = void 0; var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/core.js")); var fiberRuntime = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/fiberRuntime.js")); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } /** * @since 2.0.0 */ /** * @since 2.0.0 * @category symbols */ const ScopeTypeId = exports.ScopeTypeId = core.ScopeTypeId; /** * @since 2.0.0 * @category symbols */ const CloseableScopeTypeId = exports.CloseableScopeTypeId = core.CloseableScopeTypeId; /** * @since 2.0.0 * @category context */ const Scope = exports.Scope = fiberRuntime.scopeTag; /** * Adds a finalizer to this scope. The finalizer is guaranteed to be run when * the scope is closed. * * @since 2.0.0 * @category utils */ const addFinalizer = exports.addFinalizer = core.scopeAddFinalizer; /** * A simplified version of `addFinalizerWith` when the `finalizer` does not * depend on the `Exit` value that the scope is closed with. * * @since 2.0.0 * @category utils */ const addFinalizerExit = exports.addFinalizerExit = core.scopeAddFinalizerExit; /** * Closes a scope with the specified exit value, running all finalizers that * have been added to the scope. * * @since 2.0.0 * @category destructors */ const close = exports.close = core.scopeClose; /** * Extends the scope of an `Effect` workflow that needs a scope into this * scope by providing it to the workflow but not closing the scope when the * workflow completes execution. This allows extending a scoped value into a * larger scope. * * @since 2.0.0 * @category utils */ const extend = exports.extend = fiberRuntime.scopeExtend; /** * Forks a new scope that is a child of this scope. The child scope will * automatically be closed when this scope is closed. * * @since 2.0.0 * @category utils */ const fork = exports.fork = core.scopeFork; /** * Uses the scope by providing it to an `Effect` workflow that needs a scope, * guaranteeing that the scope is closed with the result of that workflow as * soon as the workflow completes execution, whether by success, failure, or * interruption. * * @since 2.0.0 * @category destructors */ const use = exports.use = fiberRuntime.scopeUse; /** * Creates a Scope where Finalizers will run according to the `ExecutionStrategy`. * * If an ExecutionStrategy is not provided `sequential` will be used. * * @since 2.0.0 * @category constructors */ const make = exports.make = fiberRuntime.scopeMake; //# sourceMappingURL=Scope.js.map