@trpc/next 10.0.0-alpha.4 → 10.0.0-alpha.8
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/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +8 -8
- package/src/withTRPC.tsx +2 -2
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ function withTRPC(opts) {
|
|
|
91
91
|
if (AppOrPage.getInitialProps || opts.ssr) {
|
|
92
92
|
WithTRPC.getInitialProps = /*#__PURE__*/function () {
|
|
93
93
|
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(appOrPageCtx) {
|
|
94
|
-
var _opts$responseMeta
|
|
94
|
+
var _opts$responseMeta;
|
|
95
95
|
|
|
96
96
|
var AppTree, isApp, ctx, pageProps, _originalProps$pagePr, originalProps, originalPageProps, getAppTreeProps, config, trpcClient, queryClient, trpcProp, prepassProps, dehydratedCache, dehydratedCacheWithErrors, appTreeProps, meta, _i, _Object$entries, _Object$entries$_i, key, value, _ctx$res;
|
|
97
97
|
|
|
@@ -195,16 +195,16 @@ function withTRPC(opts) {
|
|
|
195
195
|
|
|
196
196
|
pageProps.trpcState = opts.transformer ? opts.transformer.serialize(dehydratedCacheWithErrors) : dehydratedCacheWithErrors;
|
|
197
197
|
appTreeProps = getAppTreeProps(pageProps);
|
|
198
|
-
meta = (_opts$responseMeta =
|
|
198
|
+
meta = ((_opts$responseMeta = opts.responseMeta) === null || _opts$responseMeta === void 0 ? void 0 : _opts$responseMeta.call(opts, {
|
|
199
199
|
ctx: ctx,
|
|
200
200
|
clientErrors: [].concat(_toConsumableArray__default["default"](dehydratedCache.queries), _toConsumableArray__default["default"](dehydratedCache.mutations)).map(function (v) {
|
|
201
201
|
return v.state.error;
|
|
202
202
|
}).flatMap(function (err) {
|
|
203
203
|
return err instanceof Error && err.name === 'TRPCClientError' ? [err] : [];
|
|
204
204
|
})
|
|
205
|
-
}))
|
|
205
|
+
})) || {};
|
|
206
206
|
|
|
207
|
-
for (_i = 0, _Object$entries = Object.entries(meta); _i < _Object$entries.length; _i++) {
|
|
207
|
+
for (_i = 0, _Object$entries = Object.entries(meta.headers || {}); _i < _Object$entries.length; _i++) {
|
|
208
208
|
_Object$entries$_i = _slicedToArray__default["default"](_Object$entries[_i], 2), key = _Object$entries$_i[0], value = _Object$entries$_i[1];
|
|
209
209
|
|
|
210
210
|
if (typeof value === 'string') {
|
package/dist/index.mjs
CHANGED
|
@@ -77,7 +77,7 @@ function withTRPC(opts) {
|
|
|
77
77
|
if (AppOrPage.getInitialProps || opts.ssr) {
|
|
78
78
|
WithTRPC.getInitialProps = /*#__PURE__*/function () {
|
|
79
79
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(appOrPageCtx) {
|
|
80
|
-
var _opts$responseMeta
|
|
80
|
+
var _opts$responseMeta;
|
|
81
81
|
|
|
82
82
|
var AppTree, isApp, ctx, pageProps, _originalProps$pagePr, originalProps, originalPageProps, getAppTreeProps, config, trpcClient, queryClient, trpcProp, prepassProps, dehydratedCache, dehydratedCacheWithErrors, appTreeProps, meta, _i, _Object$entries, _Object$entries$_i, key, value, _ctx$res;
|
|
83
83
|
|
|
@@ -181,16 +181,16 @@ function withTRPC(opts) {
|
|
|
181
181
|
|
|
182
182
|
pageProps.trpcState = opts.transformer ? opts.transformer.serialize(dehydratedCacheWithErrors) : dehydratedCacheWithErrors;
|
|
183
183
|
appTreeProps = getAppTreeProps(pageProps);
|
|
184
|
-
meta = (_opts$responseMeta =
|
|
184
|
+
meta = ((_opts$responseMeta = opts.responseMeta) === null || _opts$responseMeta === void 0 ? void 0 : _opts$responseMeta.call(opts, {
|
|
185
185
|
ctx: ctx,
|
|
186
186
|
clientErrors: [].concat(_toConsumableArray(dehydratedCache.queries), _toConsumableArray(dehydratedCache.mutations)).map(function (v) {
|
|
187
187
|
return v.state.error;
|
|
188
188
|
}).flatMap(function (err) {
|
|
189
189
|
return err instanceof Error && err.name === 'TRPCClientError' ? [err] : [];
|
|
190
190
|
})
|
|
191
|
-
}))
|
|
191
|
+
})) || {};
|
|
192
192
|
|
|
193
|
-
for (_i = 0, _Object$entries = Object.entries(meta); _i < _Object$entries.length; _i++) {
|
|
193
|
+
for (_i = 0, _Object$entries = Object.entries(meta.headers || {}); _i < _Object$entries.length; _i++) {
|
|
194
194
|
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], value = _Object$entries$_i[1];
|
|
195
195
|
|
|
196
196
|
if (typeof value === 'string') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/next",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.8",
|
|
4
4
|
"description": "tRPC Next lib",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@trpc/client": "10.0.0-alpha.
|
|
38
|
-
"@trpc/react": "10.0.0-alpha.
|
|
39
|
-
"@trpc/server": "10.0.0-alpha.
|
|
37
|
+
"@trpc/client": "10.0.0-alpha.8",
|
|
38
|
+
"@trpc/react": "10.0.0-alpha.8",
|
|
39
|
+
"@trpc/server": "10.0.0-alpha.8",
|
|
40
40
|
"next": "*",
|
|
41
41
|
"react": ">=16.8.0",
|
|
42
42
|
"react-dom": ">=16.8.0",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"react-ssr-prepass": "^1.5.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@trpc/client": "10.0.0-alpha.
|
|
51
|
-
"@trpc/react": "10.0.0-alpha.
|
|
52
|
-
"@trpc/server": "10.0.0-alpha.
|
|
50
|
+
"@trpc/client": "10.0.0-alpha.8",
|
|
51
|
+
"@trpc/react": "10.0.0-alpha.8",
|
|
52
|
+
"@trpc/server": "10.0.0-alpha.8",
|
|
53
53
|
"@types/express": "^4.17.12",
|
|
54
54
|
"express": "^4.17.1",
|
|
55
55
|
"next": "^12.0.1",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "e5ded22d38809f6de68df26ed069ca3cf93bb368"
|
|
65
65
|
}
|
package/src/withTRPC.tsx
CHANGED
|
@@ -230,9 +230,9 @@ export function withTRPC<TRouter extends AnyRouter>(
|
|
|
230
230
|
? [err as TRPCClientError<TRouter>]
|
|
231
231
|
: [],
|
|
232
232
|
),
|
|
233
|
-
})
|
|
233
|
+
}) || {};
|
|
234
234
|
|
|
235
|
-
for (const [key, value] of Object.entries(meta)) {
|
|
235
|
+
for (const [key, value] of Object.entries(meta.headers || {})) {
|
|
236
236
|
if (typeof value === 'string') {
|
|
237
237
|
ctx.res?.setHeader(key, value);
|
|
238
238
|
}
|