@learncard/network-brain-client 2.5.62 → 2.5.63
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/brain-client.cjs.development.cjs +1418 -1315
- package/dist/brain-client.cjs.development.cjs.map +2 -2
- package/dist/brain-client.cjs.production.min.cjs +14 -14
- package/dist/brain-client.cjs.production.min.cjs.map +3 -3
- package/dist/brain-client.esm.js +59 -5
- package/dist/brain-client.esm.js.map +3 -3
- package/dist/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +13 -5
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,UAAU,EAA4B,MAAM,cAAc,CAAC;AACtF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIlE,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,MAAM,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAU5F,eAAO,MAAM,SAAS,GAClB,KAAK,MAAM,EACX,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,EACxD,yBAAyB,sBAAsB,EAC/C,eAAe,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACtC,OAAO,CAAC,SAAS,CAgFnB,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAC1B,KAAK,MAAM,EACX,UAAU,MAAM,EAChB,yBAAyB,sBAAsB,EAC/C,eAAe,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACtC,OAAO,CAAC,SAAS,CA2BnB,CAAC;AAGF,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,KAAG,SAa3C,CAAC;AAEP,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learncard/network-brain-client",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.63",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"author": "Learning Economy Foundation (www.learningeconomy.io)",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@learncard/helpers": "1.
|
|
37
|
-
"@learncard/types": "5.23.
|
|
36
|
+
"@learncard/helpers": "1.7.0",
|
|
37
|
+
"@learncard/types": "5.23.2",
|
|
38
38
|
"dts-bundle-generator": "^6.10.0",
|
|
39
39
|
"esbuild": "^0.27.1",
|
|
40
40
|
"vitest": "4.1.11"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@learncard/network-brain-service": "4.0.
|
|
43
|
+
"@learncard/network-brain-service": "4.0.4",
|
|
44
44
|
"@trpc/client": "11.8.0"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RegExpTransformer } from '@learncard/helpers';
|
|
2
|
-
import { createTRPCClient, TRPCClient, httpBatchLink } from '@trpc/client';
|
|
2
|
+
import { createTRPCClient, TRPCClient, httpBatchLink, splitLink } from '@trpc/client';
|
|
3
3
|
import type { AppRouter } from '@learncard/network-brain-service';
|
|
4
4
|
|
|
5
5
|
import { callbackLink } from './callbackLink';
|
|
@@ -8,6 +8,14 @@ export type LCNClient = TRPCClient<AppRouter>;
|
|
|
8
8
|
|
|
9
9
|
export type GuardianApprovalGetter = () => string | undefined | Promise<string | undefined>;
|
|
10
10
|
|
|
11
|
+
/** Keep size-limited issuance mutations out of unrelated tRPC request batches. */
|
|
12
|
+
const isolatedInboxBatchLink = (options: Parameters<typeof httpBatchLink<AppRouter>>[0]) =>
|
|
13
|
+
splitLink<AppRouter>({
|
|
14
|
+
condition: operation => operation.path === 'inbox.issueBatch',
|
|
15
|
+
true: httpBatchLink({ ...options, maxItems: 1 }),
|
|
16
|
+
false: httpBatchLink(options),
|
|
17
|
+
});
|
|
18
|
+
|
|
11
19
|
export const getClient = async (
|
|
12
20
|
url: string,
|
|
13
21
|
didAuthFunction: (challenge?: string) => Promise<string>,
|
|
@@ -18,7 +26,7 @@ export const getClient = async (
|
|
|
18
26
|
|
|
19
27
|
const challengeRequester = createTRPCClient<AppRouter>({
|
|
20
28
|
links: [
|
|
21
|
-
|
|
29
|
+
isolatedInboxBatchLink({
|
|
22
30
|
methodOverride: 'POST',
|
|
23
31
|
url,
|
|
24
32
|
maxURLLength: 3072,
|
|
@@ -67,7 +75,7 @@ export const getClient = async (
|
|
|
67
75
|
callbackLink(async () => {
|
|
68
76
|
challenges = await getChallenges();
|
|
69
77
|
}),
|
|
70
|
-
|
|
78
|
+
isolatedInboxBatchLink({
|
|
71
79
|
methodOverride: 'POST',
|
|
72
80
|
maxURLLength: 3072,
|
|
73
81
|
url,
|
|
@@ -104,7 +112,7 @@ export const getApiTokenClient = async (
|
|
|
104
112
|
): Promise<LCNClient> => {
|
|
105
113
|
const trpc = createTRPCClient<AppRouter>({
|
|
106
114
|
links: [
|
|
107
|
-
|
|
115
|
+
isolatedInboxBatchLink({
|
|
108
116
|
methodOverride: 'POST',
|
|
109
117
|
url,
|
|
110
118
|
maxURLLength: 3072,
|
|
@@ -134,7 +142,7 @@ export const getApiTokenClient = async (
|
|
|
134
142
|
export const getAnonymousClient = (url: string): LCNClient =>
|
|
135
143
|
createTRPCClient<AppRouter>({
|
|
136
144
|
links: [
|
|
137
|
-
|
|
145
|
+
isolatedInboxBatchLink({
|
|
138
146
|
methodOverride: 'POST',
|
|
139
147
|
url,
|
|
140
148
|
maxURLLength: 3072,
|