awaitly 1.31.1 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters.cjs +2 -2
- package/dist/adapters.cjs.map +1 -1
- package/dist/adapters.d.cts +3 -1
- package/dist/adapters.d.ts +3 -1
- package/dist/adapters.js +2 -2
- package/dist/adapters.js.map +1 -1
- package/dist/batch.cjs +2 -2
- package/dist/batch.cjs.map +1 -1
- package/dist/batch.d.cts +3 -1
- package/dist/batch.d.ts +3 -1
- package/dist/batch.js +2 -2
- package/dist/batch.js.map +1 -1
- package/dist/circuit-breaker.cjs +2 -2
- package/dist/circuit-breaker.cjs.map +1 -1
- package/dist/circuit-breaker.d.cts +3 -1
- package/dist/circuit-breaker.d.ts +3 -1
- package/dist/circuit-breaker.js +2 -2
- package/dist/circuit-breaker.js.map +1 -1
- package/dist/conditional.d.cts +3 -1
- package/dist/conditional.d.ts +3 -1
- package/dist/core.cjs +2 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -1
- package/dist/core.d.ts +2 -1
- package/dist/core.js +2 -2
- package/dist/core.js.map +1 -1
- package/dist/diagnostics.cjs +3 -3
- package/dist/diagnostics.cjs.map +1 -1
- package/dist/diagnostics.d.cts +3 -1
- package/dist/diagnostics.d.ts +3 -1
- package/dist/diagnostics.js +3 -3
- package/dist/diagnostics.js.map +1 -1
- package/dist/durable.cjs +3 -3
- package/dist/durable.cjs.map +1 -1
- package/dist/durable.d.cts +8 -361
- package/dist/durable.d.ts +8 -361
- package/dist/durable.js +3 -3
- package/dist/durable.js.map +1 -1
- package/dist/engine.cjs +11 -0
- package/dist/engine.cjs.map +1 -0
- package/dist/engine.d.cts +114 -0
- package/dist/engine.d.ts +114 -0
- package/dist/engine.js +11 -0
- package/dist/engine.js.map +1 -0
- package/dist/errors-entry-CMH73Eym.d.cts +339 -0
- package/dist/errors-entry-DOt5UUl4.d.ts +339 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +2 -318
- package/dist/errors.d.ts +2 -318
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/fetch.cjs +2 -2
- package/dist/fetch.cjs.map +1 -1
- package/dist/fetch.d.cts +3 -1
- package/dist/fetch.d.ts +3 -1
- package/dist/fetch.js +2 -2
- package/dist/fetch.js.map +1 -1
- package/dist/functional.cjs +1 -1
- package/dist/functional.cjs.map +1 -1
- package/dist/functional.d.cts +2 -0
- package/dist/functional.d.ts +2 -0
- package/dist/functional.js +1 -1
- package/dist/functional.js.map +1 -1
- package/dist/{guards-PU64_GKv.d.cts → guards-B79mP5Q8.d.cts} +3 -3
- package/dist/{guards-B5lgMJq0.d.ts → guards-BUq6NJCM.d.ts} +3 -3
- package/dist/{hitl-Dyiy0R1v.d.cts → hitl-BCqkMAHw.d.cts} +2 -2
- package/dist/{hitl-BjeSm1sJ.d.ts → hitl-BZtPx0aU.d.ts} +2 -2
- package/dist/hitl.cjs +2 -2
- package/dist/hitl.cjs.map +1 -1
- package/dist/hitl.d.cts +9 -6
- package/dist/hitl.d.ts +9 -6
- package/dist/hitl.js +2 -2
- package/dist/hitl.js.map +1 -1
- package/dist/index-BVUAOWGG.d.ts +417 -0
- package/dist/index-CQnpmUcC.d.cts +417 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/otel.d.cts +3 -1
- package/dist/otel.d.ts +3 -1
- package/dist/{persistence-entry-B3ukwbb5.d.ts → persistence-entry-ClFhxd2Q.d.ts} +11 -5
- package/dist/{persistence-entry-CgVzswbg.d.cts → persistence-entry-jflY61az.d.cts} +11 -5
- package/dist/persistence.d.cts +6 -3
- package/dist/persistence.d.ts +6 -3
- package/dist/policies.d.cts +3 -1
- package/dist/policies.d.ts +3 -1
- package/dist/ratelimit.cjs +2 -2
- package/dist/ratelimit.cjs.map +1 -1
- package/dist/ratelimit.d.cts +3 -1
- package/dist/ratelimit.d.ts +3 -1
- package/dist/ratelimit.js +2 -2
- package/dist/ratelimit.js.map +1 -1
- package/dist/reliability.cjs +2 -2
- package/dist/reliability.cjs.map +1 -1
- package/dist/reliability.d.cts +3 -1
- package/dist/reliability.d.ts +3 -1
- package/dist/reliability.js +2 -2
- package/dist/reliability.js.map +1 -1
- package/dist/resolver.cjs +2 -2
- package/dist/resolver.cjs.map +1 -1
- package/dist/resolver.d.cts +5 -3
- package/dist/resolver.d.ts +5 -3
- package/dist/resolver.js +2 -2
- package/dist/resolver.js.map +1 -1
- package/dist/resource.cjs +2 -2
- package/dist/resource.cjs.map +1 -1
- package/dist/resource.d.cts +3 -1
- package/dist/resource.d.ts +3 -1
- package/dist/resource.js +2 -2
- package/dist/resource.js.map +1 -1
- package/dist/result/retry.cjs +1 -1
- package/dist/result/retry.cjs.map +1 -1
- package/dist/result/retry.d.cts +2 -0
- package/dist/result/retry.d.ts +2 -0
- package/dist/result/retry.js +1 -1
- package/dist/result/retry.js.map +1 -1
- package/dist/result.cjs +1 -1
- package/dist/result.cjs.map +1 -1
- package/dist/result.d.cts +8 -23
- package/dist/result.d.ts +8 -23
- package/dist/result.js +1 -1
- package/dist/result.js.map +1 -1
- package/dist/{run-entry-C1uFytM6.d.cts → run-entry-rw7zll_G.d.ts} +16 -45
- package/dist/{run-entry-C1uFytM6.d.ts → run-entry-yQu63Yj9.d.cts} +16 -45
- package/dist/run.cjs +2 -2
- package/dist/run.cjs.map +1 -1
- package/dist/run.d.cts +3 -1
- package/dist/run.d.ts +3 -1
- package/dist/run.js +2 -2
- package/dist/run.js.map +1 -1
- package/dist/saga.cjs +2 -2
- package/dist/saga.cjs.map +1 -1
- package/dist/saga.d.cts +3 -1
- package/dist/saga.d.ts +3 -1
- package/dist/saga.js +2 -2
- package/dist/saga.js.map +1 -1
- package/dist/singleflight.d.cts +3 -1
- package/dist/singleflight.d.ts +3 -1
- package/dist/streaming.cjs +4 -4
- package/dist/streaming.cjs.map +1 -1
- package/dist/streaming.d.cts +5 -3
- package/dist/streaming.d.ts +5 -3
- package/dist/streaming.js +4 -4
- package/dist/streaming.js.map +1 -1
- package/dist/testing.cjs +8 -4
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +87 -4
- package/dist/testing.d.ts +87 -4
- package/dist/testing.js +8 -4
- package/dist/testing.js.map +1 -1
- package/dist/{types-wa_wTOn3.d.ts → types-CuWK5AlK.d.ts} +1 -1
- package/dist/{types-DUWrNIJu.d.cts → types-uR3JpwvF.d.cts} +1 -1
- package/dist/webhook.cjs +2 -2
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.cts +7 -4
- package/dist/webhook.d.ts +7 -4
- package/dist/webhook.js +2 -2
- package/dist/webhook.js.map +1 -1
- package/dist/workflow.cjs +3 -3
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +47 -11
- package/dist/workflow.d.ts +47 -11
- package/dist/workflow.js +3 -3
- package/dist/workflow.js.map +1 -1
- package/package.json +15 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Result, ok, err, matchError, from, fromPromise, tryAsync, fromNullable, map, mapError, match, andThen, tap, tapError, mapTry, mapErrorTry, bimap, orElse, orElseAsync, recover, recoverAsync, hydrate, isSerializedResult, all, allAsync, allSettled, allSettledAsync, partition, any, anyAsync, zip, zipAsync, flatten, deserialize, serialize, matchErrorPartial, Ok, Err,
|
|
2
|
-
export { AWAITLY_CANCELLED, AWAITLY_TIMEOUT, AWAITLY_UNEXPECTED, AsyncResult, CauseOf, DESERIALIZATION_ERROR, DeserializationError, EmptyInputError, ErrorOf, Errors, ExtractCause, ExtractError, ExtractValue, MatchErrorHandlers, MaybeAsyncResult, PROMISE_REJECTED, PromiseRejectionCause, SerializedResult, SettledError,
|
|
1
|
+
import { Result, ok, err, matchError, from, fromPromise, tryAsync, fromNullable, map, mapError, match, andThen, tap, tapError, mapTry, mapErrorTry, bimap, orElse, orElseAsync, recover, recoverAsync, hydrate, isSerializedResult, all, allAsync, allSettled, allSettledAsync, partition, any, anyAsync, zip, zipAsync, flatten, deserialize, serialize, matchErrorPartial, Ok, Err, PromiseRejectedError, UnwrapError } from './result.js';
|
|
2
|
+
export { AWAITLY_CANCELLED, AWAITLY_TIMEOUT, AWAITLY_UNEXPECTED, AsyncResult, CauseOf, DESERIALIZATION_ERROR, DeserializationError, EmptyInputError, ErrorOf, Errors, ExtractCause, ExtractError, ExtractValue, MatchErrorHandlers, MaybeAsyncResult, PROMISE_REJECTED, PromiseRejectionCause, SerializedResult, SettledError, isErr, isOk, isPromiseRejectedError, isUnexpectedError, runOrNull, runOrThrow, runOrThrowAsync, runOrUndefined, tags, unwrap, unwrapOr, unwrapOrElse } from './result.js';
|
|
3
3
|
import { TaggedError } from './tagged-error.js';
|
|
4
4
|
export { ErrorByTag, PropsOf, TagOf, TaggedErrorBase, TaggedErrorConstructor, TaggedErrorCreateOptions, TaggedErrorOptions } from './tagged-error.js';
|
|
5
5
|
import { pipe, flow, compose, recoverWith, getOrElse, getOrElseLazy, mapAsync, flatMapAsync, tapAsync, tapErrorAsync, race, traverse, traverseAsync, traverseParallel } from './functional.js';
|
|
6
6
|
export { R, identity } from './functional.js';
|
|
7
|
+
import { U as UnexpectedError } from './errors-entry-DOt5UUl4.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* awaitly
|
|
@@ -123,12 +124,12 @@ declare const Awaitly: {
|
|
|
123
124
|
readonly deserialize: typeof deserialize;
|
|
124
125
|
readonly serialize: typeof serialize;
|
|
125
126
|
readonly matchErrorPartial: typeof matchErrorPartial;
|
|
126
|
-
readonly UNEXPECTED_ERROR: "UNEXPECTED_ERROR";
|
|
127
127
|
readonly PROMISE_REJECTED: "PROMISE_REJECTED";
|
|
128
128
|
readonly AWAITLY_UNEXPECTED: "AWAITLY_UNEXPECTED";
|
|
129
129
|
readonly AWAITLY_CANCELLED: "AWAITLY_CANCELLED";
|
|
130
130
|
readonly AWAITLY_TIMEOUT: "AWAITLY_TIMEOUT";
|
|
131
131
|
readonly tags: <const T extends readonly string[]>(...t: T) => T;
|
|
132
|
+
readonly UnexpectedError: typeof UnexpectedError;
|
|
132
133
|
readonly isOk: <T, E, C>(r: Result<T, E, C>) => r is Ok<T>;
|
|
133
134
|
readonly isErr: <T, E, C>(r: Result<T, E, C>) => r is Err<E, C>;
|
|
134
135
|
readonly isUnexpectedError: (e: unknown) => e is UnexpectedError;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var De=Object.defineProperty;var Fe=(e,r)=>{for(var n in r)De(e,n,{get:r[n],enumerable:!0})};var h={};Fe(h,{AWAITLY_CANCELLED:()=>V,AWAITLY_TIMEOUT:()=>L,AWAITLY_UNEXPECTED:()=>M,DESERIALIZATION_ERROR:()=>f,PROMISE_REJECTED:()=>l,UNEXPECTED_ERROR:()=>x,UnwrapError:()=>R,all:()=>ke,allAsync:()=>xe,allSettled:()=>we,allSettledAsync:()=>Ae,andThen:()=>ae,any:()=>ge,anyAsync:()=>Pe,bimap:()=>Te,deserialize:()=>Ue,err:()=>s,flatten:()=>he,from:()=>ee,fromNullable:()=>te,fromPromise:()=>re,hydrate:()=>de,isErr:()=>T,isOk:()=>c,isPromiseRejectedError:()=>X,isSerializedResult:()=>ye,isUnexpectedError:()=>w,map:()=>oe,mapError:()=>se,mapErrorTry:()=>le,mapTry:()=>ie,match:()=>ue,matchError:()=>J,matchErrorPartial:()=>be,ok:()=>u,orElse:()=>pe,orElseAsync:()=>Ce,partition:()=>me,recover:()=>fe,recoverAsync:()=>Re,runOrNull:()=>$,runOrThrow:()=>Z,runOrThrowAsync:()=>q,runOrUndefined:()=>Q,serialize:()=>Oe,tags:()=>z,tap:()=>Ee,tapError:()=>ce,tryAsync:()=>ne,unwrap:()=>A,unwrapOr:()=>W,unwrapOrElse:()=>Y,zip:()=>v,zipAsync:()=>ve});var x="UNEXPECTED_ERROR",l="PROMISE_REJECTED",M="AWAITLY_UNEXPECTED",V="AWAITLY_CANCELLED",L="AWAITLY_TIMEOUT",z=(...e)=>e;function u(e){return{ok:!0,value:e}}function s(e,r){let n=r?.cause;return{ok:!1,error:e,...n!==void 0?{cause:n}:{}}}var c=e=>e.ok,T=e=>!e.ok,w=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type===x,X=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type===l;function J(e,r){if(w(e))return r.UNEXPECTED_ERROR(e);if(e==="UNEXPECTED_ERROR"){let n={type:x,cause:{type:"UNCAUGHT_EXCEPTION",thrown:e}};return r.UNEXPECTED_ERROR(n)}return r[e](e)}var R=class extends Error{error;cause;constructor(r){let n=typeof r.error=="string"?r.error:JSON.stringify(r.error);super(`Attempted to unwrap an Err: ${n}`),this.name="UnwrapError",this.error=r.error,this.cause=r.cause}},A=e=>{if(e.ok)return e.value;throw new R(e)},W=(e,r)=>e.ok?e.value:r,Y=(e,r)=>e.ok?e.value:r(e.error,e.cause),Z=e=>A(e),q=e=>Promise.resolve(e).then(A),$=e=>e.ok?e.value:null,Q=e=>e.ok?e.value:void 0;function ee(e,r){try{return u(e())}catch(n){return r?s(r(n),{cause:n}):s(n)}}async function re(e,r){try{return u(await e)}catch(n){return r?s(r(n),{cause:n}):s(n)}}async function ne(e,r){try{return u(await e())}catch(n){return r?s(r(n),{cause:n}):s(n)}}function te(e,r){return e!=null?u(e):s(r())}function oe(e,r){return e.ok?u(r(e.value)):e}function se(e,r){return e.ok?e:s(r(e.error,e.cause),{cause:e.cause})}function ue(e,r){return e.ok?r.ok(e.value):r.err(e.error,e.cause)}function ae(e,r){return e.ok?r(e.value):e}function Ee(e,r){return e.ok&&r(e.value),e}function ce(e,r){return e.ok||r(e.error,e.cause),e}function ie(e,r,n){if(!e.ok)return e;try{return u(r(e.value))}catch(t){return s(n(t),{cause:t})}}function le(e,r,n){if(e.ok)return e;try{return s(r(e.error),{cause:e.cause})}catch(t){return s(n(t),{cause:t})}}function Te(e,r,n){return e.ok?u(r(e.value)):s(n(e.error,e.cause),{cause:e.cause})}function pe(e,r){return e.ok?e:r(e.error,e.cause)}async function Ce(e,r){return e.ok?e:r(e.error,e.cause)}function fe(e,r){return e.ok?u(e.value):u(r(e.error,e.cause))}async function Re(e,r){let n=await e;return n.ok?u(n.value):u(await r(n.error,n.cause))}function de(e){if(typeof e!="object"||e===null||!("ok"in e))return null;let r=e;return r.ok===!0&&"value"in r?u(r.value):r.ok===!1&&"error"in r?s(r.error,{cause:r.cause}):null}function ye(e){if(typeof e!="object"||e===null||!("ok"in e))return!1;let r=e;return r.ok===!0&&"value"in r||r.ok===!1&&"error"in r}function ke(e){let r=[];for(let n of e){if(!n.ok)return n;r.push(n.value)}return u(r)}async function xe(e){let r=[];for(let n of e)try{let t=await n;if(!t.ok)return t;r.push(t.value)}catch(t){return s({type:l,cause:t},{cause:{type:"PROMISE_REJECTION",reason:t}})}return u(r)}function we(e){let r=[],n=[];for(let t of e)t.ok?r.push(t.value):n.push({error:t.error,cause:t.cause});return n.length>0?s(n):u(r)}async function Ae(e){let r=await Promise.all(e.map(o=>Promise.resolve(o).then(a=>({status:"result",result:a})).catch(a=>({status:"rejected",error:{type:l,cause:a},cause:{type:"PROMISE_REJECTION",reason:a}})))),n=[],t=[];for(let o of r)o.status==="rejected"?t.push({error:o.error,cause:o.cause}):o.result.ok?n.push(o.result.value):t.push({error:o.result.error,cause:o.result.cause});return t.length>0?s(t):u(n)}function me(e){let r=[],n=[];for(let t of e)t.ok?r.push(t.value):n.push(t.error);return{values:r,errors:n}}function ge(e){if(e.length===0)return s({type:"EMPTY_INPUT",message:"any() requires at least one Result"});let r;for(let n of e){if(n.ok)return n;r||(r=n)}return r}async function Pe(e){return e.length===0?s({type:"EMPTY_INPUT",message:"anyAsync() requires at least one Result"}):new Promise(r=>{let n=!1,t=e.length,o=null;for(let a of e)Promise.resolve(a).catch(E=>s({type:l,cause:E},{cause:{type:"PROMISE_REJECTION",reason:E}})).then(E=>{if(!n){if(E.ok){n=!0,r(E);return}o||(o=E),t--,t===0&&r(o)}})})}function v(e,r){return e.ok?r.ok?u([e.value,r.value]):r:e}async function ve(e,r){let n=a=>Promise.resolve(a).catch(E=>s({type:l,cause:E},{cause:{type:"PROMISE_REJECTION",reason:E}})),[t,o]=await Promise.all([n(e),n(r)]);return v(t,o)}function he(e){return e.ok?e.value:e}var f="DESERIALIZATION_ERROR";function Ue(e){if(typeof e!="object"||e===null)return s({type:f,value:e});if(!("ok"in e))return s({type:f,value:e});let r=e;return r.ok===!0&&"value"in r?u(r.value):r.ok===!1&&"error"in r?s(r.error,{cause:r.cause}):s({type:f,value:e})}function Oe(e){return e.ok?{ok:!0,value:e.value}:{ok:!1,error:e.error}}function be(e,r,n){if(w(e)){let o=r.UNEXPECTED_ERROR;return o?o(e):n(e)}let t=r[e];return t?t(e):n(e)}var d=class extends Error{_tag};function C(e,r){return class extends d{_tag=e;constructor(n,t){let o=r?.message?r.message(n??{}):e;if(super(o),this.name=e,Object.setPrototypeOf(this,new.target.prototype),n&&typeof n=="object"){let{_tag:a,name:E,message:i,stack:y,...p}=n,k=Object.prototype.hasOwnProperty.call(p,"cause"),Be=k?p.cause:void 0;k&&delete p.cause;let G=t?.cause!==void 0;if(k&&G)throw new TypeError("TaggedError: cannot provide 'cause' in props when also setting ErrorOptions.cause");Object.assign(this,p),k&&(this.cause=Be),G&&(this.cause=t?.cause)}else t?.cause!==void 0&&(this.cause=t.cause)}}}Object.defineProperty(C,Symbol.hasInstance,{value:e=>e instanceof d});(o=>{function e(a){return a instanceof Error}o.isError=e;function r(a){return a instanceof d}o.isTaggedError=r;function n(a,E){let i=a._tag,y=E[i];return y(a)}o.match=n;function t(a,E,i){let y=a._tag,p=E[y];return p?p(a):i(a)}o.matchPartial=t})(C||={});function U(e,...r){return r.reduce((n,t)=>t(n),e)}function O(...e){return r=>e.reduce((n,t)=>t(n),r)}function b(...e){return r=>e.reduceRight((n,t)=>t(n),r)}var B=e=>e;function je(e,r){return c(e)?u(r(e.value)):e}function Ie(e,r){return c(e)?r(e.value):e}function _e(e,r,n){return c(e)?u(r(e.value)):s(n(e.error),{cause:e.cause})}function He(e,r){return T(e)?s(r(e.error),{cause:e.cause}):e}function Ke(e,r){return c(e)&&r(e.value),e}function Se(e,r){return T(e)&&r(e.error),e}function Ne(e,r){return c(e)?r.ok(e.value):r.err(e.error,e.cause)}function Ge(e,r){return c(e)?e.value:r(e.error)}function m(e,r){return c(e)?e:r(e.error)}function g(e,r){return c(e)?e.value:r}function P(e,r){return c(e)?e.value:r()}async function D(e,r){let n=await e;return c(n)?u(await r(n.value)):n}async function F(e,r){let n=await e;return c(n)?r(n.value):n}async function j(e,r){let n=await e;return c(n)&&await r(n.value),n}async function I(e,r){let n=await e;return T(n)&&await r(n.error),n}async function Me(e){if(e.length===0)return u([]);let r=new Array(e.length),n=0,t=!1;return new Promise(o=>{e.forEach((a,E)=>{a.then(i=>{t||(T(i)?(t=!0,o(i)):(r[E]=i.value,n++,n===e.length&&(t=!0,o(u(r)))))},i=>{t||(t=!0,o(s({type:l,cause:i},{cause:{type:"PROMISE_REJECTION",reason:i}})))})})})}async function _(e){return Promise.race(e.map(r=>r.catch(n=>s({type:l,cause:n},{cause:{type:"PROMISE_REJECTION",reason:n}}))))}function H(e,r){let n=[];for(let t=0;t<e.length;t++){let o=r(e[t],t);if(T(o))return o;n.push(o.value)}return u(n)}async function K(e,r){let n=[];for(let t=0;t<e.length;t++){let o=await r(e[t],t);if(T(o))return o;n.push(o.value)}return u(n)}async function S(e,r){return Me(e.map((n,t)=>r(n,t)))}var N={map:e=>r=>je(r,e),flatMap:e=>r=>Ie(r,e),bimap:(e,r)=>n=>_e(n,e,r),mapError:e=>r=>He(r,e),tap:e=>r=>Ke(r,e),tapError:e=>r=>Se(r,e),match:e=>r=>Ne(r,e),recover:e=>r=>Ge(r,e),recoverWith:e=>r=>m(r,e),getOrElse:e=>r=>g(r,e),getOrElseLazy:e=>r=>P(r,e)};var Ze={...h,TaggedError:C,pipe:U,flow:O,compose:b,identity:B,R:N,recoverWith:m,getOrElse:g,getOrElseLazy:P,mapAsync:D,flatMapAsync:F,tapAsync:j,tapErrorAsync:I,race:_,traverse:H,traverseAsync:K,traverseParallel:S};export{V as AWAITLY_CANCELLED,L as AWAITLY_TIMEOUT,M as AWAITLY_UNEXPECTED,Ze as Awaitly,f as DESERIALIZATION_ERROR,l as PROMISE_REJECTED,N as R,C as TaggedError,x as UNEXPECTED_ERROR,R as UnwrapError,ke as all,xe as allAsync,we as allSettled,Ae as allSettledAsync,ae as andThen,ge as any,Pe as anyAsync,Te as bimap,b as compose,Ue as deserialize,s as err,F as flatMapAsync,he as flatten,O as flow,ee as from,te as fromNullable,re as fromPromise,g as getOrElse,P as getOrElseLazy,de as hydrate,B as identity,T as isErr,c as isOk,X as isPromiseRejectedError,ye as isSerializedResult,w as isUnexpectedError,oe as map,D as mapAsync,se as mapError,le as mapErrorTry,ie as mapTry,ue as match,J as matchError,be as matchErrorPartial,u as ok,pe as orElse,Ce as orElseAsync,me as partition,U as pipe,_ as race,fe as recover,Re as recoverAsync,m as recoverWith,$ as runOrNull,Z as runOrThrow,q as runOrThrowAsync,Q as runOrUndefined,Oe as serialize,z as tags,Ee as tap,j as tapAsync,ce as tapError,I as tapErrorAsync,H as traverse,K as traverseAsync,S as traverseParallel,ne as tryAsync,A as unwrap,W as unwrapOr,Y as unwrapOrElse,v as zip,ve as zipAsync};
|
|
1
|
+
var Me=Object.defineProperty;var Ve=(e,r)=>{for(var n in r)Me(e,n,{get:r[n],enumerable:!0})};var h={};Ve(h,{AWAITLY_CANCELLED:()=>q,AWAITLY_TIMEOUT:()=>Q,AWAITLY_UNEXPECTED:()=>X,DESERIALIZATION_ERROR:()=>R,PROMISE_REJECTED:()=>T,UnexpectedError:()=>d,UnwrapError:()=>k,all:()=>Oe,allAsync:()=>Ue,allSettled:()=>be,allSettledAsync:()=>Be,andThen:()=>Ce,any:()=>Fe,anyAsync:()=>je,bimap:()=>me,deserialize:()=>Ke,err:()=>s,flatten:()=>Ie,from:()=>Ee,fromNullable:()=>Te,fromPromise:()=>ce,hydrate:()=>ve,isErr:()=>p,isOk:()=>c,isPromiseRejectedError:()=>re,isSerializedResult:()=>he,isUnexpectedError:()=>m,map:()=>pe,mapError:()=>fe,mapErrorTry:()=>xe,mapTry:()=>ye,match:()=>de,matchError:()=>ne,matchErrorPartial:()=>Ne,ok:()=>u,orElse:()=>ge,orElseAsync:()=>we,partition:()=>De,recover:()=>Ae,recoverAsync:()=>Pe,runOrNull:()=>ae,runOrThrow:()=>se,runOrThrowAsync:()=>ue,runOrUndefined:()=>ie,serialize:()=>He,tags:()=>ee,tap:()=>Re,tapError:()=>ke,tryAsync:()=>le,unwrap:()=>g,unwrapOr:()=>te,unwrapOrElse:()=>oe,zip:()=>v,zipAsync:()=>_e});var C=class extends Error{_tag};function i(e,r){return class extends C{_tag=e;constructor(n,t){let o=r?.message?r.message(n??{}):e;if(super(o),this.name=e,Object.setPrototypeOf(this,new.target.prototype),n&&typeof n=="object"){let{_tag:a,name:E,message:l,stack:y,...f}=n,x=Object.prototype.hasOwnProperty.call(f,"cause"),Se=x?f.cause:void 0;x&&delete f.cause;let M=t?.cause!==void 0;if(x&&M)throw new TypeError("TaggedError: cannot provide 'cause' in props when also setting ErrorOptions.cause");Object.assign(this,f),x&&(this.cause=Se),M&&(this.cause=t?.cause)}else t?.cause!==void 0&&(this.cause=t.cause)}}}Object.defineProperty(i,Symbol.hasInstance,{value:e=>e instanceof C});(o=>{function e(a){return a instanceof Error}o.isError=e;function r(a){return a instanceof C}o.isTaggedError=r;function n(a,E){let l=a._tag,y=E[l];return y(a)}o.match=n;function t(a,E,l){let y=a._tag,f=E[y];return f?f(a):l(a)}o.matchPartial=t})(i||={});var V=class extends i("TimeoutError",{message:r=>r.operation?`TimeoutError: ${r.operation} timed out after ${r.ms}ms`:`TimeoutError: Operation timed out after ${r.ms}ms`}){},z=class extends i("RetryExhaustedError",{message:r=>r.operation?`RetryExhaustedError: ${r.operation} failed after ${r.attempts} attempts`:`RetryExhaustedError: Operation failed after ${r.attempts} attempts`}){},L=class extends i("RateLimitError",{message:r=>r.limiterName?`RateLimitError: Rate limit exceeded for ${r.limiterName}${r.retryAfterMs?`, retry after ${r.retryAfterMs}ms`:""}`:`RateLimitError: Rate limit exceeded${r.retryAfterMs?`, retry after ${r.retryAfterMs}ms`:""}`}){},G=class extends i("CircuitBreakerOpenError",{message:r=>`CircuitBreakerOpenError: Circuit ${r.circuitName} is ${r.state??"OPEN"}${r.retryAfterMs?`, retry after ${Math.ceil(r.retryAfterMs/1e3)}s`:""}`}){},$=class extends i("ValidationError",{message:r=>`ValidationError: Invalid ${r.field} - ${r.reason}`}){},J=class extends i("NotFoundError",{message:r=>r.id?`NotFoundError: ${r.resource} with id ${r.id} not found`:`NotFoundError: ${r.resource} not found`}){},W=class extends i("UnauthorizedError",{message:r=>r.reason?`UnauthorizedError: ${r.reason}`:r.action&&r.resource?`UnauthorizedError: Not authorized to ${r.action} ${r.resource}`:"UnauthorizedError: Access denied"}){},Y=class extends i("NetworkError",{message:r=>r.url?`NetworkError: ${r.reason} (${r.url})`:`NetworkError: ${r.reason}`}){},Z=class extends i("CompensationError",{message:r=>`CompensationError: Failed to compensate step ${r.step}`}){},d=class extends i("UnexpectedError",{message:r=>`UnexpectedError: ${r.cause instanceof Error?r.cause.message:String(r.cause??"unknown")}`}){};var T="PROMISE_REJECTED",X="AWAITLY_UNEXPECTED",q="AWAITLY_CANCELLED",Q="AWAITLY_TIMEOUT",ee=(...e)=>e;function u(e){return{ok:!0,value:e}}function s(e,r){let n=r?.cause;return{ok:!1,error:e,...n!==void 0?{cause:n}:{}}}var c=e=>e.ok,p=e=>!e.ok,m=e=>e instanceof d||typeof e=="object"&&e!==null&&"_tag"in e&&e._tag==="UnexpectedError",re=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type===T;function ne(e,r){return m(e)?r.UnexpectedError(e):r[e](e)}var k=class extends Error{error;cause;constructor(r){let n=typeof r.error=="string"?r.error:JSON.stringify(r.error);super(`Attempted to unwrap an Err: ${n}`),this.name="UnwrapError",this.error=r.error,this.cause=r.cause}},g=e=>{if(e.ok)return e.value;throw new k(e)},te=(e,r)=>e.ok?e.value:r,oe=(e,r)=>e.ok?e.value:r(e.error,e.cause),se=e=>g(e),ue=e=>Promise.resolve(e).then(g),ae=e=>e.ok?e.value:null,ie=e=>e.ok?e.value:void 0;function Ee(e,r){try{return u(e())}catch(n){return r?s(r(n),{cause:n}):s(n)}}async function ce(e,r){try{return u(await e)}catch(n){return r?s(r(n),{cause:n}):s(n)}}async function le(e,r){try{return u(await e())}catch(n){return r?s(r(n),{cause:n}):s(n)}}function Te(e,r){return e!=null?u(e):s(r())}function pe(e,r){return e.ok?u(r(e.value)):e}function fe(e,r){return e.ok?e:s(r(e.error,e.cause),{cause:e.cause})}function de(e,r){return e.ok?r.ok(e.value):r.err(e.error,e.cause)}function Ce(e,r){return e.ok?r(e.value):e}function Re(e,r){return e.ok&&r(e.value),e}function ke(e,r){return e.ok||r(e.error,e.cause),e}function ye(e,r,n){if(!e.ok)return e;try{return u(r(e.value))}catch(t){return s(n(t),{cause:t})}}function xe(e,r,n){if(e.ok)return e;try{return s(r(e.error),{cause:e.cause})}catch(t){return s(n(t),{cause:t})}}function me(e,r,n){return e.ok?u(r(e.value)):s(n(e.error,e.cause),{cause:e.cause})}function ge(e,r){return e.ok?e:r(e.error,e.cause)}async function we(e,r){return e.ok?e:r(e.error,e.cause)}function Ae(e,r){return e.ok?u(e.value):u(r(e.error,e.cause))}async function Pe(e,r){let n=await e;return n.ok?u(n.value):u(await r(n.error,n.cause))}function ve(e){if(typeof e!="object"||e===null||!("ok"in e))return null;let r=e;return r.ok===!0&&"value"in r?u(r.value):r.ok===!1&&"error"in r?s(r.error,{cause:r.cause}):null}function he(e){if(typeof e!="object"||e===null||!("ok"in e))return!1;let r=e;return r.ok===!0&&"value"in r||r.ok===!1&&"error"in r}function Oe(e){let r=[];for(let n of e){if(!n.ok)return n;r.push(n.value)}return u(r)}async function Ue(e){let r=[];for(let n of e)try{let t=await n;if(!t.ok)return t;r.push(t.value)}catch(t){return s({type:T,cause:t},{cause:{type:"PROMISE_REJECTION",reason:t}})}return u(r)}function be(e){let r=[],n=[];for(let t of e)t.ok?r.push(t.value):n.push({error:t.error,cause:t.cause});return n.length>0?s(n):u(r)}async function Be(e){let r=await Promise.all(e.map(o=>Promise.resolve(o).then(a=>({status:"result",result:a})).catch(a=>({status:"rejected",error:{type:T,cause:a},cause:{type:"PROMISE_REJECTION",reason:a}})))),n=[],t=[];for(let o of r)o.status==="rejected"?t.push({error:o.error,cause:o.cause}):o.result.ok?n.push(o.result.value):t.push({error:o.result.error,cause:o.result.cause});return t.length>0?s(t):u(n)}function De(e){let r=[],n=[];for(let t of e)t.ok?r.push(t.value):n.push(t.error);return{values:r,errors:n}}function Fe(e){if(e.length===0)return s({type:"EMPTY_INPUT",message:"any() requires at least one Result"});let r;for(let n of e){if(n.ok)return n;r||(r=n)}return r}async function je(e){return e.length===0?s({type:"EMPTY_INPUT",message:"anyAsync() requires at least one Result"}):new Promise(r=>{let n=!1,t=e.length,o=null;for(let a of e)Promise.resolve(a).catch(E=>s({type:T,cause:E},{cause:{type:"PROMISE_REJECTION",reason:E}})).then(E=>{if(!n){if(E.ok){n=!0,r(E);return}o||(o=E),t--,t===0&&r(o)}})})}function v(e,r){return e.ok?r.ok?u([e.value,r.value]):r:e}async function _e(e,r){let n=a=>Promise.resolve(a).catch(E=>s({type:T,cause:E},{cause:{type:"PROMISE_REJECTION",reason:E}})),[t,o]=await Promise.all([n(e),n(r)]);return v(t,o)}function Ie(e){return e.ok?e.value:e}var R="DESERIALIZATION_ERROR";function Ke(e){if(typeof e!="object"||e===null)return s({type:R,value:e});if(!("ok"in e))return s({type:R,value:e});let r=e;return r.ok===!0&&"value"in r?u(r.value):r.ok===!1&&"error"in r?s(r.error,{cause:r.cause}):s({type:R,value:e})}function He(e){return e.ok?{ok:!0,value:e.value}:{ok:!1,error:e.error}}function Ne(e,r,n){if(m(e)){let o=r.UnexpectedError;return o?o(e):n(e)}let t=r[e];return t?t(e):n(e)}function O(e,...r){return r.reduce((n,t)=>t(n),e)}function U(...e){return r=>e.reduce((n,t)=>t(n),r)}function b(...e){return r=>e.reduceRight((n,t)=>t(n),r)}var B=e=>e;function ze(e,r){return c(e)?u(r(e.value)):e}function Le(e,r){return c(e)?r(e.value):e}function Ge(e,r,n){return c(e)?u(r(e.value)):s(n(e.error),{cause:e.cause})}function $e(e,r){return p(e)?s(r(e.error),{cause:e.cause}):e}function Je(e,r){return c(e)&&r(e.value),e}function We(e,r){return p(e)&&r(e.error),e}function Ye(e,r){return c(e)?r.ok(e.value):r.err(e.error,e.cause)}function Ze(e,r){return c(e)?e.value:r(e.error)}function w(e,r){return c(e)?e:r(e.error)}function A(e,r){return c(e)?e.value:r}function P(e,r){return c(e)?e.value:r()}async function D(e,r){let n=await e;return c(n)?u(await r(n.value)):n}async function F(e,r){let n=await e;return c(n)?r(n.value):n}async function j(e,r){let n=await e;return c(n)&&await r(n.value),n}async function _(e,r){let n=await e;return p(n)&&await r(n.error),n}async function Xe(e){if(e.length===0)return u([]);let r=new Array(e.length),n=0,t=!1;return new Promise(o=>{e.forEach((a,E)=>{a.then(l=>{t||(p(l)?(t=!0,o(l)):(r[E]=l.value,n++,n===e.length&&(t=!0,o(u(r)))))},l=>{t||(t=!0,o(s({type:T,cause:l},{cause:{type:"PROMISE_REJECTION",reason:l}})))})})})}async function I(e){return Promise.race(e.map(r=>r.catch(n=>s({type:T,cause:n},{cause:{type:"PROMISE_REJECTION",reason:n}}))))}function K(e,r){let n=[];for(let t=0;t<e.length;t++){let o=r(e[t],t);if(p(o))return o;n.push(o.value)}return u(n)}async function H(e,r){let n=[];for(let t=0;t<e.length;t++){let o=await r(e[t],t);if(p(o))return o;n.push(o.value)}return u(n)}async function N(e,r){return Xe(e.map((n,t)=>r(n,t)))}var S={map:e=>r=>ze(r,e),flatMap:e=>r=>Le(r,e),bimap:(e,r)=>n=>Ge(n,e,r),mapError:e=>r=>$e(r,e),tap:e=>r=>Je(r,e),tapError:e=>r=>We(r,e),match:e=>r=>Ye(r,e),recover:e=>r=>Ze(r,e),recoverWith:e=>r=>w(r,e),getOrElse:e=>r=>A(r,e),getOrElseLazy:e=>r=>P(r,e)};var ir={...h,TaggedError:i,pipe:O,flow:U,compose:b,identity:B,R:S,recoverWith:w,getOrElse:A,getOrElseLazy:P,mapAsync:D,flatMapAsync:F,tapAsync:j,tapErrorAsync:_,race:I,traverse:K,traverseAsync:H,traverseParallel:N};export{q as AWAITLY_CANCELLED,Q as AWAITLY_TIMEOUT,X as AWAITLY_UNEXPECTED,ir as Awaitly,R as DESERIALIZATION_ERROR,T as PROMISE_REJECTED,S as R,i as TaggedError,d as UnexpectedError,k as UnwrapError,Oe as all,Ue as allAsync,be as allSettled,Be as allSettledAsync,Ce as andThen,Fe as any,je as anyAsync,me as bimap,b as compose,Ke as deserialize,s as err,F as flatMapAsync,Ie as flatten,U as flow,Ee as from,Te as fromNullable,ce as fromPromise,A as getOrElse,P as getOrElseLazy,ve as hydrate,B as identity,p as isErr,c as isOk,re as isPromiseRejectedError,he as isSerializedResult,m as isUnexpectedError,pe as map,D as mapAsync,fe as mapError,xe as mapErrorTry,ye as mapTry,de as match,ne as matchError,Ne as matchErrorPartial,u as ok,ge as orElse,we as orElseAsync,De as partition,O as pipe,I as race,Ae as recover,Pe as recoverAsync,w as recoverWith,ae as runOrNull,se as runOrThrow,ue as runOrThrowAsync,ie as runOrUndefined,He as serialize,ee as tags,Re as tap,j as tapAsync,ke as tapError,_ as tapErrorAsync,K as traverse,H as traverseAsync,N as traverseParallel,le as tryAsync,g as unwrap,te as unwrapOr,oe as unwrapOrElse,v as zip,_e as zipAsync};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|