@towns-labs/rpc-connector 2.0.1
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/README.md +7 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/common/index.cjs +9 -0
- package/dist/common/index.d.cts +3 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/index.js +1 -0
- package/dist/index-Cm1mDfJp.d.ts +10 -0
- package/dist/index-Cm1mDfJp.d.ts.map +1 -0
- package/dist/index-DC9u-Yv3.d.cts +10 -0
- package/dist/index-DC9u-Yv3.d.cts.map +1 -0
- package/dist/node/index.cjs +14 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +10 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.d.ts +10 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +13 -0
- package/dist/node/index.js.map +1 -0
- package/dist/web/index.cjs +11 -0
- package/dist/web/index.cjs.map +1 -0
- package/dist/web/index.d.cts +10 -0
- package/dist/web/index.d.cts.map +1 -0
- package/dist/web/index.d.ts +10 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +10 -0
- package/dist/web/index.js.map +1 -0
- package/package.json +76 -0
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @towns-labs/rpc-connector
|
|
2
|
+
|
|
3
|
+
This package is a wrapper around `@connectrpc/connect-node` and `@connectrpc/connect-web`.
|
|
4
|
+
We need this wrapper so we can properly bundle SDK for the web and node, relying on `package.json` exports to solve the correct import path.
|
|
5
|
+
|
|
6
|
+
> [!IMPORTANT]
|
|
7
|
+
> This package require the caller to have `@connectrpc/connect-node` or `@connectrpc/connect-web` installed, depending on the environment.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
var __connectrpc_connect = require("@connectrpc/connect");
|
|
4
|
+
Object.keys(__connectrpc_connect).forEach(function (k) {
|
|
5
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () { return __connectrpc_connect[k]; }
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@connectrpc/connect"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConnectTransportOptions } from "@connectrpc/connect-web";
|
|
2
|
+
|
|
3
|
+
//#region src/common/index.d.ts
|
|
4
|
+
/** Using the web version of the transport options as a common type */
|
|
5
|
+
type ConnectTransportOptions$1 = ConnectTransportOptions;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ConnectTransportOptions$1 as ConnectTransportOptions };
|
|
10
|
+
//# sourceMappingURL=index-Cm1mDfJp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Cm1mDfJp.d.ts","names":[],"sources":["../src/common/index.ts"],"sourcesContent":[],"mappings":";;;;AAKY,KAAA,yBAAA,GAA0B,uBAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConnectTransportOptions } from "@connectrpc/connect-web";
|
|
2
|
+
|
|
3
|
+
//#region src/common/index.d.ts
|
|
4
|
+
/** Using the web version of the transport options as a common type */
|
|
5
|
+
type ConnectTransportOptions$1 = ConnectTransportOptions;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ConnectTransportOptions$1 as ConnectTransportOptions };
|
|
10
|
+
//# sourceMappingURL=index-DC9u-Yv3.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DC9u-Yv3.d.cts","names":[],"sources":["../src/common/index.ts"],"sourcesContent":[],"mappings":";;;;AAKY,KAAA,yBAAA,GAA0B,uBAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_chunk = require('../chunk-CUT6urMc.cjs');
|
|
2
|
+
const __connectrpc_connect_node = require_chunk.__toESM(require("@connectrpc/connect-node"));
|
|
3
|
+
|
|
4
|
+
//#region src/node/index.ts
|
|
5
|
+
function createHttp2ConnectTransport(options) {
|
|
6
|
+
return (0, __connectrpc_connect_node.createConnectTransport)({
|
|
7
|
+
...options,
|
|
8
|
+
httpVersion: "2"
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.createHttp2ConnectTransport = createHttp2ConnectTransport;
|
|
14
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["options: ConnectTransportOptions"],"sources":["../../src/node/index.ts"],"sourcesContent":["import type { Transport } from '@connectrpc/connect'\nimport type { ConnectTransportOptions } from '../common'\nimport { createConnectTransport } from '@connectrpc/connect-node'\n\nexport function createHttp2ConnectTransport(options: ConnectTransportOptions): Transport {\n return createConnectTransport({ ...options, httpVersion: '2' })\n}\n"],"mappings":";;;;AAIA,SAAgB,4BAA4BA,SAA6C;AACrF,QAAO,sDAAuB;EAAE,GAAG;EAAS,aAAa;CAAK,EAAC;AAClE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConnectTransportOptions } from "../index-DC9u-Yv3.cjs";
|
|
2
|
+
import { Transport } from "@connectrpc/connect";
|
|
3
|
+
|
|
4
|
+
//#region src/node/index.d.ts
|
|
5
|
+
declare function createHttp2ConnectTransport(options: ConnectTransportOptions): Transport;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createHttp2ConnectTransport };
|
|
10
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/node/index.ts"],"sourcesContent":[],"mappings":";;;;iBAIgB,2BAAA,UAAqC,0BAA0B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConnectTransportOptions } from "../index-Cm1mDfJp.js";
|
|
2
|
+
import { Transport } from "@connectrpc/connect";
|
|
3
|
+
|
|
4
|
+
//#region src/node/index.d.ts
|
|
5
|
+
declare function createHttp2ConnectTransport(options: ConnectTransportOptions): Transport;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createHttp2ConnectTransport };
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/node/index.ts"],"sourcesContent":[],"mappings":";;;;iBAIgB,2BAAA,UAAqC,0BAA0B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createConnectTransport } from "@connectrpc/connect-node";
|
|
2
|
+
|
|
3
|
+
//#region src/node/index.ts
|
|
4
|
+
function createHttp2ConnectTransport(options) {
|
|
5
|
+
return createConnectTransport({
|
|
6
|
+
...options,
|
|
7
|
+
httpVersion: "2"
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { createHttp2ConnectTransport };
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["options: ConnectTransportOptions"],"sources":["../../src/node/index.ts"],"sourcesContent":["import type { Transport } from '@connectrpc/connect'\nimport type { ConnectTransportOptions } from '../common'\nimport { createConnectTransport } from '@connectrpc/connect-node'\n\nexport function createHttp2ConnectTransport(options: ConnectTransportOptions): Transport {\n return createConnectTransport({ ...options, httpVersion: '2' })\n}\n"],"mappings":";;;AAIA,SAAgB,4BAA4BA,SAA6C;AACrF,QAAO,uBAAuB;EAAE,GAAG;EAAS,aAAa;CAAK,EAAC;AAClE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require_chunk = require('../chunk-CUT6urMc.cjs');
|
|
2
|
+
const __connectrpc_connect_web = require_chunk.__toESM(require("@connectrpc/connect-web"));
|
|
3
|
+
|
|
4
|
+
//#region src/web/index.ts
|
|
5
|
+
function createHttp2ConnectTransport(options) {
|
|
6
|
+
return (0, __connectrpc_connect_web.createConnectTransport)(options);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.createHttp2ConnectTransport = createHttp2ConnectTransport;
|
|
11
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["options: ConnectTransportOptions"],"sources":["../../src/web/index.ts"],"sourcesContent":["import type { Transport } from '@connectrpc/connect'\nimport type { ConnectTransportOptions } from '../common'\nimport { createConnectTransport } from '@connectrpc/connect-web'\n\nexport function createHttp2ConnectTransport(options: ConnectTransportOptions): Transport {\n return createConnectTransport(options)\n}\n"],"mappings":";;;;AAIA,SAAgB,4BAA4BA,SAA6C;AACrF,QAAO,qDAAuB,QAAQ;AACzC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConnectTransportOptions } from "../index-DC9u-Yv3.cjs";
|
|
2
|
+
import { Transport } from "@connectrpc/connect";
|
|
3
|
+
|
|
4
|
+
//#region src/web/index.d.ts
|
|
5
|
+
declare function createHttp2ConnectTransport(options: ConnectTransportOptions): Transport;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createHttp2ConnectTransport };
|
|
10
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/web/index.ts"],"sourcesContent":[],"mappings":";;;;iBAIgB,2BAAA,UAAqC,0BAA0B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConnectTransportOptions } from "../index-Cm1mDfJp.js";
|
|
2
|
+
import { Transport } from "@connectrpc/connect";
|
|
3
|
+
|
|
4
|
+
//#region src/web/index.d.ts
|
|
5
|
+
declare function createHttp2ConnectTransport(options: ConnectTransportOptions): Transport;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createHttp2ConnectTransport };
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/web/index.ts"],"sourcesContent":[],"mappings":";;;;iBAIgB,2BAAA,UAAqC,0BAA0B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createConnectTransport } from "@connectrpc/connect-web";
|
|
2
|
+
|
|
3
|
+
//#region src/web/index.ts
|
|
4
|
+
function createHttp2ConnectTransport(options) {
|
|
5
|
+
return createConnectTransport(options);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createHttp2ConnectTransport };
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["options: ConnectTransportOptions"],"sources":["../../src/web/index.ts"],"sourcesContent":["import type { Transport } from '@connectrpc/connect'\nimport type { ConnectTransportOptions } from '../common'\nimport { createConnectTransport } from '@connectrpc/connect-web'\n\nexport function createHttp2ConnectTransport(options: ConnectTransportOptions): Transport {\n return createConnectTransport(options)\n}\n"],"mappings":";;;AAIA,SAAgB,4BAA4BA,SAA6C;AACrF,QAAO,uBAAuB,QAAQ;AACzC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@towns-labs/rpc-connector",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/node/index.cjs",
|
|
6
|
+
"types": "./dist/node/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsdown",
|
|
9
|
+
"cb": "bun run clean && bun run build",
|
|
10
|
+
"clean": "rm -rf dist",
|
|
11
|
+
"lint": "eslint --format unix ./src --max-warnings=0",
|
|
12
|
+
"lint:fix": "bun run lint --fix",
|
|
13
|
+
"test": "vitest",
|
|
14
|
+
"test:ci": "echo 'CI test skipped'",
|
|
15
|
+
"watch": "tsdown --watch"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@connectrpc/connect": "^2.1.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@bufbuild/protobuf": "^2.9.0",
|
|
22
|
+
"@connectrpc/connect-node": "^2.1.0",
|
|
23
|
+
"@connectrpc/connect-web": "^2.1.0",
|
|
24
|
+
"@types/node": "^20.14.8",
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^8.29.0",
|
|
26
|
+
"@typescript-eslint/parser": "^8.29.0",
|
|
27
|
+
"eslint": "^8.57.1",
|
|
28
|
+
"eslint-import-resolver-typescript": "^4.3.2",
|
|
29
|
+
"eslint-plugin-import-x": "^4.10.2",
|
|
30
|
+
"eslint-plugin-tsdoc": "^0.3.0",
|
|
31
|
+
"tsdown": "^0.12.3",
|
|
32
|
+
"typescript": "~5.8.3",
|
|
33
|
+
"vitest": "^3.2.3"
|
|
34
|
+
},
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/node/index.d.ts",
|
|
38
|
+
"import": {
|
|
39
|
+
"node": "./dist/node/index.js",
|
|
40
|
+
"browser": "./dist/web/index.js",
|
|
41
|
+
"default": "./dist/web/index.js"
|
|
42
|
+
},
|
|
43
|
+
"require": {
|
|
44
|
+
"node": "./dist/node/index.cjs",
|
|
45
|
+
"browser": "./dist/web/index.cjs",
|
|
46
|
+
"default": "./dist/web/index.cjs"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"./common": {
|
|
50
|
+
"types": "./dist/common/index.d.ts",
|
|
51
|
+
"import": "./dist/common/index.js",
|
|
52
|
+
"require": "./dist/common/index.cjs"
|
|
53
|
+
},
|
|
54
|
+
"./package.json": "./package.json"
|
|
55
|
+
},
|
|
56
|
+
"files": [
|
|
57
|
+
"/dist"
|
|
58
|
+
],
|
|
59
|
+
"module": "./dist/node/index.js",
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@connectrpc/connect-node": ">=2.0.0",
|
|
62
|
+
"@connectrpc/connect-web": ">=2.0.0"
|
|
63
|
+
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"@connectrpc/connect-node": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"@connectrpc/connect-web": {
|
|
69
|
+
"optional": true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public"
|
|
74
|
+
},
|
|
75
|
+
"sideEffects": false
|
|
76
|
+
}
|