@trypattern/sdk 0.0.0-stage → 0.1.1

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 (273) hide show
  1. package/README.md +127 -2
  2. package/dist/access.d.ts +31 -0
  3. package/dist/access.js +72 -0
  4. package/dist/actions.d.ts +57 -0
  5. package/dist/actions.js +198 -0
  6. package/dist/api.d.ts +30 -0
  7. package/dist/api.js +60 -0
  8. package/dist/app.d.ts +115 -0
  9. package/dist/app.js +266 -0
  10. package/dist/appInfo.d.ts +35 -0
  11. package/dist/appInfo.js +67 -0
  12. package/dist/appTitle.d.ts +6 -0
  13. package/dist/appTitle.js +3 -0
  14. package/dist/appearance.d.ts +7 -0
  15. package/dist/appearance.js +2 -0
  16. package/dist/auth/sessionApi.d.ts +41 -0
  17. package/dist/auth/sessionApi.js +158 -0
  18. package/dist/auth/sessionStore.d.ts +20 -0
  19. package/dist/auth/sessionStore.js +40 -0
  20. package/dist/auth/user.d.ts +11 -0
  21. package/dist/auth/user.js +9 -0
  22. package/dist/builtins/Account.d.ts +25 -0
  23. package/dist/builtins/Account.js +15 -0
  24. package/dist/builtins/AppSettings.d.ts +12 -0
  25. package/dist/builtins/AppSettings.js +31 -0
  26. package/dist/builtins/Palette.d.ts +29 -0
  27. package/dist/builtins/Palette.js +63 -0
  28. package/dist/builtins/SignIn.d.ts +28 -0
  29. package/dist/builtins/SignIn.js +60 -0
  30. package/dist/builtins/Toasts.d.ts +32 -0
  31. package/dist/builtins/Toasts.js +25 -0
  32. package/dist/builtins/actions.d.ts +2 -0
  33. package/dist/builtins/actions.js +45 -0
  34. package/dist/cache.d.ts +24 -0
  35. package/dist/cache.js +112 -0
  36. package/dist/cli/app.d.ts +2 -0
  37. package/dist/cli/app.js +1406 -0
  38. package/dist/cli/publishing.d.ts +21 -0
  39. package/dist/cli/publishing.js +493 -0
  40. package/dist/cli/screenshot.d.ts +1 -0
  41. package/dist/cli/screenshot.js +96 -0
  42. package/dist/cli/tools.d.ts +12 -0
  43. package/dist/cli/tools.js +35 -0
  44. package/dist/clock.d.ts +6 -0
  45. package/dist/clock.js +31 -0
  46. package/dist/components/AppFrame.d.ts +14 -0
  47. package/dist/components/AppFrame.js +64 -0
  48. package/dist/components/AppearancePicker.d.ts +1 -0
  49. package/dist/components/AppearancePicker.js +12 -0
  50. package/dist/components/Avatar.d.ts +9 -0
  51. package/dist/components/Avatar.js +63 -0
  52. package/dist/components/Badge.d.ts +11 -0
  53. package/dist/components/Badge.js +87 -0
  54. package/dist/components/Button.d.ts +24 -0
  55. package/dist/components/Button.js +252 -0
  56. package/dist/components/Card.d.ts +12 -0
  57. package/dist/components/Card.js +38 -0
  58. package/dist/components/CommandMenu.d.ts +23 -0
  59. package/dist/components/CommandMenu.js +214 -0
  60. package/dist/components/CommandPalette.d.ts +1 -0
  61. package/dist/components/CommandPalette.js +7 -0
  62. package/dist/components/Content.d.ts +7 -0
  63. package/dist/components/Content.js +24 -0
  64. package/dist/components/ContextMenu.d.ts +8 -0
  65. package/dist/components/ContextMenu.js +23 -0
  66. package/dist/components/CopyButton.d.ts +11 -0
  67. package/dist/components/CopyButton.js +16 -0
  68. package/dist/components/Dialog.d.ts +11 -0
  69. package/dist/components/Dialog.js +81 -0
  70. package/dist/components/Divider.d.ts +7 -0
  71. package/dist/components/Divider.js +30 -0
  72. package/dist/components/EmptyState.d.ts +8 -0
  73. package/dist/components/EmptyState.js +24 -0
  74. package/dist/components/Form.d.ts +9 -0
  75. package/dist/components/Form.js +23 -0
  76. package/dist/components/Icon.d.ts +10 -0
  77. package/dist/components/Icon.js +22 -0
  78. package/dist/components/IconButton.d.ts +14 -0
  79. package/dist/components/IconButton.js +53 -0
  80. package/dist/components/Kbd.d.ts +6 -0
  81. package/dist/components/Kbd.js +67 -0
  82. package/dist/components/Link.d.ts +14 -0
  83. package/dist/components/Link.js +44 -0
  84. package/dist/components/ListRow.d.ts +12 -0
  85. package/dist/components/ListRow.js +62 -0
  86. package/dist/components/LoadingRows.d.ts +5 -0
  87. package/dist/components/LoadingRows.js +6 -0
  88. package/dist/components/Menu.d.ts +12 -0
  89. package/dist/components/Menu.js +33 -0
  90. package/dist/components/MenuItems.d.ts +21 -0
  91. package/dist/components/MenuItems.js +32 -0
  92. package/dist/components/Placement.d.ts +21 -0
  93. package/dist/components/Placement.js +1 -0
  94. package/dist/components/Popup.d.ts +8 -0
  95. package/dist/components/Popup.js +43 -0
  96. package/dist/components/PopupItem.d.ts +8 -0
  97. package/dist/components/PopupItem.js +51 -0
  98. package/dist/components/PropertyRow.d.ts +7 -0
  99. package/dist/components/PropertyRow.js +23 -0
  100. package/dist/components/RadioGroup.d.ts +18 -0
  101. package/dist/components/RadioGroup.js +85 -0
  102. package/dist/components/Row.d.ts +16 -0
  103. package/dist/components/Row.js +27 -0
  104. package/dist/components/Screen.d.ts +13 -0
  105. package/dist/components/Screen.js +56 -0
  106. package/dist/components/Scrim.d.ts +8 -0
  107. package/dist/components/Scrim.js +40 -0
  108. package/dist/components/ScrollArea.d.ts +15 -0
  109. package/dist/components/ScrollArea.js +13 -0
  110. package/dist/components/SegmentedControl.d.ts +17 -0
  111. package/dist/components/SegmentedControl.js +68 -0
  112. package/dist/components/Select.d.ts +17 -0
  113. package/dist/components/Select.js +107 -0
  114. package/dist/components/SettingsRow.d.ts +8 -0
  115. package/dist/components/SettingsRow.js +32 -0
  116. package/dist/components/Sidebar.d.ts +20 -0
  117. package/dist/components/Sidebar.js +137 -0
  118. package/dist/components/SignInScreen.d.ts +1 -0
  119. package/dist/components/SignInScreen.js +40 -0
  120. package/dist/components/Size.d.ts +1 -0
  121. package/dist/components/Size.js +1 -0
  122. package/dist/components/Skeleton.d.ts +8 -0
  123. package/dist/components/Skeleton.js +48 -0
  124. package/dist/components/Spinner.d.ts +6 -0
  125. package/dist/components/Spinner.js +54 -0
  126. package/dist/components/Stack.d.ts +14 -0
  127. package/dist/components/Stack.js +19 -0
  128. package/dist/components/Switch.d.ts +10 -0
  129. package/dist/components/Switch.js +72 -0
  130. package/dist/components/Text.d.ts +21 -0
  131. package/dist/components/Text.js +77 -0
  132. package/dist/components/TextField.d.ts +25 -0
  133. package/dist/components/TextField.js +68 -0
  134. package/dist/components/Toaster.d.ts +1 -0
  135. package/dist/components/Toaster.js +83 -0
  136. package/dist/components/Tooltip.d.ts +8 -0
  137. package/dist/components/Tooltip.js +43 -0
  138. package/dist/components/controlLook.d.ts +70 -0
  139. package/dist/components/controlLook.js +80 -0
  140. package/dist/components/frame.d.ts +4 -0
  141. package/dist/components/frame.js +2 -0
  142. package/dist/components/icons.d.ts +59 -0
  143. package/dist/components/icons.js +111 -0
  144. package/dist/components/interaction.d.ts +12 -0
  145. package/dist/components/interaction.js +22 -0
  146. package/dist/components/spacing.d.ts +118 -0
  147. package/dist/components/spacing.js +46 -0
  148. package/dist/components/tones.d.ts +28 -0
  149. package/dist/components/tones.js +12 -0
  150. package/dist/entityStore.d.ts +46 -0
  151. package/dist/entityStore.js +160 -0
  152. package/dist/flows/accessFlows.d.ts +9 -0
  153. package/dist/flows/accessFlows.js +167 -0
  154. package/dist/flows/browser.d.ts +34 -0
  155. package/dist/flows/browser.js +167 -0
  156. package/dist/flows/contactSheet.d.ts +1 -0
  157. package/dist/flows/contactSheet.js +63 -0
  158. package/dist/flows/flowBrowser.d.ts +25 -0
  159. package/dist/flows/flowBrowser.js +23 -0
  160. package/dist/flows/flowSetup.d.ts +3 -0
  161. package/dist/flows/flowSetup.js +35 -0
  162. package/dist/flows/flows.d.ts +47 -0
  163. package/dist/flows/flows.js +175 -0
  164. package/dist/flows/screenshotName.d.ts +1 -0
  165. package/dist/flows/screenshotName.js +6 -0
  166. package/dist/gate.d.ts +8 -0
  167. package/dist/gate.js +52 -0
  168. package/dist/hooks/appContext.d.ts +15 -0
  169. package/dist/hooks/appContext.js +5 -0
  170. package/dist/hooks/appHooks.d.ts +21 -0
  171. package/dist/hooks/appHooks.js +24 -0
  172. package/dist/hooks/useAnimatesOnChange.d.ts +1 -0
  173. package/dist/hooks/useAnimatesOnChange.js +14 -0
  174. package/dist/hooks/useStoreState.d.ts +6 -0
  175. package/dist/hooks/useStoreState.js +5 -0
  176. package/dist/index.d.ts +44 -0
  177. package/dist/index.js +21 -0
  178. package/dist/memoryApi.d.ts +19 -0
  179. package/dist/memoryApi.js +42 -0
  180. package/dist/model.d.ts +94 -0
  181. package/dist/model.js +243 -0
  182. package/dist/page.d.ts +11 -0
  183. package/dist/page.js +9 -0
  184. package/dist/platform.d.ts +1 -0
  185. package/dist/platform.js +5 -0
  186. package/dist/publishWire.d.ts +271 -0
  187. package/dist/publishWire.js +168 -0
  188. package/dist/react.d.ts +49 -0
  189. package/dist/react.js +40 -0
  190. package/dist/registered.d.ts +60 -0
  191. package/dist/registered.js +19 -0
  192. package/dist/routes.d.ts +38 -0
  193. package/dist/routes.js +21 -0
  194. package/dist/rules/checkAllFiles.d.ts +1 -0
  195. package/dist/rules/checkAllFiles.js +749 -0
  196. package/dist/rules/checkApiRouting.d.ts +1 -0
  197. package/dist/rules/checkApiRouting.js +112 -0
  198. package/dist/rules/lintPlugin.d.ts +252 -0
  199. package/dist/rules/lintPlugin.js +1159 -0
  200. package/dist/rules/messages.d.ts +48 -0
  201. package/dist/rules/messages.js +48 -0
  202. package/dist/rules/themeTokens.d.ts +6 -0
  203. package/dist/rules/themeTokens.js +64 -0
  204. package/dist/schema.d.ts +4 -0
  205. package/dist/schema.js +2 -0
  206. package/dist/server/auth.d.ts +115 -0
  207. package/dist/server/auth.js +134 -0
  208. package/dist/server/authService.d.ts +9 -0
  209. package/dist/server/authService.js +50 -0
  210. package/dist/server/createServer.d.ts +402 -0
  211. package/dist/server/createServer.js +82 -0
  212. package/dist/server/env.d.ts +15 -0
  213. package/dist/server/env.js +1 -0
  214. package/dist/server/index.d.ts +13 -0
  215. package/dist/server/index.js +9 -0
  216. package/dist/server/services.d.ts +9 -0
  217. package/dist/server/services.js +47 -0
  218. package/dist/server/session.d.ts +29 -0
  219. package/dist/server/session.js +65 -0
  220. package/dist/server/sessions.d.ts +92 -0
  221. package/dist/server/sessions.js +47 -0
  222. package/dist/server/settings.d.ts +49 -0
  223. package/dist/server/settings.js +25 -0
  224. package/dist/server/signInWire.d.ts +53 -0
  225. package/dist/server/signInWire.js +23 -0
  226. package/dist/server/tables.d.ts +242 -0
  227. package/dist/server/tables.js +246 -0
  228. package/dist/server/users.d.ts +189 -0
  229. package/dist/server/users.js +49 -0
  230. package/dist/serviceClients.d.ts +5 -0
  231. package/dist/serviceClients.js +70 -0
  232. package/dist/services.d.ts +53 -0
  233. package/dist/services.js +30 -0
  234. package/dist/shortcuts.d.ts +3 -0
  235. package/dist/shortcuts.js +40 -0
  236. package/dist/start.d.ts +20 -0
  237. package/dist/start.js +145 -0
  238. package/dist/state.d.ts +14 -0
  239. package/dist/state.js +17 -0
  240. package/dist/store.d.ts +45 -0
  241. package/dist/store.js +208 -0
  242. package/dist/subscribers.d.ts +5 -0
  243. package/dist/subscribers.js +13 -0
  244. package/dist/table.d.ts +143 -0
  245. package/dist/table.js +91 -0
  246. package/dist/tables.d.ts +77 -0
  247. package/dist/tables.js +216 -0
  248. package/dist/theme/reset.css +84 -0
  249. package/dist/theme/scales.d.ts +76 -0
  250. package/dist/theme/scales.js +82 -0
  251. package/dist/theme/tokens.stylex.d.ts +218 -0
  252. package/dist/theme/tokens.stylex.js +233 -0
  253. package/dist/vite/commandBridge.d.ts +2 -0
  254. package/dist/vite/commandBridge.js +46 -0
  255. package/dist/vite/designManifest.d.ts +25 -0
  256. package/dist/vite/designManifest.js +191 -0
  257. package/dist/vite/localWorker.d.ts +4 -0
  258. package/dist/vite/localWorker.js +60 -0
  259. package/dist/vite/projectFile.d.ts +9 -0
  260. package/dist/vite/projectFile.js +17 -0
  261. package/dist/vite/rootAlias.d.ts +2 -0
  262. package/dist/vite/rootAlias.js +15 -0
  263. package/dist/vite/vite.d.ts +8 -0
  264. package/dist/vite/vite.js +95 -0
  265. package/dist/wire.d.ts +7 -0
  266. package/dist/wire.js +1 -0
  267. package/package.json +103 -3
  268. package/presets/lintPlugin.js +7 -0
  269. package/presets/oxlint.json +167 -0
  270. package/presets/register.d.ts +21 -0
  271. package/presets/server.d.ts +2 -0
  272. package/presets/tsconfig.app.json +29 -0
  273. package/presets/tsconfig.server.json +27 -0
@@ -0,0 +1,92 @@
1
+ import type { D1Database } from '@cloudflare/workers-types';
2
+ export declare const sessions: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3
+ name: "sessions";
4
+ schema: undefined;
5
+ columns: {
6
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
7
+ name: "id";
8
+ tableName: "sessions";
9
+ dataType: "string";
10
+ columnType: "SQLiteText";
11
+ data: string;
12
+ driverParam: string;
13
+ notNull: true;
14
+ hasDefault: false;
15
+ isPrimaryKey: true;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: false;
18
+ enumValues: [string, ...string[]];
19
+ baseColumn: never;
20
+ identity: undefined;
21
+ generated: undefined;
22
+ }, {}, {
23
+ length: number | undefined;
24
+ }>;
25
+ userId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
26
+ name: "user_id";
27
+ tableName: "sessions";
28
+ dataType: "string";
29
+ columnType: "SQLiteText";
30
+ data: string;
31
+ driverParam: string;
32
+ notNull: true;
33
+ hasDefault: false;
34
+ isPrimaryKey: false;
35
+ isAutoincrement: false;
36
+ hasRuntimeDefault: false;
37
+ enumValues: [string, ...string[]];
38
+ baseColumn: never;
39
+ identity: undefined;
40
+ generated: undefined;
41
+ }, {}, {
42
+ length: number | undefined;
43
+ }>;
44
+ expiresAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
45
+ name: "expires_at";
46
+ tableName: "sessions";
47
+ dataType: "string";
48
+ columnType: "SQLiteText";
49
+ data: string;
50
+ driverParam: string;
51
+ notNull: true;
52
+ hasDefault: false;
53
+ isPrimaryKey: false;
54
+ isAutoincrement: false;
55
+ hasRuntimeDefault: false;
56
+ enumValues: [string, ...string[]];
57
+ baseColumn: never;
58
+ identity: undefined;
59
+ generated: undefined;
60
+ }, {}, {
61
+ length: number | undefined;
62
+ }>;
63
+ createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
64
+ name: "created_at";
65
+ tableName: "sessions";
66
+ dataType: "string";
67
+ columnType: "SQLiteText";
68
+ data: string;
69
+ driverParam: string;
70
+ notNull: true;
71
+ hasDefault: true;
72
+ isPrimaryKey: false;
73
+ isAutoincrement: false;
74
+ hasRuntimeDefault: false;
75
+ enumValues: [string, ...string[]];
76
+ baseColumn: never;
77
+ identity: undefined;
78
+ generated: undefined;
79
+ }, {}, {
80
+ length: number | undefined;
81
+ }>;
82
+ };
83
+ dialect: "sqlite";
84
+ }>;
85
+ export declare function createSession(d1: D1Database, userId: string): Promise<`${string}-${string}-${string}-${string}-${string}`>;
86
+ export declare function renewSession(d1: D1Database, id: string): Promise<{
87
+ id: string;
88
+ email: string;
89
+ name: string;
90
+ avatarUrl: string | null;
91
+ } | undefined>;
92
+ export declare function deleteSession(d1: D1Database, id: string): Promise<void>;
@@ -0,0 +1,47 @@
1
+ import { and, eq, gt, lt, sql } from 'drizzle-orm';
2
+ import { drizzle } from 'drizzle-orm/d1';
3
+ import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
4
+ import { userColumns, users } from "./users.js";
5
+ export const sessions = sqliteTable('sessions', {
6
+ id: text('id').primaryKey(),
7
+ userId: text('user_id')
8
+ .notNull()
9
+ .references(() => users.id, { onDelete: 'cascade' }),
10
+ expiresAt: text('expires_at').notNull(),
11
+ createdAt: text('created_at')
12
+ .notNull()
13
+ .default(sql `(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))`)
14
+ });
15
+ const SESSION_DAYS = 30;
16
+ const DAY_MILLISECONDS = 86_400_000;
17
+ const sessionEnd = () => new Date(Date.now() + SESSION_DAYS * DAY_MILLISECONDS).toISOString();
18
+ export async function createSession(d1, userId) {
19
+ const db = drizzle(d1);
20
+ const id = crypto.randomUUID();
21
+ await db.batch([
22
+ db
23
+ .delete(sessions)
24
+ .where(and(eq(sessions.userId, userId), lt(sessions.expiresAt, new Date().toISOString()))),
25
+ db.insert(sessions).values({ id, userId, expiresAt: sessionEnd() })
26
+ ]);
27
+ return id;
28
+ }
29
+ export async function renewSession(d1, id) {
30
+ const db = drizzle(d1);
31
+ const user = await db
32
+ .select(userColumns)
33
+ .from(sessions)
34
+ .innerJoin(users, eq(users.id, sessions.userId))
35
+ .where(and(eq(sessions.id, id), gt(sessions.expiresAt, new Date().toISOString())))
36
+ .get();
37
+ if (user === undefined)
38
+ return undefined;
39
+ await db
40
+ .update(sessions)
41
+ .set({ expiresAt: sessionEnd() })
42
+ .where(eq(sessions.id, id));
43
+ return user;
44
+ }
45
+ export async function deleteSession(d1, id) {
46
+ await drizzle(d1).delete(sessions).where(eq(sessions.id, id));
47
+ }
@@ -0,0 +1,49 @@
1
+ import type { D1Database } from '@cloudflare/workers-types';
2
+ export declare const settings: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3
+ name: "settings";
4
+ schema: undefined;
5
+ columns: {
6
+ key: import("drizzle-orm/sqlite-core").SQLiteColumn<{
7
+ name: "key";
8
+ tableName: "settings";
9
+ dataType: "string";
10
+ columnType: "SQLiteText";
11
+ data: string;
12
+ driverParam: string;
13
+ notNull: true;
14
+ hasDefault: false;
15
+ isPrimaryKey: true;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: false;
18
+ enumValues: [string, ...string[]];
19
+ baseColumn: never;
20
+ identity: undefined;
21
+ generated: undefined;
22
+ }, {}, {
23
+ length: number | undefined;
24
+ }>;
25
+ value: import("drizzle-orm/sqlite-core").SQLiteColumn<{
26
+ name: "value";
27
+ tableName: "settings";
28
+ dataType: "string";
29
+ columnType: "SQLiteText";
30
+ data: string;
31
+ driverParam: string;
32
+ notNull: true;
33
+ hasDefault: false;
34
+ isPrimaryKey: false;
35
+ isAutoincrement: false;
36
+ hasRuntimeDefault: false;
37
+ enumValues: [string, ...string[]];
38
+ baseColumn: never;
39
+ identity: undefined;
40
+ generated: undefined;
41
+ }, {}, {
42
+ length: number | undefined;
43
+ }>;
44
+ };
45
+ dialect: "sqlite";
46
+ }>;
47
+ export declare function readTitle(d1: D1Database): Promise<string>;
48
+ export declare function writeTitle(d1: D1Database, title: string): Promise<void>;
49
+ export declare function seedTitleSql(title: string): string;
@@ -0,0 +1,25 @@
1
+ import { eq } from 'drizzle-orm';
2
+ import { drizzle } from 'drizzle-orm/d1';
3
+ import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
4
+ export const settings = sqliteTable('settings', {
5
+ key: text('key').primaryKey(),
6
+ value: text('value').notNull()
7
+ });
8
+ const TITLE = 'title';
9
+ export async function readTitle(d1) {
10
+ const row = await drizzle(d1)
11
+ .select({ value: settings.value })
12
+ .from(settings)
13
+ .where(eq(settings.key, TITLE))
14
+ .get();
15
+ return row?.value ?? '';
16
+ }
17
+ export async function writeTitle(d1, title) {
18
+ await drizzle(d1)
19
+ .insert(settings)
20
+ .values({ key: TITLE, value: title })
21
+ .onConflictDoUpdate({ target: settings.key, set: { value: title } });
22
+ }
23
+ export function seedTitleSql(title) {
24
+ return `INSERT OR IGNORE INTO settings (key, value) VALUES ('${TITLE}', '${title.replaceAll("'", "''")}');`;
25
+ }
@@ -0,0 +1,53 @@
1
+ import { z } from 'zod';
2
+ export declare const verifiedIdentity: z.ZodObject<{
3
+ email: z.ZodEmail;
4
+ name: z.ZodNullable<z.ZodString>;
5
+ avatarUrl: z.ZodNullable<z.ZodString>;
6
+ via: z.ZodEnum<{
7
+ email: "email";
8
+ google: "google";
9
+ }>;
10
+ }, z.core.$strip>;
11
+ export type VerifiedIdentity = z.infer<typeof verifiedIdentity>;
12
+ export declare const exchangeRequest: z.ZodObject<{
13
+ code: z.ZodString;
14
+ }, z.core.$strip>;
15
+ export declare const exchangeReply: z.ZodObject<{
16
+ hostname: z.ZodString;
17
+ identity: z.ZodObject<{
18
+ email: z.ZodEmail;
19
+ name: z.ZodNullable<z.ZodString>;
20
+ avatarUrl: z.ZodNullable<z.ZodString>;
21
+ via: z.ZodEnum<{
22
+ email: "email";
23
+ google: "google";
24
+ }>;
25
+ }, z.core.$strip>;
26
+ }, z.core.$strip>;
27
+ export declare const sendCodeRequest: z.ZodObject<{
28
+ email: z.ZodEmail;
29
+ hostname: z.ZodString;
30
+ appName: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>;
32
+ export declare const sendCodeReply: z.ZodObject<{
33
+ challenge: z.ZodString;
34
+ }, z.core.$strip>;
35
+ export declare const verifyCodeRequest: z.ZodObject<{
36
+ challenge: z.ZodString;
37
+ code: z.ZodString;
38
+ }, z.core.$strip>;
39
+ export declare const verifyCodeReply: z.ZodObject<{
40
+ identity: z.ZodObject<{
41
+ email: z.ZodEmail;
42
+ name: z.ZodNullable<z.ZodString>;
43
+ avatarUrl: z.ZodNullable<z.ZodString>;
44
+ via: z.ZodEnum<{
45
+ email: "email";
46
+ google: "google";
47
+ }>;
48
+ }, z.core.$strip>;
49
+ }, z.core.$strip>;
50
+ export type ExchangeReply = z.infer<typeof exchangeReply>;
51
+ export type SendCodeRequest = z.infer<typeof sendCodeRequest>;
52
+ export type SendCodeReply = z.infer<typeof sendCodeReply>;
53
+ export type VerifyCodeRequest = z.infer<typeof verifyCodeRequest>;
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ export const verifiedIdentity = z.object({
3
+ email: z.email(),
4
+ name: z.string().nullable(),
5
+ avatarUrl: z.string().nullable(),
6
+ via: z.enum(['google', 'email'])
7
+ });
8
+ export const exchangeRequest = z.object({ code: z.string() });
9
+ export const exchangeReply = z.object({
10
+ hostname: z.string(),
11
+ identity: verifiedIdentity
12
+ });
13
+ export const sendCodeRequest = z.object({
14
+ email: z.email(),
15
+ hostname: z.string(),
16
+ appName: z.string().min(1).max(60).optional()
17
+ });
18
+ export const sendCodeReply = z.object({ challenge: z.string() });
19
+ export const verifyCodeRequest = z.object({
20
+ challenge: z.string(),
21
+ code: z.string()
22
+ });
23
+ export const verifyCodeReply = z.object({ identity: verifiedIdentity });
@@ -0,0 +1,242 @@
1
+ import type { SQLiteTableWithColumns } from 'drizzle-orm/sqlite-core';
2
+ import type { ServerEnv } from './env.ts';
3
+ import type { Seed, Table, Tables } from '../table.ts';
4
+ type SqlTable = SQLiteTableWithColumns<{
5
+ name: string;
6
+ schema: undefined;
7
+ dialect: 'sqlite';
8
+ columns: Record<string, never>;
9
+ }>;
10
+ export declare function sqlTable(table: Table): SqlTable;
11
+ export declare function sqlTables<Group extends Tables>(tables: Group): Record<keyof Group, SqlTable>;
12
+ export declare function seedSql<Group extends Tables>(tables: Group, seed: Seed<Group>): string;
13
+ export declare function serveTables<Group extends Tables>(tables: Group): import("hono/hono-base").HonoBase<ServerEnv, {
14
+ "/:table": {
15
+ $get: {
16
+ input: {
17
+ param: {
18
+ table: string;
19
+ };
20
+ };
21
+ output: {
22
+ error: "forbidden" | "Signed out" | "No such row";
23
+ };
24
+ outputFormat: "json";
25
+ status: 401 | 403 | 404;
26
+ } | {
27
+ input: {
28
+ param: {
29
+ table: string;
30
+ };
31
+ };
32
+ output: {}[];
33
+ outputFormat: "json";
34
+ status: import("hono/utils/http-status").ContentfulStatusCode;
35
+ } | {
36
+ input: {
37
+ param: {
38
+ table: string;
39
+ };
40
+ };
41
+ output: {
42
+ error: string;
43
+ };
44
+ outputFormat: "json";
45
+ status: 404;
46
+ };
47
+ };
48
+ } & {
49
+ "/:table/public": {
50
+ $get: {
51
+ input: {
52
+ param: {
53
+ table: string;
54
+ };
55
+ };
56
+ output: {}[];
57
+ outputFormat: "json";
58
+ status: import("hono/utils/http-status").ContentfulStatusCode;
59
+ } | {
60
+ input: {
61
+ param: {
62
+ table: string;
63
+ };
64
+ };
65
+ output: {
66
+ error: string;
67
+ };
68
+ outputFormat: "json";
69
+ status: 404;
70
+ };
71
+ };
72
+ } & {
73
+ "/:table": {
74
+ $post: {
75
+ input: {
76
+ param: {
77
+ table: string;
78
+ };
79
+ };
80
+ output: {
81
+ error: "forbidden" | "Signed out" | "No such row";
82
+ };
83
+ outputFormat: "json";
84
+ status: 401 | 403 | 404;
85
+ } | {
86
+ input: {
87
+ param: {
88
+ table: string;
89
+ };
90
+ };
91
+ output: {};
92
+ outputFormat: "json";
93
+ status: 201;
94
+ } | {
95
+ input: {
96
+ param: {
97
+ table: string;
98
+ };
99
+ };
100
+ output: {
101
+ error: string;
102
+ };
103
+ outputFormat: "json";
104
+ status: 404;
105
+ } | {
106
+ input: {
107
+ param: {
108
+ table: string;
109
+ };
110
+ };
111
+ output: {
112
+ error: string;
113
+ };
114
+ outputFormat: "json";
115
+ status: 400;
116
+ } | {
117
+ input: {
118
+ param: {
119
+ table: string;
120
+ };
121
+ };
122
+ output: {
123
+ error: string;
124
+ unique: readonly (readonly string[])[];
125
+ };
126
+ outputFormat: "json";
127
+ status: 409;
128
+ };
129
+ };
130
+ } & {
131
+ "/:table/:id": {
132
+ $put: {
133
+ input: {
134
+ param: {
135
+ table: string;
136
+ } & {
137
+ id: string;
138
+ };
139
+ };
140
+ output: {
141
+ error: "forbidden" | "Signed out" | "No such row";
142
+ };
143
+ outputFormat: "json";
144
+ status: 401 | 403 | 404;
145
+ } | {
146
+ input: {
147
+ param: {
148
+ table: string;
149
+ } & {
150
+ id: string;
151
+ };
152
+ };
153
+ output: {};
154
+ outputFormat: "json";
155
+ status: 200;
156
+ } | {
157
+ input: {
158
+ param: {
159
+ table: string;
160
+ } & {
161
+ id: string;
162
+ };
163
+ };
164
+ output: {
165
+ error: string;
166
+ unique: readonly (readonly string[])[];
167
+ };
168
+ outputFormat: "json";
169
+ status: 409;
170
+ } | {
171
+ input: {
172
+ param: {
173
+ table: string;
174
+ } & {
175
+ id: string;
176
+ };
177
+ };
178
+ output: {
179
+ error: string;
180
+ };
181
+ outputFormat: "json";
182
+ status: 404;
183
+ } | {
184
+ input: {
185
+ param: {
186
+ table: string;
187
+ } & {
188
+ id: string;
189
+ };
190
+ };
191
+ output: {
192
+ error: string;
193
+ };
194
+ outputFormat: "json";
195
+ status: 400;
196
+ };
197
+ };
198
+ } & {
199
+ "/:table/:id": {
200
+ $delete: {
201
+ input: {
202
+ param: {
203
+ table: string;
204
+ } & {
205
+ id: string;
206
+ };
207
+ };
208
+ output: {
209
+ error: "forbidden" | "Signed out" | "No such row";
210
+ };
211
+ outputFormat: "json";
212
+ status: 401 | 403 | 404;
213
+ } | {
214
+ input: {
215
+ param: {
216
+ table: string;
217
+ } & {
218
+ id: string;
219
+ };
220
+ };
221
+ output: {
222
+ error: string;
223
+ };
224
+ outputFormat: "json";
225
+ status: 404;
226
+ } | {
227
+ input: {
228
+ param: {
229
+ table: string;
230
+ } & {
231
+ id: string;
232
+ };
233
+ };
234
+ output: {
235
+ ok: true;
236
+ };
237
+ outputFormat: "json";
238
+ status: import("hono/utils/http-status").ContentfulStatusCode;
239
+ };
240
+ };
241
+ }, "/", "/:table/:id">;
242
+ export {};