@webstudio-is/http-client 0.265.0 → 0.266.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/index.js +10 -7
- package/lib/types/index.d.ts +4 -1
- package/package.json +3 -2
package/lib/index.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { createTRPCUntypedClient, httpBatchLink } from "@trpc/client";
|
|
3
|
-
var loadProjectDataByBuildId = async (params) => {
|
|
4
|
-
const headers = "seviceToken" in params ? { Authorization: params.seviceToken } : { "x-auth-token": params.authToken };
|
|
5
|
-
return await createTrpcClient(params.origin, headers).query(
|
|
6
|
-
"build.loadProjectDataByBuildId",
|
|
7
|
-
{ buildId: params.buildId }
|
|
8
|
-
);
|
|
9
|
-
};
|
|
10
3
|
var createTrpcClient = (origin, headers) => {
|
|
11
4
|
const { sourceOrigin } = parseBuilderUrl(origin);
|
|
12
5
|
const url = new URL("/trpc", sourceOrigin);
|
|
@@ -19,8 +12,18 @@ var createTrpcClient = (origin, headers) => {
|
|
|
19
12
|
]
|
|
20
13
|
});
|
|
21
14
|
};
|
|
15
|
+
var loadProjectDataByBuildId = async (params) => {
|
|
16
|
+
const headers = "seviceToken" in params ? { Authorization: params.seviceToken } : { "x-auth-token": params.authToken };
|
|
17
|
+
return await createTrpcClient(params.origin, {
|
|
18
|
+
...params.headers,
|
|
19
|
+
...headers
|
|
20
|
+
}).query("build.loadProjectDataByBuildId", {
|
|
21
|
+
buildId: params.buildId
|
|
22
|
+
});
|
|
23
|
+
};
|
|
22
24
|
var loadProjectDataByProjectId = async (params) => {
|
|
23
25
|
return await createTrpcClient(params.origin, {
|
|
26
|
+
...params.headers,
|
|
24
27
|
"x-auth-token": params.authToken
|
|
25
28
|
}).query("build.loadProjectDataByProjectId", {
|
|
26
29
|
projectId: params.projectId
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Asset, Breakpoint, DataSource, Deployment, Instance, Page,
|
|
1
|
+
import type { Asset, Breakpoint, DataSource, Deployment, Instance, Page, Prop, Resource, StyleDecl, StyleDeclKey, StyleSource, StyleSourceSelection } from "@webstudio-is/sdk";
|
|
2
|
+
import type { SerializedPages } from "@webstudio-is/project-migrations/pages";
|
|
2
3
|
export type Data = {
|
|
3
4
|
page: Page;
|
|
4
5
|
pages: Array<Page>;
|
|
@@ -25,6 +26,7 @@ export type Data = {
|
|
|
25
26
|
export declare const loadProjectDataByBuildId: (params: {
|
|
26
27
|
buildId: string;
|
|
27
28
|
origin: string;
|
|
29
|
+
headers?: Record<string, string | undefined>;
|
|
28
30
|
} & ({
|
|
29
31
|
seviceToken: string;
|
|
30
32
|
} | {
|
|
@@ -34,6 +36,7 @@ export declare const loadProjectDataByProjectId: (params: {
|
|
|
34
36
|
projectId: string;
|
|
35
37
|
origin: string;
|
|
36
38
|
authToken: string;
|
|
39
|
+
headers?: Record<string, string | undefined>;
|
|
37
40
|
}) => Promise<Data>;
|
|
38
41
|
export declare const parseBuilderUrl: (urlStr: string) => {
|
|
39
42
|
projectId: undefined;
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/http-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.266.0",
|
|
4
4
|
"description": "Webstudio HTTP Client",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@trpc/client": "^10.45.2",
|
|
10
|
-
"@webstudio-is/sdk": "0.
|
|
10
|
+
"@webstudio-is/sdk": "0.266.0",
|
|
11
|
+
"@webstudio-is/project-migrations": "0.266.0"
|
|
11
12
|
},
|
|
12
13
|
"devDependencies": {
|
|
13
14
|
"vitest": "^3.1.2",
|