@sortsys/v2-client 0.1.4 → 0.1.6

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +3 -289
  2. package/package.json +4 -3
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { EventEmitter } from 'events';
4
4
  import * as http from 'http';
5
+ import { Observable as Observable$1 } from 'rxjs';
5
6
  import { SendOptions } from 'send';
6
7
 
7
8
  interface ConnectionStateBase<TError> {
@@ -3728,295 +3729,6 @@ interface Cache$1 {
3728
3729
  clear(): Promise<void>;
3729
3730
  keys(): Promise<Set<string>>;
3730
3731
  }
3731
- declare class Subscription implements SubscriptionLike {
3732
- private initialTeardown?;
3733
- static EMPTY: Subscription;
3734
- /**
3735
- * A flag to indicate whether this Subscription has already been unsubscribed.
3736
- */
3737
- closed: boolean;
3738
- private _parentage;
3739
- /**
3740
- * The list of registered finalizers to execute upon unsubscription. Adding and removing from this
3741
- * list occurs in the {@link #add} and {@link #remove} methods.
3742
- */
3743
- private _finalizers;
3744
- /**
3745
- * @param initialTeardown A function executed first as part of the finalization
3746
- * process that is kicked off when {@link #unsubscribe} is called.
3747
- */
3748
- constructor(initialTeardown?: (() => void) | undefined);
3749
- /**
3750
- * Disposes the resources held by the subscription. May, for instance, cancel
3751
- * an ongoing Observable execution or cancel any other type of work that
3752
- * started when the Subscription was created.
3753
- */
3754
- unsubscribe(): void;
3755
- /**
3756
- * Adds a finalizer to this subscription, so that finalization will be unsubscribed/called
3757
- * when this subscription is unsubscribed. If this subscription is already {@link #closed},
3758
- * because it has already been unsubscribed, then whatever finalizer is passed to it
3759
- * will automatically be executed (unless the finalizer itself is also a closed subscription).
3760
- *
3761
- * Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed
3762
- * subscription to a any subscription will result in no operation. (A noop).
3763
- *
3764
- * Adding a subscription to itself, or adding `null` or `undefined` will not perform any
3765
- * operation at all. (A noop).
3766
- *
3767
- * `Subscription` instances that are added to this instance will automatically remove themselves
3768
- * if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove
3769
- * will need to be removed manually with {@link #remove}
3770
- *
3771
- * @param teardown The finalization logic to add to this subscription.
3772
- */
3773
- add(teardown: TeardownLogic): void;
3774
- /**
3775
- * Checks to see if a this subscription already has a particular parent.
3776
- * This will signal that this subscription has already been added to the parent in question.
3777
- * @param parent the parent to check for
3778
- */
3779
- private _hasParent;
3780
- /**
3781
- * Adds a parent to this subscription so it can be removed from the parent if it
3782
- * unsubscribes on it's own.
3783
- *
3784
- * NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.
3785
- * @param parent The parent subscription to add
3786
- */
3787
- private _addParent;
3788
- /**
3789
- * Called on a child when it is removed via {@link #remove}.
3790
- * @param parent The parent to remove
3791
- */
3792
- private _removeParent;
3793
- /**
3794
- * Removes a finalizer from this subscription that was previously added with the {@link #add} method.
3795
- *
3796
- * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves
3797
- * from every other `Subscription` they have been added to. This means that using the `remove` method
3798
- * is not a common thing and should be used thoughtfully.
3799
- *
3800
- * If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance
3801
- * more than once, you will need to call `remove` the same number of times to remove all instances.
3802
- *
3803
- * All finalizer instances are removed to free up memory upon unsubscription.
3804
- *
3805
- * @param teardown The finalizer to remove from this subscription
3806
- */
3807
- remove(teardown: Exclude<TeardownLogic, void>): void;
3808
- }
3809
- declare class Subscriber<T> extends Subscription implements Observer$1<T> {
3810
- /**
3811
- * A static factory for a Subscriber, given a (potentially partial) definition
3812
- * of an Observer.
3813
- * @param next The `next` callback of an Observer.
3814
- * @param error The `error` callback of an
3815
- * Observer.
3816
- * @param complete The `complete` callback of an
3817
- * Observer.
3818
- * @return A Subscriber wrapping the (partially defined)
3819
- * Observer represented by the given arguments.
3820
- * @deprecated Do not use. Will be removed in v8. There is no replacement for this
3821
- * method, and there is no reason to be creating instances of `Subscriber` directly.
3822
- * If you have a specific use case, please file an issue.
3823
- */
3824
- static create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T>;
3825
- /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
3826
- protected isStopped: boolean;
3827
- /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
3828
- protected destination: Subscriber<any> | Observer$1<any>;
3829
- /**
3830
- * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
3831
- * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.
3832
- */
3833
- constructor(destination?: Subscriber<any> | Observer$1<any>);
3834
- /**
3835
- * The {@link Observer} callback to receive notifications of type `next` from
3836
- * the Observable, with a value. The Observable may call this method 0 or more
3837
- * times.
3838
- * @param value The `next` value.
3839
- */
3840
- next(value: T): void;
3841
- /**
3842
- * The {@link Observer} callback to receive notifications of type `error` from
3843
- * the Observable, with an attached `Error`. Notifies the Observer that
3844
- * the Observable has experienced an error condition.
3845
- * @param err The `error` exception.
3846
- */
3847
- error(err?: any): void;
3848
- /**
3849
- * The {@link Observer} callback to receive a valueless notification of type
3850
- * `complete` from the Observable. Notifies the Observer that the Observable
3851
- * has finished sending push-based notifications.
3852
- */
3853
- complete(): void;
3854
- unsubscribe(): void;
3855
- protected _next(value: T): void;
3856
- protected _error(err: any): void;
3857
- protected _complete(): void;
3858
- }
3859
- interface Operator<T, R> {
3860
- call(subscriber: Subscriber<R>, source: any): TeardownLogic;
3861
- }
3862
- declare class Observable$1<T> implements Subscribable$1<T> {
3863
- /**
3864
- * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
3865
- */
3866
- source: Observable$1<any> | undefined;
3867
- /**
3868
- * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
3869
- */
3870
- operator: Operator<any, T> | undefined;
3871
- /**
3872
- * @param subscribe The function that is called when the Observable is
3873
- * initially subscribed to. This function is given a Subscriber, to which new values
3874
- * can be `next`ed, or an `error` method can be called to raise an error, or
3875
- * `complete` can be called to notify of a successful completion.
3876
- */
3877
- constructor(subscribe?: (this: Observable$1<T>, subscriber: Subscriber<T>) => TeardownLogic);
3878
- /**
3879
- * Creates a new Observable by calling the Observable constructor
3880
- * @param subscribe the subscriber function to be passed to the Observable constructor
3881
- * @return A new observable.
3882
- * @deprecated Use `new Observable()` instead. Will be removed in v8.
3883
- */
3884
- static create: (...args: any[]) => any;
3885
- /**
3886
- * Creates a new Observable, with this Observable instance as the source, and the passed
3887
- * operator defined as the new observable's operator.
3888
- * @param operator the operator defining the operation to take on the observable
3889
- * @return A new observable with the Operator applied.
3890
- * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
3891
- * If you have implemented an operator using `lift`, it is recommended that you create an
3892
- * operator by simply returning `new Observable()` directly. See "Creating new operators from
3893
- * scratch" section here: https://rxjs.dev/guide/operators
3894
- */
3895
- lift<R>(operator?: Operator<T, R>): Observable$1<R>;
3896
- subscribe(observerOrNext?: Partial<Observer$1<T>> | ((value: T) => void)): Subscription;
3897
- /** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */
3898
- subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;
3899
- /**
3900
- * Used as a NON-CANCELLABLE means of subscribing to an observable, for use with
3901
- * APIs that expect promises, like `async/await`. You cannot unsubscribe from this.
3902
- *
3903
- * **WARNING**: Only use this with observables you *know* will complete. If the source
3904
- * observable does not complete, you will end up with a promise that is hung up, and
3905
- * potentially all of the state of an async function hanging out in memory. To avoid
3906
- * this situation, look into adding something like {@link timeout}, {@link take},
3907
- * {@link takeWhile}, or {@link takeUntil} amongst others.
3908
- *
3909
- * #### Example
3910
- *
3911
- * ```ts
3912
- * import { interval, take } from 'rxjs';
3913
- *
3914
- * const source$ = interval(1000).pipe(take(4));
3915
- *
3916
- * async function getTotal() {
3917
- * let total = 0;
3918
- *
3919
- * await source$.forEach(value => {
3920
- * total += value;
3921
- * console.log('observable -> ' + value);
3922
- * });
3923
- *
3924
- * return total;
3925
- * }
3926
- *
3927
- * getTotal().then(
3928
- * total => console.log('Total: ' + total)
3929
- * );
3930
- *
3931
- * // Expected:
3932
- * // 'observable -> 0'
3933
- * // 'observable -> 1'
3934
- * // 'observable -> 2'
3935
- * // 'observable -> 3'
3936
- * // 'Total: 6'
3937
- * ```
3938
- *
3939
- * @param next A handler for each value emitted by the observable.
3940
- * @return A promise that either resolves on observable completion or
3941
- * rejects with the handled error.
3942
- */
3943
- forEach(next: (value: T) => void): Promise<void>;
3944
- /**
3945
- * @param next a handler for each value emitted by the observable
3946
- * @param promiseCtor a constructor function used to instantiate the Promise
3947
- * @return a promise that either resolves on observable completion or
3948
- * rejects with the handled error
3949
- * @deprecated Passing a Promise constructor will no longer be available
3950
- * in upcoming versions of RxJS. This is because it adds weight to the library, for very
3951
- * little benefit. If you need this functionality, it is recommended that you either
3952
- * polyfill Promise, or you create an adapter to convert the returned native promise
3953
- * to whatever promise implementation you wanted. Will be removed in v8.
3954
- */
3955
- forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise<void>;
3956
- pipe(): Observable$1<T>;
3957
- pipe<A>(op1: OperatorFunction$1<T, A>): Observable$1<A>;
3958
- pipe<A, B>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>): Observable$1<B>;
3959
- pipe<A, B, C>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>): Observable$1<C>;
3960
- pipe<A, B, C, D>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>): Observable$1<D>;
3961
- pipe<A, B, C, D, E>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>): Observable$1<E>;
3962
- pipe<A, B, C, D, E, F>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>, op6: OperatorFunction$1<E, F>): Observable$1<F>;
3963
- pipe<A, B, C, D, E, F, G>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>, op6: OperatorFunction$1<E, F>, op7: OperatorFunction$1<F, G>): Observable$1<G>;
3964
- pipe<A, B, C, D, E, F, G, H>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>, op6: OperatorFunction$1<E, F>, op7: OperatorFunction$1<F, G>, op8: OperatorFunction$1<G, H>): Observable$1<H>;
3965
- pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>, op6: OperatorFunction$1<E, F>, op7: OperatorFunction$1<F, G>, op8: OperatorFunction$1<G, H>, op9: OperatorFunction$1<H, I>): Observable$1<I>;
3966
- pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction$1<T, A>, op2: OperatorFunction$1<A, B>, op3: OperatorFunction$1<B, C>, op4: OperatorFunction$1<C, D>, op5: OperatorFunction$1<D, E>, op6: OperatorFunction$1<E, F>, op7: OperatorFunction$1<F, G>, op8: OperatorFunction$1<G, H>, op9: OperatorFunction$1<H, I>, ...operations: OperatorFunction$1<any, any>[]): Observable$1<unknown>;
3967
- /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
3968
- toPromise(): Promise<T | undefined>;
3969
- /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
3970
- toPromise(PromiseCtor: typeof Promise): Promise<T | undefined>;
3971
- /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
3972
- toPromise(PromiseCtor: PromiseConstructorLike): Promise<T | undefined>;
3973
- }
3974
- interface UnaryFunction$1<T, R> {
3975
- (source: T): R;
3976
- }
3977
- interface OperatorFunction$1<T, R> extends UnaryFunction$1<Observable$1<T>, Observable$1<R>> {
3978
- }
3979
- interface Unsubscribable$1 {
3980
- unsubscribe(): void;
3981
- }
3982
- declare type TeardownLogic = Subscription | Unsubscribable$1 | (() => void) | void;
3983
- interface SubscriptionLike extends Unsubscribable$1 {
3984
- unsubscribe(): void;
3985
- readonly closed: boolean;
3986
- }
3987
- interface Subscribable$1<T> {
3988
- subscribe(observer: Partial<Observer$1<T>>): Unsubscribable$1;
3989
- }
3990
- interface Observer$1<T> {
3991
- /**
3992
- * A callback function that gets called by the producer during the subscription when
3993
- * the producer "has" the `value`. It won't be called if `error` or `complete` callback
3994
- * functions have been called, nor after the consumer has unsubscribed.
3995
- *
3996
- * For more info, please refer to {@link guide/glossary-and-semantics#next this guide}.
3997
- */
3998
- next: (value: T) => void;
3999
- /**
4000
- * A callback function that gets called by the producer if and when it encountered a
4001
- * problem of any kind. The errored value will be provided through the `err` parameter.
4002
- * This callback can't be called more than one time, it can't be called if the
4003
- * `complete` callback function have been called previously, nor it can't be called if
4004
- * the consumer has unsubscribed.
4005
- *
4006
- * For more info, please refer to {@link guide/glossary-and-semantics#error this guide}.
4007
- */
4008
- error: (err: any) => void;
4009
- /**
4010
- * A callback function that gets called by the producer if and when it has no more
4011
- * values to provide (by calling `next` callback function). This means that no error
4012
- * has happened. This callback can't be called more than one time, it can't be called
4013
- * if the `error` callback function have been called previously, nor it can't be called
4014
- * if the consumer has unsubscribed.
4015
- *
4016
- * For more info, please refer to {@link guide/glossary-and-semantics#complete this guide}.
4017
- */
4018
- complete: () => void;
4019
- }
4020
3732
  /**
4021
3733
  * Streaming/caching modes consistent with your REST client.
4022
3734
  */
@@ -4034,6 +3746,8 @@ type TRPCQueryPaths<TClient> = TRPCPaths<TClient, "query">;
4034
3746
  type TRPCMutatePaths<TClient> = TRPCPaths<TClient, "mutate">;
4035
3747
  type QueryPaths = TRPCQueryPaths<MyTRPCClient>;
4036
3748
  type MutatePaths = TRPCMutatePaths<MyTRPCClient>;
3749
+ export type QueryResult<PathT extends TRPCQueryPaths<MyTRPCClient>> = Awaited<ReturnType<PathValue<MyTRPCClient, `${PathT}.query`>>>;
3750
+ export type MutateResult<PathT extends TRPCQueryPaths<MyTRPCClient>> = Awaited<ReturnType<PathValue<MyTRPCClient, `${PathT}.mutate`>>>;
4037
3751
  type AnyFn = (...args: any[]) => any;
4038
3752
  type FirstParam<F> = F extends AnyFn ? Parameters<F> extends [
4039
3753
  infer A,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sortsys/v2-client",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "main": "dist/index.js",
5
5
  "devDependencies": {
6
6
  "dts-bundle-generator": "^9.5.1"
@@ -18,12 +18,13 @@
18
18
  "access": "public"
19
19
  },
20
20
  "scripts": {
21
- "build": "rm -rf dist && bun build src/index.ts --production --outfile dist/index.js && bunx dts-bundle-generator -o dist/index.d.ts src/index.ts --no-check --external-inlines=@trpc/server @trpc/client express-serve-static-core rxjs qs range-parser --export-referenced-types=false"
21
+ "build": "rm -rf dist && bun build src/index.ts --production --outfile dist/index.js && bunx dts-bundle-generator -o dist/index.d.ts src/index.ts --no-check --external-inlines=@trpc/server @trpc/client express-serve-static-core qs range-parser --export-referenced-types=false"
22
22
  },
23
23
  "type": "module",
24
24
  "types": "dist/index.d.ts",
25
25
  "dependencies": {
26
26
  "@types/node": "^25.0.1",
27
- "@types/send": "^1.2.1"
27
+ "@types/send": "^1.2.1",
28
+ "rxjs": "^7.8.2"
28
29
  }
29
30
  }