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

154 lines (153 loc) 4.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.unbounded = exports.subscribeScoped = exports.subscribe = exports.sliding = exports.size = exports.publishAll = exports.publish = exports.isShutdown = exports.isFull = exports.isEmpty = exports.dropping = exports.capacity = exports.bounded = exports.awaitShutdown = exports.TPubSubTypeId = void 0; var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/stm/tPubSub.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 * @category symbols */ const TPubSubTypeId = exports.TPubSubTypeId = internal.TPubSubTypeId; /** * Waits until the `TPubSub` is shutdown. The `STM` returned by this method will * not resume until the queue has been shutdown. If the `TPubSub` is already * shutdown, the `STM` will resume right away. * * @since 2.0.0 * @category mutations */ const awaitShutdown = exports.awaitShutdown = internal.awaitShutdown; /** * Creates a bounded `TPubSub` with the back pressure strategy. The `TPubSub` will retain * messages until they have been taken by all subscribers, applying back * pressure to publishers if the `TPubSub` is at capacity. * * @since 2.0.0 * @category constructors */ const bounded = exports.bounded = internal.bounded; /** * Returns the number of elements the `TPubSub` can hold. * * @since 2.0.0 * @category getters */ const capacity = exports.capacity = internal.capacity; /** * Creates a bounded `TPubSub` with the dropping strategy. The `TPubSub` will drop new * messages if the `TPubSub` is at capacity. * * @since 2.0.0 * @category constructors */ const dropping = exports.dropping = internal.dropping; /** * Returns `true` if the `TPubSub` contains zero elements, `false` otherwise. * * @since 2.0.0 * @category getters */ const isEmpty = exports.isEmpty = internal.isEmpty; /** * Returns `true` if the `TPubSub` contains at least one element, `false` * otherwise. * * @since 2.0.0 * @category getters */ const isFull = exports.isFull = internal.isFull; /** * Returns `true` if `shutdown` has been called, otherwise returns `false`. * * @since 2.0.0 * @category getters */ const isShutdown = exports.isShutdown = internal.isShutdown; /** * Publishes a message to the `TPubSub`, returning whether the message was published * to the `TPubSub`. * * @since 2.0.0 * @category mutations */ const publish = exports.publish = internal.publish; /** * Publishes all of the specified messages to the `TPubSub`, returning whether they * were published to the `TPubSub`. * * @since 2.0.0 * @category mutations */ const publishAll = exports.publishAll = internal.publishAll; /** * Retrieves the size of the `TPubSub`, which is equal to the number of elements * in the `TPubSub`. This may be negative if fibers are suspended waiting for * elements to be added to the `TPubSub`. * * @since 2.0.0 * @category getters */ const size = exports.size = internal.size; /** * Creates a bounded `TPubSub` with the sliding strategy. The `TPubSub` will add new * messages and drop old messages if the `TPubSub` is at capacity. * * For best performance use capacities that are powers of two. * * @since 2.0.0 * @category constructors */ const sliding = exports.sliding = internal.sliding; /** * Subscribes to receive messages from the `TPubSub`. The resulting subscription can * be evaluated multiple times to take a message from the `TPubSub` each time. The * caller is responsible for unsubscribing from the `TPubSub` by shutting down the * queue. * * @since 2.0.0 * @category mutations */ const subscribe = exports.subscribe = internal.subscribe; /** * Subscribes to receive messages from the `TPubSub`. The resulting subscription can * be evaluated multiple times within the scope to take a message from the `TPubSub` * each time. * * @since 2.0.0 * @category mutations */ const subscribeScoped = exports.subscribeScoped = internal.subscribeScoped; /** * Creates an unbounded `TPubSub`. * * @since 2.0.0 * @category constructors */ const unbounded = exports.unbounded = internal.unbounded; //# sourceMappingURL=TPubSub.js.map