@tailorkit/client-platform 0.1.0-beta.13 → 0.1.0-beta.14
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/{chunk-QGZU6HXU.js → chunk-S6GBD6TR.js} +24 -6
- package/dist/chunk-W4IZZ2X7.js +103 -0
- package/dist/client/client/client.gen.d.ts +1 -1
- package/dist/client/client/index.d.ts +10 -10
- package/dist/client/client/types.gen.d.ts +4 -4
- package/dist/client/client/utils.gen.d.ts +2 -2
- package/dist/client/client.gen.d.ts +2 -2
- package/dist/client/core/bodySerializer.gen.d.ts +1 -1
- package/dist/client/core/serverSentEvents.gen.d.ts +1 -1
- package/dist/client/core/types.gen.d.ts +2 -2
- package/dist/client/core/utils.gen.d.ts +1 -1
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +7 -3
- package/dist/client/sdk.gen.d.ts +5 -3
- package/dist/client/sdk.gen.js +7 -3
- package/dist/client/types.gen.d.ts +88 -16
- package/dist/client.d.ts +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +19 -3
- package/dist/preview.d.ts +89 -0
- package/dist/preview.js +14 -0
- package/package.json +7 -6
- package/dist/preview-tunnel.d.ts +0 -3
- package/dist/preview-tunnel.js +0 -9
|
@@ -111,10 +111,6 @@ var previewStart = (options) => (options.client ?? client).post({
|
|
|
111
111
|
...options.headers
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
|
-
var previewResolve = (options) => (options.client ?? client).get({
|
|
115
|
-
url: "/preview/{sessionId}",
|
|
116
|
-
...options
|
|
117
|
-
});
|
|
118
114
|
var previewStop = (options) => (options.client ?? client).post({
|
|
119
115
|
url: "/preview/{sessionId}/stop",
|
|
120
116
|
...options,
|
|
@@ -123,6 +119,26 @@ var previewStop = (options) => (options.client ?? client).post({
|
|
|
123
119
|
...options.headers
|
|
124
120
|
}
|
|
125
121
|
});
|
|
122
|
+
var previewInvitation = (options) => (options.client ?? client).get({
|
|
123
|
+
url: "/preview/shares/{shareId}",
|
|
124
|
+
...options
|
|
125
|
+
});
|
|
126
|
+
var previewAccept = (options) => (options.client ?? client).post({
|
|
127
|
+
url: "/preview/shares/{shareId}/accept",
|
|
128
|
+
...options,
|
|
129
|
+
headers: {
|
|
130
|
+
"Content-Type": "application/json",
|
|
131
|
+
...options.headers
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
var previewAccepted = (options) => (options.client ?? client).post({
|
|
135
|
+
url: "/preview/grants/resolve",
|
|
136
|
+
...options,
|
|
137
|
+
headers: {
|
|
138
|
+
"Content-Type": "application/json",
|
|
139
|
+
...options.headers
|
|
140
|
+
}
|
|
141
|
+
});
|
|
126
142
|
|
|
127
143
|
export {
|
|
128
144
|
appsList,
|
|
@@ -141,6 +157,8 @@ export {
|
|
|
141
157
|
deploymentsGet,
|
|
142
158
|
deploymentsPublish,
|
|
143
159
|
previewStart,
|
|
144
|
-
|
|
145
|
-
|
|
160
|
+
previewStop,
|
|
161
|
+
previewInvitation,
|
|
162
|
+
previewAccept,
|
|
163
|
+
previewAccepted
|
|
146
164
|
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// src/preview.ts
|
|
2
|
+
import { createORPCClient } from "@orpc/client";
|
|
3
|
+
import { RPCLink } from "@orpc/client/websocket";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
var identifier = z.string().regex(/^[A-Za-z0-9_-]{1,128}$/u);
|
|
6
|
+
var base64 = z.string().max(4 * Math.ceil(256 * 1024 / 3)).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u);
|
|
7
|
+
var hasControlCharacters = (value) => [...value].some((character) => (character.codePointAt(0) ?? 0) < 32);
|
|
8
|
+
var previewFileManifestSchema = z.object({
|
|
9
|
+
path: z.string().min(1).max(1024).refine((path) => new TextEncoder().encode(path).byteLength <= 1024, {
|
|
10
|
+
message: "Preview path exceeds 1024 UTF-8 bytes"
|
|
11
|
+
}),
|
|
12
|
+
contentType: z.string().min(1).max(255).refine((contentType) => !/[\r\n]/u.test(contentType), {
|
|
13
|
+
message: "Invalid preview content type"
|
|
14
|
+
}),
|
|
15
|
+
size: z.number().int().min(0).max(1024 * 1024),
|
|
16
|
+
chunks: z.number().int().min(0).max(4),
|
|
17
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/u)
|
|
18
|
+
});
|
|
19
|
+
var previewBuildManifestSchema = z.object({
|
|
20
|
+
files: z.array(previewFileManifestSchema).max(100)
|
|
21
|
+
}).superRefine((manifest, context) => {
|
|
22
|
+
const paths = /* @__PURE__ */ new Set();
|
|
23
|
+
let total = 0;
|
|
24
|
+
for (const [index, file] of manifest.files.entries()) {
|
|
25
|
+
if (file.path.startsWith("/") || file.path.includes("\\") || file.path.split("/").some((part) => !part || part === "." || part === "..") || hasControlCharacters(file.path) || paths.has(file.path)) {
|
|
26
|
+
context.addIssue({
|
|
27
|
+
code: "custom",
|
|
28
|
+
message: "Invalid or duplicate preview path",
|
|
29
|
+
path: ["files", index, "path"]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (file.chunks !== Math.ceil(file.size / (256 * 1024))) {
|
|
33
|
+
context.addIssue({
|
|
34
|
+
code: "custom",
|
|
35
|
+
message: "Invalid preview chunk count",
|
|
36
|
+
path: ["files", index, "chunks"]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
paths.add(file.path);
|
|
40
|
+
total += file.size;
|
|
41
|
+
}
|
|
42
|
+
if (!paths.has("client.js")) context.addIssue({ code: "custom", message: "Missing client.js" });
|
|
43
|
+
if (total > 10 * 1024 * 1024)
|
|
44
|
+
context.addIssue({ code: "custom", message: "Preview build exceeds 10 MiB" });
|
|
45
|
+
});
|
|
46
|
+
var previewEventSchema = z.discriminatedUnion("type", [
|
|
47
|
+
z.object({
|
|
48
|
+
type: z.literal("begin"),
|
|
49
|
+
buildId: identifier,
|
|
50
|
+
revision: z.number().int().positive(),
|
|
51
|
+
manifest: previewBuildManifestSchema
|
|
52
|
+
}),
|
|
53
|
+
z.object({
|
|
54
|
+
type: z.literal("chunk"),
|
|
55
|
+
revision: z.number().int().positive(),
|
|
56
|
+
fileIndex: z.number().int().min(0).max(99),
|
|
57
|
+
chunkIndex: z.number().int().min(0).max(3),
|
|
58
|
+
base64
|
|
59
|
+
}),
|
|
60
|
+
z.object({ type: z.literal("complete"), revision: z.number().int().positive() }),
|
|
61
|
+
z.object({ type: z.literal("ended") })
|
|
62
|
+
]);
|
|
63
|
+
var previewMetadataSchema = z.object({
|
|
64
|
+
sessionId: z.uuid(),
|
|
65
|
+
expiresAt: z.string().min(1),
|
|
66
|
+
websocketUrl: z.url(),
|
|
67
|
+
token: z.string().min(1)
|
|
68
|
+
});
|
|
69
|
+
var beginInput = z.object({ manifest: previewBuildManifestSchema });
|
|
70
|
+
var uploadInput = z.object({
|
|
71
|
+
buildId: identifier,
|
|
72
|
+
fileIndex: z.number().int().min(0).max(99),
|
|
73
|
+
chunkIndex: z.number().int().min(0).max(3),
|
|
74
|
+
base64
|
|
75
|
+
});
|
|
76
|
+
var buildIdOutput = z.object({ buildId: identifier });
|
|
77
|
+
var acceptedOutput = z.object({ accepted: z.literal(true) });
|
|
78
|
+
var commitOutput = z.object({ revision: z.number().int().positive() });
|
|
79
|
+
function createPreviewWebSocketClient(websocket) {
|
|
80
|
+
const rpc = createORPCClient(new RPCLink({ websocket }));
|
|
81
|
+
return {
|
|
82
|
+
beginBuild: async (input) => buildIdOutput.parse(await rpc.beginBuild(beginInput.parse(input))),
|
|
83
|
+
uploadChunk: async (input) => acceptedOutput.parse(await rpc.uploadChunk(uploadInput.parse(input))),
|
|
84
|
+
commitBuild: async (input) => commitOutput.parse(await rpc.commitBuild({ buildId: identifier.parse(input.buildId) })),
|
|
85
|
+
heartbeat: async () => acceptedOutput.parse(await rpc.heartbeat()),
|
|
86
|
+
subscribe: async () => {
|
|
87
|
+
const stream = await rpc.subscribe();
|
|
88
|
+
return (async function* () {
|
|
89
|
+
for await (const value of stream) {
|
|
90
|
+
yield previewEventSchema.parse(value);
|
|
91
|
+
}
|
|
92
|
+
})();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export {
|
|
98
|
+
previewFileManifestSchema,
|
|
99
|
+
previewBuildManifestSchema,
|
|
100
|
+
previewEventSchema,
|
|
101
|
+
previewMetadataSchema,
|
|
102
|
+
createPreviewWebSocketClient
|
|
103
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Client, Config } from "./types.gen";
|
|
1
|
+
import type { Client, Config } from "./types.gen.js";
|
|
2
2
|
export declare const createClient: (config?: Config) => Client;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export type { Auth } from "../core/auth.gen";
|
|
2
|
-
export type { QuerySerializerOptions } from "../core/bodySerializer.gen";
|
|
3
|
-
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from "../core/bodySerializer.gen";
|
|
4
|
-
export { buildClientParams } from "../core/params.gen";
|
|
5
|
-
export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen";
|
|
6
|
-
export type { ServerSentEventsResult } from "../core/serverSentEvents.gen";
|
|
7
|
-
export type { ClientMeta } from "../core/types.gen";
|
|
8
|
-
export { createClient } from "./client.gen";
|
|
9
|
-
export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from "./types.gen";
|
|
10
|
-
export { createConfig, mergeHeaders } from "./utils.gen";
|
|
1
|
+
export type { Auth } from "../core/auth.gen.js";
|
|
2
|
+
export type { QuerySerializerOptions } from "../core/bodySerializer.gen.js";
|
|
3
|
+
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from "../core/bodySerializer.gen.js";
|
|
4
|
+
export { buildClientParams } from "../core/params.gen.js";
|
|
5
|
+
export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen.js";
|
|
6
|
+
export type { ServerSentEventsResult } from "../core/serverSentEvents.gen.js";
|
|
7
|
+
export type { ClientMeta } from "../core/types.gen.js";
|
|
8
|
+
export { createClient } from "./client.gen.js";
|
|
9
|
+
export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from "./types.gen.js";
|
|
10
|
+
export { createConfig, mergeHeaders } from "./utils.gen.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Auth } from "../core/auth.gen";
|
|
2
|
-
import type { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen";
|
|
3
|
-
import type { Client as CoreClient, Config as CoreConfig } from "../core/types.gen";
|
|
4
|
-
import type { Middleware } from "./utils.gen";
|
|
1
|
+
import type { Auth } from "../core/auth.gen.js";
|
|
2
|
+
import type { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen.js";
|
|
3
|
+
import type { Client as CoreClient, Config as CoreConfig } from "../core/types.gen.js";
|
|
4
|
+
import type { Middleware } from "./utils.gen.js";
|
|
5
5
|
export type ResponseStyle = "data" | "fields";
|
|
6
6
|
export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, "body" | "headers" | "method">, CoreConfig {
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { QuerySerializerOptions } from "../core/bodySerializer.gen";
|
|
2
|
-
import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen";
|
|
1
|
+
import type { QuerySerializerOptions } from "../core/bodySerializer.gen.js";
|
|
2
|
+
import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen.js";
|
|
3
3
|
export declare const createQuerySerializer: <T = unknown>({ parameters, ...args }?: QuerySerializerOptions) => ((queryParams: T) => string);
|
|
4
4
|
/**
|
|
5
5
|
* Infers parseAs value from provided Content-Type header.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Client, type ClientOptions, type Config } from "./client";
|
|
2
|
-
import type { ClientOptions as ClientOptions2 } from "./types.gen";
|
|
1
|
+
import { type Client, type ClientOptions, type Config } from "./client/index.js";
|
|
2
|
+
import type { ClientOptions as ClientOptions2 } from "./types.gen.js";
|
|
3
3
|
/**
|
|
4
4
|
* The `createClientConfig()` function will be called on client initialization
|
|
5
5
|
* and the returned object will become the client's initial configuration.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArrayStyle, ObjectStyle, SerializerOptions } from "./pathSerializer.gen";
|
|
1
|
+
import type { ArrayStyle, ObjectStyle, SerializerOptions } from "./pathSerializer.gen.js";
|
|
2
2
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
3
3
|
export type BodySerializer = (body: unknown) => unknown;
|
|
4
4
|
type QuerySerializerOptionsObject = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config } from "./types.gen";
|
|
1
|
+
import type { Config } from "./types.gen.js";
|
|
2
2
|
export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, "method"> & Pick<Config, "method" | "responseTransformer" | "responseValidator"> & {
|
|
3
3
|
/**
|
|
4
4
|
* Fetch API implementation. You can use this option to provide a custom
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Auth, AuthToken } from "./auth.gen";
|
|
2
|
-
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.gen";
|
|
1
|
+
import type { Auth, AuthToken } from "./auth.gen.js";
|
|
2
|
+
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.gen.js";
|
|
3
3
|
export type HttpMethod = "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
4
4
|
export type Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
5
5
|
/**
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { appsCreate, appsDelete, appsDeploy, appsGet, appsList, appsUpdate, cliAuthApprove, cliAuthDeny, cliAuthPoll, cliAuthStart, cliAuthVerifyToken, deploymentsCreate, deploymentsGet, deploymentsList, deploymentsPublish, type Options,
|
|
2
|
-
export type { AppsCreateData, AppsCreateResponse, AppsCreateResponses, AppsDeleteData, AppsDeleteResponse, AppsDeleteResponses, AppsDeployData, AppsDeployResponse, AppsDeployResponses, AppsGetData, AppsGetResponse, AppsGetResponses, AppsListData, AppsListResponse, AppsListResponses, AppsUpdateData, AppsUpdateResponse, AppsUpdateResponses, CliAuthApproveData, CliAuthApproveResponse, CliAuthApproveResponses, CliAuthDenyData, CliAuthDenyResponse, CliAuthDenyResponses, CliAuthPollData, CliAuthPollResponse, CliAuthPollResponses, CliAuthStartData, CliAuthStartResponse, CliAuthStartResponses, CliAuthVerifyTokenData, CliAuthVerifyTokenResponse, CliAuthVerifyTokenResponses, ClientOptions, DeploymentsCreateData, DeploymentsCreateResponse, DeploymentsCreateResponses, DeploymentsGetData, DeploymentsGetResponse, DeploymentsGetResponses, DeploymentsListData, DeploymentsListResponse, DeploymentsListResponses, DeploymentsPublishData, DeploymentsPublishResponse, DeploymentsPublishResponses,
|
|
1
|
+
export { appsCreate, appsDelete, appsDeploy, appsGet, appsList, appsUpdate, cliAuthApprove, cliAuthDeny, cliAuthPoll, cliAuthStart, cliAuthVerifyToken, deploymentsCreate, deploymentsGet, deploymentsList, deploymentsPublish, type Options, previewAccept, previewAccepted, previewInvitation, previewStart, previewStop, } from "./sdk.gen.js";
|
|
2
|
+
export type { AppsCreateData, AppsCreateResponse, AppsCreateResponses, AppsDeleteData, AppsDeleteResponse, AppsDeleteResponses, AppsDeployData, AppsDeployResponse, AppsDeployResponses, AppsGetData, AppsGetResponse, AppsGetResponses, AppsListData, AppsListResponse, AppsListResponses, AppsUpdateData, AppsUpdateResponse, AppsUpdateResponses, CliAuthApproveData, CliAuthApproveResponse, CliAuthApproveResponses, CliAuthDenyData, CliAuthDenyResponse, CliAuthDenyResponses, CliAuthPollData, CliAuthPollResponse, CliAuthPollResponses, CliAuthStartData, CliAuthStartResponse, CliAuthStartResponses, CliAuthVerifyTokenData, CliAuthVerifyTokenResponse, CliAuthVerifyTokenResponses, ClientOptions, DeploymentsCreateData, DeploymentsCreateResponse, DeploymentsCreateResponses, DeploymentsGetData, DeploymentsGetResponse, DeploymentsGetResponses, DeploymentsListData, DeploymentsListResponse, DeploymentsListResponses, DeploymentsPublishData, DeploymentsPublishResponse, DeploymentsPublishResponses, PreviewAcceptData, PreviewAcceptedData, PreviewAcceptedResponse, PreviewAcceptedResponses, PreviewAcceptResponse, PreviewAcceptResponses, PreviewInvitationData, PreviewInvitationResponse, PreviewInvitationResponses, PreviewStartData, PreviewStartResponse, PreviewStartResponses, PreviewStopData, PreviewStopResponse, PreviewStopResponses, } from "./types.gen.js";
|
package/dist/client/index.js
CHANGED
|
@@ -15,10 +15,12 @@ import {
|
|
|
15
15
|
deploymentsGet,
|
|
16
16
|
deploymentsList,
|
|
17
17
|
deploymentsPublish,
|
|
18
|
-
|
|
18
|
+
previewAccept,
|
|
19
|
+
previewAccepted,
|
|
20
|
+
previewInvitation,
|
|
19
21
|
previewStart,
|
|
20
22
|
previewStop
|
|
21
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-S6GBD6TR.js";
|
|
22
24
|
import "../chunk-TZBKIIYQ.js";
|
|
23
25
|
import "../chunk-X5TBL4RL.js";
|
|
24
26
|
import "../chunk-VUBA7FI4.js";
|
|
@@ -46,7 +48,9 @@ export {
|
|
|
46
48
|
deploymentsGet,
|
|
47
49
|
deploymentsList,
|
|
48
50
|
deploymentsPublish,
|
|
49
|
-
|
|
51
|
+
previewAccept,
|
|
52
|
+
previewAccepted,
|
|
53
|
+
previewInvitation,
|
|
50
54
|
previewStart,
|
|
51
55
|
previewStop
|
|
52
56
|
};
|
package/dist/client/sdk.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from "./client";
|
|
2
|
-
import type { AppsCreateData, AppsCreateResponses, AppsDeleteData, AppsDeleteResponses, AppsDeployData, AppsDeployResponses, AppsGetData, AppsGetResponses, AppsListData, AppsListResponses, AppsUpdateData, AppsUpdateResponses, CliAuthApproveData, CliAuthApproveResponses, CliAuthDenyData, CliAuthDenyResponses, CliAuthPollData, CliAuthPollResponses, CliAuthStartData, CliAuthStartResponses, CliAuthVerifyTokenData, CliAuthVerifyTokenResponses, DeploymentsCreateData, DeploymentsCreateResponses, DeploymentsGetData, DeploymentsGetResponses, DeploymentsListData, DeploymentsListResponses, DeploymentsPublishData, DeploymentsPublishResponses,
|
|
1
|
+
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from "./client/index.js";
|
|
2
|
+
import type { AppsCreateData, AppsCreateResponses, AppsDeleteData, AppsDeleteResponses, AppsDeployData, AppsDeployResponses, AppsGetData, AppsGetResponses, AppsListData, AppsListResponses, AppsUpdateData, AppsUpdateResponses, CliAuthApproveData, CliAuthApproveResponses, CliAuthDenyData, CliAuthDenyResponses, CliAuthPollData, CliAuthPollResponses, CliAuthStartData, CliAuthStartResponses, CliAuthVerifyTokenData, CliAuthVerifyTokenResponses, DeploymentsCreateData, DeploymentsCreateResponses, DeploymentsGetData, DeploymentsGetResponses, DeploymentsListData, DeploymentsListResponses, DeploymentsPublishData, DeploymentsPublishResponses, PreviewAcceptData, PreviewAcceptedData, PreviewAcceptedResponses, PreviewAcceptResponses, PreviewInvitationData, PreviewInvitationResponses, PreviewStartData, PreviewStartResponses, PreviewStopData, PreviewStopResponses } from "./types.gen.js";
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -29,5 +29,7 @@ export declare const deploymentsCreate: <ThrowOnError extends boolean = false>(o
|
|
|
29
29
|
export declare const deploymentsGet: <ThrowOnError extends boolean = false>(options: Options<DeploymentsGetData, ThrowOnError>) => RequestResult<DeploymentsGetResponses, unknown, ThrowOnError>;
|
|
30
30
|
export declare const deploymentsPublish: <ThrowOnError extends boolean = false>(options: Options<DeploymentsPublishData, ThrowOnError>) => RequestResult<DeploymentsPublishResponses, unknown, ThrowOnError>;
|
|
31
31
|
export declare const previewStart: <ThrowOnError extends boolean = false>(options: Options<PreviewStartData, ThrowOnError>) => RequestResult<PreviewStartResponses, unknown, ThrowOnError>;
|
|
32
|
-
export declare const previewResolve: <ThrowOnError extends boolean = false>(options: Options<PreviewResolveData, ThrowOnError>) => RequestResult<PreviewResolveResponses, unknown, ThrowOnError>;
|
|
33
32
|
export declare const previewStop: <ThrowOnError extends boolean = false>(options: Options<PreviewStopData, ThrowOnError>) => RequestResult<PreviewStopResponses, unknown, ThrowOnError>;
|
|
33
|
+
export declare const previewInvitation: <ThrowOnError extends boolean = false>(options: Options<PreviewInvitationData, ThrowOnError>) => RequestResult<PreviewInvitationResponses, unknown, ThrowOnError>;
|
|
34
|
+
export declare const previewAccept: <ThrowOnError extends boolean = false>(options: Options<PreviewAcceptData, ThrowOnError>) => RequestResult<PreviewAcceptResponses, unknown, ThrowOnError>;
|
|
35
|
+
export declare const previewAccepted: <ThrowOnError extends boolean = false>(options: Options<PreviewAcceptedData, ThrowOnError>) => RequestResult<PreviewAcceptedResponses, unknown, ThrowOnError>;
|
package/dist/client/sdk.gen.js
CHANGED
|
@@ -14,10 +14,12 @@ import {
|
|
|
14
14
|
deploymentsGet,
|
|
15
15
|
deploymentsList,
|
|
16
16
|
deploymentsPublish,
|
|
17
|
-
|
|
17
|
+
previewAccept,
|
|
18
|
+
previewAccepted,
|
|
19
|
+
previewInvitation,
|
|
18
20
|
previewStart,
|
|
19
21
|
previewStop
|
|
20
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-S6GBD6TR.js";
|
|
21
23
|
import "../chunk-TZBKIIYQ.js";
|
|
22
24
|
import "../chunk-X5TBL4RL.js";
|
|
23
25
|
import "../chunk-VUBA7FI4.js";
|
|
@@ -45,7 +47,9 @@ export {
|
|
|
45
47
|
deploymentsGet,
|
|
46
48
|
deploymentsList,
|
|
47
49
|
deploymentsPublish,
|
|
48
|
-
|
|
50
|
+
previewAccept,
|
|
51
|
+
previewAccepted,
|
|
52
|
+
previewInvitation,
|
|
49
53
|
previewStart,
|
|
50
54
|
previewStop
|
|
51
55
|
};
|
|
@@ -574,47 +574,119 @@ export type PreviewStartResponses = {
|
|
|
574
574
|
sessionId: string;
|
|
575
575
|
tunnelToken: string;
|
|
576
576
|
tunnelUrl: string;
|
|
577
|
+
shareId: string;
|
|
577
578
|
};
|
|
578
579
|
};
|
|
579
580
|
export type PreviewStartResponse = PreviewStartResponses[keyof PreviewStartResponses];
|
|
580
|
-
export type
|
|
581
|
-
body
|
|
581
|
+
export type PreviewStopData = {
|
|
582
|
+
body: {
|
|
583
|
+
deployToken: string;
|
|
584
|
+
};
|
|
582
585
|
path: {
|
|
583
586
|
sessionId: string;
|
|
584
587
|
};
|
|
585
|
-
query
|
|
586
|
-
|
|
588
|
+
query?: never;
|
|
589
|
+
url: "/preview/{sessionId}/stop";
|
|
590
|
+
};
|
|
591
|
+
export type PreviewStopResponses = {
|
|
592
|
+
/**
|
|
593
|
+
* OK
|
|
594
|
+
*/
|
|
595
|
+
200: {
|
|
596
|
+
[key: string]: unknown;
|
|
597
|
+
};
|
|
598
|
+
};
|
|
599
|
+
export type PreviewStopResponse = PreviewStopResponses[keyof PreviewStopResponses];
|
|
600
|
+
export type PreviewInvitationData = {
|
|
601
|
+
body?: never;
|
|
602
|
+
path: {
|
|
603
|
+
shareId: string;
|
|
587
604
|
};
|
|
588
|
-
|
|
605
|
+
query?: never;
|
|
606
|
+
url: "/preview/shares/{shareId}";
|
|
589
607
|
};
|
|
590
|
-
export type
|
|
608
|
+
export type PreviewInvitationResponses = {
|
|
591
609
|
/**
|
|
592
610
|
* OK
|
|
593
611
|
*/
|
|
594
612
|
200: {
|
|
595
|
-
|
|
596
|
-
|
|
613
|
+
appName: string;
|
|
614
|
+
expiresAt: string;
|
|
597
615
|
sessionId: string;
|
|
598
|
-
status: "connected" | "offline";
|
|
599
616
|
};
|
|
600
617
|
};
|
|
601
|
-
export type
|
|
602
|
-
export type
|
|
618
|
+
export type PreviewInvitationResponse = PreviewInvitationResponses[keyof PreviewInvitationResponses];
|
|
619
|
+
export type PreviewAcceptData = {
|
|
603
620
|
body: {
|
|
604
|
-
|
|
621
|
+
scopeId: string;
|
|
605
622
|
};
|
|
606
623
|
path: {
|
|
624
|
+
shareId: string;
|
|
625
|
+
};
|
|
626
|
+
query?: never;
|
|
627
|
+
url: "/preview/shares/{shareId}/accept";
|
|
628
|
+
};
|
|
629
|
+
export type PreviewAcceptResponses = {
|
|
630
|
+
/**
|
|
631
|
+
* OK
|
|
632
|
+
*/
|
|
633
|
+
200: {
|
|
634
|
+
grantId: string;
|
|
607
635
|
sessionId: string;
|
|
608
636
|
};
|
|
637
|
+
};
|
|
638
|
+
export type PreviewAcceptResponse = PreviewAcceptResponses[keyof PreviewAcceptResponses];
|
|
639
|
+
export type PreviewAcceptedData = {
|
|
640
|
+
body: {
|
|
641
|
+
grantIds: Array<string>;
|
|
642
|
+
scopeId: string;
|
|
643
|
+
};
|
|
644
|
+
path?: never;
|
|
609
645
|
query?: never;
|
|
610
|
-
url: "/preview/
|
|
646
|
+
url: "/preview/grants/resolve";
|
|
611
647
|
};
|
|
612
|
-
export type
|
|
648
|
+
export type PreviewAcceptedResponses = {
|
|
613
649
|
/**
|
|
614
650
|
* OK
|
|
615
651
|
*/
|
|
616
652
|
200: {
|
|
617
|
-
|
|
653
|
+
items: Array<{
|
|
654
|
+
app: {
|
|
655
|
+
id: string;
|
|
656
|
+
publicId: string;
|
|
657
|
+
projectId: string;
|
|
658
|
+
scopeId: string;
|
|
659
|
+
name: string;
|
|
660
|
+
description: string | null;
|
|
661
|
+
currentDeploymentId: string | null;
|
|
662
|
+
createdAt: string;
|
|
663
|
+
updatedAt: string;
|
|
664
|
+
currentDeployment: {
|
|
665
|
+
id: string;
|
|
666
|
+
publicId: string;
|
|
667
|
+
appId: string;
|
|
668
|
+
status: "uploading" | "deploying" | "verifying" | "published";
|
|
669
|
+
clientEntryFileId: string | null;
|
|
670
|
+
logoLightFileId: string | null;
|
|
671
|
+
logoDarkFileId: string | null;
|
|
672
|
+
logoLightPath: string | null;
|
|
673
|
+
logoDarkPath: string | null;
|
|
674
|
+
createdAt: string;
|
|
675
|
+
updatedAt: string;
|
|
676
|
+
} | null;
|
|
677
|
+
clientPath?: string;
|
|
678
|
+
logoPaths?: {
|
|
679
|
+
dark?: string;
|
|
680
|
+
light?: string;
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
preview: {
|
|
684
|
+
sessionId: string;
|
|
685
|
+
expiresAt: string;
|
|
686
|
+
websocketUrl: string;
|
|
687
|
+
token: string;
|
|
688
|
+
};
|
|
689
|
+
}>;
|
|
618
690
|
};
|
|
619
691
|
};
|
|
620
|
-
export type
|
|
692
|
+
export type PreviewAcceptedResponse = PreviewAcceptedResponses[keyof PreviewAcceptedResponses];
|
package/dist/client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CreateClientConfig } from "./client/client";
|
|
1
|
+
import type { CreateClientConfig } from "./client/client/index.js";
|
|
2
2
|
export declare const createClientConfig: CreateClientConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from "./client/index";
|
|
2
|
-
export * from "./client";
|
|
1
|
+
export * from "./client/index.js";
|
|
2
|
+
export * from "./client.js";
|
|
3
|
+
export * from "./preview.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createClientConfig
|
|
3
3
|
} from "./chunk-5IRC5P4W.js";
|
|
4
|
+
import {
|
|
5
|
+
createPreviewWebSocketClient,
|
|
6
|
+
previewBuildManifestSchema,
|
|
7
|
+
previewEventSchema,
|
|
8
|
+
previewFileManifestSchema,
|
|
9
|
+
previewMetadataSchema
|
|
10
|
+
} from "./chunk-W4IZZ2X7.js";
|
|
4
11
|
import "./chunk-5X7JZMEF.js";
|
|
5
12
|
import {
|
|
6
13
|
appsCreate,
|
|
@@ -18,10 +25,12 @@ import {
|
|
|
18
25
|
deploymentsGet,
|
|
19
26
|
deploymentsList,
|
|
20
27
|
deploymentsPublish,
|
|
21
|
-
|
|
28
|
+
previewAccept,
|
|
29
|
+
previewAccepted,
|
|
30
|
+
previewInvitation,
|
|
22
31
|
previewStart,
|
|
23
32
|
previewStop
|
|
24
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-S6GBD6TR.js";
|
|
25
34
|
import "./chunk-TZBKIIYQ.js";
|
|
26
35
|
import "./chunk-X5TBL4RL.js";
|
|
27
36
|
import "./chunk-VUBA7FI4.js";
|
|
@@ -46,11 +55,18 @@ export {
|
|
|
46
55
|
cliAuthStart,
|
|
47
56
|
cliAuthVerifyToken,
|
|
48
57
|
createClientConfig,
|
|
58
|
+
createPreviewWebSocketClient,
|
|
49
59
|
deploymentsCreate,
|
|
50
60
|
deploymentsGet,
|
|
51
61
|
deploymentsList,
|
|
52
62
|
deploymentsPublish,
|
|
53
|
-
|
|
63
|
+
previewAccept,
|
|
64
|
+
previewAccepted,
|
|
65
|
+
previewBuildManifestSchema,
|
|
66
|
+
previewEventSchema,
|
|
67
|
+
previewFileManifestSchema,
|
|
68
|
+
previewInvitation,
|
|
69
|
+
previewMetadataSchema,
|
|
54
70
|
previewStart,
|
|
55
71
|
previewStop
|
|
56
72
|
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const previewFileManifestSchema: z.ZodObject<{
|
|
3
|
+
path: z.ZodString;
|
|
4
|
+
contentType: z.ZodString;
|
|
5
|
+
size: z.ZodNumber;
|
|
6
|
+
chunks: z.ZodNumber;
|
|
7
|
+
sha256: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const previewBuildManifestSchema: z.ZodObject<{
|
|
10
|
+
files: z.ZodArray<z.ZodObject<{
|
|
11
|
+
path: z.ZodString;
|
|
12
|
+
contentType: z.ZodString;
|
|
13
|
+
size: z.ZodNumber;
|
|
14
|
+
chunks: z.ZodNumber;
|
|
15
|
+
sha256: z.ZodString;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const previewEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<"begin">;
|
|
20
|
+
buildId: z.ZodString;
|
|
21
|
+
revision: z.ZodNumber;
|
|
22
|
+
manifest: z.ZodObject<{
|
|
23
|
+
files: z.ZodArray<z.ZodObject<{
|
|
24
|
+
path: z.ZodString;
|
|
25
|
+
contentType: z.ZodString;
|
|
26
|
+
size: z.ZodNumber;
|
|
27
|
+
chunks: z.ZodNumber;
|
|
28
|
+
sha256: z.ZodString;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"chunk">;
|
|
33
|
+
revision: z.ZodNumber;
|
|
34
|
+
fileIndex: z.ZodNumber;
|
|
35
|
+
chunkIndex: z.ZodNumber;
|
|
36
|
+
base64: z.ZodString;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
type: z.ZodLiteral<"complete">;
|
|
39
|
+
revision: z.ZodNumber;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
type: z.ZodLiteral<"ended">;
|
|
42
|
+
}, z.core.$strip>], "type">;
|
|
43
|
+
export declare const previewMetadataSchema: z.ZodObject<{
|
|
44
|
+
sessionId: z.ZodUUID;
|
|
45
|
+
expiresAt: z.ZodString;
|
|
46
|
+
websocketUrl: z.ZodURL;
|
|
47
|
+
token: z.ZodString;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type PreviewFileManifest = z.infer<typeof previewFileManifestSchema>;
|
|
50
|
+
export type PreviewBuildManifest = z.infer<typeof previewBuildManifestSchema>;
|
|
51
|
+
export type PreviewEvent = z.infer<typeof previewEventSchema>;
|
|
52
|
+
declare const beginInput: z.ZodObject<{
|
|
53
|
+
manifest: z.ZodObject<{
|
|
54
|
+
files: z.ZodArray<z.ZodObject<{
|
|
55
|
+
path: z.ZodString;
|
|
56
|
+
contentType: z.ZodString;
|
|
57
|
+
size: z.ZodNumber;
|
|
58
|
+
chunks: z.ZodNumber;
|
|
59
|
+
sha256: z.ZodString;
|
|
60
|
+
}, z.core.$strip>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
declare const uploadInput: z.ZodObject<{
|
|
64
|
+
buildId: z.ZodString;
|
|
65
|
+
fileIndex: z.ZodNumber;
|
|
66
|
+
chunkIndex: z.ZodNumber;
|
|
67
|
+
base64: z.ZodString;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
declare const buildIdOutput: z.ZodObject<{
|
|
70
|
+
buildId: z.ZodString;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
declare const acceptedOutput: z.ZodObject<{
|
|
73
|
+
accepted: z.ZodLiteral<true>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
declare const commitOutput: z.ZodObject<{
|
|
76
|
+
revision: z.ZodNumber;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
export interface PreviewWebSocketClient {
|
|
79
|
+
beginBuild(input: z.input<typeof beginInput>): Promise<z.infer<typeof buildIdOutput>>;
|
|
80
|
+
uploadChunk(input: z.input<typeof uploadInput>): Promise<z.infer<typeof acceptedOutput>>;
|
|
81
|
+
commitBuild(input: {
|
|
82
|
+
buildId: string;
|
|
83
|
+
}): Promise<z.infer<typeof commitOutput>>;
|
|
84
|
+
heartbeat(): Promise<z.infer<typeof acceptedOutput>>;
|
|
85
|
+
subscribe(): Promise<AsyncIterable<PreviewEvent>>;
|
|
86
|
+
}
|
|
87
|
+
/** Validates every preview WebSocket request, response, and streamed event. */
|
|
88
|
+
export declare function createPreviewWebSocketClient(websocket: WebSocket): PreviewWebSocketClient;
|
|
89
|
+
export {};
|
package/dist/preview.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createPreviewWebSocketClient,
|
|
3
|
+
previewBuildManifestSchema,
|
|
4
|
+
previewEventSchema,
|
|
5
|
+
previewFileManifestSchema,
|
|
6
|
+
previewMetadataSchema
|
|
7
|
+
} from "./chunk-W4IZZ2X7.js";
|
|
8
|
+
export {
|
|
9
|
+
createPreviewWebSocketClient,
|
|
10
|
+
previewBuildManifestSchema,
|
|
11
|
+
previewEventSchema,
|
|
12
|
+
previewFileManifestSchema,
|
|
13
|
+
previewMetadataSchema
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailorkit/client-platform",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.14",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,16 +24,17 @@
|
|
|
24
24
|
"types": "./dist/client/*.d.ts",
|
|
25
25
|
"import": "./dist/client/*.js"
|
|
26
26
|
},
|
|
27
|
-
"./preview
|
|
28
|
-
"types": "./dist/preview
|
|
29
|
-
"import": "./dist/preview
|
|
27
|
+
"./preview": {
|
|
28
|
+
"types": "./dist/preview.d.ts",
|
|
29
|
+
"import": "./dist/preview.js"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@orpc/client": "^1.15.0"
|
|
36
|
+
"@orpc/client": "^1.15.0",
|
|
37
|
+
"zod": "^4.6.2"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@hey-api/openapi-ts": "next",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
},
|
|
47
48
|
"scripts": {
|
|
48
49
|
"build": "tsup 'src/**/*.ts' --format esm --target node20 --clean && tsc -p tsconfig.build.json",
|
|
49
|
-
"generate": "openapi-ts && node ./scripts/restore-openapi-params.mjs && oxfmt src/client",
|
|
50
|
+
"generate": "openapi-ts && node ./scripts/restore-openapi-params.mjs && node ./scripts/normalize-esm-imports.mjs && oxfmt src/client",
|
|
50
51
|
"check-types": "tsc --noEmit",
|
|
51
52
|
"test": "vitest run"
|
|
52
53
|
}
|
package/dist/preview-tunnel.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { PreviewTunnelRouterClient } from "@tailorkit/api-platform/preview-tunnel";
|
|
2
|
-
/** Creates the typed oRPC client for an authenticated preview tunnel WebSocket. */
|
|
3
|
-
export declare function createPreviewTunnelClient(websocket: WebSocket): PreviewTunnelRouterClient;
|
package/dist/preview-tunnel.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// src/preview-tunnel.ts
|
|
2
|
-
import { createORPCClient } from "@orpc/client";
|
|
3
|
-
import { RPCLink } from "@orpc/client/websocket";
|
|
4
|
-
function createPreviewTunnelClient(websocket) {
|
|
5
|
-
return createORPCClient(new RPCLink({ websocket }));
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
createPreviewTunnelClient
|
|
9
|
-
};
|