@webstudio-is/trpc-interface 0.76.0 → 0.78.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/lib/cjs/shared/client.js +12 -0
- package/lib/shared/client.js +2 -0
- package/package.json +2 -2
- package/src/shared/client.ts +2 -0
package/lib/cjs/shared/client.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var client_exports = {};
|
|
20
30
|
__export(client_exports, {
|
|
@@ -24,12 +34,14 @@ module.exports = __toCommonJS(client_exports);
|
|
|
24
34
|
var import_client = require("@trpc/client");
|
|
25
35
|
var import_shared_router = require("./shared-router");
|
|
26
36
|
var import_trpc_caller_link = require("../trpc-caller-link");
|
|
37
|
+
var import_node_fetch = __toESM(require("node-fetch"), 1);
|
|
27
38
|
const createTrpcProxyServiceClient = (options) => {
|
|
28
39
|
if (options !== void 0) {
|
|
29
40
|
const remoteClient = (0, import_client.createTRPCProxyClient)({
|
|
30
41
|
links: [
|
|
31
42
|
(0, import_client.httpBatchLink)({
|
|
32
43
|
url: options.url,
|
|
44
|
+
fetch: import_node_fetch.default,
|
|
33
45
|
headers: () => ({
|
|
34
46
|
Authorization: options.token,
|
|
35
47
|
// We use this header for SaaS preview service discovery proxy
|
package/lib/shared/client.js
CHANGED
|
@@ -3,12 +3,14 @@ import {
|
|
|
3
3
|
sharedRouter
|
|
4
4
|
} from "./shared-router";
|
|
5
5
|
import { callerLink } from "../trpc-caller-link";
|
|
6
|
+
import fetch from "node-fetch";
|
|
6
7
|
const createTrpcProxyServiceClient = (options) => {
|
|
7
8
|
if (options !== void 0) {
|
|
8
9
|
const remoteClient = createTRPCProxyClient({
|
|
9
10
|
links: [
|
|
10
11
|
httpBatchLink({
|
|
11
12
|
url: options.url,
|
|
13
|
+
fetch,
|
|
12
14
|
headers: () => ({
|
|
13
15
|
Authorization: options.token,
|
|
14
16
|
// We use this header for SaaS preview service discovery proxy
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/trpc-interface",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.0",
|
|
4
4
|
"description": "Webstudio TRPC Interface",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"ts-custom-error": "^3.3.1",
|
|
12
12
|
"uuid": "^9.0.0",
|
|
13
13
|
"zod": "^3.21.4",
|
|
14
|
-
"@webstudio-is/prisma-client": "^0.
|
|
14
|
+
"@webstudio-is/prisma-client": "^0.78.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/node": "^18.11.18",
|
package/src/shared/client.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type SharedRouter,
|
|
6
6
|
} from "./shared-router";
|
|
7
7
|
import { callerLink } from "../trpc-caller-link";
|
|
8
|
+
import fetch from "node-fetch";
|
|
8
9
|
|
|
9
10
|
type SharedClientOptions = {
|
|
10
11
|
url: string;
|
|
@@ -20,6 +21,7 @@ export const createTrpcProxyServiceClient = (
|
|
|
20
21
|
links: [
|
|
21
22
|
httpBatchLink({
|
|
22
23
|
url: options.url,
|
|
24
|
+
fetch: fetch as never,
|
|
23
25
|
headers: () => ({
|
|
24
26
|
Authorization: options.token,
|
|
25
27
|
// We use this header for SaaS preview service discovery proxy
|