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,4 @@
1
+ import "../types-DkvMXalq.mjs";
2
+ import { i as runMigrations, n as getMigrationStatus, r as rollbackMigration, t as MigrationStatus } from "../runner-B5l1JfOj.mjs";
3
+ import { a as SqliteConfig, c as sqlite, i as PostgresConfig, n as DatabaseDialectType, o as libsql, r as LibsqlConfig, s as postgres, t as DatabaseDescriptor } from "../adapters-BlzWJG82.mjs";
4
+ export { type DatabaseDescriptor, type DatabaseDialectType, type LibsqlConfig, type MigrationStatus, type PostgresConfig, type SqliteConfig, getMigrationStatus, libsql, postgres, rollbackMigration, runMigrations, sqlite };
@@ -0,0 +1,62 @@
1
+ import "../dialect-helpers-B9uSp2GJ.mjs";
2
+ import { n as rollbackMigration, r as runMigrations, t as getMigrationStatus } from "../runner-BGUGywgG.mjs";
3
+
4
+ //#region src/db/adapters.ts
5
+ /**
6
+ * SQLite database adapter (better-sqlite3)
7
+ *
8
+ * For local development and Node.js deployments.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * database: sqlite({ url: "file:./data.db" })
13
+ * ```
14
+ */
15
+ function sqlite(config) {
16
+ return {
17
+ entrypoint: "dineway/db/sqlite",
18
+ config,
19
+ type: "sqlite"
20
+ };
21
+ }
22
+ /**
23
+ * libSQL database adapter
24
+ *
25
+ * For remote libSQL deployments, with file-backed local development falling
26
+ * back to the local SQLite dialect automatically.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * database: libsql({
31
+ * url: process.env.DINEWAY_DATABASE_URL || "file:./data.db",
32
+ * authToken: process.env.DINEWAY_DATABASE_AUTH_TOKEN,
33
+ * })
34
+ * ```
35
+ */
36
+ function libsql(config) {
37
+ return {
38
+ entrypoint: "dineway/db/libsql",
39
+ config,
40
+ type: "sqlite"
41
+ };
42
+ }
43
+ /**
44
+ * PostgreSQL database adapter
45
+ *
46
+ * For PostgreSQL deployments with connection pooling.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * database: postgres({ connectionString: process.env.DATABASE_URL })
51
+ * ```
52
+ */
53
+ function postgres(config) {
54
+ return {
55
+ entrypoint: "dineway/db/postgres",
56
+ config,
57
+ type: "postgres"
58
+ };
59
+ }
60
+
61
+ //#endregion
62
+ export { getMigrationStatus, libsql, postgres, rollbackMigration, runMigrations, sqlite };
@@ -0,0 +1,10 @@
1
+ import { r as LibsqlConfig } from "../adapters-BlzWJG82.mjs";
2
+ import { Dialect } from "kysely";
3
+
4
+ //#region src/db/libsql.d.ts
5
+ /**
6
+ * Create a libSQL dialect from config
7
+ */
8
+ declare function createDialect(config: LibsqlConfig): Dialect;
9
+ //#endregion
10
+ export { createDialect };
@@ -0,0 +1,21 @@
1
+ import { n as __require } from "../chunk-ClPoSABd.mjs";
2
+
3
+ //#region src/db/libsql.ts
4
+ /**
5
+ * Create a libSQL dialect from config
6
+ */
7
+ function createDialect(config) {
8
+ if (config.url === ":memory:" || config.url.startsWith("file:")) {
9
+ const BetterSqlite3 = __require("better-sqlite3");
10
+ const { SqliteDialect } = __require("kysely");
11
+ return new SqliteDialect({ database: new BetterSqlite3(config.url === ":memory:" ? config.url : config.url.slice(5)) });
12
+ }
13
+ const { LibsqlDialect } = __require("@libsql/kysely-libsql");
14
+ return new LibsqlDialect({
15
+ url: config.url,
16
+ authToken: config.authToken
17
+ });
18
+ }
19
+
20
+ //#endregion
21
+ export { createDialect };
@@ -0,0 +1,10 @@
1
+ import { i as PostgresConfig } from "../adapters-BlzWJG82.mjs";
2
+ import { PostgresDialect } from "kysely";
3
+
4
+ //#region src/db/postgres.d.ts
5
+ /**
6
+ * Create a PostgreSQL dialect from config
7
+ */
8
+ declare function createDialect(config: PostgresConfig): PostgresDialect;
9
+ //#endregion
10
+ export { createDialect };
@@ -0,0 +1,29 @@
1
+ import { PostgresDialect } from "kysely";
2
+ import { Pool } from "pg";
3
+
4
+ //#region src/db/postgres.ts
5
+ /**
6
+ * PostgreSQL runtime adapter
7
+ *
8
+ * Creates a Kysely dialect for PostgreSQL via pg.
9
+ * Loaded at runtime via virtual module.
10
+ */
11
+ /**
12
+ * Create a PostgreSQL dialect from config
13
+ */
14
+ function createDialect(config) {
15
+ return new PostgresDialect({ pool: new Pool({
16
+ connectionString: config.connectionString,
17
+ host: config.host,
18
+ port: config.port,
19
+ database: config.database,
20
+ user: config.user,
21
+ password: config.password,
22
+ ssl: config.ssl,
23
+ min: config.pool?.min ?? 0,
24
+ max: config.pool?.max ?? 10
25
+ }) });
26
+ }
27
+
28
+ //#endregion
29
+ export { createDialect };
@@ -0,0 +1,10 @@
1
+ import { a as SqliteConfig } from "../adapters-BlzWJG82.mjs";
2
+ import { Dialect } from "kysely";
3
+
4
+ //#region src/db/sqlite.d.ts
5
+ /**
6
+ * Create a SQLite dialect from config
7
+ */
8
+ declare function createDialect(config: SqliteConfig): Dialect;
9
+ //#endregion
10
+ export { createDialect };
@@ -0,0 +1,15 @@
1
+ import { n as __require } from "../chunk-ClPoSABd.mjs";
2
+
3
+ //#region src/db/sqlite.ts
4
+ /**
5
+ * Create a SQLite dialect from config
6
+ */
7
+ function createDialect(config) {
8
+ const BetterSqlite3 = __require("better-sqlite3");
9
+ const { SqliteDialect } = __require("kysely");
10
+ const url = config.url;
11
+ return new SqliteDialect({ database: new BetterSqlite3(url.startsWith("file:") ? url.slice(5) : url) });
12
+ }
13
+
14
+ //#endregion
15
+ export { createDialect };
@@ -0,0 +1,80 @@
1
+ //#region src/seed/default.ts
2
+ const defaultSeed = {
3
+ version: "1",
4
+ meta: {
5
+ name: "Default",
6
+ description: "Posts and pages with categories and tags"
7
+ },
8
+ collections: [{
9
+ slug: "posts",
10
+ label: "Posts",
11
+ labelSingular: "Post",
12
+ supports: [
13
+ "drafts",
14
+ "revisions",
15
+ "search"
16
+ ],
17
+ fields: [
18
+ {
19
+ slug: "title",
20
+ label: "Title",
21
+ type: "string",
22
+ required: true,
23
+ searchable: true
24
+ },
25
+ {
26
+ slug: "featured_image",
27
+ label: "Featured Image",
28
+ type: "image"
29
+ },
30
+ {
31
+ slug: "content",
32
+ label: "Content",
33
+ type: "portableText",
34
+ searchable: true
35
+ },
36
+ {
37
+ slug: "excerpt",
38
+ label: "Excerpt",
39
+ type: "text"
40
+ }
41
+ ]
42
+ }, {
43
+ slug: "pages",
44
+ label: "Pages",
45
+ labelSingular: "Page",
46
+ supports: [
47
+ "drafts",
48
+ "revisions",
49
+ "search"
50
+ ],
51
+ fields: [{
52
+ slug: "title",
53
+ label: "Title",
54
+ type: "string",
55
+ required: true,
56
+ searchable: true
57
+ }, {
58
+ slug: "content",
59
+ label: "Content",
60
+ type: "portableText",
61
+ searchable: true
62
+ }]
63
+ }],
64
+ taxonomies: [{
65
+ name: "category",
66
+ label: "Categories",
67
+ labelSingular: "Category",
68
+ hierarchical: true,
69
+ collections: ["posts"]
70
+ }, {
71
+ name: "tag",
72
+ label: "Tags",
73
+ labelSingular: "Tag",
74
+ hierarchical: false,
75
+ collections: ["posts"]
76
+ }]
77
+ };
78
+
79
+ //#endregion
80
+ export { defaultSeed as t };
@@ -0,0 +1,89 @@
1
+ import { sql } from "kysely";
2
+
3
+ //#region src/database/dialect-helpers.ts
4
+ /**
5
+ * Detect dialect type from a Kysely instance via the adapter class name.
6
+ */
7
+ function detectDialect(db) {
8
+ if (db.getExecutor().adapter.constructor.name === "PostgresAdapter") return "postgres";
9
+ return "sqlite";
10
+ }
11
+ function isSqlite(db) {
12
+ return detectDialect(db) === "sqlite";
13
+ }
14
+ function isPostgres(db) {
15
+ return detectDialect(db) === "postgres";
16
+ }
17
+ /**
18
+ * Default timestamp expression for column defaults.
19
+ * Wrapped in parens for use in CREATE TABLE ... DEFAULT (...).
20
+ *
21
+ * sqlite: (datetime('now'))
22
+ * postgres: CURRENT_TIMESTAMP
23
+ */
24
+ function currentTimestamp(db) {
25
+ if (isPostgres(db)) return sql`CURRENT_TIMESTAMP`;
26
+ return sql`(datetime('now'))`;
27
+ }
28
+ /**
29
+ * Timestamp expression for use in WHERE clauses and SET expressions.
30
+ * No wrapping parens.
31
+ *
32
+ * sqlite: datetime('now')
33
+ * postgres: CURRENT_TIMESTAMP
34
+ */
35
+ function currentTimestampValue(db) {
36
+ if (isPostgres(db)) return sql`CURRENT_TIMESTAMP`;
37
+ return sql`datetime('now')`;
38
+ }
39
+ /**
40
+ * Check if a table exists in the database.
41
+ */
42
+ async function tableExists(db, tableName) {
43
+ if (isPostgres(db)) return (await sql`
44
+ SELECT EXISTS(
45
+ SELECT 1 FROM information_schema.tables
46
+ WHERE table_schema = 'public' AND table_name = ${tableName}
47
+ ) as exists
48
+ `.execute(db)).rows[0]?.exists === true;
49
+ return (await sql`
50
+ SELECT name FROM sqlite_master
51
+ WHERE type = 'table' AND name = ${tableName}
52
+ `.execute(db)).rows.length > 0;
53
+ }
54
+ /**
55
+ * List tables matching a LIKE pattern.
56
+ */
57
+ async function listTablesLike(db, pattern) {
58
+ if (isPostgres(db)) return (await sql`
59
+ SELECT table_name FROM information_schema.tables
60
+ WHERE table_schema = 'public' AND table_name LIKE ${pattern}
61
+ `.execute(db)).rows.map((r) => r.table_name);
62
+ return (await sql`
63
+ SELECT name FROM sqlite_master
64
+ WHERE type = 'table' AND name LIKE ${pattern}
65
+ `.execute(db)).rows.map((r) => r.name);
66
+ }
67
+ /**
68
+ * Column type for binary data.
69
+ *
70
+ * sqlite: blob
71
+ * postgres: bytea
72
+ */
73
+ function binaryType(db) {
74
+ if (isPostgres(db)) return "bytea";
75
+ return "blob";
76
+ }
77
+ /**
78
+ * SQL expression for extracting a field from a JSON/JSONB column.
79
+ *
80
+ * sqlite: json_extract(column, '$.path')
81
+ * postgres: column->>'path'
82
+ */
83
+ function jsonExtractExpr(db, column, path) {
84
+ if (isPostgres(db)) return `${column}->>'${path}'`;
85
+ return `json_extract(${column}, '$.${path}')`;
86
+ }
87
+
88
+ //#endregion
89
+ export { isSqlite as a, tableExists as c, isPostgres as i, currentTimestamp as n, jsonExtractExpr as o, currentTimestampValue as r, listTablesLike as s, binaryType as t };
@@ -0,0 +1,26 @@
1
+ //#region src/api/error.ts
2
+ /**
3
+ * Standard cache headers for all API responses.
4
+ *
5
+ * Cache-Control: private, no-store -- prevents CDN/proxy caching of authenticated data.
6
+ * no-store already tells caches not to store the response, so Vary is unnecessary.
7
+ */
8
+ const API_CACHE_HEADERS = { "Cache-Control": "private, no-store" };
9
+ /**
10
+ * Create a standardized error response.
11
+ *
12
+ * Always returns `{ error: { code, message } }` with correct Content-Type.
13
+ * Use this for all error responses in API routes.
14
+ */
15
+ function apiError(code, message, status) {
16
+ return Response.json({ error: {
17
+ code,
18
+ message
19
+ } }, {
20
+ status,
21
+ headers: API_CACHE_HEADERS
22
+ });
23
+ }
24
+
25
+ //#endregion
26
+ export { apiError as t };