qarpeo 0.1.12 → 0.1.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.
Files changed (39) hide show
  1. package/README.md +7 -13
  2. package/dist/chunks/auth-schema.mjs +119 -147
  3. package/dist/chunks/wrangler.mjs +1 -1
  4. package/dist/cli/index.mjs +2 -2
  5. package/dist/module.mjs +146 -38
  6. package/dist/runtime/ai.d.ts +4 -2
  7. package/dist/runtime/ai.mjs +8 -2
  8. package/dist/runtime/app/components/FileUpload.vue +5 -5
  9. package/dist/runtime/app/composables/ai.d.ts +74 -0
  10. package/dist/runtime/app/composables/ai.mjs +148 -0
  11. package/dist/runtime/app/composables/auth.d.ts +16 -1
  12. package/dist/runtime/app/composables/auth.mjs +23 -34
  13. package/dist/runtime/app/composables/storage.d.ts +47 -2
  14. package/dist/runtime/app/composables/storage.mjs +204 -1
  15. package/dist/runtime/app/composables/void-client.d.ts +3 -0
  16. package/dist/runtime/app/composables/void-client.mjs +4 -0
  17. package/dist/runtime/blob.mjs +1 -1
  18. package/dist/runtime/db.mjs +1 -1
  19. package/dist/runtime/server/routes/agents/[agent]/history.get.d.ts +1 -1
  20. package/dist/runtime/server/routes/auth/handler.d.ts +2 -0
  21. package/dist/runtime/server/routes/auth/handler.mjs +11 -0
  22. package/dist/runtime/server/utils/auth.d.ts +66 -0
  23. package/dist/runtime/server/utils/auth.mjs +58 -0
  24. package/dist/runtime/server/utils/realtime.mjs +1 -1
  25. package/dist/runtime/server/utils/storage.d.ts +29 -0
  26. package/dist/runtime/server/utils/storage.mjs +79 -0
  27. package/dist/runtime/server/utils/void-ai.d.ts +7 -0
  28. package/dist/runtime/server/utils/void-ai.mjs +47 -0
  29. package/dist/runtime/server/utils/void-auth.d.ts +2 -0
  30. package/dist/runtime/server/utils/void-auth.mjs +9 -0
  31. package/dist/runtime/server/utils/void-db.d.ts +8 -0
  32. package/dist/runtime/server/utils/void-db.mjs +38 -0
  33. package/dist/runtime/server/utils/void-seed.d.ts +11 -0
  34. package/dist/runtime/server/utils/void-seed.mjs +3 -0
  35. package/dist/runtime/types/ai.d.ts +2 -0
  36. package/dist/runtime/types/imports.d.ts +65 -6
  37. package/dist/types.d.ts +1 -1
  38. package/dist/utils/auth-schema.d.ts +3 -5
  39. package/package.json +3 -2
package/README.md CHANGED
@@ -29,14 +29,9 @@ Documentation: [https://qarpeo.com](https://qarpeo.com)
29
29
  ### 1. Install
30
30
 
31
31
  ```bash
32
- # Using Vite+
33
32
  vp add qarpeo
34
-
35
- # Using pnpm
36
- pnpm add qarpeo
37
-
38
- # Using npm
39
- npm install qarpeo
33
+ # or
34
+ vp i qarpeo
40
35
  ```
41
36
 
42
37
  ### 2. Configure
@@ -84,15 +79,14 @@ Qarpeo includes an integrated CLI for health diagnostics, database migrations, a
84
79
 
85
80
  ```bash
86
81
  # Validate Cloudflare bindings, migrations, and secrets
87
- pnpm qp doctor
82
+ vpx qp doctor
88
83
 
89
84
  # Validate against production/remote deployment criteria
90
- pnpm qp doctor --remote
85
+ vpx qp doctor --remote
91
86
 
92
- # Generate and apply D1 migrations
93
- pnpm qp generate
94
- pnpm qp migrate
95
- pnpm qp migrate --remote
87
+ # List, create, and push D1 migrations
88
+ vpx qp db list
89
+ vpx qp db push
96
90
  ```
97
91
 
98
92
  ---
@@ -1,218 +1,190 @@
1
1
  const ALL_AUTH_TABLE_NAMES = [
2
+ "user",
3
+ "account",
4
+ "session",
5
+ "verification",
6
+ "twoFactor",
7
+ "passkey",
8
+ "organization",
9
+ "member",
10
+ "invitation",
2
11
  "_qarpeo_users",
3
12
  "_qarpeo_accounts",
4
- "_qarpeo_sessions",
5
- "_qarpeo_two_factor",
6
- "_qarpeo_authenticators",
7
- "_qarpeo_organizations",
8
- "_qarpeo_members",
9
- "_qarpeo_invitations",
10
- "_qarpeo_api_tokens"
13
+ "_qarpeo_sessions"
11
14
  ];
12
15
  function getActiveAuthTableNames(auth) {
13
16
  if (!auth) return [];
14
17
  const opts = typeof auth === "object" ? auth : {};
15
- const tables = ["_qarpeo_users", "_qarpeo_accounts", "_qarpeo_sessions"];
16
- if (opts.twoFactor) tables.push("_qarpeo_two_factor");
17
- if (opts.webauthn) tables.push("_qarpeo_authenticators");
18
- if (opts.organizations)
19
- tables.push("_qarpeo_organizations", "_qarpeo_members", "_qarpeo_invitations");
20
- if (opts.apiTokens) tables.push("_qarpeo_api_tokens");
21
- if (opts.sso) tables.push("_qarpeo_sso_connections");
18
+ const tables = ["user", "account", "session", "verification"];
19
+ if (opts.twoFactor) tables.push("twoFactor");
20
+ if (opts.webauthn || opts.webAuthn) tables.push("passkey");
21
+ if (opts.organizations) tables.push("organization", "member", "invitation");
22
22
  return tables;
23
23
  }
24
24
  function compileExtendedField(key, def) {
25
25
  switch (def.type) {
26
26
  case "string": {
27
- let chain = `text()`;
27
+ let chain = `text("${key}")`;
28
28
  if (def.default !== void 0) chain += `.default(${JSON.stringify(def.default)})`;
29
29
  if (def.nullable === false) chain += `.notNull()`;
30
- if (def.enum) chain += ` /* enum: ${def.enum.join("|")} */`;
31
30
  return ` ${key}: ${chain},`;
32
31
  }
33
32
  case "number": {
34
- let chain = `integer()`;
33
+ let chain = `integer("${key}")`;
35
34
  if (def.default !== void 0) chain += `.default(${Number(def.default)})`;
36
35
  return ` ${key}: ${chain},`;
37
36
  }
38
37
  case "boolean": {
39
- let chain = `integer({ mode: "boolean" })`;
38
+ let chain = `integer("${key}", { mode: "boolean" })`;
40
39
  if (def.default !== void 0) chain += `.default(${def.default ? 1 : 0})`;
41
40
  return ` ${key}: ${chain},`;
42
41
  }
43
42
  case "json": {
44
- return ` ${key}: text({ mode: "json" }),`;
43
+ return ` ${key}: text("${key}", { mode: "json" }),`;
45
44
  }
46
45
  default:
47
- return ` ${key}: text(),`;
46
+ return ` ${key}: text("${key}"),`;
48
47
  }
49
48
  }
50
49
  function generateAuthSchema(auth) {
51
50
  const opts = typeof auth === "object" ? auth : {};
52
51
  const extendsFields = opts.fields?.extends || {};
53
52
  const lines = [
54
- `// Auto-generated by Qarpeo Dynamic Schema Assembly (Section 6)`,
55
- `// snakeCase.table maps camelCase property names \u2192 snake_case column names automatically`,
56
- `import { integer, text, blob, snakeCase, index } from "drizzle-orm/sqlite-core";`,
53
+ `// Auto-generated by Qarpeo for Better Auth & void/auth on Cloudflare D1`,
54
+ `import { sql } from "drizzle-orm";
55
+ import { sqliteTable, text, integer, blob, index } from "drizzle-orm/sqlite-core";`,
57
56
  ``,
58
- `// \u2500\u2500\u2500 1. Users Table (Core + Tier 2 Extended Fields) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
59
- `export const users = snakeCase.table("_qarpeo_users", {`,
60
- ` id: text().primaryKey(),`,
61
- ` email: text().notNull().unique(),`,
62
- ` emailVerified: integer().default(0),`,
63
- ` name: text(),`,
64
- ` avatarUrl: text(),`
57
+ `// \u2500\u2500\u2500 1. User Table \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
58
+ `export const user = sqliteTable("user", {`,
59
+ ` id: text("id").primaryKey(),`,
60
+ ` name: text("name").notNull(),`,
61
+ ` email: text("email").notNull().unique(),`,
62
+ ` emailVerified: integer("email_verified", { mode: "boolean" }).notNull().default(false),`,
63
+ ` image: text("image"),`
65
64
  ];
66
65
  if (!extendsFields.role) {
67
- lines.push(` role: text().default("user"),`);
66
+ lines.push(` role: text("role").default("user"),`);
68
67
  }
69
68
  for (const [key, fieldDef] of Object.entries(extendsFields)) {
70
69
  lines.push(compileExtendedField(key, fieldDef));
71
70
  }
72
71
  lines.push(
73
- ` createdAt: integer().notNull(),`,
74
- ` updatedAt: integer().notNull(),`,
72
+ ` createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(sql\`(cast(unixepoch('subsecond') * 1000 as integer))\`),`,
73
+ ` updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull().default(sql\`(cast(unixepoch('subsecond') * 1000 as integer))\`).$onUpdate(() => new Date()),`,
75
74
  `});`,
76
75
  ``,
77
- `// \u2500\u2500\u2500 2. Accounts Table (OAuth Provider Links) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
78
- `export const accounts = snakeCase.table("_qarpeo_accounts", {`,
79
- ` id: text().primaryKey(),`,
80
- ` userId: text().notNull().references(() => users.id, { onDelete: "cascade" }),`,
81
- ` provider: text().notNull(),`,
82
- ` providerAccountId: text().notNull(),`,
83
- ` email: text(),`,
84
- ` emailVerified: integer().default(0),`,
85
- ` accessToken: text(),`,
86
- ` refreshToken: text(),`,
87
- ` expiresAt: integer(),`,
88
- ` createdAt: integer().notNull(),`,
76
+ `// \u2500\u2500\u2500 2. Session Table \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
77
+ `export const session = sqliteTable("session", {`,
78
+ ` id: text("id").primaryKey(),`,
79
+ ` expiresAt: integer("expires_at", { mode: "timestamp_ms" }).notNull(),`,
80
+ ` token: text("token").notNull().unique(),`,
81
+ ` createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(sql\`(cast(unixepoch('subsecond') * 1000 as integer))\`),`,
82
+ ` updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull().default(sql\`(cast(unixepoch('subsecond') * 1000 as integer))\`).$onUpdate(() => new Date()),`,
83
+ ` ipAddress: text("ip_address"),`,
84
+ ` userAgent: text("user_agent"),`,
85
+ ` userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),`,
89
86
  `}, (table) => [`,
90
- ` index("_qarpeo_accounts_user_id_idx").on(table.userId),`,
87
+ ` index("session_user_id_idx").on(table.userId),`,
88
+ ` index("session_token_idx").on(table.token),`,
91
89
  `]);`,
92
90
  ``,
93
- `// \u2500\u2500\u2500 3. Sessions Table (Multi-Device Session Registry) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
94
- `export const sessions = snakeCase.table("_qarpeo_sessions", {`,
95
- ` id: text().primaryKey(),`,
96
- ` userId: text().notNull().references(() => users.id, { onDelete: "cascade" }),`,
97
- ` tokenHash: text().notNull(),`,
98
- ` clientType: text().default("web"),`,
99
- ` userAgent: text(),`,
100
- ` ipAddress: text(),`,
101
- ` lastActive: integer().notNull(),`,
102
- ` expiresAt: integer().notNull(),`,
91
+ `// \u2500\u2500\u2500 3. Account Table (OAuth & Passwords) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
92
+ `export const account = sqliteTable("account", {`,
93
+ ` id: text("id").primaryKey(),`,
94
+ ` accountId: text("account_id").notNull(),`,
95
+ ` providerId: text("provider_id").notNull(),`,
96
+ ` userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),`,
97
+ ` accessToken: text("access_token"),`,
98
+ ` refreshToken: text("refresh_token"),`,
99
+ ` idToken: text("id_token"),`,
100
+ ` accessTokenExpiresAt: integer("access_token_expires_at", { mode: "timestamp_ms" }),`,
101
+ ` refreshTokenExpiresAt: integer("refresh_token_expires_at", { mode: "timestamp_ms" }),`,
102
+ ` scope: text("scope"),`,
103
+ ` password: text("password"),`,
104
+ ` createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(sql\`(cast(unixepoch('subsecond') * 1000 as integer))\`),`,
105
+ ` updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull().default(sql\`(cast(unixepoch('subsecond') * 1000 as integer))\`).$onUpdate(() => new Date()),`,
103
106
  `}, (table) => [`,
104
- ` index("_qarpeo_sessions_user_id_idx").on(table.userId),`,
105
- ` index("_qarpeo_sessions_token_hash_idx").on(table.tokenHash),`,
106
- ` index("_qarpeo_sessions_expires_at_idx").on(table.expiresAt),`,
107
- `]);`
107
+ ` index("account_user_id_idx").on(table.userId),`,
108
+ `]);`,
109
+ ``,
110
+ `// \u2500\u2500\u2500 4. Verification Table (Tokens & OTP) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
111
+ `export const verification = sqliteTable("verification", {`,
112
+ ` id: text("id").primaryKey(),`,
113
+ ` identifier: text("identifier").notNull(),`,
114
+ ` value: text("value").notNull(),`,
115
+ ` expiresAt: integer("expires_at", { mode: "timestamp_ms" }).notNull(),`,
116
+ ` createdAt: integer("created_at", { mode: "timestamp_ms" }),`,
117
+ ` updatedAt: integer("updated_at", { mode: "timestamp_ms" }),`,
118
+ `});`
108
119
  );
109
120
  if (opts.twoFactor) {
110
121
  lines.push(
111
122
  ``,
112
- `// \u2500\u2500\u2500 4. Two-Factor Authentication Table (TOTP) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
113
- `export const twoFactor = snakeCase.table("_qarpeo_two_factor", {`,
114
- ` id: text().primaryKey(),`,
115
- ` userId: text().notNull().unique().references(() => users.id, { onDelete: "cascade" }),`,
116
- ` secret: text().notNull(),`,
117
- ` backupCodes: text().notNull(),`,
118
- ` enabled: integer().default(0),`,
119
- ` createdAt: integer().notNull(),`,
123
+ `// \u2500\u2500\u2500 5. Two-Factor Authentication Table (TOTP) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
124
+ `export const twoFactor = sqliteTable("two_factor", {`,
125
+ ` id: text("id").primaryKey(),`,
126
+ ` userId: text("user_id").notNull().unique().references(() => user.id, { onDelete: "cascade" }),`,
127
+ ` secret: text("secret").notNull(),`,
128
+ ` backupCodes: text("backup_codes").notNull(),`,
129
+ ` createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(sql\`(cast(unixepoch('subsecond') * 1000 as integer))\`),`,
120
130
  `});`
121
131
  );
122
132
  }
123
- if (opts.webauthn) {
133
+ if (opts.webauthn || opts.webAuthn) {
124
134
  lines.push(
125
135
  ``,
126
- `// \u2500\u2500\u2500 5. WebAuthn Passkeys Table \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
127
- `export const authenticators = snakeCase.table("_qarpeo_authenticators", {`,
128
- ` id: text().primaryKey(),`,
129
- ` userId: text().notNull().references(() => users.id, { onDelete: "cascade" }),`,
130
- ` credentialId: text().notNull().unique(),`,
131
- ` publicKey: blob({ mode: "buffer" }).notNull(),`,
132
- ` counter: integer().notNull().default(0),`,
133
- ` transports: text(),`,
134
- ` createdAt: integer().notNull(),`,
136
+ `// \u2500\u2500\u2500 6. Passkeys Table \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
137
+ `export const passkey = sqliteTable("passkey", {`,
138
+ ` id: text("id").primaryKey(),`,
139
+ ` name: text("name"),`,
140
+ ` publicKey: text("public_key").notNull(),`,
141
+ ` userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),`,
142
+ ` credentialId: text("credential_id").notNull().unique(),`,
143
+ ` counter: integer("counter").notNull().default(0),`,
144
+ ` deviceType: text("device_type").notNull(),`,
145
+ ` backedUp: integer("backed_up", { mode: "boolean" }).notNull().default(false),`,
146
+ ` transports: text("transports"),`,
147
+ ` createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(sql\`(cast(unixepoch('subsecond') * 1000 as integer))\`),`,
135
148
  `});`
136
149
  );
137
150
  }
138
151
  if (opts.organizations) {
139
152
  lines.push(
140
153
  ``,
141
- `// \u2500\u2500\u2500 6. Organizations & Teams Multi-Tenancy Tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
142
- `export const organizations = snakeCase.table("_qarpeo_organizations", {`,
143
- ` id: text().primaryKey(),`,
144
- ` name: text().notNull(),`,
145
- ` slug: text().notNull().unique(),`,
146
- ` logoUrl: text(),`,
147
- ` createdAt: integer().notNull(),`,
154
+ `// \u2500\u2500\u2500 7. Organizations & Members Tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
155
+ `export const organization = sqliteTable("organization", {`,
156
+ ` id: text("id").primaryKey(),`,
157
+ ` name: text("name").notNull(),`,
158
+ ` slug: text("slug").notNull().unique(),`,
159
+ ` logo: text("logo"),`,
160
+ ` metadata: text("metadata"),`,
161
+ ` createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(sql\`(cast(unixepoch('subsecond') * 1000 as integer))\`),`,
148
162
  `});`,
149
163
  ``,
150
- `export const members = snakeCase.table("_qarpeo_members", {`,
151
- ` id: text().primaryKey(),`,
152
- ` organizationId: text().notNull().references(() => organizations.id, { onDelete: "cascade" }),`,
153
- ` userId: text().notNull().references(() => users.id, { onDelete: "cascade" }),`,
154
- ` role: text().notNull().default("member"),`,
155
- ` createdAt: integer().notNull(),`,
156
- `}, (table) => [`,
157
- ` index("_qarpeo_members_user_id_idx").on(table.userId),`,
158
- ` index("_qarpeo_members_org_id_idx").on(table.organizationId),`,
159
- `]);`,
164
+ `export const member = sqliteTable("member", {`,
165
+ ` id: text("id").primaryKey(),`,
166
+ ` organizationId: text("organization_id").notNull().references(() => organization.id, { onDelete: "cascade" }),`,
167
+ ` userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),`,
168
+ ` role: text("role").notNull().default("member"),`,
169
+ ` createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(sql\`(cast(unixepoch('subsecond') * 1000 as integer))\`),`,
170
+ `});`,
160
171
  ``,
161
- `export const invitations = snakeCase.table("_qarpeo_invitations", {`,
162
- ` id: text().primaryKey(),`,
163
- ` organizationId: text().notNull().references(() => organizations.id, { onDelete: "cascade" }),`,
164
- ` email: text().notNull(),`,
165
- ` role: text().notNull().default("member"),`,
166
- ` tokenHash: text().notNull(),`,
167
- ` expiresAt: integer().notNull(),`,
168
- ` createdAt: integer().notNull(),`,
172
+ `export const invitation = sqliteTable("invitation", {`,
173
+ ` id: text("id").primaryKey(),`,
174
+ ` organizationId: text("organization_id").notNull().references(() => organization.id, { onDelete: "cascade" }),`,
175
+ ` email: text("email").notNull(),`,
176
+ ` role: text("role").notNull().default("member"),`,
177
+ ` status: text("status").notNull().default("pending"),`,
178
+ ` expiresAt: integer("expires_at", { mode: "timestamp_ms" }).notNull(),`,
179
+ ` inviterId: text("inviter_id").notNull().references(() => user.id, { onDelete: "cascade" }),`,
169
180
  `});`
170
181
  );
171
182
  }
172
- if (opts.apiTokens) {
173
- lines.push(
174
- ``,
175
- `// \u2500\u2500\u2500 7. Personal Access Tokens / CLI Keys Table \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
176
- `export const apiTokens = snakeCase.table("_qarpeo_api_tokens", {`,
177
- ` id: text().primaryKey(),`,
178
- ` userId: text().notNull().references(() => users.id, { onDelete: "cascade" }),`,
179
- ` name: text().notNull(),`,
180
- ` tokenHash: text().notNull(),`,
181
- ` scopes: text().default('["*"]'),`,
182
- ` lastUsedAt: integer(),`,
183
- ` expiresAt: integer(),`,
184
- ` createdAt: integer().notNull(),`,
185
- `}, (table) => [`,
186
- ` index("_qarpeo_api_tokens_user_id_idx").on(table.userId),`,
187
- `]);`
188
- );
189
- }
190
- if (opts.sso) {
191
- lines.push(
192
- ``,
193
- `// \u2500\u2500\u2500 8. Enterprise SSO (SAML 2.0 & OIDC) Table \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
194
- `export const ssoConnections = snakeCase.table("_qarpeo_sso_connections", {`,
195
- ` id: text().primaryKey(),`,
196
- ` organizationId: text().references(() => organizations.id, { onDelete: "cascade" }),`,
197
- ` providerType: text().notNull(),`,
198
- ` name: text().notNull(),`,
199
- ` domain: text().unique(),`,
200
- ` clientId: text(),`,
201
- ` clientSecret: text(),`,
202
- ` issuer: text(),`,
203
- ` ssoUrl: text().notNull(),`,
204
- ` tokenUrl: text(),`,
205
- ` userinfoUrl: text(),`,
206
- ` cert: text(),`,
207
- ` enabled: integer().default(1),`,
208
- ` createdAt: integer().notNull(),`,
209
- ` updatedAt: integer().notNull(),`,
210
- `}, (table) => [`,
211
- ` index("_qarpeo_sso_org_id_idx").on(table.organizationId),`,
212
- ` index("_qarpeo_sso_domain_idx").on(table.domain),`,
213
- `]);`
214
- );
215
- }
183
+ lines.push(
184
+ ``,
185
+ `// Backwards compatibility aliases`,
186
+ `export { user as users, session as sessions, account as accounts, verification as verifications };`
187
+ );
216
188
  return lines.join("\n") + "\n";
217
189
  }
218
190
 
@@ -784,4 +784,4 @@ const wrangler = {
784
784
  resolveProjectName: resolveProjectName
785
785
  };
786
786
 
787
- export { checkDrizzleVersion as a, resolveProjectName as b, createWranglerConfig as c, findJobFiles as d, applyD1Migrations as e, findQueueFiles as f, generateDevWranglerConfig as g, findSchemaFiles as h, resolveBinaryPath as i, ensurePackage as j, getLocalDatabaseContext as k, getJiti as l, findLocalD1Database as m, localDb as n, resolveBindingName as r, scanSchemaExports as s, wrangler as w };
787
+ export { resolveBindingName as a, checkDrizzleVersion as b, createWranglerConfig as c, findJobFiles as d, applyD1Migrations as e, findQueueFiles as f, generateDevWranglerConfig as g, findSchemaFiles as h, resolveBinaryPath as i, ensurePackage as j, getLocalDatabaseContext as k, getJiti as l, findLocalD1Database as m, localDb as n, resolveProjectName as r, scanSchemaExports as s, wrangler as w };
@@ -4,7 +4,7 @@ import { spawnSync } from 'node:child_process';
4
4
  import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, statSync } from 'node:fs';
5
5
  import { loadNuxtConfig } from '@nuxt/kit';
6
6
  import { resolve, join } from 'pathe';
7
- import { h as findSchemaFiles, i as resolveBinaryPath, j as ensurePackage, k as getLocalDatabaseContext, l as getJiti, b as resolveProjectName, a as checkDrizzleVersion, m as findLocalD1Database } from '../chunks/wrangler.mjs';
7
+ import { h as findSchemaFiles, i as resolveBinaryPath, j as ensurePackage, k as getLocalDatabaseContext, l as getJiti, r as resolveProjectName, b as checkDrizzleVersion, m as findLocalD1Database } from '../chunks/wrangler.mjs';
8
8
  import { reset, seed } from 'drizzle-seed';
9
9
  import { stdin, stdout } from 'node:process';
10
10
  import readline from 'node:readline/promises';
@@ -2209,7 +2209,7 @@ const whoami = defineCommand({
2209
2209
  const main = defineCommand({
2210
2210
  meta: {
2211
2211
  name: "qp",
2212
- version: "0.1.12",
2212
+ version: "0.1.14",
2213
2213
  description: "Cloudflare-native powerhouse module for Nuxt"
2214
2214
  },
2215
2215
  subCommands: {