@trpc/client 10.0.0-alpha.31 → 10.0.0-alpha.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/createTRPCClient.d.ts +1 -1
- package/dist/createTRPCClient.d.ts.map +1 -1
- package/dist/createTRPCClientProxy.d.ts +1 -2
- package/dist/createTRPCClientProxy.d.ts.map +1 -1
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.dev.js +14 -80
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.prod.js +14 -80
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.esm.js +14 -76
- package/links/httpLink/dist/trpc-client-links-httpLink.cjs.dev.js +9 -76
- package/links/httpLink/dist/trpc-client-links-httpLink.cjs.prod.js +9 -76
- package/links/httpLink/dist/trpc-client-links-httpLink.esm.js +9 -72
- package/package.json +4 -4
- package/src/createTRPCClientProxy.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyRouter } from '@trpc/server';
|
|
2
2
|
import { TRPCClient as Client, CreateTRPCClientOptions } from './internals/TRPCClient';
|
|
3
|
-
export declare function createTRPCClient<TRouter extends AnyRouter>(opts: CreateTRPCClientOptions<TRouter>): Client<TRouter> & (
|
|
3
|
+
export declare function createTRPCClient<TRouter extends AnyRouter>(opts: CreateTRPCClientOptions<TRouter>): Client<TRouter> & import("./createTRPCClientProxy").FlattenRouter<TRouter>;
|
|
4
4
|
export type { TRPCRequestOptions, CreateTRPCClientOptions, TRPCClient, } from './internals/TRPCClient';
|
|
5
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;AAE9C,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,
|
|
1
|
+
{"version":3,"file":"createTRPCClient.d.ts","sourceRoot":"","sources":["../src/createTRPCClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,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,8EAIvC;AAID,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,GACX,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { AnyRouter } from '@trpc/server';
|
|
2
2
|
import { TRPCClient as Client } from './internals/TRPCClient';
|
|
3
|
-
declare type FlattenRouter<TRouter extends AnyRouter> = {
|
|
3
|
+
export declare type FlattenRouter<TRouter extends AnyRouter> = {
|
|
4
4
|
[Key in keyof TRouter['_def']['record']]: TRouter['_def']['record'][Key] extends AnyRouter ? FlattenRouter<TRouter['_def']['record'][Key]> : TRouter['_def']['record'][Key];
|
|
5
5
|
};
|
|
6
6
|
export declare function createTRPCClientProxy<TRouter extends AnyRouter>(client: Client<TRouter>): Client<TRouter> & FlattenRouter<TRouter>;
|
|
7
|
-
export {};
|
|
8
7
|
//# sourceMappingURL=createTRPCClientProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTRPCClientProxy.d.ts","sourceRoot":"","sources":["../src/createTRPCClientProxy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE9D,
|
|
1
|
+
{"version":3,"file":"createTRPCClientProxy.d.ts","sourceRoot":"","sources":["../src/createTRPCClientProxy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE9D,oBAAY,aAAa,CAAC,OAAO,SAAS,SAAS,IAAI;KACpD,GAAG,IAAI,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,SAAS,GACtF,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAC7C,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC;CACnC,CAAC;AAyCF,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,SAAS,EAC7D,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,4CAGxB"}
|
|
@@ -2,23 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
-
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
7
|
-
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
8
|
-
require('@babel/runtime/helpers/classCallCheck');
|
|
9
|
-
require('@babel/runtime/helpers/createClass');
|
|
10
5
|
var TRPCClientError = require('../../../dist/TRPCClientError-bfee2bf5.cjs.dev.js');
|
|
11
|
-
var transformRPCResponse = require('../../../dist/transformRPCResponse-
|
|
6
|
+
var transformRPCResponse = require('../../../dist/transformRPCResponse-0ad3cc9f.cjs.dev.js');
|
|
12
7
|
var _createForOfIteratorHelper = require('@babel/runtime/helpers/createForOfIteratorHelper');
|
|
8
|
+
require('@babel/runtime/helpers/objectSpread2');
|
|
9
|
+
require('@babel/runtime/helpers/classCallCheck');
|
|
10
|
+
require('@babel/runtime/helpers/createClass');
|
|
13
11
|
require('@babel/runtime/helpers/assertThisInitialized');
|
|
14
12
|
require('@babel/runtime/helpers/inherits');
|
|
15
13
|
require('@babel/runtime/helpers/createSuper');
|
|
16
14
|
require('@babel/runtime/helpers/wrapNativeSuper');
|
|
17
15
|
|
|
18
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
19
|
-
|
|
20
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
21
|
-
|
|
22
16
|
/**
|
|
23
17
|
* Dataloader that's very inspired by https://github.com/graphql/dataloader
|
|
24
18
|
* Less configuration, no caching, and allows you to cancel requests
|
|
@@ -130,65 +124,12 @@ function httpBatchLink(opts) {
|
|
|
130
124
|
|
|
131
125
|
return function (runtime) {
|
|
132
126
|
// initialized in app
|
|
133
|
-
var getHeaders = /*#__PURE__*/function () {
|
|
134
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(arg1) {
|
|
135
|
-
var val;
|
|
136
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
137
|
-
while (1) {
|
|
138
|
-
switch (_context.prev = _context.next) {
|
|
139
|
-
case 0:
|
|
140
|
-
val = opts.headers;
|
|
141
|
-
_context.t0 = _objectSpread;
|
|
142
|
-
_context.t1 = _objectSpread;
|
|
143
|
-
_context.t2 = {};
|
|
144
|
-
_context.next = 6;
|
|
145
|
-
return runtime.headers();
|
|
146
|
-
|
|
147
|
-
case 6:
|
|
148
|
-
_context.t3 = _context.sent;
|
|
149
|
-
_context.t4 = (0, _context.t1)(_context.t2, _context.t3);
|
|
150
|
-
|
|
151
|
-
if (!(typeof val === 'function')) {
|
|
152
|
-
_context.next = 14;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
_context.next = 11;
|
|
157
|
-
return val(arg1);
|
|
158
|
-
|
|
159
|
-
case 11:
|
|
160
|
-
_context.t5 = _context.sent;
|
|
161
|
-
_context.next = 15;
|
|
162
|
-
break;
|
|
163
|
-
|
|
164
|
-
case 14:
|
|
165
|
-
_context.t5 = val;
|
|
166
|
-
|
|
167
|
-
case 15:
|
|
168
|
-
_context.t6 = _context.t5;
|
|
169
|
-
return _context.abrupt("return", (0, _context.t0)(_context.t4, _context.t6));
|
|
170
|
-
|
|
171
|
-
case 17:
|
|
172
|
-
case "end":
|
|
173
|
-
return _context.stop();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}, _callee);
|
|
177
|
-
}));
|
|
178
|
-
|
|
179
|
-
return function getHeaders(_x) {
|
|
180
|
-
return _ref.apply(this, arguments);
|
|
181
|
-
};
|
|
182
|
-
}();
|
|
183
|
-
|
|
184
127
|
var fetcher = function fetcher(type) {
|
|
185
|
-
return function (
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
var path = pairs.map(function (op) {
|
|
128
|
+
return function (keyInputPairs) {
|
|
129
|
+
var path = keyInputPairs.map(function (op) {
|
|
189
130
|
return op.path;
|
|
190
131
|
}).join(',');
|
|
191
|
-
var inputs =
|
|
132
|
+
var inputs = keyInputPairs.map(function (op) {
|
|
192
133
|
return op.input;
|
|
193
134
|
});
|
|
194
135
|
|
|
@@ -196,15 +137,8 @@ function httpBatchLink(opts) {
|
|
|
196
137
|
url: url,
|
|
197
138
|
inputs: inputs,
|
|
198
139
|
path: path,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
AbortController: transformRPCResponse.getAbortController((_opts$AbortController = opts.AbortController) !== null && _opts$AbortController !== void 0 ? _opts$AbortController : runtime.AbortController),
|
|
202
|
-
headers: function headers() {
|
|
203
|
-
return getHeaders({
|
|
204
|
-
operations: pairs
|
|
205
|
-
});
|
|
206
|
-
},
|
|
207
|
-
transformer: runtime.transformer
|
|
140
|
+
runtime: runtime,
|
|
141
|
+
type: type
|
|
208
142
|
}),
|
|
209
143
|
promise = _httpRequest.promise,
|
|
210
144
|
cancel = _httpRequest.cancel;
|
|
@@ -212,7 +146,7 @@ function httpBatchLink(opts) {
|
|
|
212
146
|
return {
|
|
213
147
|
promise: promise.then(function (res) {
|
|
214
148
|
if (!Array.isArray(res)) {
|
|
215
|
-
return
|
|
149
|
+
return keyInputPairs.map(function () {
|
|
216
150
|
return res;
|
|
217
151
|
});
|
|
218
152
|
}
|
|
@@ -238,10 +172,10 @@ function httpBatchLink(opts) {
|
|
|
238
172
|
subscription: subscription,
|
|
239
173
|
mutation: mutation
|
|
240
174
|
};
|
|
241
|
-
return function (
|
|
242
|
-
var op =
|
|
243
|
-
prev =
|
|
244
|
-
onDestroy =
|
|
175
|
+
return function (_ref) {
|
|
176
|
+
var op = _ref.op,
|
|
177
|
+
prev = _ref.prev,
|
|
178
|
+
onDestroy = _ref.onDestroy;
|
|
245
179
|
var loader = loaders[op.type];
|
|
246
180
|
|
|
247
181
|
var _loader$load = loader.load(op),
|
|
@@ -2,23 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
-
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
7
|
-
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
8
|
-
require('@babel/runtime/helpers/classCallCheck');
|
|
9
|
-
require('@babel/runtime/helpers/createClass');
|
|
10
5
|
var TRPCClientError = require('../../../dist/TRPCClientError-e9bf96e9.cjs.prod.js');
|
|
11
|
-
var transformRPCResponse = require('../../../dist/transformRPCResponse-
|
|
6
|
+
var transformRPCResponse = require('../../../dist/transformRPCResponse-e6daeb02.cjs.prod.js');
|
|
12
7
|
var _createForOfIteratorHelper = require('@babel/runtime/helpers/createForOfIteratorHelper');
|
|
8
|
+
require('@babel/runtime/helpers/objectSpread2');
|
|
9
|
+
require('@babel/runtime/helpers/classCallCheck');
|
|
10
|
+
require('@babel/runtime/helpers/createClass');
|
|
13
11
|
require('@babel/runtime/helpers/assertThisInitialized');
|
|
14
12
|
require('@babel/runtime/helpers/inherits');
|
|
15
13
|
require('@babel/runtime/helpers/createSuper');
|
|
16
14
|
require('@babel/runtime/helpers/wrapNativeSuper');
|
|
17
15
|
|
|
18
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
19
|
-
|
|
20
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
21
|
-
|
|
22
16
|
/**
|
|
23
17
|
* Dataloader that's very inspired by https://github.com/graphql/dataloader
|
|
24
18
|
* Less configuration, no caching, and allows you to cancel requests
|
|
@@ -130,65 +124,12 @@ function httpBatchLink(opts) {
|
|
|
130
124
|
|
|
131
125
|
return function (runtime) {
|
|
132
126
|
// initialized in app
|
|
133
|
-
var getHeaders = /*#__PURE__*/function () {
|
|
134
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(arg1) {
|
|
135
|
-
var val;
|
|
136
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
137
|
-
while (1) {
|
|
138
|
-
switch (_context.prev = _context.next) {
|
|
139
|
-
case 0:
|
|
140
|
-
val = opts.headers;
|
|
141
|
-
_context.t0 = _objectSpread;
|
|
142
|
-
_context.t1 = _objectSpread;
|
|
143
|
-
_context.t2 = {};
|
|
144
|
-
_context.next = 6;
|
|
145
|
-
return runtime.headers();
|
|
146
|
-
|
|
147
|
-
case 6:
|
|
148
|
-
_context.t3 = _context.sent;
|
|
149
|
-
_context.t4 = (0, _context.t1)(_context.t2, _context.t3);
|
|
150
|
-
|
|
151
|
-
if (!(typeof val === 'function')) {
|
|
152
|
-
_context.next = 14;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
_context.next = 11;
|
|
157
|
-
return val(arg1);
|
|
158
|
-
|
|
159
|
-
case 11:
|
|
160
|
-
_context.t5 = _context.sent;
|
|
161
|
-
_context.next = 15;
|
|
162
|
-
break;
|
|
163
|
-
|
|
164
|
-
case 14:
|
|
165
|
-
_context.t5 = val;
|
|
166
|
-
|
|
167
|
-
case 15:
|
|
168
|
-
_context.t6 = _context.t5;
|
|
169
|
-
return _context.abrupt("return", (0, _context.t0)(_context.t4, _context.t6));
|
|
170
|
-
|
|
171
|
-
case 17:
|
|
172
|
-
case "end":
|
|
173
|
-
return _context.stop();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}, _callee);
|
|
177
|
-
}));
|
|
178
|
-
|
|
179
|
-
return function getHeaders(_x) {
|
|
180
|
-
return _ref.apply(this, arguments);
|
|
181
|
-
};
|
|
182
|
-
}();
|
|
183
|
-
|
|
184
127
|
var fetcher = function fetcher(type) {
|
|
185
|
-
return function (
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
var path = pairs.map(function (op) {
|
|
128
|
+
return function (keyInputPairs) {
|
|
129
|
+
var path = keyInputPairs.map(function (op) {
|
|
189
130
|
return op.path;
|
|
190
131
|
}).join(',');
|
|
191
|
-
var inputs =
|
|
132
|
+
var inputs = keyInputPairs.map(function (op) {
|
|
192
133
|
return op.input;
|
|
193
134
|
});
|
|
194
135
|
|
|
@@ -196,15 +137,8 @@ function httpBatchLink(opts) {
|
|
|
196
137
|
url: url,
|
|
197
138
|
inputs: inputs,
|
|
198
139
|
path: path,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
AbortController: transformRPCResponse.getAbortController((_opts$AbortController = opts.AbortController) !== null && _opts$AbortController !== void 0 ? _opts$AbortController : runtime.AbortController),
|
|
202
|
-
headers: function headers() {
|
|
203
|
-
return getHeaders({
|
|
204
|
-
operations: pairs
|
|
205
|
-
});
|
|
206
|
-
},
|
|
207
|
-
transformer: runtime.transformer
|
|
140
|
+
runtime: runtime,
|
|
141
|
+
type: type
|
|
208
142
|
}),
|
|
209
143
|
promise = _httpRequest.promise,
|
|
210
144
|
cancel = _httpRequest.cancel;
|
|
@@ -212,7 +146,7 @@ function httpBatchLink(opts) {
|
|
|
212
146
|
return {
|
|
213
147
|
promise: promise.then(function (res) {
|
|
214
148
|
if (!Array.isArray(res)) {
|
|
215
|
-
return
|
|
149
|
+
return keyInputPairs.map(function () {
|
|
216
150
|
return res;
|
|
217
151
|
});
|
|
218
152
|
}
|
|
@@ -238,10 +172,10 @@ function httpBatchLink(opts) {
|
|
|
238
172
|
subscription: subscription,
|
|
239
173
|
mutation: mutation
|
|
240
174
|
};
|
|
241
|
-
return function (
|
|
242
|
-
var op =
|
|
243
|
-
prev =
|
|
244
|
-
onDestroy =
|
|
175
|
+
return function (_ref) {
|
|
176
|
+
var op = _ref.op,
|
|
177
|
+
prev = _ref.prev,
|
|
178
|
+
onDestroy = _ref.onDestroy;
|
|
245
179
|
var loader = loaders[op.type];
|
|
246
180
|
|
|
247
181
|
var _loader$load = loader.load(op),
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
|
|
2
|
-
import _asyncToGenerator from '@babel/runtime/helpers/esm/asyncToGenerator';
|
|
3
|
-
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
4
|
-
import '@babel/runtime/helpers/classCallCheck';
|
|
5
|
-
import '@babel/runtime/helpers/createClass';
|
|
6
1
|
import { T as TRPCClientError } from '../../../dist/TRPCClientError-09b8a26b.esm.js';
|
|
7
|
-
import { T as TRPCAbortError, t as transformRPCResponse, h as httpRequest
|
|
2
|
+
import { T as TRPCAbortError, t as transformRPCResponse, h as httpRequest } from '../../../dist/transformRPCResponse-3700ef8b.esm.js';
|
|
8
3
|
import _createForOfIteratorHelper from '@babel/runtime/helpers/esm/createForOfIteratorHelper';
|
|
4
|
+
import '@babel/runtime/helpers/objectSpread2';
|
|
5
|
+
import '@babel/runtime/helpers/classCallCheck';
|
|
6
|
+
import '@babel/runtime/helpers/createClass';
|
|
9
7
|
import '@babel/runtime/helpers/assertThisInitialized';
|
|
10
8
|
import '@babel/runtime/helpers/inherits';
|
|
11
9
|
import '@babel/runtime/helpers/createSuper';
|
|
@@ -122,65 +120,12 @@ function httpBatchLink(opts) {
|
|
|
122
120
|
|
|
123
121
|
return function (runtime) {
|
|
124
122
|
// initialized in app
|
|
125
|
-
var getHeaders = /*#__PURE__*/function () {
|
|
126
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(arg1) {
|
|
127
|
-
var val;
|
|
128
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
129
|
-
while (1) {
|
|
130
|
-
switch (_context.prev = _context.next) {
|
|
131
|
-
case 0:
|
|
132
|
-
val = opts.headers;
|
|
133
|
-
_context.t0 = _objectSpread;
|
|
134
|
-
_context.t1 = _objectSpread;
|
|
135
|
-
_context.t2 = {};
|
|
136
|
-
_context.next = 6;
|
|
137
|
-
return runtime.headers();
|
|
138
|
-
|
|
139
|
-
case 6:
|
|
140
|
-
_context.t3 = _context.sent;
|
|
141
|
-
_context.t4 = (0, _context.t1)(_context.t2, _context.t3);
|
|
142
|
-
|
|
143
|
-
if (!(typeof val === 'function')) {
|
|
144
|
-
_context.next = 14;
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
_context.next = 11;
|
|
149
|
-
return val(arg1);
|
|
150
|
-
|
|
151
|
-
case 11:
|
|
152
|
-
_context.t5 = _context.sent;
|
|
153
|
-
_context.next = 15;
|
|
154
|
-
break;
|
|
155
|
-
|
|
156
|
-
case 14:
|
|
157
|
-
_context.t5 = val;
|
|
158
|
-
|
|
159
|
-
case 15:
|
|
160
|
-
_context.t6 = _context.t5;
|
|
161
|
-
return _context.abrupt("return", (0, _context.t0)(_context.t4, _context.t6));
|
|
162
|
-
|
|
163
|
-
case 17:
|
|
164
|
-
case "end":
|
|
165
|
-
return _context.stop();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}, _callee);
|
|
169
|
-
}));
|
|
170
|
-
|
|
171
|
-
return function getHeaders(_x) {
|
|
172
|
-
return _ref.apply(this, arguments);
|
|
173
|
-
};
|
|
174
|
-
}();
|
|
175
|
-
|
|
176
123
|
var fetcher = function fetcher(type) {
|
|
177
|
-
return function (
|
|
178
|
-
var
|
|
179
|
-
|
|
180
|
-
var path = pairs.map(function (op) {
|
|
124
|
+
return function (keyInputPairs) {
|
|
125
|
+
var path = keyInputPairs.map(function (op) {
|
|
181
126
|
return op.path;
|
|
182
127
|
}).join(',');
|
|
183
|
-
var inputs =
|
|
128
|
+
var inputs = keyInputPairs.map(function (op) {
|
|
184
129
|
return op.input;
|
|
185
130
|
});
|
|
186
131
|
|
|
@@ -188,15 +133,8 @@ function httpBatchLink(opts) {
|
|
|
188
133
|
url: url,
|
|
189
134
|
inputs: inputs,
|
|
190
135
|
path: path,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
AbortController: getAbortController((_opts$AbortController = opts.AbortController) !== null && _opts$AbortController !== void 0 ? _opts$AbortController : runtime.AbortController),
|
|
194
|
-
headers: function headers() {
|
|
195
|
-
return getHeaders({
|
|
196
|
-
operations: pairs
|
|
197
|
-
});
|
|
198
|
-
},
|
|
199
|
-
transformer: runtime.transformer
|
|
136
|
+
runtime: runtime,
|
|
137
|
+
type: type
|
|
200
138
|
}),
|
|
201
139
|
promise = _httpRequest.promise,
|
|
202
140
|
cancel = _httpRequest.cancel;
|
|
@@ -204,7 +142,7 @@ function httpBatchLink(opts) {
|
|
|
204
142
|
return {
|
|
205
143
|
promise: promise.then(function (res) {
|
|
206
144
|
if (!Array.isArray(res)) {
|
|
207
|
-
return
|
|
145
|
+
return keyInputPairs.map(function () {
|
|
208
146
|
return res;
|
|
209
147
|
});
|
|
210
148
|
}
|
|
@@ -230,10 +168,10 @@ function httpBatchLink(opts) {
|
|
|
230
168
|
subscription: subscription,
|
|
231
169
|
mutation: mutation
|
|
232
170
|
};
|
|
233
|
-
return function (
|
|
234
|
-
var op =
|
|
235
|
-
prev =
|
|
236
|
-
onDestroy =
|
|
171
|
+
return function (_ref) {
|
|
172
|
+
var op = _ref.op,
|
|
173
|
+
prev = _ref.prev,
|
|
174
|
+
onDestroy = _ref.onDestroy;
|
|
237
175
|
var loader = loaders[op.type];
|
|
238
176
|
|
|
239
177
|
var _loader$load = loader.load(op),
|
|
@@ -2,102 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
5
|
+
var TRPCClientError = require('../../../dist/TRPCClientError-bfee2bf5.cjs.dev.js');
|
|
6
|
+
var transformRPCResponse = require('../../../dist/transformRPCResponse-0ad3cc9f.cjs.dev.js');
|
|
7
|
+
require('@babel/runtime/helpers/objectSpread2');
|
|
8
8
|
require('@babel/runtime/helpers/classCallCheck');
|
|
9
9
|
require('@babel/runtime/helpers/createClass');
|
|
10
|
-
var TRPCClientError = require('../../../dist/TRPCClientError-bfee2bf5.cjs.dev.js');
|
|
11
|
-
var transformRPCResponse = require('../../../dist/transformRPCResponse-c6cc4677.cjs.dev.js');
|
|
12
|
-
require('@babel/runtime/helpers/createForOfIteratorHelper');
|
|
13
10
|
require('@babel/runtime/helpers/assertThisInitialized');
|
|
14
11
|
require('@babel/runtime/helpers/inherits');
|
|
15
12
|
require('@babel/runtime/helpers/createSuper');
|
|
16
13
|
require('@babel/runtime/helpers/wrapNativeSuper');
|
|
17
14
|
|
|
18
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
19
|
-
|
|
20
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
21
|
-
|
|
22
15
|
function httpLink(opts) {
|
|
23
16
|
var url = opts.url; // initialized config
|
|
24
17
|
|
|
25
18
|
return function (runtime) {
|
|
26
19
|
// initialized in app
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
while (1) {
|
|
32
|
-
switch (_context.prev = _context.next) {
|
|
33
|
-
case 0:
|
|
34
|
-
val = opts.headers;
|
|
35
|
-
_context.t0 = _objectSpread;
|
|
36
|
-
_context.t1 = _objectSpread;
|
|
37
|
-
_context.t2 = {};
|
|
38
|
-
_context.next = 6;
|
|
39
|
-
return runtime.headers();
|
|
40
|
-
|
|
41
|
-
case 6:
|
|
42
|
-
_context.t3 = _context.sent;
|
|
43
|
-
_context.t4 = (0, _context.t1)(_context.t2, _context.t3);
|
|
44
|
-
|
|
45
|
-
if (!(typeof val === 'function')) {
|
|
46
|
-
_context.next = 14;
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
_context.next = 11;
|
|
51
|
-
return val(arg1);
|
|
52
|
-
|
|
53
|
-
case 11:
|
|
54
|
-
_context.t5 = _context.sent;
|
|
55
|
-
_context.next = 15;
|
|
56
|
-
break;
|
|
57
|
-
|
|
58
|
-
case 14:
|
|
59
|
-
_context.t5 = val;
|
|
60
|
-
|
|
61
|
-
case 15:
|
|
62
|
-
_context.t6 = _context.t5;
|
|
63
|
-
return _context.abrupt("return", (0, _context.t0)(_context.t4, _context.t6));
|
|
64
|
-
|
|
65
|
-
case 17:
|
|
66
|
-
case "end":
|
|
67
|
-
return _context.stop();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}, _callee);
|
|
71
|
-
}));
|
|
72
|
-
|
|
73
|
-
return function getHeaders(_x) {
|
|
74
|
-
return _ref.apply(this, arguments);
|
|
75
|
-
};
|
|
76
|
-
}();
|
|
77
|
-
|
|
78
|
-
return function (_ref2) {
|
|
79
|
-
var _opts$fetch, _opts$AbortController;
|
|
80
|
-
|
|
81
|
-
var op = _ref2.op,
|
|
82
|
-
prev = _ref2.prev,
|
|
83
|
-
onDestroy = _ref2.onDestroy;
|
|
20
|
+
return function (_ref) {
|
|
21
|
+
var op = _ref.op,
|
|
22
|
+
prev = _ref.prev,
|
|
23
|
+
onDestroy = _ref.onDestroy;
|
|
84
24
|
var path = op.path,
|
|
85
25
|
input = op.input,
|
|
86
26
|
type = op.type;
|
|
87
27
|
|
|
88
28
|
var _httpRequest = transformRPCResponse.httpRequest({
|
|
29
|
+
runtime: runtime,
|
|
89
30
|
type: type,
|
|
90
31
|
input: input,
|
|
91
32
|
url: url,
|
|
92
|
-
path: path
|
|
93
|
-
transformer: runtime.transformer,
|
|
94
|
-
fetch: transformRPCResponse.getFetch((_opts$fetch = opts.fetch) !== null && _opts$fetch !== void 0 ? _opts$fetch : runtime.fetch),
|
|
95
|
-
AbortController: transformRPCResponse.getAbortController((_opts$AbortController = opts.AbortController) !== null && _opts$AbortController !== void 0 ? _opts$AbortController : runtime.AbortController),
|
|
96
|
-
headers: function headers() {
|
|
97
|
-
return getHeaders({
|
|
98
|
-
op: op
|
|
99
|
-
});
|
|
100
|
-
}
|
|
33
|
+
path: path
|
|
101
34
|
}),
|
|
102
35
|
promise = _httpRequest.promise,
|
|
103
36
|
cancel = _httpRequest.cancel;
|
|
@@ -2,102 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
5
|
+
var TRPCClientError = require('../../../dist/TRPCClientError-e9bf96e9.cjs.prod.js');
|
|
6
|
+
var transformRPCResponse = require('../../../dist/transformRPCResponse-e6daeb02.cjs.prod.js');
|
|
7
|
+
require('@babel/runtime/helpers/objectSpread2');
|
|
8
8
|
require('@babel/runtime/helpers/classCallCheck');
|
|
9
9
|
require('@babel/runtime/helpers/createClass');
|
|
10
|
-
var TRPCClientError = require('../../../dist/TRPCClientError-e9bf96e9.cjs.prod.js');
|
|
11
|
-
var transformRPCResponse = require('../../../dist/transformRPCResponse-2b5b4bba.cjs.prod.js');
|
|
12
|
-
require('@babel/runtime/helpers/createForOfIteratorHelper');
|
|
13
10
|
require('@babel/runtime/helpers/assertThisInitialized');
|
|
14
11
|
require('@babel/runtime/helpers/inherits');
|
|
15
12
|
require('@babel/runtime/helpers/createSuper');
|
|
16
13
|
require('@babel/runtime/helpers/wrapNativeSuper');
|
|
17
14
|
|
|
18
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
19
|
-
|
|
20
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
21
|
-
|
|
22
15
|
function httpLink(opts) {
|
|
23
16
|
var url = opts.url; // initialized config
|
|
24
17
|
|
|
25
18
|
return function (runtime) {
|
|
26
19
|
// initialized in app
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
while (1) {
|
|
32
|
-
switch (_context.prev = _context.next) {
|
|
33
|
-
case 0:
|
|
34
|
-
val = opts.headers;
|
|
35
|
-
_context.t0 = _objectSpread;
|
|
36
|
-
_context.t1 = _objectSpread;
|
|
37
|
-
_context.t2 = {};
|
|
38
|
-
_context.next = 6;
|
|
39
|
-
return runtime.headers();
|
|
40
|
-
|
|
41
|
-
case 6:
|
|
42
|
-
_context.t3 = _context.sent;
|
|
43
|
-
_context.t4 = (0, _context.t1)(_context.t2, _context.t3);
|
|
44
|
-
|
|
45
|
-
if (!(typeof val === 'function')) {
|
|
46
|
-
_context.next = 14;
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
_context.next = 11;
|
|
51
|
-
return val(arg1);
|
|
52
|
-
|
|
53
|
-
case 11:
|
|
54
|
-
_context.t5 = _context.sent;
|
|
55
|
-
_context.next = 15;
|
|
56
|
-
break;
|
|
57
|
-
|
|
58
|
-
case 14:
|
|
59
|
-
_context.t5 = val;
|
|
60
|
-
|
|
61
|
-
case 15:
|
|
62
|
-
_context.t6 = _context.t5;
|
|
63
|
-
return _context.abrupt("return", (0, _context.t0)(_context.t4, _context.t6));
|
|
64
|
-
|
|
65
|
-
case 17:
|
|
66
|
-
case "end":
|
|
67
|
-
return _context.stop();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}, _callee);
|
|
71
|
-
}));
|
|
72
|
-
|
|
73
|
-
return function getHeaders(_x) {
|
|
74
|
-
return _ref.apply(this, arguments);
|
|
75
|
-
};
|
|
76
|
-
}();
|
|
77
|
-
|
|
78
|
-
return function (_ref2) {
|
|
79
|
-
var _opts$fetch, _opts$AbortController;
|
|
80
|
-
|
|
81
|
-
var op = _ref2.op,
|
|
82
|
-
prev = _ref2.prev,
|
|
83
|
-
onDestroy = _ref2.onDestroy;
|
|
20
|
+
return function (_ref) {
|
|
21
|
+
var op = _ref.op,
|
|
22
|
+
prev = _ref.prev,
|
|
23
|
+
onDestroy = _ref.onDestroy;
|
|
84
24
|
var path = op.path,
|
|
85
25
|
input = op.input,
|
|
86
26
|
type = op.type;
|
|
87
27
|
|
|
88
28
|
var _httpRequest = transformRPCResponse.httpRequest({
|
|
29
|
+
runtime: runtime,
|
|
89
30
|
type: type,
|
|
90
31
|
input: input,
|
|
91
32
|
url: url,
|
|
92
|
-
path: path
|
|
93
|
-
transformer: runtime.transformer,
|
|
94
|
-
fetch: transformRPCResponse.getFetch((_opts$fetch = opts.fetch) !== null && _opts$fetch !== void 0 ? _opts$fetch : runtime.fetch),
|
|
95
|
-
AbortController: transformRPCResponse.getAbortController((_opts$AbortController = opts.AbortController) !== null && _opts$AbortController !== void 0 ? _opts$AbortController : runtime.AbortController),
|
|
96
|
-
headers: function headers() {
|
|
97
|
-
return getHeaders({
|
|
98
|
-
op: op
|
|
99
|
-
});
|
|
100
|
-
}
|
|
33
|
+
path: path
|
|
101
34
|
}),
|
|
102
35
|
promise = _httpRequest.promise,
|
|
103
36
|
cancel = _httpRequest.cancel;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { T as TRPCClientError } from '../../../dist/TRPCClientError-09b8a26b.esm.js';
|
|
2
|
+
import { h as httpRequest, T as TRPCAbortError, t as transformRPCResponse } from '../../../dist/transformRPCResponse-3700ef8b.esm.js';
|
|
3
|
+
import '@babel/runtime/helpers/objectSpread2';
|
|
4
4
|
import '@babel/runtime/helpers/classCallCheck';
|
|
5
5
|
import '@babel/runtime/helpers/createClass';
|
|
6
|
-
import { T as TRPCClientError } from '../../../dist/TRPCClientError-09b8a26b.esm.js';
|
|
7
|
-
import { h as httpRequest, g as getFetch, a as getAbortController, T as TRPCAbortError, t as transformRPCResponse } from '../../../dist/transformRPCResponse-648d57f1.esm.js';
|
|
8
|
-
import '@babel/runtime/helpers/createForOfIteratorHelper';
|
|
9
6
|
import '@babel/runtime/helpers/assertThisInitialized';
|
|
10
7
|
import '@babel/runtime/helpers/inherits';
|
|
11
8
|
import '@babel/runtime/helpers/createSuper';
|
|
@@ -16,80 +13,20 @@ function httpLink(opts) {
|
|
|
16
13
|
|
|
17
14
|
return function (runtime) {
|
|
18
15
|
// initialized in app
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
while (1) {
|
|
24
|
-
switch (_context.prev = _context.next) {
|
|
25
|
-
case 0:
|
|
26
|
-
val = opts.headers;
|
|
27
|
-
_context.t0 = _objectSpread;
|
|
28
|
-
_context.t1 = _objectSpread;
|
|
29
|
-
_context.t2 = {};
|
|
30
|
-
_context.next = 6;
|
|
31
|
-
return runtime.headers();
|
|
32
|
-
|
|
33
|
-
case 6:
|
|
34
|
-
_context.t3 = _context.sent;
|
|
35
|
-
_context.t4 = (0, _context.t1)(_context.t2, _context.t3);
|
|
36
|
-
|
|
37
|
-
if (!(typeof val === 'function')) {
|
|
38
|
-
_context.next = 14;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
_context.next = 11;
|
|
43
|
-
return val(arg1);
|
|
44
|
-
|
|
45
|
-
case 11:
|
|
46
|
-
_context.t5 = _context.sent;
|
|
47
|
-
_context.next = 15;
|
|
48
|
-
break;
|
|
49
|
-
|
|
50
|
-
case 14:
|
|
51
|
-
_context.t5 = val;
|
|
52
|
-
|
|
53
|
-
case 15:
|
|
54
|
-
_context.t6 = _context.t5;
|
|
55
|
-
return _context.abrupt("return", (0, _context.t0)(_context.t4, _context.t6));
|
|
56
|
-
|
|
57
|
-
case 17:
|
|
58
|
-
case "end":
|
|
59
|
-
return _context.stop();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}, _callee);
|
|
63
|
-
}));
|
|
64
|
-
|
|
65
|
-
return function getHeaders(_x) {
|
|
66
|
-
return _ref.apply(this, arguments);
|
|
67
|
-
};
|
|
68
|
-
}();
|
|
69
|
-
|
|
70
|
-
return function (_ref2) {
|
|
71
|
-
var _opts$fetch, _opts$AbortController;
|
|
72
|
-
|
|
73
|
-
var op = _ref2.op,
|
|
74
|
-
prev = _ref2.prev,
|
|
75
|
-
onDestroy = _ref2.onDestroy;
|
|
16
|
+
return function (_ref) {
|
|
17
|
+
var op = _ref.op,
|
|
18
|
+
prev = _ref.prev,
|
|
19
|
+
onDestroy = _ref.onDestroy;
|
|
76
20
|
var path = op.path,
|
|
77
21
|
input = op.input,
|
|
78
22
|
type = op.type;
|
|
79
23
|
|
|
80
24
|
var _httpRequest = httpRequest({
|
|
25
|
+
runtime: runtime,
|
|
81
26
|
type: type,
|
|
82
27
|
input: input,
|
|
83
28
|
url: url,
|
|
84
|
-
path: path
|
|
85
|
-
transformer: runtime.transformer,
|
|
86
|
-
fetch: getFetch((_opts$fetch = opts.fetch) !== null && _opts$fetch !== void 0 ? _opts$fetch : runtime.fetch),
|
|
87
|
-
AbortController: getAbortController((_opts$AbortController = opts.AbortController) !== null && _opts$AbortController !== void 0 ? _opts$AbortController : runtime.AbortController),
|
|
88
|
-
headers: function headers() {
|
|
89
|
-
return getHeaders({
|
|
90
|
-
op: op
|
|
91
|
-
});
|
|
92
|
-
}
|
|
29
|
+
path: path
|
|
93
30
|
}),
|
|
94
31
|
promise = _httpRequest.promise,
|
|
95
32
|
cancel = _httpRequest.cancel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.34",
|
|
4
4
|
"description": "tRPC Client lib",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
"@babel/runtime": "^7.9.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@trpc/server": "10.0.0-alpha.
|
|
70
|
+
"@trpc/server": "10.0.0-alpha.34"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@trpc/server": "10.0.0-alpha.
|
|
73
|
+
"@trpc/server": "10.0.0-alpha.34"
|
|
74
74
|
},
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "533e9ced4859aa20e72da44a7cdafc95736dd1e5"
|
|
79
79
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { AnyRouter } from '@trpc/server';
|
|
5
5
|
import { TRPCClient as Client } from './internals/TRPCClient';
|
|
6
6
|
|
|
7
|
-
type FlattenRouter<TRouter extends AnyRouter> = {
|
|
7
|
+
export type FlattenRouter<TRouter extends AnyRouter> = {
|
|
8
8
|
[Key in keyof TRouter['_def']['record']]: TRouter['_def']['record'][Key] extends AnyRouter
|
|
9
9
|
? FlattenRouter<TRouter['_def']['record'][Key]>
|
|
10
10
|
: TRouter['_def']['record'][Key];
|