@rfc0/patty 0.0.0-stage → 1.0.2
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 +201 -0
- package/README.md +214 -2
- package/dist/adapters/access-tokens.js +7 -0
- package/dist/adapters/accounts.js +37 -0
- package/dist/adapters/auth.js +11 -0
- package/dist/adapters/bills.js +32 -0
- package/dist/adapters/budgets.js +29 -0
- package/dist/adapters/categories.js +32 -0
- package/dist/adapters/client-grants.js +7 -0
- package/dist/adapters/credit-cards.js +33 -0
- package/dist/adapters/currencies.js +2 -0
- package/dist/adapters/currency-rates.js +18 -0
- package/dist/adapters/dashboards.js +43 -0
- package/dist/adapters/demo.js +13 -0
- package/dist/adapters/instance-settings.js +7 -0
- package/dist/adapters/invites.js +7 -0
- package/dist/adapters/recurring.js +55 -0
- package/dist/adapters/sessions.js +7 -0
- package/dist/adapters/settings.js +4 -0
- package/dist/adapters/setup-codes.js +7 -0
- package/dist/adapters/tags.js +9 -0
- package/dist/adapters/transactions.js +95 -0
- package/dist/adapters/users.js +7 -0
- package/dist/common/build-version.js +5 -0
- package/dist/common/errors.js +118 -0
- package/dist/common/net.js +71 -0
- package/dist/common/result.js +7 -0
- package/dist/composition/auth.js +106 -0
- package/dist/composition/boot.js +27 -0
- package/dist/composition/cli.js +86 -0
- package/dist/composition/demo/seed.js +92 -0
- package/dist/composition/demo/shell.js +107 -0
- package/dist/composition/export.js +89 -0
- package/dist/composition/http.js +110 -0
- package/dist/composition/import.js +55 -0
- package/dist/composition/lazy-modules.js +2 -0
- package/dist/composition/runtime.js +115 -0
- package/dist/composition/sign-in/interpreter.js +154 -0
- package/dist/composition/sign-in/server.js +36 -0
- package/dist/composition/sign-in/wiring.js +23 -0
- package/dist/composition/stdio.js +69 -0
- package/dist/config.js +136 -0
- package/dist/controllers/account/account.js +88 -0
- package/dist/controllers/account/transaction.js +119 -0
- package/dist/controllers/account/transfer.js +34 -0
- package/dist/controllers/aggregate.js +40 -0
- package/dist/controllers/auth/access-tokens.js +61 -0
- package/dist/controllers/auth/grants.js +136 -0
- package/dist/controllers/auth/key-export.js +20 -0
- package/dist/controllers/auth/owner.js +80 -0
- package/dist/controllers/auth/password.js +35 -0
- package/dist/controllers/auth/session.js +50 -0
- package/dist/controllers/auth/step-up.js +8 -0
- package/dist/controllers/auth/users.js +183 -0
- package/dist/controllers/budgets.js +87 -0
- package/dist/controllers/categories.js +67 -0
- package/dist/controllers/correlations.js +112 -0
- package/dist/controllers/credit-card/bill.js +105 -0
- package/dist/controllers/credit-card/credit-card.js +129 -0
- package/dist/controllers/credit-card/transaction.js +181 -0
- package/dist/controllers/currencies.js +1 -0
- package/dist/controllers/currency-rates.js +40 -0
- package/dist/controllers/dashboards.js +68 -0
- package/dist/controllers/demo/seed.js +31 -0
- package/dist/controllers/demo/tour.js +12 -0
- package/dist/controllers/deps.js +6 -0
- package/dist/controllers/instance.js +6 -0
- package/dist/controllers/merchants.js +12 -0
- package/dist/controllers/recurring.js +70 -0
- package/dist/controllers/resolve.js +37 -0
- package/dist/controllers/settings.js +47 -0
- package/dist/controllers/status.js +19 -0
- package/dist/controllers/summary.js +21 -0
- package/dist/controllers/tags.js +19 -0
- package/dist/controllers/transaction/bulk.js +6 -0
- package/dist/controllers/transaction/core.js +49 -0
- package/dist/controllers/transaction/read.js +28 -0
- package/dist/diplomat/auth/credentials.js +58 -0
- package/dist/diplomat/auth/sign-in-store.js +18 -0
- package/dist/diplomat/cli/commands/auth.js +100 -0
- package/dist/diplomat/cli/commands/db.js +72 -0
- package/dist/diplomat/cli/commands/demo.js +68 -0
- package/dist/diplomat/cli/commands/key.js +119 -0
- package/dist/diplomat/cli/commands/login.js +151 -0
- package/dist/diplomat/cli/commands/setup.js +132 -0
- package/dist/diplomat/cli/commands/users.js +123 -0
- package/dist/diplomat/cli/commands.js +61 -0
- package/dist/diplomat/cli/export-file.js +37 -0
- package/dist/diplomat/cli/import-file.js +44 -0
- package/dist/diplomat/cli/io.js +61 -0
- package/dist/diplomat/cli/key-export-approval.js +37 -0
- package/dist/diplomat/cli/messages.js +96 -0
- package/dist/diplomat/cli/prompt.js +74 -0
- package/dist/diplomat/cli/terminal.js +81 -0
- package/dist/diplomat/client-config/clients.js +150 -0
- package/dist/diplomat/client-config/merge.js +41 -0
- package/dist/diplomat/db/bootstrap.js +98 -0
- package/dist/diplomat/db/database-files.js +147 -0
- package/dist/diplomat/db/driver.js +167 -0
- package/dist/diplomat/db/effects.js +101 -0
- package/dist/diplomat/db/engine.js +9 -0
- package/dist/diplomat/db/export.js +22 -0
- package/dist/diplomat/db/file-lock.js +82 -0
- package/dist/diplomat/db/key-lock.js +14 -0
- package/dist/diplomat/db/locale-cache.js +23 -0
- package/dist/diplomat/db/migration-barrier.js +57 -0
- package/dist/diplomat/db/migration-journal.js +18 -0
- package/dist/diplomat/db/migration-lock.js +15 -0
- package/dist/diplomat/db/migrations.js +11 -0
- package/dist/diplomat/db/present.js +17 -0
- package/dist/diplomat/db/queries/aggregate-whitelist.js +35 -0
- package/dist/diplomat/db/queries/filters.js +59 -0
- package/dist/diplomat/db/queries/fts.js +18 -0
- package/dist/diplomat/db/queries/scope.js +8 -0
- package/dist/diplomat/db/queries/transaction-select.js +26 -0
- package/dist/diplomat/db/queries/tx-predicates.js +13 -0
- package/dist/diplomat/db/repos/access-tokens.js +27 -0
- package/dist/diplomat/db/repos/accounts.js +91 -0
- package/dist/diplomat/db/repos/bills.js +93 -0
- package/dist/diplomat/db/repos/budgets.js +72 -0
- package/dist/diplomat/db/repos/categories.js +53 -0
- package/dist/diplomat/db/repos/client-grants.js +67 -0
- package/dist/diplomat/db/repos/correlations.js +66 -0
- package/dist/diplomat/db/repos/credit-cards.js +67 -0
- package/dist/diplomat/db/repos/currencies.js +8 -0
- package/dist/diplomat/db/repos/currency-rates.js +40 -0
- package/dist/diplomat/db/repos/dashboards.js +123 -0
- package/dist/diplomat/db/repos/health.js +12 -0
- package/dist/diplomat/db/repos/instance-settings.js +14 -0
- package/dist/diplomat/db/repos/instance.js +58 -0
- package/dist/diplomat/db/repos/invites.js +43 -0
- package/dist/diplomat/db/repos/merchants.js +121 -0
- package/dist/diplomat/db/repos/recurring.js +29 -0
- package/dist/diplomat/db/repos/sessions.js +19 -0
- package/dist/diplomat/db/repos/settings.js +41 -0
- package/dist/diplomat/db/repos/setup-codes.js +28 -0
- package/dist/diplomat/db/repos/sub-categories.js +67 -0
- package/dist/diplomat/db/repos/tags.js +51 -0
- package/dist/diplomat/db/repos/transaction-tags.js +57 -0
- package/dist/diplomat/db/repos/transactions.js +163 -0
- package/dist/diplomat/db/repos/users.js +47 -0
- package/dist/diplomat/db/safety-copy.js +87 -0
- package/dist/diplomat/db/schema.js +348 -0
- package/dist/diplomat/db/seed/categories.js +112 -0
- package/dist/diplomat/db/seed/currencies.js +9 -0
- package/dist/diplomat/db/seed/demo/br.js +98 -0
- package/dist/diplomat/db/seed/demo/co.js +89 -0
- package/dist/diplomat/db/seed/demo/index.js +12 -0
- package/dist/diplomat/db/seed/demo/mx.js +90 -0
- package/dist/diplomat/db/seed/demo/shared.js +39 -0
- package/dist/diplomat/db/seed/demo/us.js +90 -0
- package/dist/diplomat/db/seed/merchant-rules.js +188 -0
- package/dist/diplomat/db/sqlite-errors.js +40 -0
- package/dist/diplomat/db/tenancy-integrity.js +45 -0
- package/dist/diplomat/db/version-guard.js +16 -0
- package/dist/diplomat/http/auth-pages.js +41 -0
- package/dist/diplomat/http/auth-paths.js +46 -0
- package/dist/diplomat/http/bearer.js +15 -0
- package/dist/diplomat/http/connect-pages.js +51 -0
- package/dist/diplomat/http/context.js +17 -0
- package/dist/diplomat/http/cookies.js +27 -0
- package/dist/diplomat/http/form-pages.js +38 -0
- package/dist/diplomat/http/hooks/auth.js +106 -0
- package/dist/diplomat/http/hooks/demo-marker.js +59 -0
- package/dist/diplomat/http/openapi.js +73 -0
- package/dist/diplomat/http/principal.js +1 -0
- package/dist/diplomat/http/rate-limiter.js +78 -0
- package/dist/diplomat/http/remedy.js +26 -0
- package/dist/diplomat/http/respond.js +50 -0
- package/dist/diplomat/http/routes/account.js +226 -0
- package/dist/diplomat/http/routes/aggregate.js +28 -0
- package/dist/diplomat/http/routes/auth.js +105 -0
- package/dist/diplomat/http/routes/budget.js +34 -0
- package/dist/diplomat/http/routes/category.js +109 -0
- package/dist/diplomat/http/routes/connect.js +124 -0
- package/dist/diplomat/http/routes/credit-card.js +263 -0
- package/dist/diplomat/http/routes/currency-rates.js +60 -0
- package/dist/diplomat/http/routes/currency.js +16 -0
- package/dist/diplomat/http/routes/dashboard.js +93 -0
- package/dist/diplomat/http/routes/invite.js +63 -0
- package/dist/diplomat/http/routes/recurring.js +65 -0
- package/dist/diplomat/http/routes/settings.js +38 -0
- package/dist/diplomat/http/routes/summary.js +23 -0
- package/dist/diplomat/http/routes/system.js +29 -0
- package/dist/diplomat/http/routes/tag.js +51 -0
- package/dist/diplomat/http/routes/tokens.js +72 -0
- package/dist/diplomat/http/routes/transaction.js +55 -0
- package/dist/diplomat/http/routes/transfer.js +35 -0
- package/dist/diplomat/http/routes/ui.js +110 -0
- package/dist/diplomat/http/routes/users.js +156 -0
- package/dist/diplomat/http/routes/well-known.js +26 -0
- package/dist/diplomat/http/routes.js +85 -0
- package/dist/diplomat/http/session.js +34 -0
- package/dist/diplomat/http/token-pages.js +75 -0
- package/dist/diplomat/http/ui-files.js +21 -0
- package/dist/diplomat/http/user-pages.js +93 -0
- package/dist/diplomat/mcp/annotations.js +8 -0
- package/dist/diplomat/mcp/auth-info.js +20 -0
- package/dist/diplomat/mcp/context.js +14 -0
- package/dist/diplomat/mcp/definition.js +3 -0
- package/dist/diplomat/mcp/gate.js +15 -0
- package/dist/diplomat/mcp/instructions.js +19 -0
- package/dist/diplomat/mcp/prompts.js +125 -0
- package/dist/diplomat/mcp/register.js +12 -0
- package/dist/diplomat/mcp/remedy.js +17 -0
- package/dist/diplomat/mcp/resources.js +93 -0
- package/dist/diplomat/mcp/respond.js +20 -0
- package/dist/diplomat/mcp/route.js +62 -0
- package/dist/diplomat/mcp/scopes.js +53 -0
- package/dist/diplomat/mcp/server.js +26 -0
- package/dist/diplomat/mcp/shared.js +5 -0
- package/dist/diplomat/mcp/stdio-session.js +94 -0
- package/dist/diplomat/mcp/stdio.js +23 -0
- package/dist/diplomat/mcp/tool-name.js +59 -0
- package/dist/diplomat/mcp/tools/account.js +218 -0
- package/dist/diplomat/mcp/tools/aggregate.js +32 -0
- package/dist/diplomat/mcp/tools/budget.js +99 -0
- package/dist/diplomat/mcp/tools/category.js +103 -0
- package/dist/diplomat/mcp/tools/correlations.js +70 -0
- package/dist/diplomat/mcp/tools/credit-card.js +239 -0
- package/dist/diplomat/mcp/tools/currency-rates.js +62 -0
- package/dist/diplomat/mcp/tools/dashboard.js +75 -0
- package/dist/diplomat/mcp/tools/index.js +31 -0
- package/dist/diplomat/mcp/tools/recurring.js +62 -0
- package/dist/diplomat/mcp/tools/summary.js +30 -0
- package/dist/diplomat/mcp/tools/system.js +83 -0
- package/dist/diplomat/mcp/tools/tag.js +48 -0
- package/dist/diplomat/mcp/tools/transaction.js +53 -0
- package/dist/diplomat/mcp/tools/transfer.js +28 -0
- package/dist/diplomat/mcp/tour.js +87 -0
- package/dist/logic/account.js +79 -0
- package/dist/logic/aggregate.js +37 -0
- package/dist/logic/auth/bearer.js +35 -0
- package/dist/logic/auth/grant.js +126 -0
- package/dist/logic/auth/key-export.js +10 -0
- package/dist/logic/auth/keychain.js +3 -0
- package/dist/logic/auth/message.js +22 -0
- package/dist/logic/auth/origin.js +57 -0
- package/dist/logic/auth/owner.js +22 -0
- package/dist/logic/auth/password.js +3 -0
- package/dist/logic/auth/redact.js +25 -0
- package/dist/logic/auth/revoke.js +28 -0
- package/dist/logic/auth/scope.js +17 -0
- package/dist/logic/auth/session.js +30 -0
- package/dist/logic/auth/sign-in-flow.js +305 -0
- package/dist/logic/auth/time.js +2 -0
- package/dist/logic/auth/token.js +74 -0
- package/dist/logic/auth/user-plans.js +84 -0
- package/dist/logic/auth/users.js +78 -0
- package/dist/logic/balance.js +2 -0
- package/dist/logic/bill.js +74 -0
- package/dist/logic/budget.js +78 -0
- package/dist/logic/category.js +37 -0
- package/dist/logic/classify.js +21 -0
- package/dist/logic/correlations.js +147 -0
- package/dist/logic/credit-card.js +2 -0
- package/dist/logic/currency-rate.js +69 -0
- package/dist/logic/dashboard.js +40 -0
- package/dist/logic/demo/database.js +30 -0
- package/dist/logic/demo/plan.js +308 -0
- package/dist/logic/demo/tour.js +33 -0
- package/dist/logic/export-destination.js +12 -0
- package/dist/logic/key-import.js +15 -0
- package/dist/logic/locale.js +5 -0
- package/dist/logic/localize.js +12 -0
- package/dist/logic/merchant.js +31 -0
- package/dist/logic/migration.js +1 -0
- package/dist/logic/money.js +12 -0
- package/dist/logic/period.js +45 -0
- package/dist/logic/persistence.js +48 -0
- package/dist/logic/recurring.js +51 -0
- package/dist/logic/resolve.js +44 -0
- package/dist/logic/summary.js +29 -0
- package/dist/logic/tag.js +13 -0
- package/dist/logic/transaction.js +197 -0
- package/dist/main.js +42 -0
- package/dist/models/account.js +197 -0
- package/dist/models/aggregate.js +61 -0
- package/dist/models/auth/bearer.js +11 -0
- package/dist/models/auth/entity.js +17 -0
- package/dist/models/auth/errors.js +42 -0
- package/dist/models/auth/grant.js +58 -0
- package/dist/models/auth/key-export.js +11 -0
- package/dist/models/auth/message.js +50 -0
- package/dist/models/auth/mode.js +7 -0
- package/dist/models/auth/origin.js +16 -0
- package/dist/models/auth/owner.js +36 -0
- package/dist/models/auth/password.js +24 -0
- package/dist/models/auth/principal.js +26 -0
- package/dist/models/auth/redact.js +4 -0
- package/dist/models/auth/scope.js +9 -0
- package/dist/models/auth/session.js +19 -0
- package/dist/models/auth/sign-in-flow.js +102 -0
- package/dist/models/auth/sign-in.js +41 -0
- package/dist/models/auth/time.js +5 -0
- package/dist/models/auth/token.js +50 -0
- package/dist/models/auth/users.js +52 -0
- package/dist/models/bill.js +55 -0
- package/dist/models/budget.js +106 -0
- package/dist/models/category.js +52 -0
- package/dist/models/client-config.js +18 -0
- package/dist/models/correlations.js +215 -0
- package/dist/models/credit-card.js +156 -0
- package/dist/models/currency-rate.js +83 -0
- package/dist/models/dashboard.js +54 -0
- package/dist/models/database.js +16 -0
- package/dist/models/date.js +8 -0
- package/dist/models/demo/core.js +58 -0
- package/dist/models/demo/tour.js +41 -0
- package/dist/models/encryption-key.js +2 -0
- package/dist/models/error.js +13 -0
- package/dist/models/export.js +9 -0
- package/dist/models/id.js +2 -0
- package/dist/models/instance.js +7 -0
- package/dist/models/key-import.js +6 -0
- package/dist/models/locale.js +25 -0
- package/dist/models/merchant.js +12 -0
- package/dist/models/money.js +14 -0
- package/dist/models/package.js +12 -0
- package/dist/models/page.js +56 -0
- package/dist/models/persistence.js +1 -0
- package/dist/models/prompts.js +5 -0
- package/dist/models/recurring.js +54 -0
- package/dist/models/remedy.js +17 -0
- package/dist/models/resolution.js +1 -0
- package/dist/models/startup.js +7 -0
- package/dist/models/summary.js +24 -0
- package/dist/models/tag.js +14 -0
- package/dist/models/tenancy.js +10 -0
- package/dist/models/transaction-tag.js +6 -0
- package/dist/models/transaction.js +275 -0
- package/dist/wire/db/access-tokens.js +1 -0
- package/dist/wire/db/accounts.js +7 -0
- package/dist/wire/db/aggregate.js +16 -0
- package/dist/wire/db/bills.js +14 -0
- package/dist/wire/db/budgets.js +33 -0
- package/dist/wire/db/categories.js +14 -0
- package/dist/wire/db/client-grants.js +1 -0
- package/dist/wire/db/correlations.js +49 -0
- package/dist/wire/db/credit-cards.js +1 -0
- package/dist/wire/db/currencies.js +1 -0
- package/dist/wire/db/currency-rates.js +1 -0
- package/dist/wire/db/dashboards.js +1 -0
- package/dist/wire/db/instance-settings.js +1 -0
- package/dist/wire/db/invites.js +1 -0
- package/dist/wire/db/merchants.js +18 -0
- package/dist/wire/db/recurring.js +19 -0
- package/dist/wire/db/sessions.js +1 -0
- package/dist/wire/db/settings.js +1 -0
- package/dist/wire/db/setup-codes.js +1 -0
- package/dist/wire/db/tags.js +1 -0
- package/dist/wire/db/tenancy.js +1 -0
- package/dist/wire/db/transactions.js +89 -0
- package/dist/wire/db/users.js +1 -0
- package/dist/wire/in/accounts.js +26 -0
- package/dist/wire/in/aggregate.js +10 -0
- package/dist/wire/in/auth.js +107 -0
- package/dist/wire/in/bills.js +11 -0
- package/dist/wire/in/budgets.js +11 -0
- package/dist/wire/in/categories.js +9 -0
- package/dist/wire/in/cli.js +106 -0
- package/dist/wire/in/coerce.js +6 -0
- package/dist/wire/in/common.js +17 -0
- package/dist/wire/in/credit-cards.js +16 -0
- package/dist/wire/in/currency-rates.js +8 -0
- package/dist/wire/in/period.js +7 -0
- package/dist/wire/in/recurring.js +6 -0
- package/dist/wire/in/settings.js +5 -0
- package/dist/wire/in/summary.js +5 -0
- package/dist/wire/in/tags.js +2 -0
- package/dist/wire/in/transactions.js +31 -0
- package/dist/wire/out/bills.js +9 -0
- package/dist/wire/out/budgets.js +10 -0
- package/dist/wire/out/client-config.js +2 -0
- package/dist/wire/out/common.js +4 -0
- package/dist/wire/out/credit-cards.js +15 -0
- package/dist/wire/out/currency-rates.js +11 -0
- package/dist/wire/out/errors.js +58 -0
- package/dist/wire/out/recurring.js +6 -0
- package/dist/wire/out/status.js +10 -0
- package/dist/wire/out/summary.js +9 -0
- package/dist/wire/out/transactions.js +52 -0
- package/drizzle/0000_futuristic_umar.sql +124 -0
- package/drizzle/0001_fts5_search.sql +23 -0
- package/drizzle/0002_rename_graph_to_history.sql +7 -0
- package/drizzle/0003_lyrical_hairball.sql +2 -0
- package/drizzle/0004_misty_ikaris.sql +7 -0
- package/drizzle/0005_credit-liability-accounts.sql +14 -0
- package/drizzle/0006_smart_aqueduct.sql +1 -0
- package/drizzle/0007_add_dashboards.sql +5 -0
- package/drizzle/0008_yummy_madripoor.sql +1 -0
- package/drizzle/0009_version_groundwork.sql +9 -0
- package/drizzle/0010_category_merchant_association_cascade.sql +16 -0
- package/drizzle/0011_dashboard_id_normalization.sql +16 -0
- package/drizzle/0012_hot_the_spike.sql +12 -0
- package/drizzle/0013_recurring_rules_merchant.sql +1 -0
- package/drizzle/0014_dashboard_source_discriminator.sql +17 -0
- package/drizzle/0015_currencies_decimals.sql +1 -0
- package/drizzle/0016_unusual_zaran.sql +13 -0
- package/drizzle/0017_premium_blur.sql +1 -0
- package/drizzle/0018_auth_identity.sql +39 -0
- package/drizzle/0019_access_tokens.sql +16 -0
- package/drizzle/0020_stdio_sign_in.sql +27 -0
- package/drizzle/0021_tenancy_data.sql +289 -0
- package/drizzle/0022_user_management.sql +17 -0
- package/drizzle/0023_instance_settings_row.sql +2 -0
- package/drizzle/0024_credentials_changed_at.sql +2 -0
- package/drizzle/0025_instance_kind.sql +2 -0
- package/drizzle/0026_demo_seeded_at.sql +2 -0
- package/drizzle/0027_demo_country.sql +2 -0
- package/drizzle/0028_reset_sign_ins.sql +2 -0
- package/drizzle/meta/0000_snapshot.json +894 -0
- package/drizzle/meta/0003_snapshot.json +910 -0
- package/drizzle/meta/0004_snapshot.json +951 -0
- package/drizzle/meta/0005_snapshot.json +991 -0
- package/drizzle/meta/0006_snapshot.json +998 -0
- package/drizzle/meta/0007_snapshot.json +1029 -0
- package/drizzle/meta/0008_snapshot.json +1049 -0
- package/drizzle/meta/0009_snapshot.json +1121 -0
- package/drizzle/meta/0010_snapshot.json +1121 -0
- package/drizzle/meta/0011_snapshot.json +1136 -0
- package/drizzle/meta/0012_snapshot.json +1227 -0
- package/drizzle/meta/0013_snapshot.json +1247 -0
- package/drizzle/meta/0014_snapshot.json +1267 -0
- package/drizzle/meta/0015_snapshot.json +1275 -0
- package/drizzle/meta/0016_snapshot.json +1371 -0
- package/drizzle/meta/0017_snapshot.json +1392 -0
- package/drizzle/meta/0018_snapshot.json +1603 -0
- package/drizzle/meta/0019_snapshot.json +1713 -0
- package/drizzle/meta/0020_snapshot.json +1904 -0
- package/drizzle/meta/0021_snapshot.json +2186 -0
- package/drizzle/meta/0022_snapshot.json +2311 -0
- package/drizzle/meta/0023_snapshot.json +2311 -0
- package/drizzle/meta/0024_snapshot.json +2318 -0
- package/drizzle/meta/0025_snapshot.json +2326 -0
- package/drizzle/meta/0026_snapshot.json +2333 -0
- package/drizzle/meta/0027_snapshot.json +2340 -0
- package/drizzle/meta/0028_snapshot.json +2340 -0
- package/drizzle/meta/_journal.json +209 -0
- package/package.json +106 -4
- package/skills/dashboard-building/SKILL.md +201 -0
- package/skills/patty-tour/SKILL.md +34 -0
- package/ui/app.css +758 -0
- package/ui/app.js +543 -0
- package/ui/connect-result.html +16 -0
- package/ui/connect.html +53 -0
- package/ui/dashboards/accounts.html +3189 -0
- package/ui/dashboards/budget.html +1734 -0
- package/ui/dashboards/cards.html +4032 -0
- package/ui/dashboards/categories.html +4694 -0
- package/ui/dashboards/comparative.html +2475 -0
- package/ui/dashboards/dashboards.html +839 -0
- package/ui/dashboards/overview.html +2405 -0
- package/ui/dashboards/pending.html +2973 -0
- package/ui/dashboards/projections.html +2528 -0
- package/ui/dashboards/tags.html +1365 -0
- package/ui/invite.html +44 -0
- package/ui/login.html +26 -0
- package/ui/money.js +175 -0
- package/ui/setup.html +29 -0
- package/ui/shell.html +96 -0
- package/ui/token-created.html +24 -0
- package/ui/tokens.html +58 -0
- package/ui/user-invited.html +27 -0
- package/ui/users.html +60 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
CREATE TABLE `accounts` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`name` text NOT NULL,
|
|
4
|
+
`type` text NOT NULL,
|
|
5
|
+
`initial_balance` real DEFAULT 0 NOT NULL,
|
|
6
|
+
`currency` text NOT NULL,
|
|
7
|
+
FOREIGN KEY (`currency`) REFERENCES `currencies`(`code`) ON UPDATE no action ON DELETE no action
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
CREATE TABLE `bills` (
|
|
11
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
12
|
+
`credit_card_id` text NOT NULL,
|
|
13
|
+
`month` integer NOT NULL,
|
|
14
|
+
`year` integer NOT NULL,
|
|
15
|
+
`close_date` text NOT NULL,
|
|
16
|
+
`due_date` text NOT NULL,
|
|
17
|
+
`status` text NOT NULL,
|
|
18
|
+
FOREIGN KEY (`credit_card_id`) REFERENCES `credit_cards`(`id`) ON UPDATE no action ON DELETE no action
|
|
19
|
+
);
|
|
20
|
+
--> statement-breakpoint
|
|
21
|
+
CREATE UNIQUE INDEX `bills_card_month_year` ON `bills` (`credit_card_id`,`month`,`year`);--> statement-breakpoint
|
|
22
|
+
CREATE TABLE `categories` (
|
|
23
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
24
|
+
`name` text NOT NULL,
|
|
25
|
+
`kind` text NOT NULL,
|
|
26
|
+
`parent_id` text,
|
|
27
|
+
FOREIGN KEY (`parent_id`) REFERENCES `categories`(`id`) ON UPDATE no action ON DELETE no action
|
|
28
|
+
);
|
|
29
|
+
--> statement-breakpoint
|
|
30
|
+
CREATE TABLE `credit_cards` (
|
|
31
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
32
|
+
`name` text NOT NULL,
|
|
33
|
+
`closing_day` integer NOT NULL,
|
|
34
|
+
`due_day` integer NOT NULL,
|
|
35
|
+
`limit_amount` real,
|
|
36
|
+
`currency` text NOT NULL,
|
|
37
|
+
FOREIGN KEY (`currency`) REFERENCES `currencies`(`code`) ON UPDATE no action ON DELETE no action
|
|
38
|
+
);
|
|
39
|
+
--> statement-breakpoint
|
|
40
|
+
CREATE TABLE `currencies` (
|
|
41
|
+
`code` text PRIMARY KEY NOT NULL,
|
|
42
|
+
`symbol` text NOT NULL,
|
|
43
|
+
`name` text NOT NULL
|
|
44
|
+
);
|
|
45
|
+
--> statement-breakpoint
|
|
46
|
+
CREATE TABLE `merchant_category` (
|
|
47
|
+
`merchant_key` text NOT NULL,
|
|
48
|
+
`category_id` text NOT NULL,
|
|
49
|
+
`weight` real DEFAULT 1 NOT NULL,
|
|
50
|
+
`origin` text NOT NULL,
|
|
51
|
+
`last_seen` integer,
|
|
52
|
+
PRIMARY KEY(`merchant_key`, `category_id`),
|
|
53
|
+
FOREIGN KEY (`merchant_key`) REFERENCES `merchants`(`key`) ON UPDATE no action ON DELETE no action,
|
|
54
|
+
FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`) ON UPDATE no action ON DELETE no action
|
|
55
|
+
);
|
|
56
|
+
--> statement-breakpoint
|
|
57
|
+
CREATE TABLE `merchants` (
|
|
58
|
+
`key` text PRIMARY KEY NOT NULL
|
|
59
|
+
);
|
|
60
|
+
--> statement-breakpoint
|
|
61
|
+
CREATE TABLE `recurring_rules` (
|
|
62
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
63
|
+
`description` text NOT NULL,
|
|
64
|
+
`amount` real NOT NULL,
|
|
65
|
+
`type` text NOT NULL,
|
|
66
|
+
`period` text NOT NULL,
|
|
67
|
+
`next_due` text NOT NULL,
|
|
68
|
+
`currency` text NOT NULL,
|
|
69
|
+
`account_id` text,
|
|
70
|
+
`category_id` text,
|
|
71
|
+
FOREIGN KEY (`currency`) REFERENCES `currencies`(`code`) ON UPDATE no action ON DELETE no action,
|
|
72
|
+
FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON UPDATE no action ON DELETE no action,
|
|
73
|
+
FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`) ON UPDATE no action ON DELETE no action
|
|
74
|
+
);
|
|
75
|
+
--> statement-breakpoint
|
|
76
|
+
CREATE TABLE `tags` (
|
|
77
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
78
|
+
`name` text NOT NULL
|
|
79
|
+
);
|
|
80
|
+
--> statement-breakpoint
|
|
81
|
+
CREATE UNIQUE INDEX `tags_name_unique` ON `tags` (`name`);--> statement-breakpoint
|
|
82
|
+
CREATE TABLE `transaction_tags` (
|
|
83
|
+
`transaction_id` text NOT NULL,
|
|
84
|
+
`tag_id` text NOT NULL,
|
|
85
|
+
PRIMARY KEY(`transaction_id`, `tag_id`),
|
|
86
|
+
FOREIGN KEY (`transaction_id`) REFERENCES `transactions`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
87
|
+
FOREIGN KEY (`tag_id`) REFERENCES `tags`(`id`) ON UPDATE no action ON DELETE cascade
|
|
88
|
+
);
|
|
89
|
+
--> statement-breakpoint
|
|
90
|
+
CREATE TABLE `transactions` (
|
|
91
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
92
|
+
`description` text NOT NULL,
|
|
93
|
+
`amount` real NOT NULL,
|
|
94
|
+
`type` text NOT NULL,
|
|
95
|
+
`date` text NOT NULL,
|
|
96
|
+
`currency` text NOT NULL,
|
|
97
|
+
`source` text NOT NULL,
|
|
98
|
+
`idempotency_key` text NOT NULL,
|
|
99
|
+
`classification_method` text NOT NULL,
|
|
100
|
+
`confidence` real NOT NULL,
|
|
101
|
+
`raw_input` text,
|
|
102
|
+
`from_account_id` text,
|
|
103
|
+
`to_account_id` text,
|
|
104
|
+
`credit_card_id` text,
|
|
105
|
+
`category_id` text,
|
|
106
|
+
`subcategory_id` text,
|
|
107
|
+
`merchant_key` text,
|
|
108
|
+
`bill_id` text,
|
|
109
|
+
FOREIGN KEY (`currency`) REFERENCES `currencies`(`code`) ON UPDATE no action ON DELETE no action,
|
|
110
|
+
FOREIGN KEY (`from_account_id`) REFERENCES `accounts`(`id`) ON UPDATE no action ON DELETE no action,
|
|
111
|
+
FOREIGN KEY (`to_account_id`) REFERENCES `accounts`(`id`) ON UPDATE no action ON DELETE no action,
|
|
112
|
+
FOREIGN KEY (`credit_card_id`) REFERENCES `credit_cards`(`id`) ON UPDATE no action ON DELETE no action,
|
|
113
|
+
FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`) ON UPDATE no action ON DELETE no action,
|
|
114
|
+
FOREIGN KEY (`subcategory_id`) REFERENCES `categories`(`id`) ON UPDATE no action ON DELETE no action,
|
|
115
|
+
FOREIGN KEY (`merchant_key`) REFERENCES `merchants`(`key`) ON UPDATE no action ON DELETE no action,
|
|
116
|
+
FOREIGN KEY (`bill_id`) REFERENCES `bills`(`id`) ON UPDATE no action ON DELETE no action,
|
|
117
|
+
CONSTRAINT "subcategory_requires_category" CHECK("transactions"."subcategory_id" IS NULL OR "transactions"."category_id" IS NOT NULL)
|
|
118
|
+
);
|
|
119
|
+
--> statement-breakpoint
|
|
120
|
+
CREATE UNIQUE INDEX `transactions_idempotency_key_unique` ON `transactions` (`idempotency_key`);--> statement-breakpoint
|
|
121
|
+
CREATE INDEX `idx_transactions_date` ON `transactions` (`date`);--> statement-breakpoint
|
|
122
|
+
CREATE INDEX `idx_transactions_from_account` ON `transactions` (`from_account_id`);--> statement-breakpoint
|
|
123
|
+
CREATE INDEX `idx_transactions_to_account` ON `transactions` (`to_account_id`);--> statement-breakpoint
|
|
124
|
+
CREATE INDEX `idx_transactions_category` ON `transactions` (`category_id`);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- FTS5 virtual table for search_transactions (libSQL bundles FTS5).
|
|
2
|
+
-- Drizzle-kit cannot generate virtual tables, so this is a manual migration.
|
|
3
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS transactions_fts
|
|
4
|
+
USING fts5(description, content='transactions', content_rowid='rowid');
|
|
5
|
+
--> statement-breakpoint
|
|
6
|
+
-- Keep FTS5 index in sync with the transactions table.
|
|
7
|
+
CREATE TRIGGER IF NOT EXISTS transactions_fts_insert
|
|
8
|
+
AFTER INSERT ON transactions BEGIN
|
|
9
|
+
INSERT INTO transactions_fts(rowid, description) VALUES (new.rowid, new.description);
|
|
10
|
+
END;
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
CREATE TRIGGER IF NOT EXISTS transactions_fts_update
|
|
13
|
+
AFTER UPDATE OF description ON transactions BEGIN
|
|
14
|
+
INSERT INTO transactions_fts(transactions_fts, rowid, description)
|
|
15
|
+
VALUES ('delete', old.rowid, old.description);
|
|
16
|
+
INSERT INTO transactions_fts(rowid, description) VALUES (new.rowid, new.description);
|
|
17
|
+
END;
|
|
18
|
+
--> statement-breakpoint
|
|
19
|
+
CREATE TRIGGER IF NOT EXISTS transactions_fts_delete
|
|
20
|
+
AFTER DELETE ON transactions BEGIN
|
|
21
|
+
INSERT INTO transactions_fts(transactions_fts, rowid, description)
|
|
22
|
+
VALUES ('delete', old.rowid, old.description);
|
|
23
|
+
END;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- Rename the classification origin/method value 'graph' (a Neo4j-era fossil) to 'history'.
|
|
2
|
+
-- Columns are plain TEXT (no CHECK constraint), so this is a pure data migration —
|
|
3
|
+
-- the enum change lives in the Drizzle schema only. Existing rows must be updated so the
|
|
4
|
+
-- stricter model enum (zod) does not reject them on read.
|
|
5
|
+
UPDATE transactions SET classification_method = 'history' WHERE classification_method = 'graph';
|
|
6
|
+
--> statement-breakpoint
|
|
7
|
+
UPDATE merchant_category SET origin = 'history' WHERE origin = 'graph';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
DROP TABLE IF EXISTS `credit_cards`;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `credit_cards` (
|
|
3
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
4
|
+
`name` text NOT NULL,
|
|
5
|
+
`closing_day` integer NOT NULL,
|
|
6
|
+
`due_day` integer NOT NULL,
|
|
7
|
+
`limit_amount` real,
|
|
8
|
+
`currency` text NOT NULL,
|
|
9
|
+
`account_id` text NOT NULL,
|
|
10
|
+
`payment_account_id` text,
|
|
11
|
+
FOREIGN KEY (`currency`) REFERENCES `currencies`(`code`) ON UPDATE no action ON DELETE no action,
|
|
12
|
+
FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON UPDATE no action ON DELETE no action,
|
|
13
|
+
FOREIGN KEY (`payment_account_id`) REFERENCES `accounts`(`id`) ON UPDATE no action ON DELETE no action
|
|
14
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `transactions` ADD `note` text;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `bills` ADD `payment_transaction_id` text REFERENCES transactions(id);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
ALTER TABLE `accounts` ADD `version` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE `bills` ADD `version` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
3
|
+
ALTER TABLE `categories` ADD `version` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
4
|
+
ALTER TABLE `credit_cards` ADD `version` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
5
|
+
ALTER TABLE `dashboards` ADD `version` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
6
|
+
ALTER TABLE `recurring_rules` ADD `version` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
7
|
+
ALTER TABLE `settings` ADD `version` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
8
|
+
ALTER TABLE `tags` ADD `version` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
9
|
+
ALTER TABLE `transactions` ADD `version` integer DEFAULT 0 NOT NULL;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_merchant_category` (
|
|
3
|
+
`merchant_key` text NOT NULL,
|
|
4
|
+
`category_id` text NOT NULL,
|
|
5
|
+
`weight` real DEFAULT 1 NOT NULL,
|
|
6
|
+
`origin` text NOT NULL,
|
|
7
|
+
`last_seen` integer,
|
|
8
|
+
PRIMARY KEY(`merchant_key`, `category_id`),
|
|
9
|
+
FOREIGN KEY (`merchant_key`) REFERENCES `merchants`(`key`) ON UPDATE no action ON DELETE no action,
|
|
10
|
+
FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`) ON UPDATE no action ON DELETE cascade
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
INSERT INTO `__new_merchant_category`("merchant_key", "category_id", "weight", "origin", "last_seen") SELECT "merchant_key", "category_id", "weight", "origin", "last_seen" FROM `merchant_category`;--> statement-breakpoint
|
|
14
|
+
DROP TABLE `merchant_category`;--> statement-breakpoint
|
|
15
|
+
ALTER TABLE `__new_merchant_category` RENAME TO `merchant_category`;--> statement-breakpoint
|
|
16
|
+
PRAGMA foreign_keys=ON;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_dashboards` (
|
|
3
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
4
|
+
`name` text NOT NULL,
|
|
5
|
+
`html` text NOT NULL,
|
|
6
|
+
`updated_at` text NOT NULL,
|
|
7
|
+
`version` integer DEFAULT 0 NOT NULL
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
INSERT INTO `__new_dashboards`("id", "name", "html", "updated_at", "version") SELECT
|
|
11
|
+
lower(hex(randomblob(4)) || '-' || hex(randomblob(2)) || '-4' || substr(hex(randomblob(2)), 2) || '-' || substr('89ab', abs(random()) % 4 + 1, 1) || substr(hex(randomblob(2)), 2) || '-' || hex(randomblob(6))),
|
|
12
|
+
"name", "html", "updated_at", "version" FROM `dashboards`;--> statement-breakpoint
|
|
13
|
+
DROP TABLE `dashboards`;--> statement-breakpoint
|
|
14
|
+
ALTER TABLE `__new_dashboards` RENAME TO `dashboards`;--> statement-breakpoint
|
|
15
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
16
|
+
CREATE UNIQUE INDEX `dashboards_name_unique` ON `dashboards` (`name`);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
CREATE TABLE `budgets` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`category_id` text NOT NULL,
|
|
4
|
+
`currency` text NOT NULL,
|
|
5
|
+
`limit_amount` real NOT NULL,
|
|
6
|
+
`period` text DEFAULT 'monthly' NOT NULL,
|
|
7
|
+
`version` integer DEFAULT 0 NOT NULL,
|
|
8
|
+
FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`) ON UPDATE no action ON DELETE no action,
|
|
9
|
+
FOREIGN KEY (`currency`) REFERENCES `currencies`(`code`) ON UPDATE no action ON DELETE no action
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
CREATE UNIQUE INDEX `budgets_category_currency_period` ON `budgets` (`category_id`,`currency`,`period`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `recurring_rules` ADD `merchant_key` text REFERENCES merchants(key);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_dashboards` (
|
|
3
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
4
|
+
`name` text NOT NULL,
|
|
5
|
+
`html` text,
|
|
6
|
+
`source` text DEFAULT 'inline' NOT NULL,
|
|
7
|
+
`path` text,
|
|
8
|
+
`updated_at` text NOT NULL,
|
|
9
|
+
`version` integer DEFAULT 0 NOT NULL,
|
|
10
|
+
CONSTRAINT "dashboard_source_content" CHECK(("__new_dashboards"."source" = 'inline' AND "__new_dashboards"."html" IS NOT NULL AND "__new_dashboards"."path" IS NULL) OR ("__new_dashboards"."source" = 'file' AND "__new_dashboards"."html" IS NULL AND "__new_dashboards"."path" IS NOT NULL))
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
INSERT INTO `__new_dashboards`("id", "name", "html", "source", "path", "updated_at", "version") SELECT "id", "name", "html", 'inline', NULL, "updated_at", "version" FROM `dashboards`;--> statement-breakpoint
|
|
14
|
+
DROP TABLE `dashboards`;--> statement-breakpoint
|
|
15
|
+
ALTER TABLE `__new_dashboards` RENAME TO `dashboards`;--> statement-breakpoint
|
|
16
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
17
|
+
CREATE UNIQUE INDEX `dashboards_name_unique` ON `dashboards` (`name`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `currencies` ADD `decimals` integer DEFAULT 2 NOT NULL;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE TABLE `currency_rates` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`from_code` text NOT NULL,
|
|
4
|
+
`to_code` text NOT NULL,
|
|
5
|
+
`rate` real NOT NULL,
|
|
6
|
+
`as_of` text NOT NULL,
|
|
7
|
+
`source` text,
|
|
8
|
+
`version` integer DEFAULT 0 NOT NULL,
|
|
9
|
+
FOREIGN KEY (`from_code`) REFERENCES `currencies`(`code`) ON UPDATE no action ON DELETE no action,
|
|
10
|
+
FOREIGN KEY (`to_code`) REFERENCES `currencies`(`code`) ON UPDATE no action ON DELETE no action
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
CREATE UNIQUE INDEX `currency_rates_from_to` ON `currency_rates` (`from_code`,`to_code`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `settings` ADD `base_currency` text REFERENCES currencies(code);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
CREATE TABLE `sessions` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`user_id` text NOT NULL,
|
|
4
|
+
`token_hash` text NOT NULL,
|
|
5
|
+
`created_at` text NOT NULL,
|
|
6
|
+
`last_seen_at` text NOT NULL,
|
|
7
|
+
`expires_at` text NOT NULL,
|
|
8
|
+
`version` integer DEFAULT 0 NOT NULL,
|
|
9
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
CREATE UNIQUE INDEX `sessions_token_hash_unique` ON `sessions` (`token_hash`);--> statement-breakpoint
|
|
13
|
+
CREATE TABLE `setup_codes` (
|
|
14
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
15
|
+
`code_hash` text NOT NULL,
|
|
16
|
+
`created_at` text NOT NULL,
|
|
17
|
+
`expires_at` text NOT NULL,
|
|
18
|
+
`used_at` text,
|
|
19
|
+
`version` integer DEFAULT 0 NOT NULL
|
|
20
|
+
);
|
|
21
|
+
--> statement-breakpoint
|
|
22
|
+
CREATE UNIQUE INDEX `setup_codes_code_hash_unique` ON `setup_codes` (`code_hash`);--> statement-breakpoint
|
|
23
|
+
CREATE TABLE `users` (
|
|
24
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
25
|
+
`username` text,
|
|
26
|
+
`password_hash` text,
|
|
27
|
+
`role` text NOT NULL,
|
|
28
|
+
`created_at` text NOT NULL,
|
|
29
|
+
`disabled_at` text,
|
|
30
|
+
`version` integer DEFAULT 0 NOT NULL
|
|
31
|
+
);
|
|
32
|
+
--> statement-breakpoint
|
|
33
|
+
CREATE UNIQUE INDEX `users_username_unique` ON `users` (`username`);
|
|
34
|
+
--> statement-breakpoint
|
|
35
|
+
-- ADR-033 §7: the owner is a row, created here on EVERY database (fresh or existing) so that stdio,
|
|
36
|
+
-- auth-disabled requests and the setup-code claim all resolve to the same user. No credentials yet.
|
|
37
|
+
-- The id must equal OWNER_USER_ID (src/models/auth.ts). Touches no existing domain table.
|
|
38
|
+
INSERT INTO `users` (`id`, `username`, `password_hash`, `role`, `created_at`, `disabled_at`, `version`)
|
|
39
|
+
VALUES ('user-owner', NULL, NULL, 'admin', strftime('%Y-%m-%dT%H:%M:%fZ', 'now'), NULL, 0);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
CREATE TABLE `access_tokens` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`user_id` text NOT NULL,
|
|
4
|
+
`name` text NOT NULL,
|
|
5
|
+
`token_hash` text NOT NULL,
|
|
6
|
+
`prefix` text NOT NULL,
|
|
7
|
+
`scopes` text NOT NULL,
|
|
8
|
+
`created_at` text NOT NULL,
|
|
9
|
+
`last_used_at` text,
|
|
10
|
+
`expires_at` text,
|
|
11
|
+
`revoked_at` text,
|
|
12
|
+
`version` integer DEFAULT 0 NOT NULL,
|
|
13
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
14
|
+
);
|
|
15
|
+
--> statement-breakpoint
|
|
16
|
+
CREATE UNIQUE INDEX `access_tokens_token_hash_unique` ON `access_tokens` (`token_hash`);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
CREATE TABLE `client_grants` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`device_code_hash` text NOT NULL,
|
|
4
|
+
`user_code` text NOT NULL,
|
|
5
|
+
`client_name` text NOT NULL,
|
|
6
|
+
`client_version` text NOT NULL,
|
|
7
|
+
`profile` text NOT NULL,
|
|
8
|
+
`channel` text DEFAULT 'stdio' NOT NULL,
|
|
9
|
+
`hint_access` text,
|
|
10
|
+
`hint_duration` text,
|
|
11
|
+
`status` text DEFAULT 'pending' NOT NULL,
|
|
12
|
+
`user_id` text,
|
|
13
|
+
`scopes` text,
|
|
14
|
+
`duration` text,
|
|
15
|
+
`created_at` text NOT NULL,
|
|
16
|
+
`approved_at` text,
|
|
17
|
+
`expires_at` text NOT NULL,
|
|
18
|
+
`version` integer DEFAULT 0 NOT NULL,
|
|
19
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
20
|
+
);
|
|
21
|
+
--> statement-breakpoint
|
|
22
|
+
CREATE UNIQUE INDEX `client_grants_device_code_hash_unique` ON `client_grants` (`device_code_hash`);--> statement-breakpoint
|
|
23
|
+
CREATE UNIQUE INDEX `client_grants_pending_user_code` ON `client_grants` (`user_code`) WHERE "client_grants"."status" = 'pending';--> statement-breakpoint
|
|
24
|
+
CREATE INDEX `client_grants_user_code_idx` ON `client_grants` (`user_code`);--> statement-breakpoint
|
|
25
|
+
ALTER TABLE `access_tokens` ADD `kind` text DEFAULT 'pat' NOT NULL;--> statement-breakpoint
|
|
26
|
+
ALTER TABLE `access_tokens` ADD `client_name` text;--> statement-breakpoint
|
|
27
|
+
ALTER TABLE `access_tokens` ADD `profile` text;
|