@secrecy/lib 1.65.0-feat-next15.2 → 1.65.0-feat-next15.3
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/lib/client.js +2 -7
- package/dist/lib/transformer.js +18 -0
- package/dist/types/transformer.d.ts +2 -0
- package/package.json +2 -1
package/dist/lib/client.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { httpBatchLink, loggerLink, createTRPCClient as innerCreateTRPCClient, TRPCClientError, } from '@trpc/client';
|
|
2
|
-
import superjson from 'superjson';
|
|
3
2
|
import { SECRECY_LIB_VERSION } from './versioning.js';
|
|
3
|
+
import { transformer } from './transformer.js';
|
|
4
4
|
export function isTRPCClientError(cause) {
|
|
5
5
|
return cause instanceof TRPCClientError;
|
|
6
6
|
}
|
|
7
|
-
superjson.registerCustom({
|
|
8
|
-
isApplicable: (v) => v instanceof Buffer,
|
|
9
|
-
serialize: (v) => [...v],
|
|
10
|
-
deserialize: (v) => Buffer.from(v),
|
|
11
|
-
}, 'buffer');
|
|
12
7
|
export const createTRPCClient = (opts) => innerCreateTRPCClient({
|
|
13
8
|
links: [
|
|
14
9
|
loggerLink({
|
|
@@ -23,7 +18,7 @@ export const createTRPCClient = (opts) => innerCreateTRPCClient({
|
|
|
23
18
|
},
|
|
24
19
|
}),
|
|
25
20
|
httpBatchLink({
|
|
26
|
-
transformer
|
|
21
|
+
transformer,
|
|
27
22
|
url: opts.apiUrl
|
|
28
23
|
? `${opts.apiUrl}/trpc`
|
|
29
24
|
: 'https://api.secrecy.tech/trpc',
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
import superjson from 'superjson';
|
|
3
|
+
superjson.registerCustom({
|
|
4
|
+
isApplicable: (v) => v instanceof Temporal.PlainDate,
|
|
5
|
+
serialize: (v) => v.toJSON(),
|
|
6
|
+
deserialize: (v) => Temporal.PlainDate.from(v),
|
|
7
|
+
}, 'Temporal.PlainDate');
|
|
8
|
+
superjson.registerCustom({
|
|
9
|
+
isApplicable: (v) => v instanceof Temporal.PlainDateTime,
|
|
10
|
+
serialize: (v) => v.toJSON(),
|
|
11
|
+
deserialize: (v) => Temporal.PlainDateTime.from(v),
|
|
12
|
+
}, 'Temporal.PlainDateTime');
|
|
13
|
+
superjson.registerCustom({
|
|
14
|
+
isApplicable: (v) => v instanceof Buffer,
|
|
15
|
+
serialize: (v) => [...v],
|
|
16
|
+
deserialize: (v) => Buffer.from(v),
|
|
17
|
+
}, 'buffer');
|
|
18
|
+
export const transformer = superjson;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@secrecy/lib",
|
|
3
3
|
"author": "Anonymize <anonymize@gmail.com>",
|
|
4
4
|
"description": "Anonymize Secrecy Library",
|
|
5
|
-
"version": "1.65.0-feat-next15.
|
|
5
|
+
"version": "1.65.0-feat-next15.3",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"typescript": "^5.9.2"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
+
"@js-temporal/polyfill": "^0.5.1",
|
|
77
78
|
"@secrecy/trpc-api-types": "1.33.0-feat-next15.7",
|
|
78
79
|
"@trpc/client": "11.5.0",
|
|
79
80
|
"@trpc/server": "11.5.0",
|