@learncard/network-brain-client 2.2.33 → 2.3.0

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { CreateTRPCProxyClient } from '@trpc/client';
1
+ import { TRPCClient } from '@trpc/client';
2
2
  import type { AppRouter } from '@learncard/network-brain-service';
3
- export type LCNClient = CreateTRPCProxyClient<AppRouter>;
3
+ export type LCNClient = TRPCClient<AppRouter>;
4
4
  export declare const getClient: (url: string, didAuthFunction: (challenge?: string) => Promise<string>) => Promise<LCNClient>;
5
5
  export default getClient;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,qBAAqB,EAAiB,MAAM,cAAc,CAAC;AAC3F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIlE,MAAM,MAAM,SAAS,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAEzD,eAAO,MAAM,SAAS,QACb,MAAM,mBACM,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,KACzD,OAAO,CAAC,SAAS,CA+CnB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,UAAU,EAAiB,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIlE,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AAE9C,eAAO,MAAM,SAAS,QACb,MAAM,mBACM,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,KACzD,OAAO,CAAC,SAAS,CAiDnB,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/network-brain-client",
3
- "version": "2.2.33",
3
+ "version": "2.3.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/brain-client.esm.js",
@@ -11,13 +11,12 @@
11
11
  "devDependencies": {
12
12
  "dts-bundle-generator": "^6.10.0",
13
13
  "esbuild": "^0.16.16",
14
- "@learncard/helpers": "1.1.16",
15
- "@learncard/types": "5.6.14"
14
+ "@learncard/helpers": "1.1.17",
15
+ "@learncard/types": "5.7.0"
16
16
  },
17
17
  "dependencies": {
18
- "@trpc/client": "^10.45.2",
19
- "@trpc/server": "^10.45.2",
20
- "@learncard/network-brain-service": "3.3.32"
18
+ "@trpc/client": "^11.3.0",
19
+ "@learncard/network-brain-service": "3.4.0"
21
20
  },
22
21
  "scripts": {
23
22
  "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.json"
package/src/index.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { RegExpTransformer } from '@learncard/helpers';
2
- import { createTRPCProxyClient, CreateTRPCProxyClient, httpBatchLink } from '@trpc/client';
2
+ import { createTRPCClient, TRPCClient, httpBatchLink } from '@trpc/client';
3
3
  import type { AppRouter } from '@learncard/network-brain-service';
4
4
 
5
5
  import { callbackLink } from './callbackLink';
6
6
 
7
- export type LCNClient = CreateTRPCProxyClient<AppRouter>;
7
+ export type LCNClient = TRPCClient<AppRouter>;
8
8
 
9
9
  export const getClient = async (
10
10
  url: string,
@@ -12,16 +12,17 @@ export const getClient = async (
12
12
  ): Promise<LCNClient> => {
13
13
  let challenges: string[] = [];
14
14
 
15
- const challengeRequester = createTRPCProxyClient<AppRouter>({
16
- transformer: {
17
- input: RegExpTransformer,
18
- output: { serialize: o => o, deserialize: o => o },
19
- },
15
+ const challengeRequester = createTRPCClient<AppRouter>({
20
16
  links: [
21
17
  httpBatchLink({
18
+ methodOverride: 'POST',
22
19
  url,
23
- maxURLLength: 2048,
20
+ maxURLLength: 3072,
24
21
  headers: { Authorization: `Bearer ${await didAuthFunction()}` },
22
+ transformer: {
23
+ input: RegExpTransformer,
24
+ output: { serialize: o => o, deserialize: o => o },
25
+ },
25
26
  }),
26
27
  ],
27
28
  });
@@ -34,23 +35,24 @@ export const getClient = async (
34
35
 
35
36
  getChallenges().then(result => (challenges = result));
36
37
 
37
- const trpc = createTRPCProxyClient<AppRouter>({
38
- transformer: {
39
- input: RegExpTransformer,
40
- output: { serialize: o => o, deserialize: o => o },
41
- },
38
+ const trpc = createTRPCClient<AppRouter>({
42
39
  links: [
43
40
  callbackLink(async () => {
44
41
  challenges = await getChallenges();
45
42
  }),
46
43
  httpBatchLink({
47
- maxURLLength: 2048,
44
+ methodOverride: 'POST',
45
+ maxURLLength: 3072,
48
46
  url,
49
47
  headers: async () => {
50
48
  if (challenges.length === 0) challenges.push(...(await getChallenges()));
51
49
 
52
50
  return { Authorization: `Bearer ${await didAuthFunction(challenges.pop())}` };
53
51
  },
52
+ transformer: {
53
+ input: RegExpTransformer,
54
+ output: { serialize: o => o, deserialize: o => o },
55
+ },
54
56
  }),
55
57
  ],
56
58
  });