@trpc/client 10.0.0-alpha.48 → 10.0.0-alpha.50

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.
@@ -1,8 +1,5 @@
1
1
  import type { AnyRouter } from '@trpc/server';
2
2
  import { TRPCClient as Client, CreateTRPCClientOptions } from './internals/TRPCClient';
3
- /**
4
- * @deprecated use `createTRPCProxyClient` instead
5
- */
6
3
  export declare function createTRPCClient<TRouter extends AnyRouter>(opts: CreateTRPCClientOptions<TRouter>): Client<TRouter>;
7
4
  export type { TRPCRequestOptions, CreateTRPCClientOptions, TRPCClient, AssertLegacyDef, } from './internals/TRPCClient';
8
5
  //# sourceMappingURL=createTRPCClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createTRPCClient.d.ts","sourceRoot":"","sources":["../src/createTRPCClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,UAAU,IAAI,MAAM,EACpB,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,SAAS,EACxD,IAAI,EAAE,uBAAuB,CAAC,OAAO,CAAC,mBAIvC;AAID,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,eAAe,GAChB,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"createTRPCClient.d.ts","sourceRoot":"","sources":["../src/createTRPCClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,UAAU,IAAI,MAAM,EACpB,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,SAAS,EACxD,IAAI,EAAE,uBAAuB,CAAC,OAAO,CAAC,mBAIvC;AAID,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,eAAe,GAChB,MAAM,wBAAwB,CAAC"}
@@ -28,7 +28,7 @@ declare type DecoratedProcedureRecord<TProcedures extends ProcedureRouterRecord,
28
28
  [TKey in keyof TProcedures]: TProcedures[TKey] extends AnyRouter ? DecoratedProcedureRecord<TProcedures[TKey]['_def']['record'], TProcedures[TKey]> : assertProcedure<TProcedures[TKey]>['_def']['_old'] extends true ? never : DecorateProcedure<assertProcedure<TProcedures[TKey]>, TRouter>;
29
29
  }>;
30
30
  /**
31
- * @deprecated use `createTRPCProxyClient` instead
31
+ * @deprecated use createTRPCProxyClient instead
32
32
  * @internal
33
33
  */
34
34
  export declare function createTRPCClientProxy<TRouter extends AnyRouter>(client: Client<TRouter>): DecoratedProcedureRecord<TRouter["_def"]["record"], TRouter>;
package/dist/index.js CHANGED
@@ -242,9 +242,7 @@ class TRPCClient {
242
242
  }
243
243
  }
244
244
 
245
- /**
246
- * @deprecated use `createTRPCProxyClient` instead
247
- */ function createTRPCClient(opts) {
245
+ function createTRPCClient(opts) {
248
246
  const client = new TRPCClient(opts);
249
247
  return client;
250
248
  }
@@ -255,7 +253,7 @@ const clientCallTypeMap = {
255
253
  subscribe: 'subscription'
256
254
  };
257
255
  /**
258
- * @deprecated use `createTRPCProxyClient` instead
256
+ * @deprecated use createTRPCProxyClient instead
259
257
  * @internal
260
258
  */ function createTRPCClientProxy(client) {
261
259
  const proxy = shared.createProxy(({ path , args })=>{
package/dist/index.mjs CHANGED
@@ -241,9 +241,7 @@ class TRPCClient {
241
241
  }
242
242
  }
243
243
 
244
- /**
245
- * @deprecated use `createTRPCProxyClient` instead
246
- */ function createTRPCClient(opts) {
244
+ function createTRPCClient(opts) {
247
245
  const client = new TRPCClient(opts);
248
246
  return client;
249
247
  }
@@ -254,7 +252,7 @@ const clientCallTypeMap = {
254
252
  subscribe: 'subscription'
255
253
  };
256
254
  /**
257
- * @deprecated use `createTRPCProxyClient` instead
255
+ * @deprecated use createTRPCProxyClient instead
258
256
  * @internal
259
257
  */ function createTRPCClientProxy(client) {
260
258
  const proxy = createProxy(({ path , args })=>{
@@ -78,6 +78,7 @@ function dataLoader(fetchMany, opts) {
78
78
  }
79
79
 
80
80
  var thisBatch = batch;
81
+ var dispatchImmediately = false;
81
82
  var promise = new Promise(function (resolve, reject) {
82
83
  var item = batchItem;
83
84
  item.reject = reject;
@@ -85,15 +86,10 @@ function dataLoader(fetchMany, opts) {
85
86
  thisBatch.items.push(item);
86
87
 
87
88
  if (typeof (opts === null || opts === void 0 ? void 0 : opts.maxBatchSize) !== 'undefined' && thisBatch.items.length >= opts.maxBatchSize) {
88
- dispatch();
89
- return;
89
+ dispatchImmediately = true;
90
90
  }
91
91
  });
92
92
 
93
- if (!dispatchTimer) {
94
- dispatchTimer = setTimeout(dispatch);
95
- }
96
-
97
93
  var cancel = function cancel() {
98
94
  batchItem.cancelled = true;
99
95
 
@@ -107,6 +103,12 @@ function dataLoader(fetchMany, opts) {
107
103
  thisBatch.cancel();
108
104
  };
109
105
 
106
+ if (dispatchImmediately) {
107
+ dispatch();
108
+ } else if (!dispatchTimer) {
109
+ dispatchTimer = setTimeout(dispatch);
110
+ }
111
+
110
112
  return {
111
113
  promise: promise,
112
114
  cancel: cancel
@@ -78,6 +78,7 @@ function dataLoader(fetchMany, opts) {
78
78
  }
79
79
 
80
80
  var thisBatch = batch;
81
+ var dispatchImmediately = false;
81
82
  var promise = new Promise(function (resolve, reject) {
82
83
  var item = batchItem;
83
84
  item.reject = reject;
@@ -85,15 +86,10 @@ function dataLoader(fetchMany, opts) {
85
86
  thisBatch.items.push(item);
86
87
 
87
88
  if (typeof (opts === null || opts === void 0 ? void 0 : opts.maxBatchSize) !== 'undefined' && thisBatch.items.length >= opts.maxBatchSize) {
88
- dispatch();
89
- return;
89
+ dispatchImmediately = true;
90
90
  }
91
91
  });
92
92
 
93
- if (!dispatchTimer) {
94
- dispatchTimer = setTimeout(dispatch);
95
- }
96
-
97
93
  var cancel = function cancel() {
98
94
  batchItem.cancelled = true;
99
95
 
@@ -107,6 +103,12 @@ function dataLoader(fetchMany, opts) {
107
103
  thisBatch.cancel();
108
104
  };
109
105
 
106
+ if (dispatchImmediately) {
107
+ dispatch();
108
+ } else if (!dispatchTimer) {
109
+ dispatchTimer = setTimeout(dispatch);
110
+ }
111
+
110
112
  return {
111
113
  promise: promise,
112
114
  cancel: cancel
@@ -74,6 +74,7 @@ function dataLoader(fetchMany, opts) {
74
74
  }
75
75
 
76
76
  var thisBatch = batch;
77
+ var dispatchImmediately = false;
77
78
  var promise = new Promise(function (resolve, reject) {
78
79
  var item = batchItem;
79
80
  item.reject = reject;
@@ -81,15 +82,10 @@ function dataLoader(fetchMany, opts) {
81
82
  thisBatch.items.push(item);
82
83
 
83
84
  if (typeof (opts === null || opts === void 0 ? void 0 : opts.maxBatchSize) !== 'undefined' && thisBatch.items.length >= opts.maxBatchSize) {
84
- dispatch();
85
- return;
85
+ dispatchImmediately = true;
86
86
  }
87
87
  });
88
88
 
89
- if (!dispatchTimer) {
90
- dispatchTimer = setTimeout(dispatch);
91
- }
92
-
93
89
  var cancel = function cancel() {
94
90
  batchItem.cancelled = true;
95
91
 
@@ -103,6 +99,12 @@ function dataLoader(fetchMany, opts) {
103
99
  thisBatch.cancel();
104
100
  };
105
101
 
102
+ if (dispatchImmediately) {
103
+ dispatch();
104
+ } else if (!dispatchTimer) {
105
+ dispatchTimer = setTimeout(dispatch);
106
+ }
107
+
106
108
  return {
107
109
  promise: promise,
108
110
  cancel: cancel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/client",
3
- "version": "10.0.0-alpha.48",
3
+ "version": "10.0.0-alpha.50",
4
4
  "description": "tRPC Client lib",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -63,13 +63,13 @@
63
63
  "ts-watch": "tsc --project tsconfig.watch.json"
64
64
  },
65
65
  "peerDependencies": {
66
- "@trpc/server": "10.0.0-alpha.48"
66
+ "@trpc/server": "10.0.0-alpha.50"
67
67
  },
68
68
  "devDependencies": {
69
- "@trpc/server": "10.0.0-alpha.48"
69
+ "@trpc/server": "10.0.0-alpha.50"
70
70
  },
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "7c36df29c30d06d0483212d0a6d20cae7ecb59c7"
74
+ "gitHead": "f9faff30d825cb4f98d9e7e375d30ff6687e93a8"
75
75
  }
@@ -7,9 +7,6 @@ import {
7
7
  CreateTRPCClientOptions,
8
8
  } from './internals/TRPCClient';
9
9
 
10
- /**
11
- * @deprecated use `createTRPCProxyClient` instead
12
- */
13
10
  export function createTRPCClient<TRouter extends AnyRouter>(
14
11
  opts: CreateTRPCClientOptions<TRouter>,
15
12
  ) {
@@ -87,7 +87,7 @@ const clientCallTypeMap: Record<
87
87
  };
88
88
 
89
89
  /**
90
- * @deprecated use `createTRPCProxyClient` instead
90
+ * @deprecated use createTRPCProxyClient instead
91
91
  * @internal
92
92
  */
93
93
  export function createTRPCClientProxy<TRouter extends AnyRouter>(