@deslop/stash 0.1.1091 → 0.1.1093
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/README.md +1 -1
- package/dist/cli.js +4 -4
- package/dist/{contracts-C1Rqhg6U.mjs → contracts-PzeJtyhG.mjs} +176 -54
- package/dist/server.js +354 -186
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
-
import { $ as succeed$5, $a as badArgument, $c as split, $d as make$40, $f as isUndefined, $i as mkString, $l as CurrentLogSpans, $n as toJsonSchemaDocument, $o as flatMap, $r as Suspend, $s as serviceOption, $u as groupBy, A as SignInParams, Aa as collect, Ad as isResult, Af as Prototype, Ai as empty$10, Al as buildWithMemoMap, An as decodeUnknownOption, Ao as as$1, Ar as make$45, As as never, At as fromWebSocket, Au as random$1, Ba as takeAll, Bc as Random$2, Bd as minutes, Bf as NodeInspectSymbol, Bi as fromIterable, Bl as succeedContext, Bn as isMinLength, Bo as catchReason, Br as fromReadable, Bs as provideContext, Bt as TransportError, Bu as empty$11, C as AuthError, Ca as map$4, Cc as withFiberSucceed, Cd as headUnsafe, Cf as some$1, Ci as FileSystem, Cn as UndefinedOr, Co as isUnicast, Cr as get$7, Cs as map$1, Ct as makeCollectorUnsafe, D as OAuthTokenError, Da as make$36, Dc as withTracerEnabled, Dd as fromOption$1, Df as combine$1, Di as concat, Dl as prettyErrors, Dn as decodeSync, Do as andThen, Dr as set$3, Ds as matchCauseEffect, Du as externalSpan, E as OAuthFlow, Ea as pipeTo, Ec as withSpan, Ed as failVoid, Ef as String$3, Ei as catch_$1, El as makeDieReason, En as decodeEffect, Eo as all$1, Er as remove$3, Et as SocketError, Eu as Tracer, F as runMain, Fa as offerAll, Fc as passthrough, Fd as days, Ff as assignProperty, Fi as flatMap$3, Fl as merge$3, Fn as fromJsonString, Fo as catchCause, Fr as fromSetCookie, Fs as option$1, Ft as EncodeError, Fu as appendAll, G as Port, Ga as makeUnsafe$6, Gc as isNonEmpty, Gd as Reference, Gf as hash, Gi as limitBytes, Gl as addFinalizerExit, Gn as makeFilter, Go as contextWith, Gr as make$43, Gs as result$1, Gu as findFirst, H as layer$10, Ha as unbounded, Hc as endsWith, Hd as seconds, Hf as format$1, Hi as fromQueue, Hl as unwrap$3, Hn as isSchema, Ho as catchTags, Hr as toArrayBuffer, Hs as provideServiceEffect, Ht as Any, Hu as every, Ia as offerUnsafe, Ic as spaced, Id as format$2, If as getStackTraceLimit, Ii as flattenIterable, Il as mergeAll, In as is$4, Ir as isEmpty$1, Is as orDie, It as HttpClientError, Iu as contains$1, J as String$2, Ja as interrupt$2, Jc as padStart, Jf as isNotNull, Ji as mapArray, Jl as forkUnsafe$1, Jn as optionalKey, Jo as ensuring$1, Jr as Filter, Js as runFork, Jt as DateTimeUtcFromString, Ju as flatMap$2, K as Record, Ka as await_, Kc as length, Kd as Service, Kf as hasProperty, Ki as map$2, Kl as close, Kn as mutable, Kr as ChildProcessSpawner, Ks as retry, Kt as Class$1, Ku as findFirstIndex, La as shutdown, Lc as toStep, Ld as fromInputUnsafe$1, Lf as setStackTraceLimit, Li as fromArray, Ll as provide$1, Ln as isGreaterThanOrEqualTo, Lo as catchDefect, Lr as parseHeader, Ls as orElseSucceed, Lu as dedupe, Ma as failCause$2, Mc as fromStep, Md as match$3, Mf as contA, Mi as fail$2, Ml as effectContext, Mn as encodeSync, Mo as asVoid, Mr as stringOrRedacted, Ms as onExit, Mu as TaggedClass, N as layer$12, Na as make$38, Nc as isSchedule, Nd as succeed, Nf as contE, Ni as failCause$3, Nl as effectDiscard, Nn as encodeTo, No as cached, Nr as empty$9, Ns as onExitPrimitive, Nt as DecodeError, Nu as TaggedError, O as OAuthTokenResponse, Oa as makeUnsafe$7, Oc as zipWith, Od as getSuccess, Of as flip, Oi as decodeText, Ol as squash, On as decodeTo, Oo as annotateCurrentSpan, Or as setAll, Os as matchCauseEffectEager, Ot as SocketOpenError, Ou as make$42, P as make$41, Pa as offer, Pd as try_$1, Pi as filter$6, Pl as launch, Pn as encodeUnknownEffect$1, Po as callback, Pr as expireCookieUnsafe$1, Ps as onInterrupt, Pt as EmptyBodyError, Q as schema, Qa as runIn, Qc as slice$2, Qd as getUnsafe, Qf as isTagged, Qi as mergeAll$1, Ql as CurrentLogAnnotations, Qn as toEncoded$1, Qo as filterOrFail, Qr as PropertySignature, Qs as scoped, Qt as Exit$1, Qu as getUnsafe$1, R as layer$11, Rc as catchDone, Rd as max$1, Rf as BaseProto, Rl as provideMerge, Rn as isInt, Rr as setUnsafe$2, Rs as promise, Rt as InvalidUrlError, Ru as dedupeAdjacentWith, S as RpcAuth, Sa as fromTransform, Sc as withFiber, Sd as empty$12, Sf as orElseSome, Si as Path, Sl as hasInterruptsOnly, Sn as Uint8ArrayFromBase64, So as isPrivate, Sr as fromRecordUnsafe, Ss as makeSpanScoped, St as Collector, Su as reportCauseUnsafe, T as GitHubUser, Tc as withParentSpan, Td as fail, Tf as Number$1, Ti as catchTags$1, Tl as isTimeoutError, Tn as Unknown, To as acquireRelease, Tr as merge$2, Ts as mapError, Tu as ParentSpan, U as Crypto, Ua as make$35, Uc as includes, Ud as toMillis, Uf as redact, Ui as fromReadableStream, Ul as Scope, Un as isSchemaError$1, Uo as catch_, Ur as toUint8Array$1, Us as raceFirst, Ut as ArraySchema, Uu as filter$5, Va as publishUnsafe, Vc as camelToSnake, Vd as parts, Vf as toJson, Vi as fromPubSub, Vl as sync$1, Vn as isPattern, Vo as catchTag, Vr as pipeThroughDuplex, Vs as provideService, Vt as isHttpClientError, Vu as ensure, W as Array$1, Wa as set$2, Wc as isEmpty$2, Wd as zero$1, Wf as equals, Wi as groupedWithin, Wl as addFinalizer, Wn as make$44, Wo as context, Wr as fromWritable, Ws as repeat, Wt as Boolean$2, Wu as filterMap, X as all, Xa as interruptAllAs, Xc as replace$1, Xd as getOrUndefined$1, Xf as isNotUndefined, Xi as mapEffect, Xl as makeUnsafe$3, Xn as toCodecJson, Xo as fail$1, Xr as Literal$2, Xs as runSync, Xt as Duration, Xu as get$8, Y as URL$1, Ya as interruptAll, Yc as repeat$1, Yd as get$6, Yf as isNotNullish, Yi as mapArrayEffect, Yl as make$37, Yn as tag, Yo as exit, Yr as FilterGroup, Ys as runForkWith, Yt as Defect, Yu as fromIterable$1, Z as option, Za as interruptAs, Zc as replaceAll, Zd as getOrUndefinedUnsafe, Zf as isObject, Zi as mapError$1, Zl as provide$2, Zo as failCause, Zr as Objects, Zs as scope, Zt as Error$2, Zu as getSomes, _ as Organization, _a as toReadableStreamEffect, _c as updateService, _d as takeRight, _f as liftThrowable, _i as encode$1, _l as filterInterruptors, _o as ipFromStringUnsafe, _r as fromIterable$3, _s as logDebug, _t as ClientAbort$1, _u as fiberEnterInterruptibleUnsafe, a as FxConversation, aa as run$3, ac as tap$1, ad as join$1, af as filter$4, ai as null_, al as parse$10, an as MutableJson, ao as Dns, ap as constVoid, ar as omit, as as forkChild, at as RpcSerialization, au as isDeferred, b as AUTH_URL, ba as last$2, bc as when$2, bd as map$6, bf as none, bi as toEpochMillis, bl as hasDies, bn as URLFromString, bo as isLinkLocal, br as empty$8, bs as logInfo, bt as spanAttributes, bu as makeSpanUnsafe, c as GitHubIssue, ca as runForEachArray, cc as timeout, cd as map$3, cf as flatten, ci as resolveDescription, cl as currentTimeMillis, cn as Null, co as makeRecordUnsafe, cp as flow, cr as CurrentRedactedNames$1, cs as fromOption, ct as layerSchemaBinary, cu as fail$3, d as ImageType, da as scan, dc as transposeOption, dd as prepend$2, df as getOrElse, di as toEncoded, dl as StackTrace, dn as Record$1, do as NetAddressError, dp as pipeArguments, dr as redactUrl, ds as ignore$1, dt as constEof, du as isExit, ea as mkUint8Array, ec as sleep, ed as head, ef as makeUnsafe$4, ei as Union$1, el as startsWith, en as Finite, eo as fromInput$2, ep as or$1, er as toType, es as flatMapEager, et as unwrap$4, f as Note, fa as succeed$3, fc as tryPromise, fd as reduce, ff as getOrNull, fi as passthrough$1, fl as annotate, fn as Redacted$1, fo as formatInet, fr as setAll$1, fu as isFailure$1, g as OEmbed, ga as toReadableStream, gc as updateContext, gd as take$1, gf as liftPredicate, gi as encode, gl as fail$4, gn as TaggedError$1, go as ipFromString, gr as has$3, gs as log, gt as isWrapper, gu as effectIsExit, h as NotesError, ha as tap$2, hc as uninterruptibleMask, hd as sort, hf as isSome, hi as decode$3, hn as Struct, ho as inetAddressFromIpString, hr as fromIterable$2, hs as isEffect, ht as exitSchema, i as FileType, ia as provideService$1, ic as sync, id as isReadonlyArrayNonEmpty, if as exists, ii as mapOrSame, il as max$2, in as Literals, io as zero, ip as constUndefined, ir as isSchemaError, is as forever$1, iu as into, j as Verification, ja as end$1, jc as forever, jd as isSuccess, jf as PipeInspectableProto, ji as ensuring, jl as effect, jn as encodeEffect, jo as asSome, jr as value$2, js as onError, ju as Error$1, k as Session, kc as addDelay, kd as isFailure, kf as mapInput, ki as die$3, kl as CurrentMemoMap, kn as decodeUnknownEffect, ko as annotateLogs, kr as isRedacted, ks as matchEffect, ku as nativeTracer, l as GitHubReadme, lc as timeoutOption, lf as fromNullishOr, li as resolveIdentifier, ln as NullOr, lo as nameServerFromInput, lp as identity, lr as empty$7, ls as fromResult, lt as RequestId, lu as failCause$1, m as NoteJson, ma as takeUntil, mc as uninterruptible, md as some$2, mf as isNone, mi as transformOptional, ml as die$1, mn as StringFromUriComponent, mo as formatUrlUnsafe, mr as unwrap$1, ms as interruptible, mt as ServerClient, mu as succeed$4, n as Capture, na as orDie$1, nc as succeedNone, nd as isArrayNonEmpty, nf as all$2, ni as isNever, nl as trim, nn as Json, no as gibibytes, np as constFalse, nr as withDecodingDefault, ns as fnUntraced, nu as _await, o as FxStatus, oa as runCollect, oc as tapCause, od as last$1, of as flatMap$1, oi as optionalKey$1, on as Never, oo as DnsError, op as constant, or as getReferenceKey, os as forkIn, ot as json$1, ou as makeUnsafe$5, p as NoteId, pa as suspend$1, pc as try_, pd as reverse, pf as getOrUndefined, pi as transform$1, pl as combine, pn as String$1, po as formatIp, pr as toString$2, ps as interrupt, pt as constPong, pu as isSuccess$1, q as Redacted, qa as getCurrent, qc as match$2, qd as add$1, qf as isIterable, qi as mapAccum, ql as closeUnsafe, qn as optional$1, qo as die$2, qr as Arrays, qt as DateTimeUtc, r as Extraction, ra as pipeThroughChannel, rc as suspend, rd as isReadonlyArrayEmpty, rf as contains$2, ri as isOptional, rl as trimEnd, rn as Literal$1, ro as mebibytes, rp as constTrue, rr as withDecodingDefaultKey, rs as forEach, rt as withRun, ru as doneUnsafe, s as GitHubComment, sa as runForEach, sc as tapError$1, sd as lastNonEmpty, sf as flatMapNullishOr, si as replaceChecks, sl as Clock, sn as NonEmptyArray, so as make$39, sp as dual, sr as encodeUnknownEffect, ss as forkScoped, st as layerJson$1, su as die, t as RpcContracts, ta as onEnd, tc as succeed$1, td as headNonEmpty, tf as merge$1, ti as decodeTo$1, tl as toLowerCase, tn as Int, to as fromInputUnsafe, tp as compose$1, tr as withConstructorDefault, ts as fn$1, tt as withDefault, tu as TracerTimingEnabled, u as GitHubRepo, ua as runLast, uc as timeoutOrElse, ud as of, uf as fromUndefinedOr, ui as string, ul as IllegalArgumentError, un as Number$2, uo as domainNameFromStringUnsafe, up as pipe, ur as fromInput, us as gen, ut as ResponseDefectEncoded, uu as interrupt$1, v as Reader, vc as useSpan, vd as has$4, vf as map$5, vi as formatIso, vn as Tuple, vo as ipv4ToOctets, vr as get$9, vt as getStreamSchemas, vu as fiberEnterUninterruptibleUnsafe, w as CallbackParams, wc as withLogSpan, wd as make$46, wf as toArray$1, wi as catchReason$1, wl as isNoSuchElementError, wn as Union, wo as unixPathAddress, wr as isRedactedName, ws as mapEager, wt as CloseEvent, wu as DisablePropagation, x as CurrentUser, xc as whileLoop, xd as toEntries, xf as orElse$2, xi as defaultFormatter, xl as hasInterrupts, xn as Uint8Array$2, xo as isLoopback, xr as fromInput$1, xs as logWarning, xt as spanName, xu as onExitUnsafe, y as TikTokPage, ya as unwrap$2, yc as void_, yd as keys, yf as match$1, yi as now, yl as fromReasons, yn as URL$2, yo as isInetAddressV6, yr as CurrentRedactedNames, ys as logFatal, yt as isStreamSchema, yu as forkUnsafe, za as take, zd as millis, zf as Class, zi as fromEffect, zl as succeed$2, zn as isMaxLength, zo as catchIf, zr as toSetCookieHeaders, zs as provide$3, zt as StatusCodeError, zu as drop } from "./contracts-C1Rqhg6U.mjs";
|
|
2
|
+
import { $ as option, $a as interruptAll, $c as repeat$1, $d as Service, $f as hasProperty, $i as mapArrayEffect, $l as closeUnsafe, $o as exit, $r as FilterGroup, $s as runForkWith, $t as Error$2, $u as findFirstIndex, A as Session, Aa as pipeTo, Ac as withSpan, Ad as headUnsafe, Af as some$1, Ai as catch_$1, Al as isTimeoutError, An as decodeTo, Ao as all$1, Ar as remove$3, At as SocketOpenError, B as layer$11, Ba as offerUnsafe, Bc as spaced, Bd as succeed, Bf as contE, Bi as flattenIterable, Bl as launch, Bn as isInt, Br as isEmpty$1, Bs as orDie, Bt as InvalidUrlError, Bu as TaggedError, C as development, Ca as unwrap$2, Cc as void_, Cd as take$1, Cf as liftPredicate, Ci as now, Cn as Uint8Array$2, Co as isInetAddressV6, Cr as CurrentRedactedNames, Cs as logFatal, Ct as spanName, Cu as effectIsExit, D as OAuthFlow, Da as map$4, Dc as withFiberSucceed, Dd as map$6, Df as none, Di as FileSystem, Dl as hasInterruptsOnly, Dn as Unknown, Do as isUnicast, Dr as get$7, Ds as map$1, Du as makeSpanUnsafe, E as GitHubUser, Ea as fromTransform, Ec as withFiber, Ed as keys, Ef as match$1, Ei as Path, El as hasInterrupts, En as Union, Eo as isPrivate, Er as fromRecordUnsafe, Es as makeSpanScoped, Et as CloseEvent, Eu as forkUnsafe, F as layer$12, Fa as end$1, Fc as forever, Fd as getSuccess, Ff as flip, Fi as ensuring, Fl as buildWithMemoMap, Fn as encodeTo, Fo as asSome, Fr as value$2, Fs as onError, Ft as DecodeError, Fu as make$43, G as Crypto, Ga as publishUnsafe, Gc as camelToSnake, Gd as max$1, Gf as BaseProto, Gi as fromPubSub, Gl as succeed$2, Gn as isSchemaError$1, Go as catchTag, Gr as pipeThroughDuplex, Gs as provideService, Gt as ArraySchema, Gu as dedupeAdjacentWith, Hc as catchDone, Hd as days, Hf as assignProperty, Hl as mergeAll, Hn as isMinLength, Hr as setUnsafe$2, Hs as promise, Ht as TransportError, Hu as appendAll, I as make$42, Ia as failCause$2, Ic as fromStep, Id as isFailure, If as mapInput, Ii as fail$2, Il as buildWithScope, In as encodeUnknownEffect$1, Io as asVoid, Ir as stringOrRedacted, Is as onExit, It as EmptyBodyError, Iu as nativeTracer, J as Record, Ja as set$2, Jc as isEmpty$2, Jd as parts, Jf as toJson, Ji as groupedWithin, Jl as unwrap$3, Jn as mutable, Jo as context, Jr as fromWritable, Js as repeat, Jt as Class$1, Ju as ensure, K as Array$1, Ka as unbounded, Kc as endsWith, Kd as millis, Kf as Class, Ki as fromQueue, Kl as succeedContext, Kn as make$45, Ko as catchTags, Kr as toArrayBuffer, Ks as provideServiceEffect, Kt as Boolean$2, Ku as drop, L as runMain, La as make$39, Lc as isSchedule, Ld as isResult, Lf as Prototype, Li as failCause$3, Ll as effect, Ln as fromJsonString, Lo as cached, Lr as empty$9, Ls as onExitPrimitive, Lt as EncodeError, Lu as random$1, M as User, Ma as makeUnsafe$8, Mc as zipWith, Md as fail, Mf as Number$1, Mi as decodeText, Ml as prettyErrors, Mn as decodeUnknownOption, Mo as annotateCurrentSpan, Mr as setAll, Ms as matchCauseEffectEager, Mt as fromWebSocket, Mu as ParentSpan, N as Verification, Nc as addDelay, Nd as failVoid, Nf as String$3, Ni as die$3, Nl as squash, Nn as encodeEffect, No as annotateLogs, Nr as isRedacted, Ns as matchEffect, Nu as Tracer, O as OAuthTokenError, Oc as withLogSpan, Od as toEntries, Of as orElse$2, Oi as catchReason$1, On as decodeEffect, Oo as unixPathAddress, Or as isRedactedName, Os as mapEager, Ot as SocketError, Ou as onExitUnsafe, Pa as collect, Pd as fromOption$1, Pf as combine$1, Pi as empty$10, Pl as CurrentMemoMap, Pn as encodeSync, Po as as$1, Pr as make$46, Ps as never, Pu as externalSpan, Q as all, Qa as interrupt$2, Qc as padStart, Qd as Reference, Qf as hash, Qi as mapArray, Ql as close, Qn as toCodecJson, Qo as ensuring$1, Qr as Filter, Qs as runFork, Qt as Duration, Qu as findFirst, Ra as offer, Rd as isSuccess, Rf as PipeInspectableProto, Ri as filter$6, Rl as effectContext, Rn as is$4, Ro as callback, Rr as expireCookieUnsafe$1, Rs as onInterrupt, Rt as HttpClientError, Ru as Error$1, S as RpcAuth, Sc as useSpan, Sd as sort, Sf as isSome, Si as formatIso, Sl as filterInterruptors, Sn as URLFromString, So as ipv4ToOctets, Sr as set$4, St as spanAttributes, T as CallbackParams, Tc as whileLoop, Td as has$4, Tf as map$5, Ti as defaultFormatter, Tl as hasDies, Tn as UndefinedOr, To as isLoopback, Tr as fromInput$1, Ts as logWarning, Tt as makeCollectorUnsafe, Tu as fiberEnterUninterruptibleUnsafe, Ua as take, Ud as format$2, Uf as getStackTraceLimit, Ui as fromEffect, Ul as provide$1, Un as isPattern, Uo as catchIf, Ur as toSetCookieHeaders, Us as provide$3, Ut as isHttpClientError, Uu as contains$1, Va as shutdown, Vc as toStep, Vd as try_$1, Vi as fromArray, Vl as merge$3, Vn as isMaxLength, Vo as catchDefect, Vr as parseHeader, Vs as orElseSucceed, Vt as StatusCodeError, W as layer$10, Wa as takeAll, Wc as Random$2, Wd as fromInputUnsafe$1, Wf as setStackTraceLimit, Wi as fromIterable, Wl as provideMerge, Wn as isSchema, Wo as catchReason, Wr as fromReadable, Ws as provideContext, Wt as Any, Wu as dedupe, X as String$2, Xa as await_, Xc as length, Xd as toMillis, Xf as redact, Xi as map$2, Xl as addFinalizer, Xn as optionalKey, Xr as ChildProcessSpawner, Xs as retry, Xt as DateTimeUtcFromString, Xu as filter$5, Y as Redacted, Ya as makeUnsafe$7, Yc as isNonEmpty, Yd as seconds, Yf as format$1, Yi as limitBytes, Yl as Scope, Yn as optional$1, Yo as contextWith, Yr as make$44, Ys as result$1, Yt as DateTimeUtc, Yu as every, Z as URL$1, Za as getCurrent, Zc as match$2, Zd as zero$1, Zf as equals, Zi as mapAccum, Zl as addFinalizerExit, Zn as tag, Zo as die$2, Zr as Arrays, Zt as Defect, Zu as filterMap, _ as Organization, _a as suspend$1, _c as try_, _d as of, _f as fromUndefinedOr, _i as transform$1, _l as annotate, _n as Struct, _o as formatIp, _p as pipe, _r as fromIterable$2, _s as interrupt, _t as exitSchema, _u as interrupt$1, a as FxConversation, aa as onEnd, ac as succeed$1, ad as getUnsafe$2, af as getUnsafe$1, ai as decodeTo$1, al as toLowerCase, an as Literal$1, ao as fromInputUnsafe, ap as isTagged, ar as withDecodingDefaultKey, as as fn$1, at as withRun, au as CurrentLogAnnotations, b as AUTH_URL, ba as toReadableStream, bc as updateContext, bd as reverse, bf as getOrUndefined, bi as encode, bn as Tuple, bo as ipFromString, br as fromIterable$3, bs as log, bt as getStreamSchemas, bu as isSuccess$1, c as GitHubIssue, ca as provideService$1, cc as sync, cd as headNonEmpty, cf as merge$1, ci as mapOrSame, cl as max$2, cn as Never, co as zero, cp as compose$1, cr as getReferenceKey, cs as forever$1, ct as json$1, cu as TracerTimingEnabled, d as ImageType, da as runForEach, dc as tapError$1, dd as isReadonlyArrayNonEmpty, df as exists, di as replaceChecks, dl as Clock, dn as NullOr, do as make$40, dp as constUndefined, dr as empty$7, ds as forkScoped, dt as RequestId, du as into, ea as mapEffect, ec as runSync, ef as add$1, ei as Literal$2, el as replace$1, en as Exit$1, eo as interruptAllAs, ep as isIterable, er as toEncoded$1, es as fail$1, et as schema, eu as fork, f as Note, fa as runForEachArray, fc as timeout, fd as join$1, ff as filter$4, fi as resolveDescription, fl as currentTimeMillis, fn as Number$2, fo as makeRecordUnsafe, fp as constVoid, fr as fromInput, fs as fromOption, ft as ResponseDefectEncoded, fu as isDeferred, g as OEmbed, ga as succeed$3, gc as tryPromise, gf as fromNullishOr, gi as passthrough$1, gl as StackTrace, gn as StringFromUriComponent, go as formatInet, gp as identity, gr as unwrap$1, gt as ServerClient, gu as failCause$1, h as NotesError, ha as scan, hc as transposeOption, hd as map$3, hf as flatten, hi as toEncoded, hl as IllegalArgumentError, hn as String$1, ho as NetAddressError, hp as flow, hr as toString$2, hs as ignore$1, ht as constPong, hu as fail$3, i as FileType, ia as mkUint8Array, ic as sleep, id as getSomes, if as getOrUndefinedUnsafe, ii as Union$1, il as startsWith, in as Json, io as fromInput$2, ip as isObject, ir as withDecodingDefault, is as flatMapEager, iu as provide$2, j as SignInParams, ja as make$37, jc as withTracerEnabled, jd as make$47, jf as toArray$1, ji as concat, jl as makeDieReason, jn as decodeUnknownEffect, jo as andThen, jr as set$3, js as matchCauseEffect, ju as DisablePropagation, k as OAuthTokenResponse, kc as withParentSpan, kd as empty$12, kf as orElseSome, ki as catchTags$1, kl as isNoSuchElementError, kn as decodeSync, ko as acquireRelease, kr as merge$2, ks as mapError, ku as reportCauseUnsafe, l as GitHubReadme, la as run$3, lc as tap$1, ld as isArrayNonEmpty, lf as all$2, li as null_, ll as parse$10, ln as NonEmptyArray, lo as Dns, lp as constFalse, lr as encodeUnknownEffect, ls as forkChild, lt as layerJson$1, lu as _await, m as NoteJson, ma as runLast, mc as timeoutOrElse, md as lastNonEmpty, mf as flatMapNullishOr, mi as string, mn as Redacted$1, mo as domainNameFromStringUnsafe, mp as dual, mr as setAll$1, ms as gen, mu as die, n as Capture, na as mergeAll$1, nc as scoped, nd as fromIterable$1, nf as get$6, ni as PropertySignature, nl as slice$2, nn as Finite, no as runIn, np as isNotNullish, nr as toType, ns as filterOrFail, nt as unwrap$4, nu as make$38, o as FxStatus, oa as orDie$1, oc as succeedNone, od as groupBy, of as make$41, oi as isNever, ol as trim, on as Literals, oo as gibibytes, op as isUndefined, or as isSchemaError, os as fnUntraced, ou as CurrentLogSpans, p as NoteId, pc as timeoutOption, pd as last$1, pf as flatMap$1, pi as resolveIdentifier, pl as currentTimeNanos, pn as Record$1, po as nameServerFromInput, pp as constant, pr as redactUrl, ps as fromResult, pt as constEof, pu as makeUnsafe$6, q as Port, qa as make$36, qc as includes, qd as minutes, qf as NodeInspectSymbol, qi as fromReadableStream, ql as sync$1, qn as makeFilter, qo as catch_, qr as toUint8Array$1, qs as raceFirst, qu as empty$11, r as Extraction, ra as mkString, rc as serviceOption, rd as get$8, rf as getOrUndefined$1, ri as Suspend, rl as split, rn as Int, ro as badArgument, rp as isNotUndefined, rr as withConstructorDefault, rs as flatMap, rt as withDefault, ru as makeUnsafe$4, s as GitHubComment, sa as pipeThroughChannel, sc as suspend, sd as head, sf as makeUnsafe$5, si as isOptional, sl as trimEnd, sn as MutableJson, so as mebibytes, sp as or$1, sr as omit, ss as forEach, st as RpcSerialization, t as RpcContracts, ta as mapError$1, tc as scope, td as flatMap$2, ti as Objects, tl as replaceAll, to as interruptAs, tp as isNotNull, tr as toJsonSchemaDocument, ts as failCause, tt as succeed$5, tu as forkUnsafe$1, u as GitHubRepo, ua as runCollect, uc as tapCause, ud as isReadonlyArrayEmpty, uf as contains$2, ui as optionalKey$1, un as Null, uo as DnsError, up as constTrue, ur as CurrentRedactedNames$1, us as forkIn, ut as layerSchemaBinary, uu as doneUnsafe, v as Reader, va as takeUntil, vc as uninterruptible, vd as prepend$2, vf as getOrElse, vi as transformOptional, vl as combine, vn as TaggedError$1, vo as formatUrlUnsafe, vp as pipeArguments, vr as has$3, vs as interruptible, vt as isWrapper, vu as isExit, w as AuthError, wa as last$2, wc as when$2, wd as takeRight, wf as liftThrowable, wi as toEpochMillis, wl as fromReasons, wn as Uint8ArrayFromBase64, wo as isLinkLocal, wr as empty$8, ws as logInfo, wt as Collector, wu as fiberEnterInterruptibleUnsafe, x as CurrentUser, xa as toReadableStreamEffect, xc as updateService, xd as some$2, xf as isNone, xi as encode$1, xl as fail$4, xn as URL$2, xo as ipFromStringUnsafe, xr as get$9, xs as logDebug, xt as isStreamSchema, xu as succeed$4, y as TikTokPage, ya as tap$2, yc as uninterruptibleMask, yd as reduce, yf as getOrNull, yi as decode$3, yl as die$1, yo as inetAddressFromIpString, yr as empty$13, ys as isEffect, yt as ClientAbort$1, yu as isFailure$1, za as offerAll, zc as passthrough, zd as match$3, zf as contA, zi as flatMap$3, zl as effectDiscard, zn as isGreaterThanOrEqualTo, zo as catchCause, zr as fromSetCookie, zs as option$1, zu as TaggedClass } from "./contracts-PzeJtyhG.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { Duplex, Readable, pipeline } from "node:stream";
|
|
5
5
|
import * as Http from "node:http";
|
|
@@ -117,9 +117,9 @@ const compose = /*#__PURE__*/ dual(2, (left, right) => (input) => {
|
|
|
117
117
|
});
|
|
118
118
|
//#endregion
|
|
119
119
|
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/MutableHashMap.js
|
|
120
|
-
const TypeId$
|
|
120
|
+
const TypeId$20 = "~effect/MutableHashMap";
|
|
121
121
|
const MutableHashMapProto = {
|
|
122
|
-
[TypeId$
|
|
122
|
+
[TypeId$20]: TypeId$20,
|
|
123
123
|
[Symbol.iterator]() {
|
|
124
124
|
return this.backing[Symbol.iterator]();
|
|
125
125
|
},
|
|
@@ -463,9 +463,9 @@ const RefProto = {
|
|
|
463
463
|
* @category constructors
|
|
464
464
|
* @since 4.0.0
|
|
465
465
|
*/
|
|
466
|
-
const makeUnsafe$
|
|
466
|
+
const makeUnsafe$3 = (value) => {
|
|
467
467
|
const self = Object.create(RefProto);
|
|
468
|
-
self.ref = make$
|
|
468
|
+
self.ref = make$36(value);
|
|
469
469
|
return self;
|
|
470
470
|
};
|
|
471
471
|
/**
|
|
@@ -494,7 +494,7 @@ const makeUnsafe$2 = (value) => {
|
|
|
494
494
|
* @category constructors
|
|
495
495
|
* @since 2.0.0
|
|
496
496
|
*/
|
|
497
|
-
const make$
|
|
497
|
+
const make$35 = (value) => sync(() => makeUnsafe$3(value));
|
|
498
498
|
/**
|
|
499
499
|
* Gets the current value of the Ref.
|
|
500
500
|
*
|
|
@@ -560,7 +560,7 @@ const get$4 = (self) => sync(() => self.ref.current);
|
|
|
560
560
|
const set = /*#__PURE__*/ dual(2, (self, value) => sync(() => set$2(self.ref, value)));
|
|
561
561
|
//#endregion
|
|
562
562
|
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/HttpBody.js
|
|
563
|
-
const TypeId$
|
|
563
|
+
const TypeId$19 = "~effect/http/HttpBody";
|
|
564
564
|
const HttpBodyErrorTypeId = "~effect/http/HttpBody/HttpBodyError";
|
|
565
565
|
/**
|
|
566
566
|
* Error produced while constructing an HTTP body from JSON or schema-encoded input.
|
|
@@ -578,10 +578,10 @@ var HttpBodyError = class extends (/*#__PURE__*/ TaggedError("HttpBodyError")) {
|
|
|
578
578
|
*/
|
|
579
579
|
[HttpBodyErrorTypeId] = HttpBodyErrorTypeId;
|
|
580
580
|
};
|
|
581
|
-
var Proto$
|
|
582
|
-
[TypeId$
|
|
581
|
+
var Proto$11 = class {
|
|
582
|
+
[TypeId$19];
|
|
583
583
|
constructor() {
|
|
584
|
-
this[TypeId$
|
|
584
|
+
this[TypeId$19] = TypeId$19;
|
|
585
585
|
}
|
|
586
586
|
[NodeInspectSymbol]() {
|
|
587
587
|
return this.toJSON();
|
|
@@ -597,7 +597,7 @@ var Proto$10 = class {
|
|
|
597
597
|
* @category models
|
|
598
598
|
* @since 4.0.0
|
|
599
599
|
*/
|
|
600
|
-
var Empty$1 = class extends Proto$
|
|
600
|
+
var Empty$1 = class extends Proto$11 {
|
|
601
601
|
_tag = "Empty";
|
|
602
602
|
toJSON() {
|
|
603
603
|
return {
|
|
@@ -625,7 +625,7 @@ const empty$5 = /*#__PURE__*/ new Empty$1();
|
|
|
625
625
|
* @category models
|
|
626
626
|
* @since 4.0.0
|
|
627
627
|
*/
|
|
628
|
-
var Raw = class extends Proto$
|
|
628
|
+
var Raw = class extends Proto$11 {
|
|
629
629
|
_tag = "Raw";
|
|
630
630
|
body;
|
|
631
631
|
contentType;
|
|
@@ -665,7 +665,7 @@ const raw$1 = (body, options) => new Raw(body, options?.contentType, options?.co
|
|
|
665
665
|
* @category models
|
|
666
666
|
* @since 4.0.0
|
|
667
667
|
*/
|
|
668
|
-
var Uint8Array$1 = class extends Proto$
|
|
668
|
+
var Uint8Array$1 = class extends Proto$11 {
|
|
669
669
|
_tag = "Uint8Array";
|
|
670
670
|
contentType;
|
|
671
671
|
contentLength;
|
|
@@ -794,7 +794,7 @@ const urlParams = (urlParams, contentType) => text$3(toString$2(fromInput(urlPar
|
|
|
794
794
|
* @category models
|
|
795
795
|
* @since 4.0.0
|
|
796
796
|
*/
|
|
797
|
-
var FormData$1 = class extends Proto$
|
|
797
|
+
var FormData$1 = class extends Proto$11 {
|
|
798
798
|
_tag = "FormData";
|
|
799
799
|
contentType = void 0;
|
|
800
800
|
contentLength = void 0;
|
|
@@ -826,7 +826,7 @@ const formData = (body) => new FormData$1(body);
|
|
|
826
826
|
* @category models
|
|
827
827
|
* @since 4.0.0
|
|
828
828
|
*/
|
|
829
|
-
var Stream = class extends Proto$
|
|
829
|
+
var Stream = class extends Proto$11 {
|
|
830
830
|
_tag = "Stream";
|
|
831
831
|
stream;
|
|
832
832
|
contentType;
|
|
@@ -951,7 +951,7 @@ var UrlError = class extends (/*#__PURE__*/ TaggedError("UrlError")) {};
|
|
|
951
951
|
* @category constructors
|
|
952
952
|
* @since 4.0.0
|
|
953
953
|
*/
|
|
954
|
-
const make$
|
|
954
|
+
const make$34 = (url, params, hash) => try_$1({
|
|
955
955
|
try: () => {
|
|
956
956
|
const urlInstance = new URL(url, baseUrl());
|
|
957
957
|
for (let i = 0; i < params.params.length; i++) {
|
|
@@ -1013,7 +1013,7 @@ const fromString = (url, base) => try_$1({
|
|
|
1013
1013
|
});
|
|
1014
1014
|
//#endregion
|
|
1015
1015
|
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/HttpClientRequest.js
|
|
1016
|
-
const TypeId$
|
|
1016
|
+
const TypeId$18 = "~effect/http/HttpClientRequest";
|
|
1017
1017
|
/**
|
|
1018
1018
|
* Returns `true` when a value is an `HttpClientRequest`.
|
|
1019
1019
|
*
|
|
@@ -1021,9 +1021,9 @@ const TypeId$17 = "~effect/http/HttpClientRequest";
|
|
|
1021
1021
|
* @category guards
|
|
1022
1022
|
* @since 4.0.0
|
|
1023
1023
|
*/
|
|
1024
|
-
const isHttpClientRequest = (u) => hasProperty(u, TypeId$
|
|
1025
|
-
const Proto$
|
|
1026
|
-
[TypeId$
|
|
1024
|
+
const isHttpClientRequest = (u) => hasProperty(u, TypeId$18);
|
|
1025
|
+
const Proto$10 = {
|
|
1026
|
+
[TypeId$18]: TypeId$18,
|
|
1027
1027
|
...BaseProto,
|
|
1028
1028
|
toJSON() {
|
|
1029
1029
|
return {
|
|
@@ -1048,7 +1048,7 @@ const Proto$9 = {
|
|
|
1048
1048
|
* @since 4.0.0
|
|
1049
1049
|
*/
|
|
1050
1050
|
function makeWith$1(method, url, urlParams, hash, headers, body) {
|
|
1051
|
-
const self = Object.create(Proto$
|
|
1051
|
+
const self = Object.create(Proto$10);
|
|
1052
1052
|
self.method = method;
|
|
1053
1053
|
self.url = url;
|
|
1054
1054
|
self.urlParams = urlParams;
|
|
@@ -1072,7 +1072,7 @@ const empty$4 = /*#__PURE__*/ makeWith$1("GET", "", empty$7, /*#__PURE__*/ none(
|
|
|
1072
1072
|
* @category constructors
|
|
1073
1073
|
* @since 4.0.0
|
|
1074
1074
|
*/
|
|
1075
|
-
const make$
|
|
1075
|
+
const make$33 = (method) => (url, options) => modify(empty$4, {
|
|
1076
1076
|
method,
|
|
1077
1077
|
url,
|
|
1078
1078
|
...options ?? void 0
|
|
@@ -1084,7 +1084,7 @@ const make$32 = (method) => (url, options) => modify(empty$4, {
|
|
|
1084
1084
|
* @category constructors
|
|
1085
1085
|
* @since 4.0.0
|
|
1086
1086
|
*/
|
|
1087
|
-
const get$3 = /*#__PURE__*/ make$
|
|
1087
|
+
const get$3 = /*#__PURE__*/ make$33("GET");
|
|
1088
1088
|
/**
|
|
1089
1089
|
* Creates a `POST` request for the specified URL.
|
|
1090
1090
|
*
|
|
@@ -1092,8 +1092,8 @@ const get$3 = /*#__PURE__*/ make$32("GET");
|
|
|
1092
1092
|
* @category constructors
|
|
1093
1093
|
* @since 4.0.0
|
|
1094
1094
|
*/
|
|
1095
|
-
const post = /*#__PURE__*/ make$
|
|
1096
|
-
const del = /*#__PURE__*/ make$
|
|
1095
|
+
const post = /*#__PURE__*/ make$33("POST");
|
|
1096
|
+
const del = /*#__PURE__*/ make$33("DELETE");
|
|
1097
1097
|
/**
|
|
1098
1098
|
* Applies request options to an `HttpClientRequest`, returning a new request.
|
|
1099
1099
|
*
|
|
@@ -1295,7 +1295,7 @@ const bodyFormData = /*#__PURE__*/ dual(2, (self, body) => setBody$1(self, formD
|
|
|
1295
1295
|
* @since 4.0.0
|
|
1296
1296
|
*/
|
|
1297
1297
|
function toUrl(self) {
|
|
1298
|
-
const r = make$
|
|
1298
|
+
const r = make$34(self.url, self.urlParams, getOrUndefined(self.hash));
|
|
1299
1299
|
if (isSuccess(r)) return some$1(r.success);
|
|
1300
1300
|
return none();
|
|
1301
1301
|
}
|
|
@@ -1308,7 +1308,7 @@ function toUrl(self) {
|
|
|
1308
1308
|
* @category type IDs
|
|
1309
1309
|
* @since 4.0.0
|
|
1310
1310
|
*/
|
|
1311
|
-
const TypeId$
|
|
1311
|
+
const TypeId$17 = "~effect/http/HttpIncomingMessage";
|
|
1312
1312
|
/**
|
|
1313
1313
|
* Creates a decoder that reads an incoming message's JSON body and decodes it with the supplied schema.
|
|
1314
1314
|
*
|
|
@@ -1374,7 +1374,7 @@ const inspect = (self, that) => {
|
|
|
1374
1374
|
* @category type IDs
|
|
1375
1375
|
* @since 4.0.0
|
|
1376
1376
|
*/
|
|
1377
|
-
const TypeId$
|
|
1377
|
+
const TypeId$16 = "~effect/http/HttpClientResponse";
|
|
1378
1378
|
/**
|
|
1379
1379
|
* Wraps a Web `Response` and its original `HttpClientRequest` as an `HttpClientResponse`.
|
|
1380
1380
|
*
|
|
@@ -1412,16 +1412,16 @@ const filterStatusOk$1 = (self) => self.status >= 200 && self.status < 300 ? suc
|
|
|
1412
1412
|
description: "non 2xx status code"
|
|
1413
1413
|
}) }));
|
|
1414
1414
|
var WebHttpClientResponse = class extends Class {
|
|
1415
|
+
[TypeId$17];
|
|
1415
1416
|
[TypeId$16];
|
|
1416
|
-
[TypeId$15];
|
|
1417
1417
|
request;
|
|
1418
1418
|
source;
|
|
1419
1419
|
constructor(request, source) {
|
|
1420
1420
|
super();
|
|
1421
1421
|
this.request = request;
|
|
1422
1422
|
this.source = source;
|
|
1423
|
+
this[TypeId$17] = TypeId$17;
|
|
1423
1424
|
this[TypeId$16] = TypeId$16;
|
|
1424
|
-
this[TypeId$15] = TypeId$15;
|
|
1425
1425
|
}
|
|
1426
1426
|
toJSON() {
|
|
1427
1427
|
return inspect(this, {
|
|
@@ -1684,7 +1684,7 @@ const addHeaderAttributes = (span, phase, headers, filter, redactedNames) => {
|
|
|
1684
1684
|
};
|
|
1685
1685
|
//#endregion
|
|
1686
1686
|
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/HttpClient.js
|
|
1687
|
-
const TypeId$
|
|
1687
|
+
const TypeId$15 = "~effect/http/HttpClient";
|
|
1688
1688
|
/**
|
|
1689
1689
|
* Service tag for the default outgoing HTTP client service.
|
|
1690
1690
|
*
|
|
@@ -1735,7 +1735,7 @@ const filterStatusOk = /*#__PURE__*/ transformResponse(/*#__PURE__*/ flatMap(fil
|
|
|
1735
1735
|
* @since 4.0.0
|
|
1736
1736
|
*/
|
|
1737
1737
|
const makeWith = (postprocess, preprocess) => {
|
|
1738
|
-
const self = Object.create(Proto$
|
|
1738
|
+
const self = Object.create(Proto$9);
|
|
1739
1739
|
self.preprocess = preprocess;
|
|
1740
1740
|
self.postprocess = postprocess;
|
|
1741
1741
|
self.execute = function(request) {
|
|
@@ -1743,8 +1743,8 @@ const makeWith = (postprocess, preprocess) => {
|
|
|
1743
1743
|
};
|
|
1744
1744
|
return self;
|
|
1745
1745
|
};
|
|
1746
|
-
const Proto$
|
|
1747
|
-
[TypeId$
|
|
1746
|
+
const Proto$9 = {
|
|
1747
|
+
[TypeId$15]: TypeId$15,
|
|
1748
1748
|
pipe() {
|
|
1749
1749
|
return pipeArguments(this, arguments);
|
|
1750
1750
|
},
|
|
@@ -1753,7 +1753,7 @@ const Proto$8 = {
|
|
|
1753
1753
|
return { _id: "effect/HttpClient" };
|
|
1754
1754
|
},
|
|
1755
1755
|
.../*#__PURE__*/ Object.fromEntries(/*#__PURE__*/ allShort.map(([fullMethod, method]) => [method, function(url, options) {
|
|
1756
|
-
return this.execute(make$
|
|
1756
|
+
return this.execute(make$33(fullMethod)(url, options));
|
|
1757
1757
|
}]))
|
|
1758
1758
|
};
|
|
1759
1759
|
/**
|
|
@@ -1767,10 +1767,10 @@ const Proto$8 = {
|
|
|
1767
1767
|
* @category constructors
|
|
1768
1768
|
* @since 4.0.0
|
|
1769
1769
|
*/
|
|
1770
|
-
const make$
|
|
1770
|
+
const make$32 = (f) => makeWith((effect) => flatMap(effect, (request) => withFiber((fiber) => {
|
|
1771
1771
|
const scopedController = scopedRequests.get(request);
|
|
1772
1772
|
const controller = scopedController ?? new AbortController();
|
|
1773
|
-
const urlResult = make$
|
|
1773
|
+
const urlResult = make$34(request.url, request.urlParams, getOrUndefined(request.hash));
|
|
1774
1774
|
if (isFailure(urlResult)) return fail$1(new HttpClientError({ reason: new InvalidUrlError({
|
|
1775
1775
|
request,
|
|
1776
1776
|
cause: urlResult.failure
|
|
@@ -1997,8 +1997,8 @@ var InterruptibleResponse = class {
|
|
|
1997
1997
|
this.original = original;
|
|
1998
1998
|
this.controller = controller;
|
|
1999
1999
|
}
|
|
2000
|
-
[TypeId$15] = TypeId$15;
|
|
2001
2000
|
[TypeId$16] = TypeId$16;
|
|
2001
|
+
[TypeId$17] = TypeId$17;
|
|
2002
2002
|
applyInterrupt(effect) {
|
|
2003
2003
|
return suspend(() => {
|
|
2004
2004
|
responseRegistry.unregister(this.original);
|
|
@@ -2149,7 +2149,7 @@ const isCleanSingleTrailingParam = (path) => CLEAN_SINGLE_PARAM_REGEXP.test(path
|
|
|
2149
2149
|
/**
|
|
2150
2150
|
* @internal
|
|
2151
2151
|
*/
|
|
2152
|
-
const make$
|
|
2152
|
+
const make$31 = (options = {}) => new RouterImpl(options);
|
|
2153
2153
|
var RouterImpl = class {
|
|
2154
2154
|
constructor(options = {}) {
|
|
2155
2155
|
this.options = {
|
|
@@ -2768,7 +2768,7 @@ const httpMethods = [
|
|
|
2768
2768
|
* @category constructors
|
|
2769
2769
|
* @since 4.0.0
|
|
2770
2770
|
*/
|
|
2771
|
-
const make$
|
|
2771
|
+
const make$30 = make$31;
|
|
2772
2772
|
//#endregion
|
|
2773
2773
|
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/Etag.js
|
|
2774
2774
|
/**
|
|
@@ -2910,14 +2910,14 @@ const layerWeak = /*#__PURE__*/ succeed$2(Generator)({
|
|
|
2910
2910
|
const ignore = "~effect/ErrorReporter/ignore";
|
|
2911
2911
|
//#endregion
|
|
2912
2912
|
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/internal/headers.js
|
|
2913
|
-
const Proto$
|
|
2913
|
+
const Proto$8 = /*#__PURE__*/ Object.getPrototypeOf(empty$8);
|
|
2914
2914
|
/**
|
|
2915
2915
|
* @internal
|
|
2916
2916
|
*/
|
|
2917
|
-
const emptyMutableUnsafe = () => Object.create(Proto$
|
|
2917
|
+
const emptyMutableUnsafe = () => Object.create(Proto$8);
|
|
2918
2918
|
//#endregion
|
|
2919
2919
|
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/HttpServerResponse.js
|
|
2920
|
-
const TypeId$
|
|
2920
|
+
const TypeId$14 = "~effect/http/HttpServerResponse";
|
|
2921
2921
|
/**
|
|
2922
2922
|
* Returns `true` when the supplied value is an `HttpServerResponse`.
|
|
2923
2923
|
*
|
|
@@ -2925,7 +2925,7 @@ const TypeId$13 = "~effect/http/HttpServerResponse";
|
|
|
2925
2925
|
* @category guards
|
|
2926
2926
|
* @since 4.0.0
|
|
2927
2927
|
*/
|
|
2928
|
-
const isHttpServerResponse = (u) => hasProperty(u, TypeId$
|
|
2928
|
+
const isHttpServerResponse = (u) => hasProperty(u, TypeId$14);
|
|
2929
2929
|
/**
|
|
2930
2930
|
* Creates an empty HTTP response.
|
|
2931
2931
|
*
|
|
@@ -3150,9 +3150,9 @@ const setBody = /*#__PURE__*/ dual(2, (self, body) => makeResponse$1({
|
|
|
3150
3150
|
...self,
|
|
3151
3151
|
body
|
|
3152
3152
|
}, updateHeaders(self.headers, body)));
|
|
3153
|
-
const Proto$
|
|
3153
|
+
const Proto$7 = {
|
|
3154
3154
|
...PipeInspectableProto,
|
|
3155
|
-
[TypeId$
|
|
3155
|
+
[TypeId$14]: TypeId$14,
|
|
3156
3156
|
[ignore]: true,
|
|
3157
3157
|
toJSON() {
|
|
3158
3158
|
return {
|
|
@@ -3166,7 +3166,7 @@ const Proto$6 = {
|
|
|
3166
3166
|
}
|
|
3167
3167
|
};
|
|
3168
3168
|
const makeResponse$1 = (options, ownedHeaders) => {
|
|
3169
|
-
const self = Object.create(Proto$
|
|
3169
|
+
const self = Object.create(Proto$7);
|
|
3170
3170
|
self.status = options.status;
|
|
3171
3171
|
self.statusText = options.statusText;
|
|
3172
3172
|
self.cookies = options.cookies ?? empty$9;
|
|
@@ -3784,7 +3784,7 @@ var HttpPlatform = class extends (/*#__PURE__*/ Service()("effect/http/HttpPlatf
|
|
|
3784
3784
|
* @category constructors
|
|
3785
3785
|
* @since 4.0.0
|
|
3786
3786
|
*/
|
|
3787
|
-
const make$
|
|
3787
|
+
const make$29 = /*#__PURE__*/ fnUntraced(function* (impl) {
|
|
3788
3788
|
const fs = yield* FileSystem;
|
|
3789
3789
|
const etagGen = yield* Generator;
|
|
3790
3790
|
return HttpPlatform.of({
|
|
@@ -3936,7 +3936,7 @@ const toResponseOrElseDefect = (u, orElse) => {
|
|
|
3936
3936
|
* @stability unstable
|
|
3937
3937
|
* @since 4.0.0
|
|
3938
3938
|
*/
|
|
3939
|
-
const TypeId$
|
|
3939
|
+
const TypeId$13 = "~effect/http/HttpServerError";
|
|
3940
3940
|
/**
|
|
3941
3941
|
* Tagged error for failures that occur while handling an HTTP server request.
|
|
3942
3942
|
*
|
|
@@ -3958,7 +3958,7 @@ var HttpServerError = class extends (/*#__PURE__*/ TaggedError("HttpServerError"
|
|
|
3958
3958
|
});
|
|
3959
3959
|
else super(props);
|
|
3960
3960
|
}
|
|
3961
|
-
[TypeId$
|
|
3961
|
+
[TypeId$13] = TypeId$13;
|
|
3962
3962
|
stack = `${this.name}: ${this.message}`;
|
|
3963
3963
|
get request() {
|
|
3964
3964
|
return this.reason.request;
|
|
@@ -4272,7 +4272,7 @@ const constValueChars = /*#__PURE__*/ new Uint8Array(256);
|
|
|
4272
4272
|
constValueChars[9] = 1;
|
|
4273
4273
|
for (let i = 32; i <= 126; i++) constValueChars[i] = 1;
|
|
4274
4274
|
for (let i = 128; i <= 255; i++) constValueChars[i] = 1;
|
|
4275
|
-
function make$
|
|
4275
|
+
function make$28() {
|
|
4276
4276
|
const decoder = new TextDecoder();
|
|
4277
4277
|
const state = {
|
|
4278
4278
|
state: State$4.key,
|
|
@@ -4449,7 +4449,7 @@ function makeState(needle_) {
|
|
|
4449
4449
|
matchIndex: 0
|
|
4450
4450
|
};
|
|
4451
4451
|
}
|
|
4452
|
-
function make$
|
|
4452
|
+
function make$27(needle, callback, seed, minimumChunkLength) {
|
|
4453
4453
|
const state = makeState(needle);
|
|
4454
4454
|
const minChunkLength = minimumChunkLength ?? state.needleLength;
|
|
4455
4455
|
if (seed !== void 0) {
|
|
@@ -4561,7 +4561,7 @@ function parseBoundary(headers) {
|
|
|
4561
4561
|
}
|
|
4562
4562
|
function noopOnChunk(_chunk) {}
|
|
4563
4563
|
const toLimit = (input) => input === Infinity ? Infinity : Number(fromInputUnsafe(input));
|
|
4564
|
-
function make$
|
|
4564
|
+
function make$26({ headers, onFile: onPart, onField, onError, onDone, isFile = defaultIsFile$1, maxParts = Infinity, maxTotalSize: maxTotalSizeInput = Infinity, maxPartSize: maxPartSizeInput = Infinity, maxFieldSize: maxFieldSizeInput = 1048576 }) {
|
|
4565
4565
|
const maxTotalSize = toLimit(maxTotalSizeInput);
|
|
4566
4566
|
const maxPartSize = toLimit(maxPartSizeInput);
|
|
4567
4567
|
const maxFieldSize = toLimit(maxFieldSizeInput);
|
|
@@ -4598,8 +4598,8 @@ function make$25({ headers, onFile: onPart, onField, onError, onDone, isFile = d
|
|
|
4598
4598
|
if (state.state === State$3.body && state.isFile) state.onChunk(null);
|
|
4599
4599
|
onError(error);
|
|
4600
4600
|
}
|
|
4601
|
-
const headerParser = make$
|
|
4602
|
-
const split = make$
|
|
4601
|
+
const headerParser = make$28();
|
|
4602
|
+
const split = make$27(`\r\n--${boundary}`, function(index, chunk) {
|
|
4603
4603
|
if (state.stopped) return;
|
|
4604
4604
|
if (index === 0) {
|
|
4605
4605
|
skipBody();
|
|
@@ -4731,7 +4731,7 @@ function decodeField$1(info, value) {
|
|
|
4731
4731
|
* @category constructors
|
|
4732
4732
|
* @since 4.0.0
|
|
4733
4733
|
*/
|
|
4734
|
-
const make$
|
|
4734
|
+
const make$25 = make$26;
|
|
4735
4735
|
/**
|
|
4736
4736
|
* Determines whether a multipart part should be treated as a file.
|
|
4737
4737
|
*
|
|
@@ -4770,7 +4770,7 @@ const decodeField = decodeField$1;
|
|
|
4770
4770
|
* @category type IDs
|
|
4771
4771
|
* @since 4.0.0
|
|
4772
4772
|
*/
|
|
4773
|
-
const TypeId$
|
|
4773
|
+
const TypeId$12 = "~effect/http/Multipart";
|
|
4774
4774
|
const MultipartErrorTypeId = "~effect/http/Multipart/MultipartError";
|
|
4775
4775
|
const toMultipartError = (cause) => isMultipartError(cause) ? cause : MultipartError.fromReason("InternalError", cause);
|
|
4776
4776
|
/**
|
|
@@ -4885,10 +4885,10 @@ const makeConfig = (headers) => withFiber((fiber) => {
|
|
|
4885
4885
|
});
|
|
4886
4886
|
});
|
|
4887
4887
|
var PartBase$1 = class extends Class {
|
|
4888
|
-
[TypeId$
|
|
4888
|
+
[TypeId$12];
|
|
4889
4889
|
constructor() {
|
|
4890
4890
|
super();
|
|
4891
|
-
this[TypeId$
|
|
4891
|
+
this[TypeId$12] = TypeId$12;
|
|
4892
4892
|
}
|
|
4893
4893
|
};
|
|
4894
4894
|
const defaultWriteFile = (path, file) => flatMap(FileSystem, (fs) => mapError(run$3(file.content, fs.sink(path)), toMultipartError));
|
|
@@ -5029,7 +5029,7 @@ const FieldMimeTypes = /*#__PURE__*/ Reference("effect/http/Multipart/FieldMimeT
|
|
|
5029
5029
|
* @category type IDs
|
|
5030
5030
|
* @since 4.0.0
|
|
5031
5031
|
*/
|
|
5032
|
-
const TypeId$
|
|
5032
|
+
const TypeId$11 = "~effect/http/HttpServerRequest";
|
|
5033
5033
|
/**
|
|
5034
5034
|
* Service tag for the active server-side HTTP request.
|
|
5035
5035
|
*
|
|
@@ -5125,7 +5125,7 @@ const requestPreResponseHandlers = /*#__PURE__*/ new WeakMap();
|
|
|
5125
5125
|
* @category constructors
|
|
5126
5126
|
* @since 4.0.0
|
|
5127
5127
|
*/
|
|
5128
|
-
const make$
|
|
5128
|
+
const make$24 = (middleware) => middleware;
|
|
5129
5129
|
const loggerDisabledRequests = /*#__PURE__*/ new WeakSet();
|
|
5130
5130
|
const stripSearchAndHash = (url) => {
|
|
5131
5131
|
const queryIndex = url.indexOf("?");
|
|
@@ -5142,7 +5142,7 @@ const stripSearchAndHash = (url) => {
|
|
|
5142
5142
|
* @since 4.0.0
|
|
5143
5143
|
*/
|
|
5144
5144
|
const withLoggerDisabled = (self) => withFiber((fiber) => {
|
|
5145
|
-
const request = getUnsafe(fiber.context, HttpServerRequest);
|
|
5145
|
+
const request = getUnsafe$1(fiber.context, HttpServerRequest);
|
|
5146
5146
|
loggerDisabledRequests.add(request.source);
|
|
5147
5147
|
return self;
|
|
5148
5148
|
});
|
|
@@ -5186,8 +5186,8 @@ const TracerHeaderFilter = /*#__PURE__*/ Reference("effect/http/HttpMiddleware/T
|
|
|
5186
5186
|
* @category logging
|
|
5187
5187
|
* @since 4.0.0
|
|
5188
5188
|
*/
|
|
5189
|
-
const logger$1 = /*#__PURE__*/ make$
|
|
5190
|
-
const request = getUnsafe(fiber.context, HttpServerRequest);
|
|
5189
|
+
const logger$1 = /*#__PURE__*/ make$24((httpApp) => withFiber((fiber) => {
|
|
5190
|
+
const request = getUnsafe$1(fiber.context, HttpServerRequest);
|
|
5191
5191
|
const path = stripSearchAndHash(request.url);
|
|
5192
5192
|
return withLogSpan(flatMap(exit(httpApp), (exit) => {
|
|
5193
5193
|
if (loggerDisabledRequests.has(request.source)) return exit;
|
|
@@ -5231,8 +5231,8 @@ const responseSpanExit = (request, response) => {
|
|
|
5231
5231
|
* @category tracing
|
|
5232
5232
|
* @since 4.0.0
|
|
5233
5233
|
*/
|
|
5234
|
-
const tracer = /*#__PURE__*/ make$
|
|
5235
|
-
const request = getUnsafe(fiber.context, HttpServerRequest);
|
|
5234
|
+
const tracer = /*#__PURE__*/ make$24((httpApp) => withFiber((fiber) => {
|
|
5235
|
+
const request = getUnsafe$1(fiber.context, HttpServerRequest);
|
|
5236
5236
|
if (isTracerDisabledUnsafe(fiber, request)) return httpApp;
|
|
5237
5237
|
const nameGenerator = fiber.getRef(SpanNameGenerator);
|
|
5238
5238
|
const span = makeSpanUnsafe(fiber, nameGenerator(request), {
|
|
@@ -5373,8 +5373,8 @@ const toHandled = (self, handleResponse, middleware) => {
|
|
|
5373
5373
|
}
|
|
5374
5374
|
return withFiber((fiber) => {
|
|
5375
5375
|
fiberEnterUninterruptibleUnsafe(fiber);
|
|
5376
|
-
const scope = makeUnsafe$
|
|
5377
|
-
const frame = new RequestFrame(scope, fiber.context, getUnsafe(fiber.context, HttpServerRequest));
|
|
5376
|
+
const scope = makeUnsafe$4();
|
|
5377
|
+
const frame = new RequestFrame(scope, fiber.context, getUnsafe$1(fiber.context, HttpServerRequest));
|
|
5378
5378
|
fiber.setContext(add$1(frame.prev, Scope, scope));
|
|
5379
5379
|
const currentTracer = fiber.cache.tracer;
|
|
5380
5380
|
if (middleware === void 0 && (currentTracer === void 0 || currentTracer === nativeTracer || isTracerDisabledUnsafe(fiber, frame.request))) {
|
|
@@ -5421,7 +5421,7 @@ var HttpServer = class extends (/*#__PURE__*/ Service()("effect/http/HttpServer"
|
|
|
5421
5421
|
* @category constructors
|
|
5422
5422
|
* @since 4.0.0
|
|
5423
5423
|
*/
|
|
5424
|
-
const make$
|
|
5424
|
+
const make$23 = (options) => options;
|
|
5425
5425
|
/**
|
|
5426
5426
|
* Creates a layer that starts serving an HTTP response effect with the current
|
|
5427
5427
|
* `HttpServer`.
|
|
@@ -5489,7 +5489,7 @@ const withLogAddress = (layer) => effectDiscard(logAddress).pipe(provideMerge(la
|
|
|
5489
5489
|
* @stability unstable
|
|
5490
5490
|
* @since 4.0.0
|
|
5491
5491
|
*/
|
|
5492
|
-
const TypeId$
|
|
5492
|
+
const TypeId$10 = "~effect/http/HttpRouter";
|
|
5493
5493
|
/**
|
|
5494
5494
|
* Service tag for the HTTP router used while constructing an HTTP application.
|
|
5495
5495
|
* Route and middleware layers require this service to register themselves with
|
|
@@ -5512,10 +5512,10 @@ const HttpRouter = /*#__PURE__*/ Service("effect/http/HttpRouter");
|
|
|
5512
5512
|
* @category constructors
|
|
5513
5513
|
* @since 4.0.0
|
|
5514
5514
|
*/
|
|
5515
|
-
const make$
|
|
5515
|
+
const make$22 = /*#__PURE__*/ gen(function* () {
|
|
5516
5516
|
const config = yield* RouterConfig;
|
|
5517
5517
|
const ignoreDuplicateSlashes = config.ignoreDuplicateSlashes ?? true;
|
|
5518
|
-
const router = make$
|
|
5518
|
+
const router = make$30(config);
|
|
5519
5519
|
const middleware = /* @__PURE__ */ new Set();
|
|
5520
5520
|
const addAll = (routes) => contextWith((context) => {
|
|
5521
5521
|
const middleware = getMiddleware(context);
|
|
@@ -5545,7 +5545,7 @@ const make$21 = /*#__PURE__*/ gen(function* () {
|
|
|
5545
5545
|
return void_;
|
|
5546
5546
|
});
|
|
5547
5547
|
return HttpRouter.of({
|
|
5548
|
-
[TypeId$
|
|
5548
|
+
[TypeId$10]: TypeId$10,
|
|
5549
5549
|
prefixed(prefix) {
|
|
5550
5550
|
prefix = removeTrailingSlash(prefix);
|
|
5551
5551
|
return HttpRouter.of({
|
|
@@ -5569,7 +5569,7 @@ const make$21 = /*#__PURE__*/ gen(function* () {
|
|
|
5569
5569
|
asHttpEffect() {
|
|
5570
5570
|
let handler = withFiber((fiber) => {
|
|
5571
5571
|
let context = fiber.context;
|
|
5572
|
-
const request = getUnsafe(context, HttpServerRequest);
|
|
5572
|
+
const request = getUnsafe$1(context, HttpServerRequest);
|
|
5573
5573
|
let result = router.find(request.method, request.url);
|
|
5574
5574
|
if (result === void 0 && request.method === "HEAD") result = router.find("GET", request.url);
|
|
5575
5575
|
if (result === void 0) return fail$1(new HttpServerError({ reason: new RouteNotFound({ request }) }));
|
|
@@ -5664,7 +5664,7 @@ var RouteContext = class extends (/*#__PURE__*/ Service()("effect/http/HttpRoute
|
|
|
5664
5664
|
* @category getters
|
|
5665
5665
|
* @since 4.0.0
|
|
5666
5666
|
*/
|
|
5667
|
-
const params = /*#__PURE__*/ withFiberSucceed((fiber) => getUnsafe(fiber.context, RouteContext).params);
|
|
5667
|
+
const params = /*#__PURE__*/ withFiberSucceed((fiber) => getUnsafe$1(fiber.context, RouteContext).params);
|
|
5668
5668
|
/**
|
|
5669
5669
|
* Decodes a schema from the path parameters captured for the current matched
|
|
5670
5670
|
* route.
|
|
@@ -5722,7 +5722,7 @@ const use = (f) => effectDiscard(flatMap(HttpRouter, f));
|
|
|
5722
5722
|
* @category layers
|
|
5723
5723
|
* @since 4.0.0
|
|
5724
5724
|
*/
|
|
5725
|
-
const layer$8 = /*#__PURE__*/ effect(HttpRouter)(make$
|
|
5725
|
+
const layer$8 = /*#__PURE__*/ effect(HttpRouter)(make$22);
|
|
5726
5726
|
const RouteTypeId = "~effect/http/HttpRouter/Route";
|
|
5727
5727
|
const makeRoute = (options) => ({
|
|
5728
5728
|
...options,
|
|
@@ -5846,7 +5846,7 @@ const makeMiddleware = (middleware, options) => options?.global ? effectDiscard(
|
|
|
5846
5846
|
const router = yield* HttpRouter;
|
|
5847
5847
|
const fn = isEffect(middleware) ? yield* middleware : middleware;
|
|
5848
5848
|
yield* router.addGlobalMiddleware(fn);
|
|
5849
|
-
})) : new MiddlewareImpl(isEffect(middleware) ? effectContext(map$1(middleware, (fn) => makeUnsafe$
|
|
5849
|
+
})) : new MiddlewareImpl(isEffect(middleware) ? effectContext(map$1(middleware, (fn) => makeUnsafe$5(/* @__PURE__ */ new Map([[fnContextKey, fn]])))) : succeedContext(makeUnsafe$5(/* @__PURE__ */ new Map([[fnContextKey, middleware]]))));
|
|
5850
5850
|
let middlewareId = 0;
|
|
5851
5851
|
const fnContextKey = "effect/http/HttpRouter/MiddlewareFn";
|
|
5852
5852
|
var MiddlewareImpl = class MiddlewareImpl {
|
|
@@ -5866,7 +5866,7 @@ var MiddlewareImpl = class MiddlewareImpl {
|
|
|
5866
5866
|
const depsContext = yield* buildWithMemoMap(this.dependencies, memoMap, scope);
|
|
5867
5867
|
stack.push(...getMiddleware(depsContext));
|
|
5868
5868
|
}
|
|
5869
|
-
return makeUnsafe$
|
|
5869
|
+
return makeUnsafe$5(/* @__PURE__ */ new Map([[contextKey, stack]]));
|
|
5870
5870
|
})).pipe(provide$1(this.layerFn));
|
|
5871
5871
|
}
|
|
5872
5872
|
layer;
|
|
@@ -5936,7 +5936,7 @@ const serve = (appLayer, options) => {
|
|
|
5936
5936
|
* @stability stable
|
|
5937
5937
|
* @since 2.0.0
|
|
5938
5938
|
*/
|
|
5939
|
-
const TypeId$
|
|
5939
|
+
const TypeId$9 = "~effect/FiberSet";
|
|
5940
5940
|
/**
|
|
5941
5941
|
* Checks whether a value is a FiberSet.
|
|
5942
5942
|
*
|
|
@@ -5959,9 +5959,9 @@ const TypeId$8 = "~effect/FiberSet";
|
|
|
5959
5959
|
* @category guards
|
|
5960
5960
|
* @since 2.0.0
|
|
5961
5961
|
*/
|
|
5962
|
-
const isFiberSet = (u) => hasProperty(u, TypeId$
|
|
5963
|
-
const Proto$
|
|
5964
|
-
[TypeId$
|
|
5962
|
+
const isFiberSet = (u) => hasProperty(u, TypeId$9);
|
|
5963
|
+
const Proto$6 = {
|
|
5964
|
+
[TypeId$9]: TypeId$9,
|
|
5965
5965
|
[Symbol.iterator]() {
|
|
5966
5966
|
if (this.state._tag === "Closed") return empty$12();
|
|
5967
5967
|
return this.state.backing[Symbol.iterator]();
|
|
@@ -5974,8 +5974,8 @@ const Proto$5 = {
|
|
|
5974
5974
|
};
|
|
5975
5975
|
}
|
|
5976
5976
|
};
|
|
5977
|
-
const makeUnsafe$
|
|
5978
|
-
const self = Object.create(Proto$
|
|
5977
|
+
const makeUnsafe$2 = (backing, deferred) => {
|
|
5978
|
+
const self = Object.create(Proto$6);
|
|
5979
5979
|
self.state = {
|
|
5980
5980
|
_tag: "Open",
|
|
5981
5981
|
backing
|
|
@@ -6019,7 +6019,7 @@ const makeUnsafe$1 = (backing, deferred) => {
|
|
|
6019
6019
|
* @category constructors
|
|
6020
6020
|
* @since 2.0.0
|
|
6021
6021
|
*/
|
|
6022
|
-
const make$
|
|
6022
|
+
const make$21 = () => acquireRelease(sync(() => makeUnsafe$2(/* @__PURE__ */ new Set(), makeUnsafe$6())), (set) => suspend(() => {
|
|
6023
6023
|
const state = set.state;
|
|
6024
6024
|
if (state._tag === "Closed") return void_;
|
|
6025
6025
|
set.state = { _tag: "Closed" };
|
|
@@ -6292,10 +6292,10 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
|
|
|
6292
6292
|
const services = yield* context();
|
|
6293
6293
|
const scope = get$6(services, Scope);
|
|
6294
6294
|
const trackFiber = runIn(forkUnsafe$1(scope, "parallel"));
|
|
6295
|
-
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$
|
|
6295
|
+
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$37(concurrency);
|
|
6296
6296
|
const clients = /* @__PURE__ */ new Map();
|
|
6297
6297
|
let isShutdown = false;
|
|
6298
|
-
const shutdownLatch = makeUnsafe$
|
|
6298
|
+
const shutdownLatch = makeUnsafe$7(false);
|
|
6299
6299
|
yield* addFinalizer(scope, withFiber((parent) => {
|
|
6300
6300
|
isShutdown = true;
|
|
6301
6301
|
for (const client of clients.values()) {
|
|
@@ -6397,7 +6397,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
|
|
|
6397
6397
|
}) : streamOrEffect;
|
|
6398
6398
|
const withMiddleware = rpc.middlewares.size === 0 ? handler : isStream ? flatMap(exit(applyMiddleware(services, handler, metadata)), (exit) => writeFailure ? failCause(writeFailure) : exit) : applyMiddleware(services, handler, metadata);
|
|
6399
6399
|
let responded = false;
|
|
6400
|
-
const scope = makeUnsafe$
|
|
6400
|
+
const scope = makeUnsafe$4();
|
|
6401
6401
|
let deferred = void 0;
|
|
6402
6402
|
let effect = onExit(withMiddleware, (exit) => {
|
|
6403
6403
|
responded = true;
|
|
@@ -6487,7 +6487,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
|
|
|
6487
6487
|
client.latches ??= /* @__PURE__ */ new Map();
|
|
6488
6488
|
latch = client.latches.get(request.id);
|
|
6489
6489
|
if (!latch) {
|
|
6490
|
-
latch = makeUnsafe$
|
|
6490
|
+
latch = makeUnsafe$7(false);
|
|
6491
6491
|
client.latches.set(request.id, latch);
|
|
6492
6492
|
}
|
|
6493
6493
|
}
|
|
@@ -6560,7 +6560,7 @@ const handlerContext = (entry, fiberContext) => {
|
|
|
6560
6560
|
return merged;
|
|
6561
6561
|
};
|
|
6562
6562
|
const applyMiddleware = (context, handler, options) => {
|
|
6563
|
-
for (const service of options.rpc.middlewares) handler = getUnsafe(context, service)(handler, options);
|
|
6563
|
+
for (const service of options.rpc.middlewares) handler = getUnsafe$1(context, service)(handler, options);
|
|
6564
6564
|
return handler;
|
|
6565
6565
|
};
|
|
6566
6566
|
/**
|
|
@@ -6572,11 +6572,11 @@ const applyMiddleware = (context, handler, options) => {
|
|
|
6572
6572
|
* @category running
|
|
6573
6573
|
* @since 4.0.0
|
|
6574
6574
|
*/
|
|
6575
|
-
const make$
|
|
6575
|
+
const make$20 = /*#__PURE__*/ fnUntraced(function* (group, options) {
|
|
6576
6576
|
const { codecFor, disconnects, end, run, send, supportsAck, supportsSpanPropagation, supportsTransferables } = yield* Protocol;
|
|
6577
6577
|
const { encodeDefectUnsafe, encodeUnknownRequestExit } = defectCodecs(codecFor);
|
|
6578
6578
|
const services = yield* context();
|
|
6579
|
-
const scope = yield* make$
|
|
6579
|
+
const scope = yield* make$38();
|
|
6580
6580
|
const server = yield* makeNoSerialization(group, {
|
|
6581
6581
|
...options,
|
|
6582
6582
|
disableClientAcks: !supportsAck,
|
|
@@ -6719,7 +6719,7 @@ const make$19 = /*#__PURE__*/ fnUntraced(function* (group, options) {
|
|
|
6719
6719
|
* @category layers
|
|
6720
6720
|
* @since 4.0.0
|
|
6721
6721
|
*/
|
|
6722
|
-
const layer$7 = (group, options) => effectDiscard(forkScoped(make$
|
|
6722
|
+
const layer$7 = (group, options) => effectDiscard(forkScoped(make$20(group, options)));
|
|
6723
6723
|
/**
|
|
6724
6724
|
* Creates a RPC server that registers a HTTP route with a `HttpRouter`.
|
|
6725
6725
|
*
|
|
@@ -6813,7 +6813,7 @@ const makeProtocolWithHttpEffect = /*#__PURE__*/ fnUntraced(function* (options =
|
|
|
6813
6813
|
const { encodeDefectUnsafe } = defectCodecs(serialization.codecFor);
|
|
6814
6814
|
const includesFraming = serialization.includesFraming;
|
|
6815
6815
|
const isBinary = !serialization.contentType.includes("json");
|
|
6816
|
-
const disconnects = yield* make$
|
|
6816
|
+
const disconnects = yield* make$39();
|
|
6817
6817
|
let writeRequest;
|
|
6818
6818
|
let clientId = 0;
|
|
6819
6819
|
const clients = /* @__PURE__ */ new Map();
|
|
@@ -6821,12 +6821,12 @@ const makeProtocolWithHttpEffect = /*#__PURE__*/ fnUntraced(function* (options =
|
|
|
6821
6821
|
const encoder = new TextEncoder();
|
|
6822
6822
|
const httpEffect = gen(function* () {
|
|
6823
6823
|
const fiber = getCurrent();
|
|
6824
|
-
const request = getUnsafe(fiber.context, HttpServerRequest);
|
|
6825
|
-
const scope = getUnsafe(fiber.context, Scope);
|
|
6824
|
+
const request = getUnsafe$1(fiber.context, HttpServerRequest);
|
|
6825
|
+
const scope = getUnsafe$1(fiber.context, Scope);
|
|
6826
6826
|
const requestHeaders = Object.entries(request.headers);
|
|
6827
6827
|
const data = yield* orDie(isBinary ? map$1(request.arrayBuffer, (buf) => new Uint8Array(buf)) : request.text);
|
|
6828
6828
|
const id = clientId++;
|
|
6829
|
-
const queue = yield* make$
|
|
6829
|
+
const queue = yield* make$39({ capacity: includesFraming && options.streamBufferSize !== "unbounded" ? options.streamBufferSize ?? 16 : void 0 });
|
|
6830
6830
|
const parser = serialization.makeUnsafe();
|
|
6831
6831
|
const requestIds = [];
|
|
6832
6832
|
const offer$1 = (data) => typeof data === "string" ? offer(queue, encoder.encode(data)) : offer(queue, data);
|
|
@@ -6943,7 +6943,7 @@ const layerProtocolHttp = (options) => {
|
|
|
6943
6943
|
const makeSocketProtocol = /*#__PURE__*/ gen(function* () {
|
|
6944
6944
|
const serialization = yield* RpcSerialization;
|
|
6945
6945
|
const { encodeDefectUnsafe } = defectCodecs(serialization.codecFor);
|
|
6946
|
-
const disconnects = yield* make$
|
|
6946
|
+
const disconnects = yield* make$39();
|
|
6947
6947
|
let clientId = 0;
|
|
6948
6948
|
const clients = /* @__PURE__ */ new Map();
|
|
6949
6949
|
const clientIds = /* @__PURE__ */ new Set();
|
|
@@ -7035,7 +7035,7 @@ const makeSocketProtocol = /*#__PURE__*/ gen(function* () {
|
|
|
7035
7035
|
* @stability stable
|
|
7036
7036
|
* @since 2.0.0
|
|
7037
7037
|
*/
|
|
7038
|
-
const TypeId$
|
|
7038
|
+
const TypeId$8 = "~effect/FiberMap";
|
|
7039
7039
|
/**
|
|
7040
7040
|
* Returns `true` if a value is a `FiberMap`.
|
|
7041
7041
|
*
|
|
@@ -7062,9 +7062,9 @@ const TypeId$7 = "~effect/FiberMap";
|
|
|
7062
7062
|
* @category guards
|
|
7063
7063
|
* @since 2.0.0
|
|
7064
7064
|
*/
|
|
7065
|
-
const isFiberMap = (u) => hasProperty(u, TypeId$
|
|
7066
|
-
const Proto$
|
|
7067
|
-
[TypeId$
|
|
7065
|
+
const isFiberMap = (u) => hasProperty(u, TypeId$8);
|
|
7066
|
+
const Proto$5 = {
|
|
7067
|
+
[TypeId$8]: TypeId$8,
|
|
7068
7068
|
[Symbol.iterator]() {
|
|
7069
7069
|
if (this.state._tag === "Closed") return empty$12();
|
|
7070
7070
|
return this.state.backing[Symbol.iterator]();
|
|
@@ -7077,8 +7077,8 @@ const Proto$4 = {
|
|
|
7077
7077
|
};
|
|
7078
7078
|
}
|
|
7079
7079
|
};
|
|
7080
|
-
const makeUnsafe = (backing, deferred) => {
|
|
7081
|
-
const self = Object.create(Proto$
|
|
7080
|
+
const makeUnsafe$1 = (backing, deferred) => {
|
|
7081
|
+
const self = Object.create(Proto$5);
|
|
7082
7082
|
self.state = {
|
|
7083
7083
|
_tag: "Open",
|
|
7084
7084
|
backing
|
|
@@ -7122,7 +7122,7 @@ const makeUnsafe = (backing, deferred) => {
|
|
|
7122
7122
|
* @category constructors
|
|
7123
7123
|
* @since 2.0.0
|
|
7124
7124
|
*/
|
|
7125
|
-
const make$
|
|
7125
|
+
const make$19 = () => acquireRelease(sync(() => makeUnsafe$1(empty$6(), makeUnsafe$6())), (map) => suspend(() => {
|
|
7126
7126
|
const state = map.state;
|
|
7127
7127
|
if (state._tag === "Closed") return void_;
|
|
7128
7128
|
map.state = { _tag: "Closed" };
|
|
@@ -10949,13 +10949,13 @@ var NodeHttpIncomingMessage = class extends Class {
|
|
|
10949
10949
|
*
|
|
10950
10950
|
* @since 4.0.0
|
|
10951
10951
|
*/
|
|
10952
|
-
[TypeId$
|
|
10952
|
+
[TypeId$17];
|
|
10953
10953
|
source;
|
|
10954
10954
|
onError;
|
|
10955
10955
|
remoteAddressOverride;
|
|
10956
10956
|
constructor(source, onError, remoteAddressOverride) {
|
|
10957
10957
|
super();
|
|
10958
|
-
this[TypeId$
|
|
10958
|
+
this[TypeId$17] = TypeId$17;
|
|
10959
10959
|
this.source = source;
|
|
10960
10960
|
this.onError = onError;
|
|
10961
10961
|
this.remoteAddressOverride = remoteAddressOverride;
|
|
@@ -11082,7 +11082,7 @@ var RequestInit = class extends (/*#__PURE__*/ Service()("effect/http/FetchHttpC
|
|
|
11082
11082
|
* @category layers
|
|
11083
11083
|
* @since 4.0.0
|
|
11084
11084
|
*/
|
|
11085
|
-
const layer$6 = /*#__PURE__*/ layerMergedContext(/*#__PURE__*/ succeed$1(/* @__PURE__ */ make$
|
|
11085
|
+
const layer$6 = /*#__PURE__*/ layerMergedContext(/*#__PURE__*/ succeed$1(/* @__PURE__ */ make$32((request, url, signal, fiber) => {
|
|
11086
11086
|
const fetch = fiber.getRef(Fetch);
|
|
11087
11087
|
const options = getOrUndefined$1(fiber.context, RequestInit) ?? {};
|
|
11088
11088
|
let headers = options.headers ? merge$2(fromInput$1(options.headers), request.headers) : request.headers;
|
|
@@ -11150,7 +11150,7 @@ const layerAgentOptions = /*#__PURE__*/ flow(makeAgent, /*#__PURE__*/ effect(Htt
|
|
|
11150
11150
|
*/
|
|
11151
11151
|
const makeNodeHttp = /*#__PURE__*/ gen(function* () {
|
|
11152
11152
|
const agent = yield* HttpAgent;
|
|
11153
|
-
return make$
|
|
11153
|
+
return make$32((request, url, signal) => {
|
|
11154
11154
|
const nodeRequest = url.protocol === "https:" ? Https.request(url, {
|
|
11155
11155
|
agent: agent.https,
|
|
11156
11156
|
method: request.method,
|
|
@@ -11238,7 +11238,7 @@ const waitForFinish = (nodeRequest, request) => callback((resume) => {
|
|
|
11238
11238
|
});
|
|
11239
11239
|
});
|
|
11240
11240
|
var NodeHttpResponse = class extends NodeHttpIncomingMessage {
|
|
11241
|
-
[TypeId$
|
|
11241
|
+
[TypeId$16];
|
|
11242
11242
|
request;
|
|
11243
11243
|
url;
|
|
11244
11244
|
constructor(request, source, url) {
|
|
@@ -11247,7 +11247,7 @@ var NodeHttpResponse = class extends NodeHttpIncomingMessage {
|
|
|
11247
11247
|
response: this,
|
|
11248
11248
|
cause
|
|
11249
11249
|
}) }));
|
|
11250
|
-
this[TypeId$
|
|
11250
|
+
this[TypeId$16] = TypeId$16;
|
|
11251
11251
|
this.request = request;
|
|
11252
11252
|
this.url = url;
|
|
11253
11253
|
}
|
|
@@ -11358,7 +11358,7 @@ const compress = (data, algorithm, options) => callback((resume) => {
|
|
|
11358
11358
|
* @category constructors
|
|
11359
11359
|
* @since 4.0.0
|
|
11360
11360
|
*/
|
|
11361
|
-
const make$
|
|
11361
|
+
const make$18 = (fallback) => ({
|
|
11362
11362
|
algorithms: fallback.algorithms,
|
|
11363
11363
|
compressResponse(response, algorithm, options) {
|
|
11364
11364
|
const body = response.body;
|
|
@@ -11445,9 +11445,9 @@ const compressedBody = (response, body) => removeHeader(setBody(response, body),
|
|
|
11445
11445
|
* @category constructors
|
|
11446
11446
|
* @since 4.0.0
|
|
11447
11447
|
*/
|
|
11448
|
-
const make$
|
|
11448
|
+
const make$17 = /*#__PURE__*/ make$29({
|
|
11449
11449
|
platform: "node",
|
|
11450
|
-
compression: /* @__PURE__ */ make$
|
|
11450
|
+
compression: /* @__PURE__ */ make$18({
|
|
11451
11451
|
algorithms,
|
|
11452
11452
|
compressResponse(response, algorithm, options) {
|
|
11453
11453
|
const body = response.body;
|
|
@@ -11502,7 +11502,7 @@ const make$16 = /*#__PURE__*/ make$28({
|
|
|
11502
11502
|
* @category layers
|
|
11503
11503
|
* @since 4.0.0
|
|
11504
11504
|
*/
|
|
11505
|
-
const layer$5 = /*#__PURE__*/ pipe(/*#__PURE__*/ effect(HttpPlatform)(make$
|
|
11505
|
+
const layer$5 = /*#__PURE__*/ pipe(/*#__PURE__*/ effect(HttpPlatform)(make$17), /*#__PURE__*/ provide$1(layer$10), /*#__PURE__*/ provide$1(layer$9));
|
|
11506
11506
|
//#endregion
|
|
11507
11507
|
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.5_effect@4.0.5_redis@6.3.0_@opentelemetry+api@1.9.1_/node_modules/@effect/platform-node/dist/NodeMultipartParser.js
|
|
11508
11508
|
/**
|
|
@@ -11520,7 +11520,7 @@ var MultipartStream = class extends Duplex {
|
|
|
11520
11520
|
super({ readableObjectMode: true });
|
|
11521
11521
|
let currentError;
|
|
11522
11522
|
let currentFile;
|
|
11523
|
-
this._parser = make$
|
|
11523
|
+
this._parser = make$25({
|
|
11524
11524
|
...config,
|
|
11525
11525
|
onField: (info, value) => {
|
|
11526
11526
|
if (currentError !== void 0) return;
|
|
@@ -11583,7 +11583,7 @@ var MultipartStream = class extends Duplex {
|
|
|
11583
11583
|
* @category constructors
|
|
11584
11584
|
* @since 4.0.0
|
|
11585
11585
|
*/
|
|
11586
|
-
const make$
|
|
11586
|
+
const make$16 = (config) => new MultipartStream(config);
|
|
11587
11587
|
/**
|
|
11588
11588
|
* A readable stream containing a parsed multipart file.
|
|
11589
11589
|
*
|
|
@@ -11632,7 +11632,7 @@ var FileStream = class extends Readable {
|
|
|
11632
11632
|
*/
|
|
11633
11633
|
const stream = (source, headers) => makeConfig(headers).pipe(map$1((config) => fromReadable({
|
|
11634
11634
|
evaluate() {
|
|
11635
|
-
const parser = make$
|
|
11635
|
+
const parser = make$16(config);
|
|
11636
11636
|
source.pipe(parser);
|
|
11637
11637
|
return parser;
|
|
11638
11638
|
},
|
|
@@ -11652,10 +11652,10 @@ const persisted = (source, headers) => toPersisted(stream(source, headers), (pat
|
|
|
11652
11652
|
}));
|
|
11653
11653
|
const convertPart = (part) => part._tag === "Field" ? new FieldImpl(part.info, part.value) : new FileImpl(part);
|
|
11654
11654
|
var PartBase = class extends Class {
|
|
11655
|
-
[TypeId$
|
|
11655
|
+
[TypeId$12];
|
|
11656
11656
|
constructor() {
|
|
11657
11657
|
super();
|
|
11658
|
-
this[TypeId$
|
|
11658
|
+
this[TypeId$12] = TypeId$12;
|
|
11659
11659
|
}
|
|
11660
11660
|
};
|
|
11661
11661
|
var FieldImpl = class extends PartBase {
|
|
@@ -11746,7 +11746,7 @@ function convertError(cause) {
|
|
|
11746
11746
|
* @category constructors
|
|
11747
11747
|
* @since 4.0.0
|
|
11748
11748
|
*/
|
|
11749
|
-
const make$
|
|
11749
|
+
const make$15 = /*#__PURE__*/ fnUntraced(function* (evaluate, options) {
|
|
11750
11750
|
const scope$2 = yield* scope;
|
|
11751
11751
|
const server = evaluate();
|
|
11752
11752
|
const shutdown = yield* callback((resume) => {
|
|
@@ -11779,7 +11779,7 @@ const make$14 = /*#__PURE__*/ fnUntraced(function* (evaluate, options) {
|
|
|
11779
11779
|
})), (wss) => callback((resume) => {
|
|
11780
11780
|
wss.close(() => resume(void_));
|
|
11781
11781
|
})).pipe(provide$2(scope$2), cached);
|
|
11782
|
-
return make$
|
|
11782
|
+
return make$23({
|
|
11783
11783
|
address: boundAddress,
|
|
11784
11784
|
serve: fnUntraced(function* (httpApp, middleware) {
|
|
11785
11785
|
const serveScope = yield* scope;
|
|
@@ -11874,7 +11874,7 @@ const makeUpgradeHandler = (lazyWss, httpEffect, options) => {
|
|
|
11874
11874
|
});
|
|
11875
11875
|
};
|
|
11876
11876
|
var ServerRequestImpl = class ServerRequestImpl extends NodeHttpIncomingMessage {
|
|
11877
|
-
[TypeId$
|
|
11877
|
+
[TypeId$11];
|
|
11878
11878
|
response;
|
|
11879
11879
|
upgradeEffect;
|
|
11880
11880
|
upgraded = false;
|
|
@@ -11885,7 +11885,7 @@ var ServerRequestImpl = class ServerRequestImpl extends NodeHttpIncomingMessage
|
|
|
11885
11885
|
request: this,
|
|
11886
11886
|
cause
|
|
11887
11887
|
}) }), remoteAddressOverride);
|
|
11888
|
-
this[TypeId$
|
|
11888
|
+
this[TypeId$11] = TypeId$11;
|
|
11889
11889
|
this.response = response;
|
|
11890
11890
|
this.upgradeEffect = upgradeEffect;
|
|
11891
11891
|
this.url = url;
|
|
@@ -11957,7 +11957,7 @@ const layerHttpServices = /*#__PURE__*/ mergeAll(layer$5, layerWeak, layer$11);
|
|
|
11957
11957
|
* @category layers
|
|
11958
11958
|
* @since 4.0.0
|
|
11959
11959
|
*/
|
|
11960
|
-
const layerConfig = (evaluate, options) => mergeAll(effect(HttpServer)(flatMap(unwrap$4(options), (options) => make$
|
|
11960
|
+
const layerConfig = (evaluate, options) => mergeAll(effect(HttpServer)(flatMap(unwrap$4(options), (options) => make$15(evaluate, options))), layerHttpServices);
|
|
11961
11961
|
const closeCode = (exit) => isSuccess$1(exit) ? 1e3 : hasInterruptsOnly(exit.cause) ? 1001 : 1011;
|
|
11962
11962
|
const upgradedResponse = /*#__PURE__*/ empty$3({ status: 101 });
|
|
11963
11963
|
const handleResponse = (request, response) => {
|
|
@@ -12038,7 +12038,7 @@ const handleResponse = (request, response) => {
|
|
|
12038
12038
|
});
|
|
12039
12039
|
case "Stream": {
|
|
12040
12040
|
nodeResponse.writeHead(response.status, response.statusText, headers);
|
|
12041
|
-
const drainLatch = makeUnsafe$
|
|
12041
|
+
const drainLatch = makeUnsafe$7();
|
|
12042
12042
|
nodeResponse.on("drain", () => drainLatch.openUnsafe());
|
|
12043
12043
|
return body.stream.pipe(orDie$1, runForEachArray((array) => {
|
|
12044
12044
|
const chunk = array.length > 1 ? Buffer.concat(array) : array[0];
|
|
@@ -12387,7 +12387,7 @@ const utf8Strings = (record) => {
|
|
|
12387
12387
|
*/
|
|
12388
12388
|
const layer$4 = /*#__PURE__*/ effect(Dns, /*#__PURE__*/ orDie(/*#__PURE__*/ (/* @__PURE__ */ fnUntraced(function* (options) {
|
|
12389
12389
|
const resolve = yield* resolver(options);
|
|
12390
|
-
return make$
|
|
12390
|
+
return make$40({
|
|
12391
12391
|
lookup,
|
|
12392
12392
|
resolve: (name, type) => map$1(resolve(name, type), map$3(utf8Strings))
|
|
12393
12393
|
});
|
|
@@ -12785,6 +12785,110 @@ const when = when$1;
|
|
|
12785
12785
|
*/
|
|
12786
12786
|
const orElse = orElse$1;
|
|
12787
12787
|
//#endregion
|
|
12788
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SynchronizedRef.js
|
|
12789
|
+
/**
|
|
12790
|
+
* Stores mutable state whose updates run one at a time.
|
|
12791
|
+
*
|
|
12792
|
+
* A `SynchronizedRef<A>` behaves like a `Ref<A>` for reading and simple state
|
|
12793
|
+
* storage, but update and modify operations are serialized so each change sees
|
|
12794
|
+
* a consistent current value. This is especially useful when the next value is
|
|
12795
|
+
* computed by an effect, because the effectful transition is still protected
|
|
12796
|
+
* from concurrent updates. This module includes constructors, reads, writes,
|
|
12797
|
+
* updates, partial updates, and effectful update helpers.
|
|
12798
|
+
*
|
|
12799
|
+
* @stability stable
|
|
12800
|
+
* @since 2.0.0
|
|
12801
|
+
*/
|
|
12802
|
+
const TypeId$6 = "~effect/SynchronizedRef";
|
|
12803
|
+
const Proto$4 = {
|
|
12804
|
+
...PipeInspectableProto,
|
|
12805
|
+
[TypeId$6]: TypeId$6,
|
|
12806
|
+
toJSON() {
|
|
12807
|
+
return {
|
|
12808
|
+
_id: "SynchronizedRef",
|
|
12809
|
+
value: this.backing.ref.current
|
|
12810
|
+
};
|
|
12811
|
+
}
|
|
12812
|
+
};
|
|
12813
|
+
/**
|
|
12814
|
+
* Creates a `SynchronizedRef` synchronously from an initial value.
|
|
12815
|
+
*
|
|
12816
|
+
* **When to use**
|
|
12817
|
+
*
|
|
12818
|
+
* Use when you need synchronous `SynchronizedRef` construction outside an
|
|
12819
|
+
* Effect workflow.
|
|
12820
|
+
*
|
|
12821
|
+
* @stability stable
|
|
12822
|
+
* @category constructors
|
|
12823
|
+
* @since 4.0.0
|
|
12824
|
+
*/
|
|
12825
|
+
const makeUnsafe = (value) => {
|
|
12826
|
+
const self = Object.create(Proto$4);
|
|
12827
|
+
self.semaphore = makeUnsafe$8(1);
|
|
12828
|
+
self.backing = makeUnsafe$3(value);
|
|
12829
|
+
return self;
|
|
12830
|
+
};
|
|
12831
|
+
/**
|
|
12832
|
+
* Creates a `SynchronizedRef` from an initial value, wrapped in an `Effect`.
|
|
12833
|
+
*
|
|
12834
|
+
* **When to use**
|
|
12835
|
+
*
|
|
12836
|
+
* Use to create a `SynchronizedRef` inside an Effect program when later updates
|
|
12837
|
+
* may run effects and must be serialized.
|
|
12838
|
+
*
|
|
12839
|
+
* **Details**
|
|
12840
|
+
*
|
|
12841
|
+
* The returned effect constructs a fresh `SynchronizedRef` by delegating to
|
|
12842
|
+
* `makeUnsafe` when the effect is evaluated.
|
|
12843
|
+
*
|
|
12844
|
+
* @see {@link makeUnsafe} for synchronous construction when the caller controls safe initialization
|
|
12845
|
+
* @see {@link Ref.make} for a plain `Ref` when updates do not need effectful synchronization
|
|
12846
|
+
*
|
|
12847
|
+
* @stability stable
|
|
12848
|
+
* @category constructors
|
|
12849
|
+
* @since 2.0.0
|
|
12850
|
+
*/
|
|
12851
|
+
const make$13 = (value) => sync(() => makeUnsafe(value));
|
|
12852
|
+
/**
|
|
12853
|
+
* Reads the current value synchronously, bypassing the `Effect` API and the
|
|
12854
|
+
* ref's semaphore.
|
|
12855
|
+
*
|
|
12856
|
+
* **When to use**
|
|
12857
|
+
*
|
|
12858
|
+
* Use when you need immediate synchronous access to a `SynchronizedRef` value
|
|
12859
|
+
* in low-level code that can safely read outside an `Effect`.
|
|
12860
|
+
*
|
|
12861
|
+
* @see {@link get} for the Effect-wrapped read when composing inside Effect programs
|
|
12862
|
+
*
|
|
12863
|
+
* @stability stable
|
|
12864
|
+
* @category getters
|
|
12865
|
+
* @since 4.0.0
|
|
12866
|
+
*/
|
|
12867
|
+
const getUnsafe = (self) => self.backing.ref.current;
|
|
12868
|
+
/**
|
|
12869
|
+
* Runs an effectful modification atomically while holding the ref's semaphore,
|
|
12870
|
+
* stores the new value if the effect succeeds, and returns the computed result.
|
|
12871
|
+
*
|
|
12872
|
+
* **When to use**
|
|
12873
|
+
*
|
|
12874
|
+
* Use to effectfully compute both a separate return value and the next stored
|
|
12875
|
+
* `SynchronizedRef` value in one serialized update.
|
|
12876
|
+
*
|
|
12877
|
+
* @see {@link modify} for the pure variant
|
|
12878
|
+
* @see {@link updateEffect} for effectfully storing a new value without a separate result
|
|
12879
|
+
*
|
|
12880
|
+
* @stability stable
|
|
12881
|
+
* @category mutations
|
|
12882
|
+
* @since 2.0.0
|
|
12883
|
+
*/
|
|
12884
|
+
const modifyEffect$1 = /*#__PURE__*/ dual(2, (self, f) => self.semaphore.withPermit(suspend(() => {
|
|
12885
|
+
const value = getUnsafe(self);
|
|
12886
|
+
return map$1(f(value), ([b, a]) => {
|
|
12887
|
+
self.backing.ref.current = a;
|
|
12888
|
+
return b;
|
|
12889
|
+
});
|
|
12890
|
+
})));
|
|
12891
|
+
//#endregion
|
|
12788
12892
|
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SubscriptionRef.js
|
|
12789
12893
|
/**
|
|
12790
12894
|
* Stores mutable state and publishes changes as a stream.
|
|
@@ -12831,7 +12935,7 @@ const Proto$3 = {
|
|
|
12831
12935
|
*/
|
|
12832
12936
|
const make$12 = (value) => map$1(unbounded({ replay: 1 }), (pubsub) => {
|
|
12833
12937
|
const self = Object.create(Proto$3);
|
|
12834
|
-
self.semaphore = makeUnsafe$
|
|
12938
|
+
self.semaphore = makeUnsafe$8(1);
|
|
12835
12939
|
self.value = value;
|
|
12836
12940
|
self.pubsub = pubsub;
|
|
12837
12941
|
publishUnsafe(self.pubsub, value);
|
|
@@ -13601,6 +13705,13 @@ const COOKIE = {
|
|
|
13601
13705
|
};
|
|
13602
13706
|
const SESSION_DURATION = days(365);
|
|
13603
13707
|
const OAUTH_DURATION = minutes(10);
|
|
13708
|
+
const DEVELOPMENT_USER = User.make({
|
|
13709
|
+
id: "development",
|
|
13710
|
+
name: "Developer"
|
|
13711
|
+
});
|
|
13712
|
+
const MOCK_AUTH = { verify: fn$1("Auth.verify")(function* (_token) {
|
|
13713
|
+
return yield* succeed$1(DEVELOPMENT_USER);
|
|
13714
|
+
}) };
|
|
13604
13715
|
Uint8Array.from([
|
|
13605
13716
|
48,
|
|
13606
13717
|
46,
|
|
@@ -13639,11 +13750,12 @@ function respond(message, handler) {
|
|
|
13639
13750
|
onTrue: () => 401
|
|
13640
13751
|
}) })));
|
|
13641
13752
|
}
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13753
|
+
const userFrom = fnUntraced(function* (auth, headers) {
|
|
13754
|
+
if (yield* development) return DEVELOPMENT_USER;
|
|
13755
|
+
return yield* pipe(get$7(headers, "authorization"), filter$4(startsWith("Bearer ")), map$5(replace$1("Bearer ", "")), orElse$2(() => pipe(get$7(headers, "cookie"), flatMapNullishOr((cookie) => parseHeader(cookie)[SESSION_COOKIE]))), fromOption, rejected("Sign in first"), flatMap((token) => auth.verify(token)));
|
|
13756
|
+
});
|
|
13645
13757
|
function provide(auth) {
|
|
13646
|
-
return pipe(make$
|
|
13758
|
+
return pipe(make$41(Auth, auth), add$1(RpcAuth, RpcAuth.of((effect, request) => flatMap(userFrom(auth, request.headers), (user) => provideService(effect, CurrentUser, user)))));
|
|
13647
13759
|
}
|
|
13648
13760
|
function verifyWith(current) {
|
|
13649
13761
|
return fn$1("Auth.verify")(function* (token) {
|
|
@@ -13659,9 +13771,13 @@ function verifyWith(current) {
|
|
|
13659
13771
|
}
|
|
13660
13772
|
const SameOrigin = middleware((httpEffect) => gen(function* () {
|
|
13661
13773
|
const request = yield* HttpServerRequest;
|
|
13662
|
-
|
|
13774
|
+
const scheme = match(exists(get$7(request.headers, "x-forwarded-proto"), (proto) => proto === "https" || proto === "wss"), {
|
|
13775
|
+
onFalse: () => "http",
|
|
13776
|
+
onTrue: () => "https"
|
|
13777
|
+
});
|
|
13778
|
+
if (exists(get$7(request.headers, "origin"), (origin) => origin !== `${scheme}://${request.headers["host"] ?? ""}`)) return text$2("The request comes from another origin", { status: 403 });
|
|
13663
13779
|
return yield* httpEffect;
|
|
13664
|
-
})
|
|
13780
|
+
})).layer;
|
|
13665
13781
|
function parentDomain(request) {
|
|
13666
13782
|
return pipe(toURL(request), map$5((url) => pipe(url.hostname, split("."), drop(1), join$1("."))), filter$4(isNonEmpty));
|
|
13667
13783
|
}
|
|
@@ -13729,13 +13845,14 @@ fnUntraced(function* (issuer, config, redirects) {
|
|
|
13729
13845
|
});
|
|
13730
13846
|
var Auth = class Auth extends Service()("@deslop/auth/service/Auth") {
|
|
13731
13847
|
static layer = merge$3(SameOrigin, effectContext(gen(function* () {
|
|
13848
|
+
if (yield* development) return provide(Auth.of(MOCK_AUTH));
|
|
13732
13849
|
const client = filterStatusOk(yield* HttpClient);
|
|
13733
13850
|
const url = yield* pipe(String$2("AUTH_URL"), withDefault(AUTH_URL));
|
|
13734
13851
|
const read = pipe(client.get(`${url}/auth/keys`), flatMap(schemaBodyJson$1(Verification)), flatMap((verification) => map$1(pipe(fromResult(decode$3(verification.key)), flatMap((key) => tryPromise(() => crypto.subtle.importKey("raw", new Uint8Array(key), { name: "Ed25519" }, false, ["verify"])))), (publicKey) => ({
|
|
13735
13852
|
publicKey,
|
|
13736
13853
|
users: fromIterable$2(verification.users)
|
|
13737
13854
|
}))), timeout("10 seconds"));
|
|
13738
|
-
const current = yield* make$
|
|
13855
|
+
const current = yield* make$35(yield* pipe(read, tapError$1((cause) => logWarning(`Cannot read the auth keys from ${url}`, cause)), retry(spaced("5 seconds"))));
|
|
13739
13856
|
yield* pipe(read, flatMap((verification) => set(current, verification)), ignore$1({
|
|
13740
13857
|
log: "Warn",
|
|
13741
13858
|
message: `Cannot refresh the auth keys from ${url}`
|
|
@@ -13747,8 +13864,15 @@ Service()("@deslop/auth/service/Issuer");
|
|
|
13747
13864
|
const HttpAuth = middleware()(gen(function* () {
|
|
13748
13865
|
const auth = yield* Auth;
|
|
13749
13866
|
return (httpEffect) => gen(function* () {
|
|
13750
|
-
const
|
|
13751
|
-
|
|
13867
|
+
const request = yield* HttpServerRequest;
|
|
13868
|
+
const user = yield* result$1(userFrom(auth, request.headers));
|
|
13869
|
+
if (isFailure(user)) {
|
|
13870
|
+
if (includes("text/html")(request.headers["accept"] ?? "")) return redirect(`${AUTH_URL}/auth/github?${toString$2(fromInput({ redirect: match$1(toURL(request), {
|
|
13871
|
+
onNone: () => "/",
|
|
13872
|
+
onSome: (url) => url.href
|
|
13873
|
+
}) }))}`);
|
|
13874
|
+
return yield* as$1(logWarning("Sign in first", user.failure), text$2("Sign in first", { status: 401 }));
|
|
13875
|
+
}
|
|
13752
13876
|
return yield* provideService(httpEffect, CurrentUser, user.success);
|
|
13753
13877
|
});
|
|
13754
13878
|
}));
|
|
@@ -13886,7 +14010,7 @@ const make$10 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
13886
14010
|
package: "@effect/opentelemetry",
|
|
13887
14011
|
module: options.label
|
|
13888
14012
|
}));
|
|
13889
|
-
const exportFibers = yield* make$
|
|
14013
|
+
const exportFibers = yield* make$21();
|
|
13890
14014
|
const runExportFork = yield* runtime(exportFibers)();
|
|
13891
14015
|
yield* (yield* Flusher).register(runExport);
|
|
13892
14016
|
yield* addFinalizer(scope, suspend(() => {
|
|
@@ -14101,7 +14225,7 @@ const make$8 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
14101
14225
|
excludeLogSpans: options.excludeLogSpans ?? false,
|
|
14102
14226
|
clock: yield* Clock
|
|
14103
14227
|
};
|
|
14104
|
-
return make$
|
|
14228
|
+
return make$42((options) => {
|
|
14105
14229
|
exporter.push(makeLogRecord(options, opts));
|
|
14106
14230
|
});
|
|
14107
14231
|
});
|
|
@@ -14226,7 +14350,7 @@ const layer$1 = /*#__PURE__*/ flow(/* @__PURE__ */ fnUntraced(function* (options
|
|
|
14226
14350
|
if (!span.sampled) return;
|
|
14227
14351
|
exporter.push(makeOtlpSpan(span));
|
|
14228
14352
|
}
|
|
14229
|
-
return make$
|
|
14353
|
+
return make$43({
|
|
14230
14354
|
span(options) {
|
|
14231
14355
|
return new SpanImpl(options, exportFn);
|
|
14232
14356
|
},
|
|
@@ -14387,20 +14511,32 @@ const SpanKind = {
|
|
|
14387
14511
|
};
|
|
14388
14512
|
//#endregion
|
|
14389
14513
|
//#region ../../packages/runtime/src/telemetry.ts
|
|
14390
|
-
function layerOtlp(serviceName, url) {
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
resource
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
|
|
14514
|
+
function layerOtlp(serviceName, url, runtime) {
|
|
14515
|
+
return unwrap$3(gen(function* () {
|
|
14516
|
+
const start = `${yield* currentTimeNanos}`;
|
|
14517
|
+
const resource = {
|
|
14518
|
+
attributes: {
|
|
14519
|
+
"scope.run.started_unix_nano": start,
|
|
14520
|
+
"scope.runtime": runtime,
|
|
14521
|
+
"service.instance.id": start
|
|
14522
|
+
},
|
|
14523
|
+
serviceName
|
|
14524
|
+
};
|
|
14525
|
+
return pipe(mergeAll(layer$1({
|
|
14526
|
+
exportInterval: "250 millis",
|
|
14527
|
+
resource,
|
|
14528
|
+
url: new URL("/v1/traces", url).href
|
|
14529
|
+
}), layer$2({
|
|
14530
|
+
exportInterval: "250 millis",
|
|
14531
|
+
resource,
|
|
14532
|
+
url: new URL("/v1/logs", url).href
|
|
14533
|
+
})), provide$1([layerJson, layer$6]));
|
|
14534
|
+
}));
|
|
14399
14535
|
}
|
|
14400
14536
|
//#endregion
|
|
14401
14537
|
//#region ../../packages/runtime/src/server.ts
|
|
14402
14538
|
function layer(applicationName) {
|
|
14403
|
-
return mergeAll(unwrap$3(map$1(pipe(URL$1("VITE_OTEL_URL"), withDefault(new URL("http://localhost:4318"))), (url) => layerOtlp(`${applicationName}-server`, url))), layerSchemaBinary());
|
|
14539
|
+
return mergeAll(unwrap$3(map$1(pipe(URL$1("VITE_OTEL_URL"), withDefault(new URL("http://localhost:4318"))), (url) => layerOtlp(`${applicationName}-server`, url, "server"))), layerSchemaBinary());
|
|
14404
14540
|
}
|
|
14405
14541
|
layer$3({
|
|
14406
14542
|
index: "index.html",
|
|
@@ -44079,7 +44215,7 @@ function captionTranscript(input) {
|
|
|
44079
44215
|
const cues = pipe(input.vtt, replaceAll(/\r\n?/gu, "\n"), split("\n\n"), flatMap$2((block) => {
|
|
44080
44216
|
const lines = split(block, "\n");
|
|
44081
44217
|
return pipe(findFirstIndex(lines, includes("-->")), map$5((index) => {
|
|
44082
|
-
const times = map$3(pipe(getUnsafe$
|
|
44218
|
+
const times = map$3(pipe(getUnsafe$2(lines, index), split(" --> ")), (time) => reduce(pipe(time, split(" "), headNonEmpty, split(":"), map$3(parse$10), getSomes), 0, (total, part) => total * 60 + part));
|
|
44083
44219
|
return map$3(drop(lines, index + 1), (line) => ({
|
|
44084
44220
|
end: lastNonEmpty(times),
|
|
44085
44221
|
start: headNonEmpty(times),
|
|
@@ -44136,7 +44272,7 @@ const Transcription = Struct({ chunks: ArraySchema(Struct({
|
|
|
44136
44272
|
const MAX_WHISPER_SECONDS = 7200;
|
|
44137
44273
|
const BLOCKED_ANSWER = /not a bot|requir(?:es|ing) login|login required|CONNECT tunnel failed|ProxyError|HTTP Error (?:403|429|5\d\d)|Requested format is not available|timed out/iu;
|
|
44138
44274
|
const run = fnUntraced(function* (command, args) {
|
|
44139
|
-
const handle = yield* make$
|
|
44275
|
+
const handle = yield* make$44(command, args, {
|
|
44140
44276
|
stderr: "pipe",
|
|
44141
44277
|
stdout: "pipe"
|
|
44142
44278
|
});
|
|
@@ -44152,7 +44288,7 @@ var Media = class Media extends Service()("@deslop/stash/services/media/service/
|
|
|
44152
44288
|
const path = yield* Path;
|
|
44153
44289
|
const spawner = yield* ChildProcessSpawner;
|
|
44154
44290
|
const cache = path.join(yield* pipe(String$2("XDG_CACHE_HOME"), withDefault(path.join(yield* String$2("HOME"), ".cache"))), "deslop", "media");
|
|
44155
|
-
const whisper = yield* make$
|
|
44291
|
+
const whisper = yield* make$37(1);
|
|
44156
44292
|
const ytDlpArgs = [
|
|
44157
44293
|
"--js-runtimes",
|
|
44158
44294
|
"node",
|
|
@@ -97047,7 +97183,7 @@ function toCodec(schema) {
|
|
|
97047
97183
|
const encoded = toEncoded(jsonCodec.ast);
|
|
97048
97184
|
const from = transform(encoded);
|
|
97049
97185
|
if (from === encoded) return jsonCodec.ast === schema.ast ? schema : jsonCodec;
|
|
97050
|
-
return make$
|
|
97186
|
+
return make$45(decodeTo$1(from, jsonCodec.ast, passthrough$1()));
|
|
97051
97187
|
}
|
|
97052
97188
|
function transform(root) {
|
|
97053
97189
|
let cache;
|
|
@@ -98795,7 +98931,7 @@ const TypeId$1 = "~effect/ai/Toolkit";
|
|
|
98795
98931
|
* @since 4.0.0
|
|
98796
98932
|
*/
|
|
98797
98933
|
const FailureOrigin = /*#__PURE__*/ Reference("effect/ai/Toolkit/FailureOrigin", { defaultValue: () => "result" });
|
|
98798
|
-
const failureCause = (error, origin) => annotate(fail$4(error), make$
|
|
98934
|
+
const failureCause = (error, origin) => annotate(fail$4(error), make$41(FailureOrigin, origin));
|
|
98799
98935
|
const Proto = {
|
|
98800
98936
|
.../*#__PURE__*/ Prototype({
|
|
98801
98937
|
label: "Toolkit",
|
|
@@ -98867,7 +99003,7 @@ const Proto = {
|
|
|
98867
99003
|
})));
|
|
98868
99004
|
}
|
|
98869
99005
|
const decodedParams = decodedParamsResult.success;
|
|
98870
|
-
const queue = yield* make$
|
|
99006
|
+
const queue = yield* make$39();
|
|
98871
99007
|
const context = {
|
|
98872
99008
|
toolCallId,
|
|
98873
99009
|
preliminary: (result) => asVoid(offer(queue, {
|
|
@@ -98933,7 +99069,7 @@ const Proto = {
|
|
|
98933
99069
|
context: services
|
|
98934
99070
|
});
|
|
98935
99071
|
}
|
|
98936
|
-
return makeUnsafe$
|
|
99072
|
+
return makeUnsafe$5(context$1);
|
|
98937
99073
|
});
|
|
98938
99074
|
},
|
|
98939
99075
|
toLayer(build) {
|
|
@@ -99544,11 +99680,11 @@ const make$1 = /*#__PURE__*/ fnUntraced(function* (params) {
|
|
|
99544
99680
|
return void_;
|
|
99545
99681
|
}) : identity)));
|
|
99546
99682
|
}
|
|
99547
|
-
const queue = yield* make$
|
|
99683
|
+
const queue = yield* make$39();
|
|
99548
99684
|
const deferredFinishParts = [];
|
|
99549
99685
|
if (preResolvedStreamParts.length > 0) yield* offerAll(queue, preResolvedStreamParts);
|
|
99550
|
-
const toolCallFibers = yield* make$
|
|
99551
|
-
const toolCallSemaphore = concurrency === "unbounded" ? void 0 : yield* make$
|
|
99686
|
+
const toolCallFibers = yield* make$21();
|
|
99687
|
+
const toolCallSemaphore = concurrency === "unbounded" ? void 0 : yield* make$37(concurrency);
|
|
99552
99688
|
const pendingToolCalls = /* @__PURE__ */ new Map();
|
|
99553
99689
|
const bufferedToolCalls = [];
|
|
99554
99690
|
const handleToolCall = fnUntraced(function* (part) {
|
|
@@ -101700,7 +101836,7 @@ var Organizer = class Organizer extends Service()("@deslop/stash/services/notes/
|
|
|
101700
101836
|
tags: normalizeTags(response.value.tags)
|
|
101701
101837
|
};
|
|
101702
101838
|
}, timeout("5 minutes"), mapError((cause) => pipe(liftPredicate(cause, is$4(NotesError)), getOrElse(() => NotesError.make({
|
|
101703
|
-
cause: make$
|
|
101839
|
+
cause: make$46(cause),
|
|
101704
101840
|
message: "AI tagging failed; the note is saved as it is."
|
|
101705
101841
|
}))))) });
|
|
101706
101842
|
}));
|
|
@@ -101769,17 +101905,16 @@ function optional(message, fallback) {
|
|
|
101769
101905
|
return (effect) => pipe(effect, tapError$1((error) => logWarning(message, error)), orElseSucceed(fallback));
|
|
101770
101906
|
}
|
|
101771
101907
|
var Notes = class Notes extends Service()("@deslop/stash/services/notes/service/Notes") {
|
|
101772
|
-
static layer = effect(this, gen(function* () {
|
|
101908
|
+
static layer = (directory) => effect(this, gen(function* () {
|
|
101773
101909
|
const fs = yield* FileSystem;
|
|
101774
101910
|
const path = yield* Path;
|
|
101775
101911
|
const sources = yield* Sources;
|
|
101776
101912
|
const media = yield* Media;
|
|
101777
101913
|
const organizer = yield* Organizer;
|
|
101778
|
-
const directory = yield* pipe(String$2("STASH_DATA_DIR"), withDefault(path.join(yield* String$2("HOME"), ".deslop", "stash")));
|
|
101779
101914
|
const images = path.join(directory, "images");
|
|
101780
101915
|
const files = path.join(directory, "files");
|
|
101781
|
-
const reading = yield* make$
|
|
101782
|
-
const runs = yield* make$
|
|
101916
|
+
const reading = yield* make$37(2);
|
|
101917
|
+
const runs = yield* make$19();
|
|
101783
101918
|
const storageFailed = mapError((cause) => NotesError.make({
|
|
101784
101919
|
cause,
|
|
101785
101920
|
message: "The notes database or files could not be read or written."
|
|
@@ -101802,7 +101937,7 @@ var Notes = class Notes extends Service()("@deslop/stash/services/notes/service/
|
|
|
101802
101937
|
}));
|
|
101803
101938
|
}
|
|
101804
101939
|
function updateNote(id, change) {
|
|
101805
|
-
return transact((current) => make$
|
|
101940
|
+
return transact((current) => make$47(void 0, changeNote(current, id, change)));
|
|
101806
101941
|
}
|
|
101807
101942
|
function findNote(id) {
|
|
101808
101943
|
return map$1(get$1(state), (notes) => findFirst(notes, (note) => note.id === id));
|
|
@@ -101995,8 +102130,8 @@ var Notes = class Notes extends Service()("@deslop/stash/services/notes/service/
|
|
|
101995
102130
|
text: ""
|
|
101996
102131
|
});
|
|
101997
102132
|
const earlier = yield* transact((current) => match$1(findFirst(current, (item) => item.id === input.id), {
|
|
101998
|
-
onNone: () => make$
|
|
101999
|
-
onSome: (item) => make$
|
|
102133
|
+
onNone: () => make$47(none(), prepend$2(current, note)),
|
|
102134
|
+
onSome: (item) => make$47(some$1(item), current)
|
|
102000
102135
|
}));
|
|
102001
102136
|
return yield* match$1(earlier, {
|
|
102002
102137
|
onNone: () => as$1(start(note), note),
|
|
@@ -102029,18 +102164,18 @@ var Notes = class Notes extends Service()("@deslop/stash/services/notes/service/
|
|
|
102029
102164
|
onSome: (link) => ({ url: link })
|
|
102030
102165
|
})
|
|
102031
102166
|
});
|
|
102032
|
-
return make$
|
|
102167
|
+
return make$47({
|
|
102033
102168
|
fresh: true,
|
|
102034
102169
|
note
|
|
102035
102170
|
}, prepend$2(current, note));
|
|
102036
102171
|
},
|
|
102037
102172
|
onSome: (note) => {
|
|
102038
102173
|
const merged = withWords(note, text);
|
|
102039
|
-
if (note.id === input.id || merged === note) return make$
|
|
102174
|
+
if (note.id === input.id || merged === note) return make$47({
|
|
102040
102175
|
fresh: false,
|
|
102041
102176
|
note
|
|
102042
102177
|
}, current);
|
|
102043
|
-
return make$
|
|
102178
|
+
return make$47({
|
|
102044
102179
|
fresh: false,
|
|
102045
102180
|
note: merged
|
|
102046
102181
|
}, changeNote(current, note.id, () => merged));
|
|
@@ -102084,20 +102219,20 @@ var Notes = class Notes extends Service()("@deslop/stash/services/notes/service/
|
|
|
102084
102219
|
regenerate: fn$1("Notes.regenerate")(function* (input) {
|
|
102085
102220
|
yield* remove$1(runs, input.id);
|
|
102086
102221
|
const reset = yield* transact((current) => match$1(findFirst(current, (note) => note.id === input.id), {
|
|
102087
|
-
onNone: () => make$
|
|
102222
|
+
onNone: () => make$47(none(), current),
|
|
102088
102223
|
onSome: (found) => {
|
|
102089
102224
|
const next = {
|
|
102090
102225
|
...omit(found, ["issue", "transcript"]),
|
|
102091
102226
|
status: "organizing"
|
|
102092
102227
|
};
|
|
102093
|
-
return make$
|
|
102228
|
+
return make$47(some$1(next), changeNote(current, input.id, () => next));
|
|
102094
102229
|
}
|
|
102095
102230
|
}));
|
|
102096
102231
|
yield* pipe(fromOption(reset), missing, flatMap(start));
|
|
102097
102232
|
}),
|
|
102098
102233
|
remove: fn$1("Notes.remove")(function* (input) {
|
|
102099
102234
|
yield* remove$1(runs, input.id);
|
|
102100
|
-
yield* transact((current) => make$
|
|
102235
|
+
yield* transact((current) => make$47(void 0, match(some$2(current, (note) => note.id === input.id), {
|
|
102101
102236
|
onFalse: () => current,
|
|
102102
102237
|
onTrue: () => filter$5(current, (note) => note.id !== input.id)
|
|
102103
102238
|
})));
|
|
@@ -102110,38 +102245,71 @@ var Notes = class Notes extends Service()("@deslop/stash/services/notes/service/
|
|
|
102110
102245
|
});
|
|
102111
102246
|
}));
|
|
102112
102247
|
};
|
|
102248
|
+
var UserNotes = class UserNotes extends Service()("@deslop/stash/services/notes/service/UserNotes") {
|
|
102249
|
+
static layer = effect(this, gen(function* () {
|
|
102250
|
+
const fs = yield* FileSystem;
|
|
102251
|
+
const path = yield* Path;
|
|
102252
|
+
const directory = yield* pipe(String$2("STASH_DATA_DIR"), withDefault(path.join(yield* String$2("HOME"), ".deslop", "stash")));
|
|
102253
|
+
const users = yield* pipe(fs.makeDirectory(directory, {
|
|
102254
|
+
mode: 448,
|
|
102255
|
+
recursive: true
|
|
102256
|
+
}), andThen(fs.readDirectory(directory)), mapError((cause) => NotesError.make({
|
|
102257
|
+
cause,
|
|
102258
|
+
message: "The notes folder could not be read."
|
|
102259
|
+
})));
|
|
102260
|
+
const scope = yield* Scope;
|
|
102261
|
+
const services = succeedContext(yield* context());
|
|
102262
|
+
const loaded = yield* make$13(empty$13());
|
|
102263
|
+
const build = fnUntraced(function* (user) {
|
|
102264
|
+
const owned = yield* fork(scope);
|
|
102265
|
+
const context = yield* pipe(buildWithScope(pipe(Notes.layer(path.join(directory, user)), provide$1(services)), owned), onError((cause) => close(owned, failCause$1(cause))));
|
|
102266
|
+
return get$6(context, Notes);
|
|
102267
|
+
});
|
|
102268
|
+
function load(user) {
|
|
102269
|
+
return modifyEffect$1(loaded, (current) => match$1(get$9(current, user), {
|
|
102270
|
+
onNone: () => map$1(build(user), (notes) => make$47(notes, set$4(current, user, notes))),
|
|
102271
|
+
onSome: (notes) => succeed$1(make$47(notes, current))
|
|
102272
|
+
}));
|
|
102273
|
+
}
|
|
102274
|
+
yield* forEach(users, load, {
|
|
102275
|
+
concurrency: 1,
|
|
102276
|
+
discard: true
|
|
102277
|
+
});
|
|
102278
|
+
return UserNotes.of({ current: flatMap(CurrentUser, (user) => load(user.id)) });
|
|
102279
|
+
}));
|
|
102280
|
+
};
|
|
102113
102281
|
//#endregion
|
|
102114
102282
|
//#region src/rpcs/handlers.ts
|
|
102115
102283
|
const RpcHandlers = RpcContracts.toLayer(gen(function* () {
|
|
102116
|
-
const notes = yield*
|
|
102284
|
+
const notes = (yield* UserNotes).current;
|
|
102117
102285
|
return RpcContracts.of({
|
|
102118
|
-
"notes.capture": notes.capture,
|
|
102119
|
-
"notes.get": notes.get,
|
|
102120
|
-
"notes.regenerate": notes.regenerate,
|
|
102121
|
-
"notes.remove": notes.remove,
|
|
102122
|
-
"notes.search": notes.search,
|
|
102123
|
-
"notes.watch": () => notes.events
|
|
102286
|
+
"notes.capture": (input) => flatMap(notes, (service) => service.capture(input)),
|
|
102287
|
+
"notes.get": (input) => flatMap(notes, (service) => service.get(input)),
|
|
102288
|
+
"notes.regenerate": (input) => flatMap(notes, (service) => service.regenerate(input)),
|
|
102289
|
+
"notes.remove": (input) => flatMap(notes, (service) => service.remove(input)),
|
|
102290
|
+
"notes.search": (input) => flatMap(notes, (service) => service.search(input)),
|
|
102291
|
+
"notes.watch": () => unwrap$2(map$1(notes, (service) => service.events))
|
|
102124
102292
|
});
|
|
102125
102293
|
}));
|
|
102126
102294
|
//#endregion
|
|
102127
102295
|
//#region src/main.server.ts
|
|
102128
102296
|
const noteIdParam = schemaPathParams(Struct({ id: NoteId }));
|
|
102129
102297
|
const routes = pipe(use((router) => gen(function* () {
|
|
102130
|
-
const
|
|
102298
|
+
const userNotes = (yield* UserNotes).current;
|
|
102131
102299
|
yield* router.add("POST", "/api/capture", gen(function* () {
|
|
102132
|
-
return yield* schemaJson(Note)(yield*
|
|
102300
|
+
return yield* schemaJson(Note)(yield* (yield* userNotes).capture(yield* schemaBodyJson(Capture)));
|
|
102133
102301
|
}));
|
|
102134
102302
|
yield* router.add("POST", "/api/files/:id", gen(function* () {
|
|
102135
102303
|
const request = yield* HttpServerRequest;
|
|
102136
102304
|
const type = yield* decodeUnknownEffect(FileType)(pipe(request.headers["content-type"] ?? "", split(";"), headNonEmpty, trim));
|
|
102137
|
-
return yield* schemaJson(Note)(yield*
|
|
102305
|
+
return yield* schemaJson(Note)(yield* (yield* userNotes).captureFile({
|
|
102138
102306
|
body: request.stream,
|
|
102139
102307
|
id: (yield* noteIdParam).id,
|
|
102140
102308
|
type
|
|
102141
102309
|
}));
|
|
102142
102310
|
}));
|
|
102143
102311
|
yield* router.add("GET", "/api/images/:id", gen(function* () {
|
|
102144
|
-
const image = yield*
|
|
102312
|
+
const image = yield* (yield* userNotes).image((yield* noteIdParam).id);
|
|
102145
102313
|
return uint8Array(image.bytes, {
|
|
102146
102314
|
contentType: image.type,
|
|
102147
102315
|
headers: { "cache-control": "private, max-age=31536000, immutable" }
|
|
@@ -102153,6 +102321,6 @@ const rpc = pipe(layerHttp({
|
|
|
102153
102321
|
path: "/api/rpc",
|
|
102154
102322
|
protocol: "websocket"
|
|
102155
102323
|
}), provide$1(RpcHandlers), provide$1(layerJson$1));
|
|
102156
|
-
runMain(pipe(serve(pipe(merge$3(rpc, routes), provide$1(Auth.layer)), { disableLogger: true }), provide$1(
|
|
102324
|
+
runMain(pipe(serve(pipe(merge$3(rpc, routes), provide$1(Auth.layer)), { disableLogger: true }), provide$1(UserNotes.layer), provide$1(mergeAll(Sources.layer, Media.layer, Organizer.layer)), provide$1(mergeAll(layer$4, layer$6, layer$11)), provide$1(layer("@deslop/stash")), provide$1(layerNodeHttpServer), launch));
|
|
102157
102325
|
//#endregion
|
|
102158
102326
|
export {};
|