@trpc/client 10.38.1 → 10.38.2

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,7 +1,7 @@
1
1
  import { observable } from '@trpc/server/observable';
2
2
  import { t as transformResult } from './transformResult-7ab522e6.mjs';
3
3
  import { T as TRPCClientError } from './TRPCClientError-fef6cf44.mjs';
4
- import { r as resolveHTTPLinkOptions, g as getUrl, j as jsonHttpRequester } from './httpUtils-ad76b802.mjs';
4
+ import { r as resolveHTTPLinkOptions, g as getUrl, j as jsonHttpRequester } from './httpUtils-e8fecf0a.mjs';
5
5
 
6
6
  /* eslint-disable @typescript-eslint/no-non-null-assertion */ /**
7
7
  * A function that should never be called unless we messed something up.
@@ -1,7 +1,7 @@
1
1
  import { observable } from '@trpc/server/observable';
2
2
  import { t as transformResult } from './transformResult-82684494.js';
3
3
  import { T as TRPCClientError } from './TRPCClientError-8462a9bf.js';
4
- import { r as resolveHTTPLinkOptions, g as getUrl, j as jsonHttpRequester } from './httpUtils-f23aeadb.js';
4
+ import { r as resolveHTTPLinkOptions, g as getUrl, j as jsonHttpRequester } from './httpUtils-5142e9e1.js';
5
5
 
6
6
  /**
7
7
  * A function that should never be called unless we messed something up.
@@ -3,7 +3,7 @@
3
3
  var observable = require('@trpc/server/observable');
4
4
  var transformResult = require('./transformResult-26a22823.js');
5
5
  var TRPCClientError = require('./TRPCClientError-dffb44e0.js');
6
- var httpUtils = require('./httpUtils-fd6f3ad7.js');
6
+ var httpUtils = require('./httpUtils-b94fce6f.js');
7
7
 
8
8
  /* eslint-disable @typescript-eslint/no-non-null-assertion */ /**
9
9
  * A function that should never be called unless we messed something up.
@@ -114,10 +114,12 @@ async function fetchHTTPResponse(opts, ac) {
114
114
  function httpRequest(opts) {
115
115
  const ac = opts.AbortController ? new opts.AbortController() : null;
116
116
  const meta = {};
117
+ let done = false;
117
118
  const promise = new Promise((resolve, reject) => {
118
119
  fetchHTTPResponse(opts, ac)
119
120
  .then((_res) => {
120
121
  meta.response = _res;
122
+ done = true;
121
123
  return _res.json();
122
124
  })
123
125
  .then((json) => {
@@ -128,11 +130,14 @@ function httpRequest(opts) {
128
130
  });
129
131
  })
130
132
  .catch((err) => {
133
+ done = true;
131
134
  reject(TRPCClientError.from(err, { meta }));
132
135
  });
133
136
  });
134
137
  const cancel = () => {
135
- ac?.abort();
138
+ if (!done) {
139
+ ac?.abort();
140
+ }
136
141
  };
137
142
  return { promise, cancel };
138
143
  }
@@ -113,9 +113,11 @@ async function fetchHTTPResponse(opts, ac) {
113
113
  function httpRequest(opts) {
114
114
  const ac = opts.AbortController ? new opts.AbortController() : null;
115
115
  const meta = {};
116
+ let done = false;
116
117
  const promise = new Promise((resolve, reject)=>{
117
118
  fetchHTTPResponse(opts, ac).then((_res)=>{
118
119
  meta.response = _res;
120
+ done = true;
119
121
  return _res.json();
120
122
  }).then((json)=>{
121
123
  meta.responseJSON = json;
@@ -124,13 +126,16 @@ function httpRequest(opts) {
124
126
  meta
125
127
  });
126
128
  }).catch((err)=>{
129
+ done = true;
127
130
  reject(TRPCClientError.TRPCClientError.from(err, {
128
131
  meta
129
132
  }));
130
133
  });
131
134
  });
132
135
  const cancel = ()=>{
133
- ac?.abort();
136
+ if (!done) {
137
+ ac?.abort();
138
+ }
134
139
  };
135
140
  return {
136
141
  promise,
@@ -111,9 +111,11 @@ async function fetchHTTPResponse(opts, ac) {
111
111
  function httpRequest(opts) {
112
112
  const ac = opts.AbortController ? new opts.AbortController() : null;
113
113
  const meta = {};
114
+ let done = false;
114
115
  const promise = new Promise((resolve, reject)=>{
115
116
  fetchHTTPResponse(opts, ac).then((_res)=>{
116
117
  meta.response = _res;
118
+ done = true;
117
119
  return _res.json();
118
120
  }).then((json)=>{
119
121
  meta.responseJSON = json;
@@ -122,13 +124,16 @@ function httpRequest(opts) {
122
124
  meta
123
125
  });
124
126
  }).catch((err)=>{
127
+ done = true;
125
128
  reject(TRPCClientError.from(err, {
126
129
  meta
127
130
  }));
128
131
  });
129
132
  });
130
133
  const cancel = ()=>{
131
- ac?.abort();
134
+ if (!done) {
135
+ ac?.abort();
136
+ }
132
137
  };
133
138
  return {
134
139
  promise,
package/dist/index.js CHANGED
@@ -6,8 +6,8 @@ var observable = require('@trpc/server/observable');
6
6
  var links_splitLink = require('./splitLink-f29e84be.js');
7
7
  var TRPCClientError = require('./TRPCClientError-dffb44e0.js');
8
8
  var shared = require('@trpc/server/shared');
9
- var httpUtils = require('./httpUtils-fd6f3ad7.js');
10
- var links_httpBatchLink = require('./httpBatchLink-3d721a5c.js');
9
+ var httpUtils = require('./httpUtils-b94fce6f.js');
10
+ var links_httpBatchLink = require('./httpBatchLink-8b963505.js');
11
11
  var links_httpLink = require('./links/httpLink.js');
12
12
  var links_loggerLink = require('./links/loggerLink.js');
13
13
  var links_wsLink = require('./links/wsLink.js');
package/dist/index.mjs CHANGED
@@ -4,10 +4,10 @@ export { s as splitLink } from './splitLink-4c75f7be.mjs';
4
4
  import { T as TRPCClientError } from './TRPCClientError-fef6cf44.mjs';
5
5
  export { T as TRPCClientError } from './TRPCClientError-fef6cf44.mjs';
6
6
  import { createFlatProxy, createRecursiveProxy } from '@trpc/server/shared';
7
- import { f as fetchHTTPResponse, g as getUrl, a as getBody$1, h as httpRequest } from './httpUtils-ad76b802.mjs';
8
- export { b as getFetch } from './httpUtils-ad76b802.mjs';
9
- import { c as createHTTPBatchLink } from './httpBatchLink-520db465.mjs';
10
- export { h as httpBatchLink } from './httpBatchLink-520db465.mjs';
7
+ import { f as fetchHTTPResponse, g as getUrl, a as getBody$1, h as httpRequest } from './httpUtils-e8fecf0a.mjs';
8
+ export { b as getFetch } from './httpUtils-e8fecf0a.mjs';
9
+ import { c as createHTTPBatchLink } from './httpBatchLink-64296887.mjs';
10
+ export { h as httpBatchLink } from './httpBatchLink-64296887.mjs';
11
11
  import { httpLinkFactory } from './links/httpLink.mjs';
12
12
  export { httpLink, httpLinkFactory } from './links/httpLink.mjs';
13
13
  export { loggerLink } from './links/loggerLink.mjs';
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var links_httpBatchLink = require('../httpBatchLink-3d721a5c.js');
6
- require('../httpUtils-fd6f3ad7.js');
5
+ var links_httpBatchLink = require('../httpBatchLink-8b963505.js');
6
+ require('../httpUtils-b94fce6f.js');
7
7
  require('@trpc/server/observable');
8
8
  require('../transformResult-26a22823.js');
9
9
  require('../TRPCClientError-dffb44e0.js');
@@ -1,5 +1,5 @@
1
- export { h as httpBatchLink } from '../httpBatchLink-520db465.mjs';
2
- import '../httpUtils-ad76b802.mjs';
1
+ export { h as httpBatchLink } from '../httpBatchLink-64296887.mjs';
2
+ import '../httpUtils-e8fecf0a.mjs';
3
3
  import '@trpc/server/observable';
4
4
  import '../transformResult-7ab522e6.mjs';
5
5
  import '../TRPCClientError-fef6cf44.mjs';
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var observable = require('@trpc/server/observable');
6
6
  var transformResult = require('../transformResult-26a22823.js');
7
7
  var TRPCClientError = require('../TRPCClientError-dffb44e0.js');
8
- var httpUtils = require('../httpUtils-fd6f3ad7.js');
8
+ var httpUtils = require('../httpUtils-b94fce6f.js');
9
9
 
10
10
  function httpLinkFactory(factoryOpts) {
11
11
  return (opts)=>{
@@ -1,7 +1,7 @@
1
1
  import { observable } from '@trpc/server/observable';
2
2
  import { t as transformResult } from '../transformResult-7ab522e6.mjs';
3
3
  import { T as TRPCClientError } from '../TRPCClientError-fef6cf44.mjs';
4
- import { r as resolveHTTPLinkOptions, j as jsonHttpRequester } from '../httpUtils-ad76b802.mjs';
4
+ import { r as resolveHTTPLinkOptions, j as jsonHttpRequester } from '../httpUtils-e8fecf0a.mjs';
5
5
 
6
6
  function httpLinkFactory(factoryOpts) {
7
7
  return (opts)=>{
@@ -1 +1 @@
1
- {"version":3,"file":"httpUtils.d.ts","sourceRoot":"","sources":["../../../src/links/internals/httpUtils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AC;AAE9B,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MAgBpB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,OAMrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,CACtB,IAAI,EAAE,sBAAsB,GAAG;IAC7B,OAAO,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACnD,KACE,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAElC,eAAO,MAAM,iBAAiB,EAAE,SAO/B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAC7C,sBAAsB,GAAG;IACvB,OAAO,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAClD,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC,CAAC;AAEJ,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,kBAAkB,EACxB,EAAE,CAAC,EAAE,4BAA4B,GAAG,IAAI,0BA0BzC;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,kBAAkB,GACvB,gBAAgB,CAAC,UAAU,CAAC,CA8B9B"}
@@ -0,0 +1 @@
1
+ export * from '../../dist/links/formDataLink';
@@ -0,0 +1 @@
1
+ module.exports = require('../../dist/links/formDataLink');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/client",
3
- "version": "10.38.1",
3
+ "version": "10.38.2",
4
4
  "description": "The tRPC client library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "scripts": {
25
25
  "build": "rollup --config rollup.config.ts --configPlugin rollup-plugin-swc3",
26
26
  "dev": "pnpm build --watch",
27
- "codegen:entrypoints": "tsx entrypoints.script.ts",
27
+ "codegen-entrypoints": "tsx entrypoints.script.ts",
28
28
  "lint": "eslint --cache --ext \".js,.ts,.tsx\" --ignore-path ../../.gitignore --report-unused-disable-directives src",
29
29
  "ts-watch": "tsc --project tsconfig.watch.json"
30
30
  },
@@ -76,11 +76,11 @@
76
76
  "!**/*.test.*"
77
77
  ],
78
78
  "peerDependencies": {
79
- "@trpc/server": "10.38.1"
79
+ "@trpc/server": "10.38.2"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@testing-library/dom": "^9.0.0",
83
- "@trpc/server": "10.38.1",
83
+ "@trpc/server": "10.38.2",
84
84
  "@types/isomorphic-fetch": "^0.0.36",
85
85
  "@types/node": "^18.16.16",
86
86
  "eslint": "^8.40.0",
@@ -98,5 +98,5 @@
98
98
  "funding": [
99
99
  "https://trpc.io/sponsor"
100
100
  ],
101
- "gitHead": "c48811ab55efbec8d1a9db778c46be2dc5c25818"
101
+ "gitHead": "3ae64cc8b8c73306d6b022dec9eae769b246b0fb"
102
102
  }
@@ -180,10 +180,12 @@ export function httpRequest(
180
180
  const ac = opts.AbortController ? new opts.AbortController() : null;
181
181
  const meta = {} as HTTPResult['meta'];
182
182
 
183
+ let done = false;
183
184
  const promise = new Promise<HTTPResult>((resolve, reject) => {
184
185
  fetchHTTPResponse(opts, ac)
185
186
  .then((_res) => {
186
187
  meta.response = _res;
188
+ done = true;
187
189
  return _res.json();
188
190
  })
189
191
  .then((json) => {
@@ -194,11 +196,14 @@ export function httpRequest(
194
196
  });
195
197
  })
196
198
  .catch((err) => {
199
+ done = true;
197
200
  reject(TRPCClientError.from(err, { meta }));
198
201
  });
199
202
  });
200
203
  const cancel = () => {
201
- ac?.abort();
204
+ if (!done) {
205
+ ac?.abort();
206
+ }
202
207
  };
203
208
  return { promise, cancel };
204
209
  }
@@ -1 +0,0 @@
1
- export * from '../../dist/links/shared';
@@ -1 +0,0 @@
1
- module.exports = require('../../dist/links/shared');
@@ -1 +0,0 @@
1
- export * from '../../dist/links/ssrLink';
@@ -1 +0,0 @@
1
- module.exports = require('../../dist/links/ssrLink');