dineway 0.1.3

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.
Files changed (96) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +89 -0
  3. package/dist/adapters-BlzWJG82.d.mts +106 -0
  4. package/dist/apply-CAPvMfoU.mjs +1339 -0
  5. package/dist/astro/index.d.mts +50 -0
  6. package/dist/astro/index.mjs +1326 -0
  7. package/dist/astro/middleware/auth.d.mts +30 -0
  8. package/dist/astro/middleware/auth.mjs +708 -0
  9. package/dist/astro/middleware/redirect.d.mts +21 -0
  10. package/dist/astro/middleware/redirect.mjs +62 -0
  11. package/dist/astro/middleware/request-context.d.mts +17 -0
  12. package/dist/astro/middleware/request-context.mjs +1371 -0
  13. package/dist/astro/middleware/setup.d.mts +19 -0
  14. package/dist/astro/middleware/setup.mjs +46 -0
  15. package/dist/astro/middleware.d.mts +12 -0
  16. package/dist/astro/middleware.mjs +1716 -0
  17. package/dist/astro/types.d.mts +269 -0
  18. package/dist/astro/types.mjs +1 -0
  19. package/dist/base64-F8-DUraK.mjs +58 -0
  20. package/dist/byline-DeWCMU_i.mjs +234 -0
  21. package/dist/bylines-DyqBV9EQ.mjs +137 -0
  22. package/dist/chunk-ClPoSABd.mjs +21 -0
  23. package/dist/cli/index.d.mts +1 -0
  24. package/dist/cli/index.mjs +3987 -0
  25. package/dist/client/external-auth-headers.d.mts +38 -0
  26. package/dist/client/external-auth-headers.mjs +101 -0
  27. package/dist/client/index.d.mts +397 -0
  28. package/dist/client/index.mjs +345 -0
  29. package/dist/config-Cq8H0SfX.mjs +46 -0
  30. package/dist/connection-C9pxzuag.mjs +52 -0
  31. package/dist/content-zSgdNmnt.mjs +836 -0
  32. package/dist/db/index.d.mts +4 -0
  33. package/dist/db/index.mjs +62 -0
  34. package/dist/db/libsql.d.mts +10 -0
  35. package/dist/db/libsql.mjs +21 -0
  36. package/dist/db/postgres.d.mts +10 -0
  37. package/dist/db/postgres.mjs +29 -0
  38. package/dist/db/sqlite.d.mts +10 -0
  39. package/dist/db/sqlite.mjs +15 -0
  40. package/dist/default-WYlzADZL.mjs +80 -0
  41. package/dist/dialect-helpers-B9uSp2GJ.mjs +89 -0
  42. package/dist/error-DrxtnGPg.mjs +26 -0
  43. package/dist/index-C-jx21qs.d.mts +4771 -0
  44. package/dist/index.d.mts +16 -0
  45. package/dist/index.mjs +30 -0
  46. package/dist/load-C6FCD1FU.mjs +27 -0
  47. package/dist/loader-qKmo0wAY.mjs +446 -0
  48. package/dist/manifest-schema-CTSEyIJ3.mjs +186 -0
  49. package/dist/media/index.d.mts +25 -0
  50. package/dist/media/index.mjs +54 -0
  51. package/dist/media/local-runtime.d.mts +38 -0
  52. package/dist/media/local-runtime.mjs +132 -0
  53. package/dist/media-DMTr80Gv.mjs +199 -0
  54. package/dist/mode-BlyYtIFO.mjs +22 -0
  55. package/dist/page/index.d.mts +148 -0
  56. package/dist/page/index.mjs +419 -0
  57. package/dist/placeholder-B3knXwNc.mjs +267 -0
  58. package/dist/placeholder-bOx1xCTY.d.mts +283 -0
  59. package/dist/plugin-utils.d.mts +57 -0
  60. package/dist/plugin-utils.mjs +77 -0
  61. package/dist/plugins/adapt-sandbox-entry.d.mts +21 -0
  62. package/dist/plugins/adapt-sandbox-entry.mjs +112 -0
  63. package/dist/query-BiaPl_g2.mjs +459 -0
  64. package/dist/redirect-JPqLAbxa.mjs +328 -0
  65. package/dist/registry-DSd1GWB8.mjs +851 -0
  66. package/dist/request-context.d.mts +49 -0
  67. package/dist/request-context.mjs +42 -0
  68. package/dist/runner-B5l1JfOj.d.mts +26 -0
  69. package/dist/runner-BGUGywgG.mjs +1529 -0
  70. package/dist/runtime.d.mts +25 -0
  71. package/dist/runtime.mjs +41 -0
  72. package/dist/search-BNruJHDL.mjs +11054 -0
  73. package/dist/seed/index.d.mts +3 -0
  74. package/dist/seed/index.mjs +15 -0
  75. package/dist/seo/index.d.mts +69 -0
  76. package/dist/seo/index.mjs +69 -0
  77. package/dist/storage/local.d.mts +38 -0
  78. package/dist/storage/local.mjs +165 -0
  79. package/dist/storage/s3.d.mts +31 -0
  80. package/dist/storage/s3.mjs +174 -0
  81. package/dist/tokens-4vgYuXsZ.mjs +170 -0
  82. package/dist/transport-C5FYnid7.mjs +417 -0
  83. package/dist/transport-gIL-e43D.d.mts +41 -0
  84. package/dist/types-BawVha09.mjs +30 -0
  85. package/dist/types-BgQeVaPj.d.mts +192 -0
  86. package/dist/types-CLLdsG3g.d.mts +103 -0
  87. package/dist/types-D38djUXv.d.mts +1196 -0
  88. package/dist/types-DShnjzb6.mjs +15 -0
  89. package/dist/types-DkvMXalq.d.mts +425 -0
  90. package/dist/types-DuNbGKjF.mjs +74 -0
  91. package/dist/types-ju-_ORz7.d.mts +182 -0
  92. package/dist/validate-CXnRKfJK.mjs +327 -0
  93. package/dist/validate-CqRJb_xU.mjs +96 -0
  94. package/dist/validate-DVKJJ-M_.d.mts +377 -0
  95. package/locals.d.ts +47 -0
  96. package/package.json +313 -0
@@ -0,0 +1,345 @@
1
+ import { a as tokenInterceptor, c as markdownToPortableText, i as refreshInterceptor, l as portableTextToMarkdown, n as csrfInterceptor, o as convertDataForRead, r as devBypassInterceptor, s as convertDataForWrite, t as createTransport } from "../transport-C5FYnid7.mjs";
2
+ import mime from "mime/lite";
3
+
4
+ //#region src/client/index.ts
5
+ /**
6
+ * DinewayClient — typed HTTP client for the Dineway REST API.
7
+ *
8
+ * Handles auth, CSRF, PT ↔ Markdown conversion, and optional `_rev`
9
+ * concurrency tokens. Shared foundation for the CLI and future MCP server.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { DinewayClient } from "dineway/client";
14
+ *
15
+ * const client = new DinewayClient({
16
+ * baseUrl: "http://localhost:4321",
17
+ * devBypass: true,
18
+ * });
19
+ *
20
+ * const posts = await client.list("posts", { status: "published" });
21
+ * ```
22
+ */
23
+ const TRAILING_SLASH_PATTERN = /\/$/;
24
+ function mimeFromFilename(filename) {
25
+ return mime.getType(filename) ?? "application/octet-stream";
26
+ }
27
+ var DinewayApiError = class extends Error {
28
+ constructor(status, code, message, details) {
29
+ super(message);
30
+ this.status = status;
31
+ this.code = code;
32
+ this.details = details;
33
+ this.name = "DinewayApiError";
34
+ }
35
+ };
36
+ var DinewayClientError = class extends Error {
37
+ constructor(message) {
38
+ super(message);
39
+ this.name = "DinewayClientError";
40
+ }
41
+ };
42
+ var DinewayClient = class {
43
+ baseUrl;
44
+ transport;
45
+ /** Cached field schemas per collection for PT conversion */
46
+ fieldSchemaCache = /* @__PURE__ */ new Map();
47
+ constructor(options) {
48
+ this.baseUrl = options.baseUrl.replace(TRAILING_SLASH_PATTERN, "");
49
+ const interceptors = [csrfInterceptor()];
50
+ if (options.token) interceptors.push(tokenInterceptor(options.token));
51
+ else if (options.devBypass) interceptors.push(devBypassInterceptor(this.baseUrl));
52
+ if (options.refreshToken) interceptors.push(refreshInterceptor({
53
+ refreshToken: options.refreshToken,
54
+ tokenEndpoint: `${this.baseUrl}/_dineway/api/oauth/token/refresh`,
55
+ onTokenRefreshed: options.onTokenRefresh ? (accessToken, _refreshToken, expiresAt) => {
56
+ const expiresIn = Math.floor((new Date(expiresAt).getTime() - Date.now()) / 1e3);
57
+ options.onTokenRefresh(accessToken, expiresIn);
58
+ } : void 0
59
+ }));
60
+ if (options.interceptors) interceptors.push(...options.interceptors);
61
+ this.transport = createTransport({ interceptors });
62
+ }
63
+ /** List all collections */
64
+ async collections() {
65
+ return (await this.request("GET", "/schema/collections")).items;
66
+ }
67
+ /** Get a single collection with its fields */
68
+ async collection(slug) {
69
+ const col = (await this.request("GET", `/schema/collections/${encodeURIComponent(slug)}?includeFields=true`)).item;
70
+ if (col.fields) this.fieldSchemaCache.set(slug, col.fields.map((f) => ({
71
+ slug: f.slug,
72
+ type: f.type
73
+ })));
74
+ return col;
75
+ }
76
+ /** Create a collection */
77
+ async createCollection(input) {
78
+ return (await this.request("POST", "/schema/collections", input)).item;
79
+ }
80
+ /** Delete a collection */
81
+ async deleteCollection(slug) {
82
+ await this.request("DELETE", `/schema/collections/${encodeURIComponent(slug)}`);
83
+ }
84
+ /** Create a field on a collection */
85
+ async createField(collection, input) {
86
+ const data = await this.request("POST", `/schema/collections/${encodeURIComponent(collection)}/fields`, input);
87
+ this.fieldSchemaCache.delete(collection);
88
+ return data.item;
89
+ }
90
+ /** Delete a field from a collection */
91
+ async deleteField(collection, fieldSlug) {
92
+ await this.request("DELETE", `/schema/collections/${encodeURIComponent(collection)}/fields/${encodeURIComponent(fieldSlug)}`);
93
+ this.fieldSchemaCache.delete(collection);
94
+ }
95
+ /** Get full manifest (schema + field descriptors + features) */
96
+ async manifest() {
97
+ return this.request("GET", "/manifest");
98
+ }
99
+ /** Export full schema as JSON (used by `dineway types`) */
100
+ async schemaExport() {
101
+ return this.request("GET", "/schema");
102
+ }
103
+ /** Export schema as TypeScript type definitions (used by `dineway types`) */
104
+ async schemaTypes() {
105
+ const response = await this.requestRaw("GET", "/schema?format=typescript");
106
+ await this.assertOk(response);
107
+ return response.text();
108
+ }
109
+ /** List content in a collection */
110
+ async list(collection, options) {
111
+ const params = new URLSearchParams();
112
+ if (options?.status) params.set("status", options.status);
113
+ if (options?.limit) params.set("limit", String(options.limit));
114
+ if (options?.cursor) params.set("cursor", options.cursor);
115
+ if (options?.orderBy) params.set("orderBy", options.orderBy);
116
+ if (options?.order) params.set("order", options.order);
117
+ if (options?.locale) params.set("locale", options.locale);
118
+ const qs = params.toString();
119
+ const path = `/content/${encodeURIComponent(collection)}${qs ? `?${qs}` : ""}`;
120
+ return this.request("GET", path);
121
+ }
122
+ /** Async iterator that auto-follows cursors */
123
+ async *listAll(collection, options) {
124
+ let cursor;
125
+ do {
126
+ const result = await this.list(collection, {
127
+ ...options,
128
+ cursor
129
+ });
130
+ for (const item of result.items) yield item;
131
+ cursor = result.nextCursor;
132
+ } while (cursor);
133
+ }
134
+ /**
135
+ * Get a single content item. Returns the item with a `_rev` token
136
+ * that can be passed to update() for optimistic concurrency.
137
+ */
138
+ async get(collection, id, options) {
139
+ const params = new URLSearchParams();
140
+ if (options?.locale) params.set("locale", options.locale);
141
+ const qs = params.size > 0 ? `?${params}` : "";
142
+ const result = await this.requestRaw("GET", `/content/${encodeURIComponent(collection)}/${encodeURIComponent(id)}${qs}`);
143
+ if (!result.ok) await this.assertOk(result);
144
+ const json = (await result.json()).data;
145
+ const item = json.item;
146
+ if (json._rev) item._rev = json._rev;
147
+ if (!options?.raw && item.data) {
148
+ const fields = await this.getFieldSchemas(collection);
149
+ item.data = convertDataForRead(item.data, fields, false);
150
+ }
151
+ return item;
152
+ }
153
+ /** Create a new content item */
154
+ async create(collection, input) {
155
+ const fields = await this.getFieldSchemas(collection);
156
+ const data = convertDataForWrite(input.data, fields);
157
+ return (await this.request("POST", `/content/${encodeURIComponent(collection)}`, {
158
+ ...input,
159
+ data
160
+ })).item;
161
+ }
162
+ /**
163
+ * Update a content item. Pass `_rev` from a prior get() for optimistic
164
+ * concurrency — the server returns 409 if the item has changed.
165
+ * Omit `_rev` for a blind write (no conflict detection).
166
+ */
167
+ async update(collection, id, input) {
168
+ let data = input.data;
169
+ if (data) {
170
+ const fields = await this.getFieldSchemas(collection);
171
+ data = convertDataForWrite(data, fields);
172
+ }
173
+ const body = {
174
+ data,
175
+ slug: input.slug,
176
+ status: input.status,
177
+ ...input._rev ? { _rev: input._rev } : {}
178
+ };
179
+ const result = await this.request("PUT", `/content/${encodeURIComponent(collection)}/${encodeURIComponent(id)}`, body);
180
+ const item = result.item;
181
+ if (result._rev) item._rev = result._rev;
182
+ return item;
183
+ }
184
+ /** Delete (soft) a content item */
185
+ async delete(collection, id) {
186
+ await this.request("DELETE", `/content/${encodeURIComponent(collection)}/${encodeURIComponent(id)}`);
187
+ }
188
+ /** Publish a content item */
189
+ async publish(collection, id) {
190
+ await this.request("POST", `/content/${encodeURIComponent(collection)}/${encodeURIComponent(id)}/publish`);
191
+ }
192
+ /** Unpublish a content item */
193
+ async unpublish(collection, id) {
194
+ await this.request("POST", `/content/${encodeURIComponent(collection)}/${encodeURIComponent(id)}/unpublish`);
195
+ }
196
+ /** Schedule publishing */
197
+ async schedule(collection, id, options) {
198
+ await this.request("POST", `/content/${encodeURIComponent(collection)}/${encodeURIComponent(id)}/schedule`, { scheduledAt: options.at });
199
+ }
200
+ /** Restore a trashed content item */
201
+ async restore(collection, id) {
202
+ await this.request("POST", `/content/${encodeURIComponent(collection)}/${encodeURIComponent(id)}/restore`);
203
+ }
204
+ /** Compare live and draft revisions */
205
+ async compare(collection, id) {
206
+ return this.request("GET", `/content/${encodeURIComponent(collection)}/${encodeURIComponent(id)}/compare`);
207
+ }
208
+ /** Discard draft revision, reverting to the published version */
209
+ async discardDraft(collection, id) {
210
+ await this.request("POST", `/content/${encodeURIComponent(collection)}/${encodeURIComponent(id)}/discard-draft`);
211
+ }
212
+ /**
213
+ * Get all translations of a content item.
214
+ * Returns the translation group ID and a summary of each locale version.
215
+ */
216
+ async translations(collection, id) {
217
+ return this.request("GET", `/content/${encodeURIComponent(collection)}/${encodeURIComponent(id)}/translations`);
218
+ }
219
+ /** List media items */
220
+ async mediaList(options) {
221
+ const params = new URLSearchParams();
222
+ if (options?.mimeType) params.set("mimeType", options.mimeType);
223
+ if (options?.limit) params.set("limit", String(options.limit));
224
+ if (options?.cursor) params.set("cursor", options.cursor);
225
+ const qs = params.toString();
226
+ return this.request("GET", `/media${qs ? `?${qs}` : ""}`);
227
+ }
228
+ /** Get a single media item */
229
+ async mediaGet(id) {
230
+ return (await this.request("GET", `/media/${encodeURIComponent(id)}`)).item;
231
+ }
232
+ /** Upload a media file */
233
+ async mediaUpload(file, filename, options) {
234
+ const formData = new FormData();
235
+ if (file instanceof Blob) formData.append("file", file, filename);
236
+ else {
237
+ const mimeType = options?.contentType ?? mimeFromFilename(filename);
238
+ formData.append("file", new Blob([file], { type: mimeType }), filename);
239
+ }
240
+ if (options?.alt) formData.append("alt", options.alt);
241
+ if (options?.caption) formData.append("caption", options.caption);
242
+ const url = `${this.baseUrl}/_dineway/api/media`;
243
+ const request = new Request(url, {
244
+ method: "POST",
245
+ body: formData
246
+ });
247
+ const response = await this.transport.fetch(request);
248
+ await this.assertOk(response);
249
+ return (await response.json()).data.item;
250
+ }
251
+ /** Delete a media item */
252
+ async mediaDelete(id) {
253
+ await this.request("DELETE", `/media/${encodeURIComponent(id)}`);
254
+ }
255
+ /** Full-text search */
256
+ async search(query, options) {
257
+ const params = new URLSearchParams({ q: query });
258
+ if (options?.collection) params.set("collections", options.collection);
259
+ if (options?.locale) params.set("locale", options.locale);
260
+ if (options?.limit) params.set("limit", String(options.limit));
261
+ return (await this.request("GET", `/search?${params}`)).items;
262
+ }
263
+ /** List taxonomies */
264
+ async taxonomies() {
265
+ return (await this.request("GET", "/taxonomies")).items;
266
+ }
267
+ /** List terms in a taxonomy */
268
+ async terms(taxonomy, options) {
269
+ const params = new URLSearchParams();
270
+ if (options?.limit) params.set("limit", String(options.limit));
271
+ if (options?.cursor) params.set("cursor", options.cursor);
272
+ const qs = params.toString();
273
+ return this.request("GET", `/taxonomies/${encodeURIComponent(taxonomy)}/terms${qs ? `?${qs}` : ""}`);
274
+ }
275
+ /** Create a taxonomy term */
276
+ async createTerm(taxonomy, input) {
277
+ return this.request("POST", `/taxonomies/${encodeURIComponent(taxonomy)}/terms`, input);
278
+ }
279
+ /** List menus */
280
+ async menus() {
281
+ return (await this.request("GET", "/menus")).items;
282
+ }
283
+ /** Get a menu with its items */
284
+ async menu(name) {
285
+ return this.request("GET", `/menus/${encodeURIComponent(name)}`);
286
+ }
287
+ /** Make a typed JSON request to the API */
288
+ async request(method, path, body) {
289
+ const response = await this.requestRaw(method, path, body);
290
+ await this.assertOk(response);
291
+ return (await response.json()).data;
292
+ }
293
+ /** Make a raw request — caller handles response */
294
+ async requestRaw(method, path, body) {
295
+ const url = `${this.baseUrl}/_dineway/api${path}`;
296
+ const headers = { Accept: "application/json" };
297
+ let requestBody;
298
+ if (body !== void 0) {
299
+ headers["Content-Type"] = "application/json";
300
+ requestBody = JSON.stringify(body);
301
+ }
302
+ const request = new Request(url, {
303
+ method,
304
+ headers,
305
+ body: requestBody
306
+ });
307
+ return this.transport.fetch(request);
308
+ }
309
+ /** Assert a response is OK, throw typed error if not */
310
+ async assertOk(response) {
311
+ if (response.ok) return;
312
+ let code = "UNKNOWN_ERROR";
313
+ let message = `HTTP ${response.status}`;
314
+ let details;
315
+ try {
316
+ const json = await response.json();
317
+ if (json.error) {
318
+ code = json.error.code ?? code;
319
+ message = json.error.message ?? message;
320
+ details = json.error.details;
321
+ }
322
+ } catch {
323
+ message = response.statusText || message;
324
+ }
325
+ throw new DinewayApiError(response.status, code, message, details);
326
+ }
327
+ /** Get cached field schemas for a collection, fetching if needed */
328
+ async getFieldSchemas(collection) {
329
+ let cached = this.fieldSchemaCache.get(collection);
330
+ if (cached) return cached;
331
+ try {
332
+ cached = (await this.collection(collection)).fields.map((f) => ({
333
+ slug: f.slug,
334
+ type: f.type
335
+ }));
336
+ this.fieldSchemaCache.set(collection, cached);
337
+ return cached;
338
+ } catch {
339
+ return [];
340
+ }
341
+ }
342
+ };
343
+
344
+ //#endregion
345
+ export { DinewayApiError, DinewayClient, DinewayClientError, createTransport, csrfInterceptor, devBypassInterceptor, markdownToPortableText, portableTextToMarkdown, tokenInterceptor };
@@ -0,0 +1,46 @@
1
+ //#region src/i18n/config.ts
2
+ let _config;
3
+ /**
4
+ * Initialize i18n config from virtual module data.
5
+ * Called during runtime initialization.
6
+ */
7
+ function setI18nConfig(config) {
8
+ _config = config;
9
+ }
10
+ /**
11
+ * Get the current i18n config.
12
+ * Returns null if i18n is not configured.
13
+ */
14
+ function getI18nConfig() {
15
+ return _config ?? null;
16
+ }
17
+ /**
18
+ * Check if i18n is enabled.
19
+ * Returns true when multiple locales are configured.
20
+ */
21
+ function isI18nEnabled() {
22
+ return _config != null && _config.locales.length > 1;
23
+ }
24
+ /**
25
+ * Resolve fallback locale chain for a given locale.
26
+ * Returns array of locales to try, from most preferred to least.
27
+ * Always ends with defaultLocale.
28
+ */
29
+ function getFallbackChain(locale) {
30
+ if (!_config) return [locale];
31
+ const chain = [locale];
32
+ let current = locale;
33
+ const visited = new Set([locale]);
34
+ while (_config.fallback?.[current]) {
35
+ const next = _config.fallback[current];
36
+ if (visited.has(next)) break;
37
+ chain.push(next);
38
+ visited.add(next);
39
+ current = next;
40
+ }
41
+ if (!visited.has(_config.defaultLocale)) chain.push(_config.defaultLocale);
42
+ return chain;
43
+ }
44
+
45
+ //#endregion
46
+ export { setI18nConfig as i, getI18nConfig as n, isI18nEnabled as r, getFallbackChain as t };
@@ -0,0 +1,52 @@
1
+ import { n as __require } from "./chunk-ClPoSABd.mjs";
2
+ import BetterSqlite3 from "better-sqlite3";
3
+ import { Kysely, SqliteDialect } from "kysely";
4
+
5
+ //#region src/database/connection.ts
6
+ const LIBSQL_REMOTE_URL_PREFIXES = [
7
+ "libsql:",
8
+ "http://",
9
+ "https://",
10
+ "ws://",
11
+ "wss://"
12
+ ];
13
+ var DinewayDatabaseError = class extends Error {
14
+ constructor(message, cause) {
15
+ super(message);
16
+ this.cause = cause;
17
+ this.name = "DinewayDatabaseError";
18
+ }
19
+ };
20
+ /**
21
+ * Creates a Kysely database instance
22
+ * Supports:
23
+ * - file:./path/to/db.sqlite (local SQLite)
24
+ * - :memory: (in-memory SQLite for testing)
25
+ * - libsql://..., http://..., https://..., ws://..., wss://... (remote libSQL)
26
+ */
27
+ function createDatabase(config) {
28
+ try {
29
+ if (config.url.startsWith("file:") || config.url === ":memory:") {
30
+ const sqlite = new BetterSqlite3(config.url === ":memory:" ? ":memory:" : config.url.replace("file:", ""));
31
+ sqlite.pragma("journal_mode = WAL");
32
+ sqlite.pragma("foreign_keys = ON");
33
+ return new Kysely({ dialect: new SqliteDialect({ database: sqlite }) });
34
+ }
35
+ if (LIBSQL_REMOTE_URL_PREFIXES.some((prefix) => config.url.startsWith(prefix))) try {
36
+ const { LibsqlDialect } = __require("@libsql/kysely-libsql");
37
+ return new Kysely({ dialect: new LibsqlDialect({
38
+ url: config.url,
39
+ authToken: config.authToken
40
+ }) });
41
+ } catch (error) {
42
+ throw new DinewayDatabaseError("Failed to load libSQL dialect. Install @libsql/kysely-libsql to use remote libSQL databases", error);
43
+ }
44
+ throw new DinewayDatabaseError(`Unsupported database URL scheme: ${config.url}`);
45
+ } catch (error) {
46
+ if (error instanceof DinewayDatabaseError) throw error;
47
+ throw new DinewayDatabaseError("Failed to create database", error);
48
+ }
49
+ }
50
+
51
+ //#endregion
52
+ export { createDatabase as n, DinewayDatabaseError as t };