@tailorkit/app 0.1.0-beta.29 → 0.1.0-beta.32
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/LICENSE.md +47 -174
- package/README.md +37 -38
- package/dist/chunk-7ZQPXG7O.js +34 -0
- package/dist/chunk-PJBDA2RU.js +415 -0
- package/dist/{chunk-STTKSRAI.js → chunk-UDXPIO6D.js} +267 -112
- package/dist/{chunk-ANTVMHDZ.js → chunk-YX3JURMG.js} +100 -59
- package/dist/client/connection.d.ts +11 -11
- package/dist/client/query-store.d.ts +2 -2
- package/dist/client/reference.d.ts +4 -4
- package/dist/client/session.d.ts +27 -4
- package/dist/client/tools.d.ts +11 -5
- package/dist/client-connection.js +4 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +3 -3
- package/dist/database/definition.d.ts +1 -1
- package/dist/database/schema.d.ts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/preact.d.ts +5 -5
- package/dist/protocol.d.ts +23 -23
- package/dist/protocol.js +11 -9
- package/dist/routing.d.ts +4 -4
- package/dist/server/builder.d.ts +6 -6
- package/dist/server/bundle.d.ts +1 -6
- package/dist/server/functions.d.ts +19 -19
- package/dist/server/instances.d.ts +5 -4
- package/dist/server.d.ts +1 -1
- package/dist/server.js +4 -4
- package/dist/views.d.ts +4 -3
- package/package.json +34 -22
- package/dist/builder/client-views.d.ts +0 -16
- package/dist/builder/database-paths.d.ts +0 -4
- package/dist/builder/define-view.d.ts +0 -3
- package/dist/builder/drizzle.d.ts +0 -2
- package/dist/builder/file-routes.d.ts +0 -34
- package/dist/builder/generate-migrations.d.ts +0 -6
- package/dist/builder/index.d.ts +0 -11
- package/dist/builder/instances.d.ts +0 -19
- package/dist/builder/migrations.d.ts +0 -6
- package/dist/builder/schema-check.d.ts +0 -2
- package/dist/builder/server.d.ts +0 -6
- package/dist/builder/upload-manifest.d.ts +0 -20
- package/dist/builder.js +0 -1531
- package/dist/chunk-DA2TE2FW.js +0 -27
- package/dist/chunk-IJBQ77AH.js +0 -35
- package/dist/chunk-L5ECQGR7.js +0 -26
- package/dist/chunk-SWBQZDWT.js +0 -321
- package/dist/config/config.d.ts +0 -86
- package/dist/config/index.d.ts +0 -1
- package/dist/config/loader.d.ts +0 -7
- package/dist/config-loader.js +0 -7
- package/dist/config.js +0 -8
- package/dist/preact-version.d.ts +0 -7
package/dist/chunk-DA2TE2FW.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// src/config/config.ts
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
var buildConfigSchema = z.object({
|
|
4
|
-
outDir: z.string().default(".tailorkit")
|
|
5
|
-
});
|
|
6
|
-
var logosConfigSchema = z.object({
|
|
7
|
-
dark: z.string().min(1).optional(),
|
|
8
|
-
light: z.string().min(1).optional()
|
|
9
|
-
});
|
|
10
|
-
var tailorkitConfigSchema = z.strictObject({
|
|
11
|
-
appId: z.string().min(1).optional(),
|
|
12
|
-
build: buildConfigSchema.optional(),
|
|
13
|
-
host: z.string().url(),
|
|
14
|
-
logos: logosConfigSchema.optional(),
|
|
15
|
-
server: z.strictObject({
|
|
16
|
-
entry: z.string().min(1).default("src/server.ts"),
|
|
17
|
-
migrations: z.string().min(1).optional()
|
|
18
|
-
}).optional()
|
|
19
|
-
});
|
|
20
|
-
var defineConfig = (config) => config;
|
|
21
|
-
var defineTailorKitConfig = defineConfig;
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
tailorkitConfigSchema,
|
|
25
|
-
defineConfig,
|
|
26
|
-
defineTailorKitConfig
|
|
27
|
-
};
|
package/dist/chunk-IJBQ77AH.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// src/errors.ts
|
|
2
|
-
var AppError = class extends Error {
|
|
3
|
-
constructor(code, message = code) {
|
|
4
|
-
super(message);
|
|
5
|
-
this.code = code;
|
|
6
|
-
this.name = "AppError";
|
|
7
|
-
}
|
|
8
|
-
code;
|
|
9
|
-
};
|
|
10
|
-
function appError(error) {
|
|
11
|
-
if (error instanceof AppError) return error;
|
|
12
|
-
if (error instanceof Error && error.name === "AbortError")
|
|
13
|
-
return new AppError("UNAVAILABLE", "App connection interrupted");
|
|
14
|
-
if (error && typeof error === "object" && "code" in error && error.code === "NETWORK_ERROR")
|
|
15
|
-
return new AppError("UNAVAILABLE", "App connection interrupted");
|
|
16
|
-
if (error && typeof error === "object" && "code" in error && [
|
|
17
|
-
"BAD_REQUEST",
|
|
18
|
-
"UNAUTHORIZED",
|
|
19
|
-
"FORBIDDEN",
|
|
20
|
-
"NOT_FOUND",
|
|
21
|
-
"CONFLICT",
|
|
22
|
-
"INCOMPATIBLE_VERSION",
|
|
23
|
-
"UNAVAILABLE"
|
|
24
|
-
].includes(String(error.code)))
|
|
25
|
-
return new AppError(
|
|
26
|
-
error.code,
|
|
27
|
-
"message" in error ? String(error.message) : String(error.code)
|
|
28
|
-
);
|
|
29
|
-
return new AppError("INTERNAL_SERVER_ERROR", "App function failed");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
AppError,
|
|
34
|
-
appError
|
|
35
|
-
};
|
package/dist/chunk-L5ECQGR7.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
tailorkitConfigSchema
|
|
3
|
-
} from "./chunk-DA2TE2FW.js";
|
|
4
|
-
|
|
5
|
-
// src/config/loader.ts
|
|
6
|
-
import { cosmiconfig } from "cosmiconfig";
|
|
7
|
-
import path from "path";
|
|
8
|
-
var explorer = cosmiconfig("tailorkit", {
|
|
9
|
-
searchPlaces: ["tailorkit.config.ts", "tailorkit.config.mjs", "tailorkit.config.js"]
|
|
10
|
-
});
|
|
11
|
-
var loadTailorKitConfig = async (configPath, cwd = process.cwd()) => {
|
|
12
|
-
const searchFrom = path.resolve(cwd);
|
|
13
|
-
const result = configPath === void 0 ? await explorer.search(searchFrom) : await explorer.load(path.resolve(searchFrom, configPath));
|
|
14
|
-
if (result === null) {
|
|
15
|
-
throw new Error(`Could not find tailorkit config from ${searchFrom}.`);
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
config: tailorkitConfigSchema.parse(result.config),
|
|
19
|
-
filepath: result.filepath,
|
|
20
|
-
root: path.dirname(result.filepath)
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
loadTailorKitConfig
|
|
26
|
-
};
|
package/dist/chunk-SWBQZDWT.js
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AppError,
|
|
3
|
-
appError
|
|
4
|
-
} from "./chunk-IJBQ77AH.js";
|
|
5
|
-
|
|
6
|
-
// src/client/connection.ts
|
|
7
|
-
import { createORPCClient } from "@orpc/client";
|
|
8
|
-
import { RPCLink as FetchLink } from "@orpc/client/fetch";
|
|
9
|
-
import { RPCLink } from "@orpc/client/websocket";
|
|
10
|
-
|
|
11
|
-
// src/client/session.ts
|
|
12
|
-
var APP_SESSION_RENEWAL_MS = 6e4;
|
|
13
|
-
function freezeIdentity(value) {
|
|
14
|
-
if (value && typeof value === "object" && !Object.isFrozen(value)) {
|
|
15
|
-
for (const child of Object.values(value)) freezeIdentity(child);
|
|
16
|
-
Object.freeze(value);
|
|
17
|
-
}
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
function sessionRenewalDelay(session) {
|
|
21
|
-
return Math.max(500, session.expiresAt - Date.now() - APP_SESSION_RENEWAL_MS);
|
|
22
|
-
}
|
|
23
|
-
function createSessionProvider(options) {
|
|
24
|
-
const base = new URL(options.baseUrl, globalThis.location?.href);
|
|
25
|
-
if (!base.pathname.endsWith("/")) {
|
|
26
|
-
base.pathname += "/";
|
|
27
|
-
}
|
|
28
|
-
let cached;
|
|
29
|
-
let pending;
|
|
30
|
-
return (input) => {
|
|
31
|
-
if (!input.refresh && cached && cached.expiresAt > Date.now() + APP_SESSION_RENEWAL_MS) {
|
|
32
|
-
return Promise.resolve(cached);
|
|
33
|
-
}
|
|
34
|
-
pending ??= (async () => {
|
|
35
|
-
const response = await (options.fetch ?? fetch)(new URL("backend/session", base), {
|
|
36
|
-
method: "POST",
|
|
37
|
-
credentials: "same-origin",
|
|
38
|
-
headers: { "content-type": "application/json" },
|
|
39
|
-
body: JSON.stringify({ appId: options.appId })
|
|
40
|
-
}).catch(() => {
|
|
41
|
-
throw new AppError("UNAVAILABLE", "Unable to reach the app session provider");
|
|
42
|
-
});
|
|
43
|
-
if (!response.ok) {
|
|
44
|
-
const code = response.status === 403 ? "FORBIDDEN" : "UNAVAILABLE";
|
|
45
|
-
throw new AppError(
|
|
46
|
-
response.status === 401 ? "UNAUTHORIZED" : code,
|
|
47
|
-
"Unable to authorize the app backend"
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
const value = await response.json();
|
|
51
|
-
if (typeof value.token !== "string" || typeof value.expiresAt !== "number" || typeof value.url !== "string") {
|
|
52
|
-
throw new AppError("UNAVAILABLE", "Invalid app session");
|
|
53
|
-
}
|
|
54
|
-
cached = {
|
|
55
|
-
...value.toolUrl !== void 0 ? { toolUrl: value.toolUrl } : {},
|
|
56
|
-
...value.identity !== void 0 ? { identity: freezeIdentity(value.identity) } : {},
|
|
57
|
-
token: value.token,
|
|
58
|
-
expiresAt: value.expiresAt,
|
|
59
|
-
url: value.url,
|
|
60
|
-
...value.subjectId !== void 0 ? { subjectId: value.subjectId } : {}
|
|
61
|
-
};
|
|
62
|
-
return cached;
|
|
63
|
-
})().finally(() => {
|
|
64
|
-
pending = void 0;
|
|
65
|
-
});
|
|
66
|
-
return pending;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// src/client/reference.ts
|
|
71
|
-
function reference(name, _kind) {
|
|
72
|
-
return Object.freeze({ name });
|
|
73
|
-
}
|
|
74
|
-
function createApi() {
|
|
75
|
-
function group(path) {
|
|
76
|
-
return new Proxy(/* @__PURE__ */ Object.create(null), {
|
|
77
|
-
get(_target, name) {
|
|
78
|
-
if (typeof name !== "string" || name === "then") return;
|
|
79
|
-
if (name === "name" && path) return path;
|
|
80
|
-
return group(path ? `${path}.${name}` : name);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return group("");
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// src/client/connection.ts
|
|
88
|
-
function createClient(options = {}) {
|
|
89
|
-
let closed = false;
|
|
90
|
-
let socket;
|
|
91
|
-
let timer;
|
|
92
|
-
const stops = /* @__PURE__ */ new Set();
|
|
93
|
-
const requests = /* @__PURE__ */ new Set();
|
|
94
|
-
const getSession = options.getSession ?? ((request) => {
|
|
95
|
-
const bridge = globalThis.__tailorkitBackendSession;
|
|
96
|
-
if (!bridge) {
|
|
97
|
-
throw new AppError("UNAVAILABLE", "The host JWT bridge is unavailable");
|
|
98
|
-
}
|
|
99
|
-
return bridge(request);
|
|
100
|
-
});
|
|
101
|
-
const wire = createORPCClient(
|
|
102
|
-
new RPCLink({
|
|
103
|
-
connect: async (info) => {
|
|
104
|
-
if (closed) {
|
|
105
|
-
throw new AppError("UNAVAILABLE", "App client closed");
|
|
106
|
-
}
|
|
107
|
-
const session = await getSession({ refresh: info.totalAttempt > 1 });
|
|
108
|
-
if (closed) {
|
|
109
|
-
throw new AppError("UNAVAILABLE", "App client closed");
|
|
110
|
-
}
|
|
111
|
-
const url = backendUrl(session, "queries");
|
|
112
|
-
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
113
|
-
socket = await (options.connect ?? ((url2, protocols) => new WebSocket(url2, protocols)))(
|
|
114
|
-
url.href,
|
|
115
|
-
["tailorkit", `jwt.${session.token}`]
|
|
116
|
-
);
|
|
117
|
-
clearTimeout(timer);
|
|
118
|
-
timer = setTimeout(
|
|
119
|
-
() => socket?.close(1e3, "Renew authentication"),
|
|
120
|
-
sessionRenewalDelay(session)
|
|
121
|
-
);
|
|
122
|
-
return socket;
|
|
123
|
-
},
|
|
124
|
-
reconnect: {
|
|
125
|
-
enabled: true,
|
|
126
|
-
delay: (info) => info.attempt === 1 ? 0 : options.retryDelayMs ?? 1e3
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
);
|
|
130
|
-
async function call(kind, input) {
|
|
131
|
-
if (closed) {
|
|
132
|
-
throw new AppError("UNAVAILABLE", "App client closed");
|
|
133
|
-
}
|
|
134
|
-
const controller = new AbortController();
|
|
135
|
-
requests.add(controller);
|
|
136
|
-
try {
|
|
137
|
-
const invocation = kind === "mutations" ? structuredClone(input) : input;
|
|
138
|
-
let attempt = 0;
|
|
139
|
-
let refresh = false;
|
|
140
|
-
let refreshed = false;
|
|
141
|
-
while (true) {
|
|
142
|
-
try {
|
|
143
|
-
if (closed) {
|
|
144
|
-
throw new AppError("UNAVAILABLE", "App client closed");
|
|
145
|
-
}
|
|
146
|
-
const session = await getSession({ refresh });
|
|
147
|
-
refresh = false;
|
|
148
|
-
if (closed) {
|
|
149
|
-
throw new AppError("UNAVAILABLE", "App client closed");
|
|
150
|
-
}
|
|
151
|
-
const url = backendUrl(session, kind);
|
|
152
|
-
url.pathname = url.pathname.slice(0, -kind.length).replace(/\/$/u, "");
|
|
153
|
-
const http = createORPCClient(
|
|
154
|
-
new FetchLink({
|
|
155
|
-
url: url.pathname,
|
|
156
|
-
origin: url.origin,
|
|
157
|
-
headers: { authorization: `Bearer ${session.token}` },
|
|
158
|
-
fetch: async (url2, init) => {
|
|
159
|
-
let response;
|
|
160
|
-
try {
|
|
161
|
-
response = await (options.fetch ?? fetch)(url2, { ...init, credentials: "omit" });
|
|
162
|
-
} catch {
|
|
163
|
-
throw new AppError("UNAVAILABLE", "App connection interrupted");
|
|
164
|
-
}
|
|
165
|
-
if ([502, 503, 504].includes(response.status)) {
|
|
166
|
-
throw new AppError("UNAVAILABLE", "App backend temporarily unavailable");
|
|
167
|
-
}
|
|
168
|
-
if (kind === "mutations" && response.body) {
|
|
169
|
-
try {
|
|
170
|
-
return new Response(await response.arrayBuffer(), {
|
|
171
|
-
status: response.status,
|
|
172
|
-
headers: response.headers
|
|
173
|
-
});
|
|
174
|
-
} catch {
|
|
175
|
-
throw new AppError("UNAVAILABLE", "App connection interrupted");
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return response;
|
|
179
|
-
}
|
|
180
|
-
})
|
|
181
|
-
);
|
|
182
|
-
if (kind === "mutations") {
|
|
183
|
-
return await http.mutations(invocation, {
|
|
184
|
-
signal: controller.signal
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
return await http[kind](invocation, { signal: controller.signal });
|
|
188
|
-
} catch (error) {
|
|
189
|
-
const failure = appError(error);
|
|
190
|
-
if (kind !== "mutations" || closed || controller.signal.aborted) {
|
|
191
|
-
throw failure;
|
|
192
|
-
}
|
|
193
|
-
if (failure.code === "UNAUTHORIZED" && !refreshed) {
|
|
194
|
-
refresh = true;
|
|
195
|
-
refreshed = true;
|
|
196
|
-
continue;
|
|
197
|
-
}
|
|
198
|
-
if (failure.code !== "UNAVAILABLE") {
|
|
199
|
-
throw failure;
|
|
200
|
-
}
|
|
201
|
-
await waitForRetry(
|
|
202
|
-
controller.signal,
|
|
203
|
-
Math.min((options.retryDelayMs ?? 1e3) * 2 ** Math.min(attempt++, 5), 3e4)
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
} catch (error) {
|
|
208
|
-
throw appError(error);
|
|
209
|
-
} finally {
|
|
210
|
-
requests.delete(controller);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return {
|
|
214
|
-
query: (ref, ...[args]) => call("queries", { name: ref.name, args }),
|
|
215
|
-
mutate: (ref, ...[args, settings]) => call("mutations", {
|
|
216
|
-
name: ref.name,
|
|
217
|
-
args,
|
|
218
|
-
requestId: settings?.requestId ?? crypto.randomUUID()
|
|
219
|
-
}),
|
|
220
|
-
action: (ref, ...[args]) => call("actions", { name: ref.name, args }),
|
|
221
|
-
subscribe(ref, args, next, settings = {}) {
|
|
222
|
-
if (closed) {
|
|
223
|
-
throw new AppError("UNAVAILABLE", "App client closed");
|
|
224
|
-
}
|
|
225
|
-
const controller = new AbortController();
|
|
226
|
-
const stop = () => {
|
|
227
|
-
controller.abort();
|
|
228
|
-
stops.delete(stop);
|
|
229
|
-
};
|
|
230
|
-
stops.add(stop);
|
|
231
|
-
const run = async () => {
|
|
232
|
-
while (!controller.signal.aborted) {
|
|
233
|
-
try {
|
|
234
|
-
const stream = await wire.subscribe(
|
|
235
|
-
{ name: ref.name, args },
|
|
236
|
-
{ signal: controller.signal }
|
|
237
|
-
);
|
|
238
|
-
for await (const value of stream) {
|
|
239
|
-
if (controller.signal.aborted || closed) {
|
|
240
|
-
break;
|
|
241
|
-
}
|
|
242
|
-
next(value);
|
|
243
|
-
}
|
|
244
|
-
} catch (error) {
|
|
245
|
-
if (controller.signal.aborted || closed) {
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
const failure = appError(error);
|
|
249
|
-
if (!(error instanceof Error && error.name === "AbortError")) {
|
|
250
|
-
settings.onError?.(failure);
|
|
251
|
-
}
|
|
252
|
-
if (!["UNAUTHORIZED", "UNAVAILABLE", "INTERNAL_SERVER_ERROR"].includes(failure.code)) {
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
if (!controller.signal.aborted && !closed) {
|
|
257
|
-
await waitForRetry(controller.signal, options.retryDelayMs ?? 1e3);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
stop();
|
|
261
|
-
};
|
|
262
|
-
void run().catch((error) => {
|
|
263
|
-
stop();
|
|
264
|
-
settings.onError?.(appError(error));
|
|
265
|
-
});
|
|
266
|
-
return stop;
|
|
267
|
-
},
|
|
268
|
-
close() {
|
|
269
|
-
closed = true;
|
|
270
|
-
for (const stop of stops) {
|
|
271
|
-
stop();
|
|
272
|
-
}
|
|
273
|
-
for (const request of requests) {
|
|
274
|
-
request.abort();
|
|
275
|
-
}
|
|
276
|
-
clearTimeout(timer);
|
|
277
|
-
socket?.close();
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
function backendUrl(session, route) {
|
|
282
|
-
const url = new URL(session.url);
|
|
283
|
-
if (url.username || url.password || url.search || url.hash) {
|
|
284
|
-
throw new AppError("BAD_REQUEST", "Invalid app backend URL");
|
|
285
|
-
}
|
|
286
|
-
if (url.protocol === "wss:") {
|
|
287
|
-
url.protocol = "https:";
|
|
288
|
-
}
|
|
289
|
-
if (url.protocol === "ws:") {
|
|
290
|
-
url.protocol = "http:";
|
|
291
|
-
}
|
|
292
|
-
if (url.protocol !== "https:" && !(url.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname))) {
|
|
293
|
-
throw new AppError("BAD_REQUEST", "App backends require HTTPS");
|
|
294
|
-
}
|
|
295
|
-
if (session.expiresAt <= Date.now() + 1e3) {
|
|
296
|
-
throw new AppError("UNAUTHORIZED", "App token expired");
|
|
297
|
-
}
|
|
298
|
-
url.pathname = `${url.pathname.replace(/\/$/u, "")}/${route}`;
|
|
299
|
-
return url;
|
|
300
|
-
}
|
|
301
|
-
function waitForRetry(signal, delayMs) {
|
|
302
|
-
if (signal.aborted) {
|
|
303
|
-
return Promise.resolve();
|
|
304
|
-
}
|
|
305
|
-
return new Promise((resolve) => {
|
|
306
|
-
const wake = () => {
|
|
307
|
-
clearTimeout(timer);
|
|
308
|
-
signal.removeEventListener("abort", wake);
|
|
309
|
-
resolve();
|
|
310
|
-
};
|
|
311
|
-
const timer = setTimeout(wake, delayMs);
|
|
312
|
-
signal.addEventListener("abort", wake, { once: true });
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
export {
|
|
317
|
-
createSessionProvider,
|
|
318
|
-
reference,
|
|
319
|
-
createApi,
|
|
320
|
-
createClient
|
|
321
|
-
};
|
package/dist/config/config.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare const tailorkitConfigSchema: z.ZodObject<{
|
|
3
|
-
appId: z.ZodOptional<z.ZodString>;
|
|
4
|
-
build: z.ZodOptional<z.ZodObject<{
|
|
5
|
-
outDir: z.ZodDefault<z.ZodString>;
|
|
6
|
-
}, z.core.$strip>>;
|
|
7
|
-
host: z.ZodString;
|
|
8
|
-
logos: z.ZodOptional<z.ZodObject<{
|
|
9
|
-
dark: z.ZodOptional<z.ZodString>;
|
|
10
|
-
light: z.ZodOptional<z.ZodString>;
|
|
11
|
-
}, z.core.$strip>>;
|
|
12
|
-
server: z.ZodOptional<z.ZodObject<{
|
|
13
|
-
entry: z.ZodDefault<z.ZodString>;
|
|
14
|
-
migrations: z.ZodOptional<z.ZodString>;
|
|
15
|
-
}, z.core.$strict>>;
|
|
16
|
-
}, z.core.$strict>;
|
|
17
|
-
/**
|
|
18
|
-
* App configuration exported from `tailorkit.config.ts`.
|
|
19
|
-
* Relative paths are resolved from the directory containing the config file.
|
|
20
|
-
*/
|
|
21
|
-
export interface TailorKitConfig extends z.input<typeof tailorkitConfigSchema> {
|
|
22
|
-
/**
|
|
23
|
-
* ID of the app on the TailorKit host, used for deployment and remote preview.
|
|
24
|
-
* When omitted, the first deployment creates an app and saves its ID here.
|
|
25
|
-
* Remote preview requires an existing app ID.
|
|
26
|
-
* @default undefined
|
|
27
|
-
*/
|
|
28
|
-
appId?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Build output settings. Omit to use the default output directory.
|
|
31
|
-
* @default undefined
|
|
32
|
-
*/
|
|
33
|
-
build?: {
|
|
34
|
-
/**
|
|
35
|
-
* Directory for generated client bundles, server bundles, and migration assets.
|
|
36
|
-
* A build or CLI `outDir` option overrides this value.
|
|
37
|
-
* @default ".tailorkit"
|
|
38
|
-
*/
|
|
39
|
-
outDir?: string;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* URL of the TailorKit host used for authentication, deployment, remote preview,
|
|
43
|
-
* and fetching the host schema for generated types. Required; has no default.
|
|
44
|
-
*/
|
|
45
|
-
host: string;
|
|
46
|
-
/**
|
|
47
|
-
* Optional app logo assets included in the build and uploaded on deployment.
|
|
48
|
-
* Accepts SVG, PNG, or WebP files. Omit to upload no custom logos.
|
|
49
|
-
* @default undefined
|
|
50
|
-
*/
|
|
51
|
-
logos?: {
|
|
52
|
-
/**
|
|
53
|
-
* Path to the app logo for dark mode. Omit to upload no dark-mode logo.
|
|
54
|
-
* @default undefined
|
|
55
|
-
*/
|
|
56
|
-
dark?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Path to the app logo for light mode. Omit to upload no light-mode logo.
|
|
59
|
-
* @default undefined
|
|
60
|
-
*/
|
|
61
|
-
light?: string;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Enables the private app backend and its database migrations when present.
|
|
65
|
-
* Set to `{}` to use the default paths; omit for a client-only app.
|
|
66
|
-
* @default undefined
|
|
67
|
-
*/
|
|
68
|
-
server?: {
|
|
69
|
-
/**
|
|
70
|
-
* Source entry point for the app's private backend bundle.
|
|
71
|
-
* @default "src/server.ts"
|
|
72
|
-
*/
|
|
73
|
-
entry?: string;
|
|
74
|
-
/**
|
|
75
|
-
* Directory containing Drizzle migrations, used for generation and bundling.
|
|
76
|
-
* When omitted, uses `./src/db/migrations` and allows that directory to be absent.
|
|
77
|
-
* An explicitly configured directory must exist when building the backend.
|
|
78
|
-
* @default "./src/db/migrations"
|
|
79
|
-
*/
|
|
80
|
-
migrations?: string;
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
export type ResolvedTailorKitConfig = z.output<typeof tailorkitConfigSchema>;
|
|
84
|
-
export { tailorkitConfigSchema };
|
|
85
|
-
export declare const defineConfig: (config: TailorKitConfig) => TailorKitConfig;
|
|
86
|
-
export declare const defineTailorKitConfig: typeof defineConfig;
|
package/dist/config/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { defineConfig, defineTailorKitConfig, type TailorKitConfig } from "./config";
|
package/dist/config/loader.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ResolvedTailorKitConfig } from "./config";
|
|
2
|
-
export interface LoadedTailorKitConfig {
|
|
3
|
-
config: ResolvedTailorKitConfig;
|
|
4
|
-
filepath: string;
|
|
5
|
-
root: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const loadTailorKitConfig: (configPath: string | undefined, cwd?: string) => Promise<LoadedTailorKitConfig>;
|
package/dist/config-loader.js
DELETED
package/dist/config.js
DELETED
package/dist/preact-version.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const MINIMUM_PREACT_MAJOR_VERSION = 11;
|
|
2
|
-
export interface PreactVersionCheck {
|
|
3
|
-
major: number;
|
|
4
|
-
version: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const parsePreactVersion: (version: string) => PreactVersionCheck;
|
|
7
|
-
export declare const assertSupportedPreactVersion: (version: string) => PreactVersionCheck;
|