@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,86 @@
|
|
|
1
|
+
import { runEffects } from '@rfc0/effect-runner';
|
|
2
|
+
import { err, ok, ResultAsync } from 'neverthrow';
|
|
3
|
+
import { AUTH_APPLIERS, bindAuthRunEffects, createAuthDeps } from './auth.js';
|
|
4
|
+
import { version } from '../common/build-version.js';
|
|
5
|
+
import { loadConfig } from '../config.js';
|
|
6
|
+
import { clientConfigs } from '../diplomat/client-config/clients.js';
|
|
7
|
+
import { runCli } from '../diplomat/cli/commands.js';
|
|
8
|
+
import * as tty from '../diplomat/cli/terminal.js';
|
|
9
|
+
import { bootstrap } from '../diplomat/db/bootstrap.js';
|
|
10
|
+
import { closeDatabase, openDatabase } from '../diplomat/db/driver.js';
|
|
11
|
+
import { createEngineContext } from '../diplomat/db/engine.js';
|
|
12
|
+
import { AuthMode } from '../models/auth/mode.js';
|
|
13
|
+
import { createDemoShell } from './demo/shell.js';
|
|
14
|
+
import { createExporter } from './export.js';
|
|
15
|
+
import { createImporter } from './import.js';
|
|
16
|
+
import { createSignInFor } from './sign-in/wiring.js';
|
|
17
|
+
/**
|
|
18
|
+
* Composition root of the command mode (`setup`, `auth …`, `login`, `logout`): the one place that joins the database,
|
|
19
|
+
* the keychain, the terminal and the client config files into the `CliIo` the commands in `diplomat/cli` are written
|
|
20
|
+
* against. Loaded lazily by `main.ts`, so a server start never pays for it.
|
|
21
|
+
*/
|
|
22
|
+
/** Bootstraps, closing the database when that fails — by refusal or by throwing. */
|
|
23
|
+
const bootstrapOrClose = async (db) => {
|
|
24
|
+
try {
|
|
25
|
+
return await bootstrap(db);
|
|
26
|
+
}
|
|
27
|
+
catch (cause) {
|
|
28
|
+
closeDatabase(db);
|
|
29
|
+
throw cause;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const openShell = async () => {
|
|
33
|
+
const config = loadConfig();
|
|
34
|
+
const db = await openDatabase(config);
|
|
35
|
+
const bootstrapped = await bootstrapOrClose(db);
|
|
36
|
+
if (bootstrapped.isErr()) {
|
|
37
|
+
closeDatabase(db);
|
|
38
|
+
return err(bootstrapped.error);
|
|
39
|
+
}
|
|
40
|
+
const engineContext = createEngineContext(db);
|
|
41
|
+
const deps = await createAuthDeps(db);
|
|
42
|
+
const run = bindAuthRunEffects((flow) => runEffects(engineContext, AUTH_APPLIERS, flow));
|
|
43
|
+
return ok({
|
|
44
|
+
deps,
|
|
45
|
+
run,
|
|
46
|
+
close: () => closeDatabase(db),
|
|
47
|
+
authRequired: config.PATTY_AUTH === AuthMode.enum.required,
|
|
48
|
+
defaultProfile: config.PATTY_PROFILE,
|
|
49
|
+
// The CLI binds nothing, so HOST:PORT is not known to serve THIS database: only a configured origin is named.
|
|
50
|
+
inviteOrigin: config.PUBLIC_URL ?? null,
|
|
51
|
+
// `login` never reuses a server already on HOST:PORT: it names no page and serves its own, on this database.
|
|
52
|
+
signIn: (profile) => createSignInFor({ config, db, deps, run }, { profile, origin: () => null, canServePage: true }),
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const waitOrAbort = (ms, signal) => new Promise((resolve) => {
|
|
56
|
+
if (signal.aborted)
|
|
57
|
+
return resolve();
|
|
58
|
+
const finish = () => {
|
|
59
|
+
clearTimeout(timer);
|
|
60
|
+
signal.removeEventListener('abort', finish);
|
|
61
|
+
resolve();
|
|
62
|
+
};
|
|
63
|
+
const timer = setTimeout(finish, ms);
|
|
64
|
+
signal.addEventListener('abort', finish, { once: true });
|
|
65
|
+
});
|
|
66
|
+
const interruptSignal = () => {
|
|
67
|
+
const controller = new AbortController();
|
|
68
|
+
process.once('SIGINT', () => controller.abort());
|
|
69
|
+
return controller.signal;
|
|
70
|
+
};
|
|
71
|
+
const defaultCliIo = () => ({
|
|
72
|
+
openShell: () => new ResultAsync(openShell()),
|
|
73
|
+
openTerminal: () => (tty.isInteractive() ? tty.open() : null),
|
|
74
|
+
readPasswordFromStdin: tty.readPasswordFromStdin,
|
|
75
|
+
out: tty.printResult,
|
|
76
|
+
err: tty.printDiagnostic,
|
|
77
|
+
version,
|
|
78
|
+
wait: waitOrAbort,
|
|
79
|
+
interruptSignal,
|
|
80
|
+
clients: clientConfigs,
|
|
81
|
+
exporter: createExporter(),
|
|
82
|
+
importer: createImporter(),
|
|
83
|
+
demo: createDemoShell(),
|
|
84
|
+
});
|
|
85
|
+
/** The command line, ready to run: the router bound to the real terminal, database, keychain and config files. */
|
|
86
|
+
export const runCommandLine = (args) => runCli(args, defaultCliIo());
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as R from 'remeda';
|
|
2
|
+
import { err, ok } from 'neverthrow';
|
|
3
|
+
import * as demoAdapters from '../../adapters/demo.js';
|
|
4
|
+
import { formatAppError } from '../../common/errors.js';
|
|
5
|
+
import { addAccountExpense, addAccountIncome } from '../../controllers/account/transaction.js';
|
|
6
|
+
import { createAccount } from '../../controllers/account/account.js';
|
|
7
|
+
import { createTransfer } from '../../controllers/account/transfer.js';
|
|
8
|
+
import { createBudget } from '../../controllers/budgets.js';
|
|
9
|
+
import { payBill, revertBillPayment } from '../../controllers/credit-card/bill.js';
|
|
10
|
+
import { createCreditCard } from '../../controllers/credit-card/credit-card.js';
|
|
11
|
+
import { addCardPurchase } from '../../controllers/credit-card/transaction.js';
|
|
12
|
+
import { setExchangeRate } from '../../controllers/currency-rates.js';
|
|
13
|
+
import { scopedFor } from '../../controllers/deps.js';
|
|
14
|
+
import { completeDemoSeed, demoSeedStatus, markDemoInstance } from '../../controllers/demo/seed.js';
|
|
15
|
+
import { applyDueRecurring, createRecurring } from '../../controllers/recurring.js';
|
|
16
|
+
import { setBaseCurrency, setLocale } from '../../controllers/settings.js';
|
|
17
|
+
import { createTag } from '../../controllers/tags.js';
|
|
18
|
+
import { DEMO_PACKS } from '../../diplomat/db/seed/demo/index.js';
|
|
19
|
+
import { clockDateOf, planDemo } from '../../logic/demo/plan.js';
|
|
20
|
+
import { toIsoDate } from '../../logic/period.js';
|
|
21
|
+
import { OWNER_PRINCIPAL } from '../../models/auth/principal.js';
|
|
22
|
+
import { DEMO_SEED_FRESH, demoErrors, DemoSeedStatus, DemoStepKind, } from '../../models/demo/core.js';
|
|
23
|
+
import { TransactionSource } from '../../models/transaction.js';
|
|
24
|
+
import { instanceSettingsRepo } from '../../diplomat/db/repos/instance-settings.js';
|
|
25
|
+
import { bindAuthRunEffects } from '../auth.js';
|
|
26
|
+
import { createRuntime } from '../runtime.js';
|
|
27
|
+
/**
|
|
28
|
+
* Composition root of the demo seed: runs the generator's plan (`logic/demo/plan.ts`) through the same write flows the
|
|
29
|
+
* MCP tools and REST routes run — one runner, the clock set to each item's date — so bills, idempotency keys,
|
|
30
|
+
* classification and merchant learning behave exactly as in real use. No demo-only write path, no raw SQL.
|
|
31
|
+
*/
|
|
32
|
+
const SOURCE = TransactionSource.enum.mcp;
|
|
33
|
+
const NOON = 12;
|
|
34
|
+
const run = (scoped, flow) => scoped.runEffects(() => flow(scoped.deps).map(demoAdapters.outcomeToDb));
|
|
35
|
+
const K = DemoStepKind.enum;
|
|
36
|
+
const HANDLERS = {
|
|
37
|
+
[K.locale]: (scoped, { input }) => run(scoped, (deps) => setLocale(deps, input)).map(() => scoped.resetLocale()),
|
|
38
|
+
[K.baseCurrency]: (scoped, { input }) => run(scoped, (deps) => setBaseCurrency(deps, input)),
|
|
39
|
+
[K.account]: (scoped, { input }) => run(scoped, (deps) => createAccount(deps, input)),
|
|
40
|
+
[K.card]: (scoped, { input }) => run(scoped, (deps) => createCreditCard(deps, input)),
|
|
41
|
+
[K.tag]: (scoped, { name }) => run(scoped, (deps) => createTag(deps, name)),
|
|
42
|
+
[K.rate]: (scoped, { input }) => run(scoped, (deps) => setExchangeRate(deps, input)),
|
|
43
|
+
[K.recurring]: (scoped, { input }) => run(scoped, (deps) => createRecurring(deps, input)),
|
|
44
|
+
[K.budget]: (scoped, { input }) => run(scoped, (deps) => createBudget(deps, input)),
|
|
45
|
+
[K.expense]: (scoped, { input }) => run(scoped, (deps) => addAccountExpense(deps, input, SOURCE)),
|
|
46
|
+
[K.income]: (scoped, { input }) => run(scoped, (deps) => addAccountIncome(deps, input, SOURCE)),
|
|
47
|
+
[K.purchase]: (scoped, { input }) => run(scoped, (deps) => addCardPurchase(deps, input, SOURCE)),
|
|
48
|
+
[K.transfer]: (scoped, { input }) => run(scoped, (deps) => createTransfer(deps, input, SOURCE)),
|
|
49
|
+
[K.applyDue]: (scoped, { through }) => run(scoped, (deps) => applyDueRecurring(deps, { through })),
|
|
50
|
+
[K.payBill]: (scoped, { input }) => run(scoped, (deps) => payBill(deps, { ...input, source: SOURCE })),
|
|
51
|
+
[K.revertBill]: (scoped, { input }) => run(scoped, (deps) => revertBillPayment(deps, input)),
|
|
52
|
+
};
|
|
53
|
+
// The one cast: TypeScript cannot correlate `step.kind` with the handler picked by it; `Handlers` proves each has one.
|
|
54
|
+
const runStep = (scoped, step) => HANDLERS[step.kind](scoped, step);
|
|
55
|
+
const failedStep = (step, error) => demoErrors.stepFailed(step.kind, step.date, formatAppError(error));
|
|
56
|
+
const noonOf = (isoDate) => {
|
|
57
|
+
const [year = 0, month = 1, day = 1] = isoDate.split('-').map(Number);
|
|
58
|
+
return new Date(year, month - 1, day, NOON);
|
|
59
|
+
};
|
|
60
|
+
const runAuthFlow = (runtime, flow) => bindAuthRunEffects(runtime.authRunEffects)(flow);
|
|
61
|
+
// A loop, not `runEffectsSequence`: the plan stops at the first failed step (every later step builds on the earlier
|
|
62
|
+
// ones), whereas `runEffectsSequence` carries on past a failed line.
|
|
63
|
+
const runPlan = async (scoped, plan, clock, today) => {
|
|
64
|
+
for (const step of plan) {
|
|
65
|
+
clock.now = noonOf(clockDateOf(step, today));
|
|
66
|
+
const result = await runStep(scoped, step);
|
|
67
|
+
if (result.isErr())
|
|
68
|
+
return err(failedStep(step, result.error));
|
|
69
|
+
}
|
|
70
|
+
return ok(undefined);
|
|
71
|
+
};
|
|
72
|
+
export const seedDemo = async (db, options) => {
|
|
73
|
+
const clock = { now: options.today };
|
|
74
|
+
const runtime = createRuntime(db, { ...options.config, PATTY_LOCALE: undefined }, { clock: () => clock.now });
|
|
75
|
+
const scoped = scopedFor(runtime, OWNER_PRINCIPAL);
|
|
76
|
+
const instanceSettings = instanceSettingsRepo(db);
|
|
77
|
+
const start = await demoSeedStatus({ instance: scoped.deps.instance, instanceSettings });
|
|
78
|
+
if (start !== DEMO_SEED_FRESH)
|
|
79
|
+
return ok({ status: start, steps: {} });
|
|
80
|
+
const marked = await runAuthFlow(runtime, () => markDemoInstance({ instanceSettings }));
|
|
81
|
+
if (marked.isErr())
|
|
82
|
+
return err(marked.error);
|
|
83
|
+
const today = toIsoDate(options.today);
|
|
84
|
+
const plan = planDemo(DEMO_PACKS[options.country], today, options.today.toISOString());
|
|
85
|
+
const ran = await runPlan(scoped, plan, clock, today);
|
|
86
|
+
if (ran.isErr())
|
|
87
|
+
return err(ran.error);
|
|
88
|
+
const completed = await runAuthFlow(runtime, () => completeDemoSeed({ instanceSettings }, options.today.toISOString(), options.country));
|
|
89
|
+
if (completed.isErr())
|
|
90
|
+
return err(completed.error);
|
|
91
|
+
return ok({ status: DemoSeedStatus.enum.seeded, steps: R.countBy(plan, (step) => step.kind) });
|
|
92
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { err, ok } from 'neverthrow';
|
|
2
|
+
import { demoConfig, DEMO_DB_PATH, loadConfig, osLocale } from '../../config.js';
|
|
3
|
+
import { formatAppError } from '../../common/errors.js';
|
|
4
|
+
import { isPortInUse } from '../../common/net.js';
|
|
5
|
+
import { bootstrap } from '../../diplomat/db/bootstrap.js';
|
|
6
|
+
import { acquireDatabaseLock, canonicalPath, databaseExists, isSymlink, probeDatabase, removeDatabaseFiles, } from '../../diplomat/db/database-files.js';
|
|
7
|
+
import { closeDatabase, openDatabaseWithKey } from '../../diplomat/db/driver.js';
|
|
8
|
+
import { resolveDemoCountry } from '../../logic/demo/plan.js';
|
|
9
|
+
import { failureOfSeedStatus, planDemoDatabase, refusalWithoutProbe } from '../../logic/demo/database.js';
|
|
10
|
+
import { startupRefusalMessage } from '../../models/startup.js';
|
|
11
|
+
import { DEMO_DB_KEY, DemoFailureCode, demoFailures, } from '../../models/demo/core.js';
|
|
12
|
+
import { seedDemo } from './seed.js';
|
|
13
|
+
import { loadHttpModule } from '../lazy-modules.js';
|
|
14
|
+
const seedFailure = (reason) => demoFailures.of(DemoFailureCode.enum.seed_failed, reason);
|
|
15
|
+
const locateDatabase = (databasePath, realDatabasePath) => {
|
|
16
|
+
const demo = canonicalPath(databasePath);
|
|
17
|
+
const real = canonicalPath(realDatabasePath);
|
|
18
|
+
return { isRealDatabase: demo === null || real === null || demo === real, isAlias: isSymlink(databasePath) };
|
|
19
|
+
};
|
|
20
|
+
const lookAtDatabase = async (databasePath, location, reset) => ({
|
|
21
|
+
...location,
|
|
22
|
+
reset,
|
|
23
|
+
...(await probeDatabase(databasePath)),
|
|
24
|
+
});
|
|
25
|
+
const seedDatabase = async ({ seed, databasePath, country, today }) => {
|
|
26
|
+
const db = await openDatabaseWithKey({ DB_PATH: databasePath }, DEMO_DB_KEY);
|
|
27
|
+
try {
|
|
28
|
+
const bootstrapped = await bootstrap(db);
|
|
29
|
+
if (bootstrapped.isErr())
|
|
30
|
+
return err(seedFailure(startupRefusalMessage(bootstrapped.error)));
|
|
31
|
+
const seeded = await seed(db, { country, today, config: demoConfig(databasePath) });
|
|
32
|
+
return seeded.map((report) => report.status).mapErr((error) => seedFailure(formatAppError(error)));
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
closeDatabase(db);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/** A database this run created is removed if its seed fails; one that was already there is not ours to delete. */
|
|
39
|
+
const seedOrClean = async (run, createdHere) => {
|
|
40
|
+
try {
|
|
41
|
+
const seeded = await seedDatabase(run);
|
|
42
|
+
if (seeded.isErr() && createdHere)
|
|
43
|
+
removeDatabaseFiles(run.databasePath);
|
|
44
|
+
return seeded;
|
|
45
|
+
}
|
|
46
|
+
catch (cause) {
|
|
47
|
+
if (createdHere)
|
|
48
|
+
removeDatabaseFiles(run.databasePath);
|
|
49
|
+
throw cause;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const prepareLocked = async (context, location, request) => {
|
|
53
|
+
const { databasePath, seed } = context;
|
|
54
|
+
const plan = planDemoDatabase(await lookAtDatabase(databasePath, location, request.reset));
|
|
55
|
+
if (plan.isErr())
|
|
56
|
+
return err(demoFailures.of(plan.error));
|
|
57
|
+
if (plan.value.deleteFirst)
|
|
58
|
+
removeDatabaseFiles(databasePath);
|
|
59
|
+
const country = request.country ?? resolveDemoCountry(osLocale());
|
|
60
|
+
const status = await seedOrClean({ seed, databasePath, country, today: context.today() }, plan.value.createdHere);
|
|
61
|
+
return status.andThen((seeded) => {
|
|
62
|
+
const failure = failureOfSeedStatus(seeded);
|
|
63
|
+
return failure === null ? ok({ status: seeded, databasePath, country }) : err(demoFailures.of(failure));
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const prepareDemo = async (context, request) => {
|
|
67
|
+
const { databasePath } = context;
|
|
68
|
+
const location = locateDatabase(databasePath, context.realDatabasePath());
|
|
69
|
+
const early = refusalWithoutProbe(location);
|
|
70
|
+
if (early !== null)
|
|
71
|
+
return err(demoFailures.of(early));
|
|
72
|
+
const lock = await acquireDatabaseLock(databasePath);
|
|
73
|
+
if (lock === null)
|
|
74
|
+
return err(demoFailures.of(DemoFailureCode.enum.busy));
|
|
75
|
+
try {
|
|
76
|
+
return await prepareLocked(context, location, request);
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
await lock.release();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const serveDemo = async (databasePath) => {
|
|
83
|
+
try {
|
|
84
|
+
const { runHttp } = await loadHttpModule();
|
|
85
|
+
const started = await runHttp(demoConfig(databasePath));
|
|
86
|
+
return started.mapErr((refusal) => demoFailures.of(DemoFailureCode.enum.start_failed, startupRefusalMessage(refusal)));
|
|
87
|
+
}
|
|
88
|
+
catch (cause) {
|
|
89
|
+
if (isPortInUse(cause))
|
|
90
|
+
return err(demoFailures.of(DemoFailureCode.enum.port_in_use));
|
|
91
|
+
throw cause;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
export const createDemoShell = (options = {}) => {
|
|
95
|
+
const context = {
|
|
96
|
+
databasePath: options.databasePath ?? DEMO_DB_PATH,
|
|
97
|
+
realDatabasePath: options.realDatabasePath ?? (() => loadConfig().DB_PATH),
|
|
98
|
+
today: options.today ?? (() => new Date()),
|
|
99
|
+
seed: options.seed ?? seedDemo,
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
databasePath: context.databasePath,
|
|
103
|
+
hasDatabase: () => databaseExists(context.databasePath),
|
|
104
|
+
prepare: (request) => prepareDemo(context, request),
|
|
105
|
+
serve: () => serveDemo(context.databasePath),
|
|
106
|
+
};
|
|
107
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { existsSync, rmSync } from 'node:fs';
|
|
2
|
+
import { sql } from 'drizzle-orm';
|
|
3
|
+
import { err, ok } from 'neverthrow';
|
|
4
|
+
import { loadCredentialsModule } from './auth.js';
|
|
5
|
+
import { loadConfig } from '../config.js';
|
|
6
|
+
import { closeDatabase, openDatabaseWithKey, resolveEncryptionKey } from '../diplomat/db/driver.js';
|
|
7
|
+
import { countSnapshotRows } from '../diplomat/db/export.js';
|
|
8
|
+
import { usersRepo } from '../diplomat/db/repos/users.js';
|
|
9
|
+
import { snapshotTo } from '../diplomat/db/safety-copy.js';
|
|
10
|
+
import { reasonOf } from '../models/error.js';
|
|
11
|
+
import { FILE_EXISTS_CODE } from '../models/export.js';
|
|
12
|
+
const missingDatabase = (file) => `there is no database at ${file}`;
|
|
13
|
+
/** The database opened with its key and read once: a wrong key fails on that first read, never on a later write.
|
|
14
|
+
* A missing file fails before the key is resolved, so a keychain with no entry is not given a key for nothing. */
|
|
15
|
+
const openKeyed = async () => {
|
|
16
|
+
const config = loadConfig();
|
|
17
|
+
if (!existsSync(config.DB_PATH))
|
|
18
|
+
return err(missingDatabase(config.DB_PATH));
|
|
19
|
+
try {
|
|
20
|
+
const key = await resolveEncryptionKey(config);
|
|
21
|
+
const db = await openDatabaseWithKey(config, key);
|
|
22
|
+
try {
|
|
23
|
+
await db.run(sql `SELECT count(*) FROM sqlite_master`);
|
|
24
|
+
}
|
|
25
|
+
catch (cause) {
|
|
26
|
+
closeDatabase(db);
|
|
27
|
+
throw cause;
|
|
28
|
+
}
|
|
29
|
+
return ok({ key, db });
|
|
30
|
+
}
|
|
31
|
+
catch (cause) {
|
|
32
|
+
return err(reasonOf(cause));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/** Nothing is left behind by a snapshot that failed — except a file that was there before we asked (`wx` refused it),
|
|
36
|
+
* which is not ours to remove. */
|
|
37
|
+
const snapshotAndCount = async ({ key, db }, destination) => {
|
|
38
|
+
try {
|
|
39
|
+
await snapshotTo(db, destination);
|
|
40
|
+
return await countSnapshotRows(destination, key);
|
|
41
|
+
}
|
|
42
|
+
catch (cause) {
|
|
43
|
+
if (cause.code !== FILE_EXISTS_CODE)
|
|
44
|
+
rmSync(destination, { force: true });
|
|
45
|
+
throw cause;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/** Reads the users of the database as it is — no migration, so a database a newer build has not migrated yet fails
|
|
49
|
+
* here (a missing column) and the person is told to start the server once, not upgraded behind their back. */
|
|
50
|
+
const readUsers = async () => {
|
|
51
|
+
const opened = await openKeyed();
|
|
52
|
+
if (opened.isErr())
|
|
53
|
+
return err(opened.error);
|
|
54
|
+
try {
|
|
55
|
+
return ok(await usersRepo(opened.value.db).listAll());
|
|
56
|
+
}
|
|
57
|
+
catch (cause) {
|
|
58
|
+
return err(reasonOf(cause));
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
closeDatabase(opened.value.db);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export const createExporter = () => ({
|
|
65
|
+
databasePath: () => loadConfig().DB_PATH,
|
|
66
|
+
provenKey: async () => {
|
|
67
|
+
const opened = await openKeyed();
|
|
68
|
+
if (opened.isErr())
|
|
69
|
+
return err(opened.error);
|
|
70
|
+
closeDatabase(opened.value.db);
|
|
71
|
+
return ok(opened.value.key);
|
|
72
|
+
},
|
|
73
|
+
users: readUsers,
|
|
74
|
+
stepUpSecrets: async () => (await loadCredentialsModule()).createSecrets(),
|
|
75
|
+
writeSnapshot: async (destination) => {
|
|
76
|
+
const opened = await openKeyed();
|
|
77
|
+
if (opened.isErr())
|
|
78
|
+
return err(opened.error);
|
|
79
|
+
try {
|
|
80
|
+
return ok(await snapshotAndCount(opened.value, destination));
|
|
81
|
+
}
|
|
82
|
+
catch (cause) {
|
|
83
|
+
return err(reasonOf(cause));
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
closeDatabase(opened.value.db);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { ok, safeTry } from 'neverthrow';
|
|
2
|
+
import Fastify from 'fastify';
|
|
3
|
+
import { version } from '../common/build-version.js';
|
|
4
|
+
import { boot } from './boot.js';
|
|
5
|
+
import { DASHBOARD_PATH, httpOrigin, isPortInUse, LOOPBACK_HOST, portInUseReason } from '../common/net.js';
|
|
6
|
+
import { DISABLED_AUTH } from '../diplomat/http/context.js';
|
|
7
|
+
import { redactSecretQuery } from '../logic/auth/redact.js';
|
|
8
|
+
import { AuthMode } from '../models/auth/mode.js';
|
|
9
|
+
import { registerAuthHook } from '../diplomat/http/hooks/auth.js';
|
|
10
|
+
import { registerDemoMarkerHook } from '../diplomat/http/hooks/demo-marker.js';
|
|
11
|
+
import { registerRoutes } from '../diplomat/http/routes.js';
|
|
12
|
+
import { registerMcpRoute } from '../diplomat/mcp/route.js';
|
|
13
|
+
import { LOG_PREFIX } from '../models/package.js';
|
|
14
|
+
// Cookies and bearer credentials must never reach a log line (ADR-033 §2), whatever a serializer adds.
|
|
15
|
+
const REDACTED_LOG_PATHS = ['req.headers.cookie', 'req.headers.authorization', 'res.headers["set-cookie"]'];
|
|
16
|
+
const LOG_CENSOR = '[Redacted]';
|
|
17
|
+
// Fastify's own `req` serializer, except that a secret in the query string (an invite code in
|
|
18
|
+
// `/ui/access/invite?code=…`) is replaced: redaction paths cannot reach inside a URL.
|
|
19
|
+
const requestForLog = (req) => ({
|
|
20
|
+
method: req.method,
|
|
21
|
+
url: redactSecretQuery(req.url),
|
|
22
|
+
version: String(req.headers['accept-version'] ?? '') || undefined,
|
|
23
|
+
host: req.host,
|
|
24
|
+
remoteAddress: req.ip,
|
|
25
|
+
remotePort: req.socket?.remotePort,
|
|
26
|
+
});
|
|
27
|
+
export const httpLoggerOptions = (enabled) => enabled ? { redact: { paths: REDACTED_LOG_PATHS, censor: LOG_CENSOR }, serializers: { req: requestForLog } } : false;
|
|
28
|
+
/**
|
|
29
|
+
* Composition root for the HTTP surface (REST + streamable-HTTP MCP): wires the two
|
|
30
|
+
* diplomat edges onto one Fastify instance. Lives outside diplomat/http and diplomat/mcp
|
|
31
|
+
* so neither edge depends on the other (docs/architecture.md dependency table) — only the
|
|
32
|
+
* composition root is allowed to know about both.
|
|
33
|
+
*/
|
|
34
|
+
export const buildHttpApp = (surface, version, opts) => {
|
|
35
|
+
// ADR-027 Phase 3: GET /ui/events is a genuinely long-lived connection (SSE) — without this,
|
|
36
|
+
// fastify.close() waits for it to end on its own, which it never does, hanging shutdown for as
|
|
37
|
+
// long as any browser tab has a dashboard open.
|
|
38
|
+
const app = Fastify({
|
|
39
|
+
logger: httpLoggerOptions(opts?.logger ?? true),
|
|
40
|
+
trustProxy: opts?.trustProxy,
|
|
41
|
+
forceCloseConnections: true,
|
|
42
|
+
});
|
|
43
|
+
registerHttpApp(app, surface, version, opts?.auth);
|
|
44
|
+
return app;
|
|
45
|
+
};
|
|
46
|
+
/** Everything `buildHttpApp` adds to a bare Fastify instance, in the one order that matters: the auth hook
|
|
47
|
+
* first, so it guards every route registered after it (and any request no route matches). Exported so a
|
|
48
|
+
* test can attach an `onRoute` listener to the instance before the routes exist. */
|
|
49
|
+
export const registerHttpApp = (app, surface, version, auth = DISABLED_AUTH) => {
|
|
50
|
+
// Ordering is wiring: the auth hook goes on first, so it runs ahead of every route registered below and
|
|
51
|
+
// also guards a request no route matches.
|
|
52
|
+
registerAuthHook(app, auth);
|
|
53
|
+
registerDemoMarkerHook(app, surface);
|
|
54
|
+
registerRoutes(app, { ...surface, version }, surface.changeBus.subscribe, auth);
|
|
55
|
+
registerMcpRoute(app, surface, version, auth.mode === AuthMode.enum.required ? auth.publicUrl : undefined);
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Best-effort HTTP sidecar alongside stdio MCP (ADR-013 Decision 7). A bind failure is
|
|
59
|
+
* caught here and never propagates: the stdio MCP connection this runs beside is the
|
|
60
|
+
* resilient primary and must keep working even when the port is taken. All output goes to
|
|
61
|
+
* stderr — stdout carries the MCP protocol in stdio mode (ADR-007) — and the Fastify
|
|
62
|
+
* request logger is disabled for the same reason.
|
|
63
|
+
*/
|
|
64
|
+
export const startHttpSidecar = async (surface, version, port, host = LOOPBACK_HOST, opts) => {
|
|
65
|
+
const app = buildHttpApp(surface, version, { ...opts, logger: false });
|
|
66
|
+
try {
|
|
67
|
+
await app.listen({ port, host });
|
|
68
|
+
// `port` may be 0 (OS-assigned); read back the address actually bound for the banner.
|
|
69
|
+
const boundPort = app.server.address().port;
|
|
70
|
+
const origin = httpOrigin(host, boundPort);
|
|
71
|
+
console.error(`${LOG_PREFIX} HTTP sidecar up — REST ${origin}/api · MCP ${origin}/mcp · dashboard ${origin}${DASHBOARD_PATH}`);
|
|
72
|
+
return { app, listening: true };
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
const reason = isPortInUse(e) ? portInUseReason(port) : String(e);
|
|
76
|
+
console.error(`${LOG_PREFIX} HTTP sidecar disabled — ${reason}. Dashboards/REST are unavailable this run; MCP over stdio ` +
|
|
77
|
+
`keeps working. Free the port (or set PORT=<other> and restart) to enable it.`);
|
|
78
|
+
return { app, listening: false };
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* The pure-HTTP start (`MCP_TRANSPORT=http`): Fastify with REST + streamable HTTP MCP. Unlike the sidecar, this is the
|
|
83
|
+
* only surface running — a bind failure here is fatal by design (there is no stdio fallback to keep the process alive),
|
|
84
|
+
* handled by the entrypoint.
|
|
85
|
+
*/
|
|
86
|
+
export const runHttp = (config) => safeTry(async function* () {
|
|
87
|
+
const { runtime, prepared } = yield* boot(config);
|
|
88
|
+
const app = buildHttpApp(runtime, version, { auth: prepared.auth, trustProxy: config.TRUST_PROXY });
|
|
89
|
+
// A repeated signal (or SIGINT followed by SIGTERM) must not double-close/double-exit.
|
|
90
|
+
let shuttingDown = false;
|
|
91
|
+
const shutdown = () => {
|
|
92
|
+
if (shuttingDown)
|
|
93
|
+
return;
|
|
94
|
+
shuttingDown = true;
|
|
95
|
+
app
|
|
96
|
+
.close()
|
|
97
|
+
.catch((err) => app.log.error(err))
|
|
98
|
+
.finally(() => process.exit(0));
|
|
99
|
+
};
|
|
100
|
+
process.on('SIGINT', shutdown);
|
|
101
|
+
process.on('SIGTERM', shutdown);
|
|
102
|
+
await app.listen({ port: config.PORT, host: config.HOST });
|
|
103
|
+
// config.PORT may be 0 (OS-assigned); read back the address actually bound for the banner.
|
|
104
|
+
const boundPort = app.server.address().port;
|
|
105
|
+
const origin = httpOrigin(config.HOST, boundPort);
|
|
106
|
+
// eslint-disable-next-line no-console -- HTTP-mode banner; stdout safe.
|
|
107
|
+
console.log(`${LOG_PREFIX} REST ${origin}/api · MCP ${origin}/mcp`);
|
|
108
|
+
await prepared.issueAndAnnounceSetup(origin);
|
|
109
|
+
return ok(undefined);
|
|
110
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { err, ok } from 'neverthrow';
|
|
3
|
+
import { loadConfig } from '../config.js';
|
|
4
|
+
import { CLI_MESSAGES } from '../diplomat/cli/messages.js';
|
|
5
|
+
import { countRowsOnCopy, discardStaged, hasDataBearingCompanion, publishStaged, stagePrivateCopy, } from '../diplomat/db/database-files.js';
|
|
6
|
+
import { findEncryptionKey, keychainHoldsKey, storeKeychainKeyIfAbsent } from '../diplomat/db/driver.js';
|
|
7
|
+
import { reasonOf } from '../models/error.js';
|
|
8
|
+
import { KeyImportRefusal } from '../models/key-import.js';
|
|
9
|
+
const attempt = async (work, failure) => {
|
|
10
|
+
try {
|
|
11
|
+
return ok(await work());
|
|
12
|
+
}
|
|
13
|
+
catch (cause) {
|
|
14
|
+
return err(failure(cause));
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const refuseStaged = (staged, snapshot) => {
|
|
18
|
+
discardStaged(staged);
|
|
19
|
+
return err(CLI_MESSAGES.snapshotNotStandalone(snapshot));
|
|
20
|
+
};
|
|
21
|
+
const readKeySources = async () => {
|
|
22
|
+
const config = loadConfig();
|
|
23
|
+
const keyFileConfigured = Boolean(config.PATTY_DB_KEY_FILE);
|
|
24
|
+
const keyEnvConfigured = Boolean(config.PATTY_DB_KEY);
|
|
25
|
+
return {
|
|
26
|
+
keyFileConfigured,
|
|
27
|
+
keyEnvConfigured,
|
|
28
|
+
keychainHoldsKey: keyFileConfigured || keyEnvConfigured ? false : await keychainHoldsKey(),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export const createImporter = () => ({
|
|
32
|
+
databasePath: () => loadConfig().DB_PATH,
|
|
33
|
+
keySources: () => attempt(readKeySources, reasonOf),
|
|
34
|
+
proveAgainstDatabase: (key) => {
|
|
35
|
+
const { DB_PATH } = loadConfig();
|
|
36
|
+
if (!existsSync(DB_PATH))
|
|
37
|
+
return Promise.resolve(ok(undefined));
|
|
38
|
+
return attempt(async () => void (await countRowsOnCopy(DB_PATH, key)), () => CLI_MESSAGES.keyDoesNotOpenDatabase(DB_PATH));
|
|
39
|
+
},
|
|
40
|
+
storeKey: async (key) => {
|
|
41
|
+
const stored = await attempt(() => storeKeychainKeyIfAbsent(key, loadConfig().KEY_LOCK_PATH), reasonOf);
|
|
42
|
+
return stored.andThen((written) => written ? ok(undefined) : err(CLI_MESSAGES.keyImportRefused(KeyImportRefusal.enum.keychain_holds_key)));
|
|
43
|
+
},
|
|
44
|
+
resolveKey: async () => {
|
|
45
|
+
const found = await attempt(() => findEncryptionKey(loadConfig()), reasonOf);
|
|
46
|
+
return found.andThen((key) => (key === null ? err(CLI_MESSAGES.noKeyToImport) : ok(key)));
|
|
47
|
+
},
|
|
48
|
+
inspectSnapshot: (staged, key) => attempt(() => countRowsOnCopy(staged.path, key), () => CLI_MESSAGES.keyDoesNotOpenSnapshot(staged.source)),
|
|
49
|
+
stageSnapshot: async (snapshot) => {
|
|
50
|
+
const staged = await attempt(() => stagePrivateCopy(snapshot, loadConfig().DB_PATH), reasonOf);
|
|
51
|
+
return staged.andThen((copy) => (hasDataBearingCompanion(snapshot) ? refuseStaged(copy, snapshot) : ok(copy)));
|
|
52
|
+
},
|
|
53
|
+
publishSnapshot: (staged) => attempt(() => publishStaged(staged, loadConfig().DB_PATH), reasonOf),
|
|
54
|
+
discardSnapshot: discardStaged,
|
|
55
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { createChangeBus, runEffects, runEffectsSequence } from '@rfc0/effect-runner';
|
|
3
|
+
import { AUTH_APPLIERS } from './auth.js';
|
|
4
|
+
import { createEngineContext } from '../diplomat/db/engine.js';
|
|
5
|
+
import { createLocaleResolver } from '../diplomat/db/locale-cache.js';
|
|
6
|
+
import { accountApplier, accountsRepo } from '../diplomat/db/repos/accounts.js';
|
|
7
|
+
import { billApplier, billsRepo } from '../diplomat/db/repos/bills.js';
|
|
8
|
+
import { budgetApplier, budgetsRepo } from '../diplomat/db/repos/budgets.js';
|
|
9
|
+
import { categoriesRepo, categoryApplier } from '../diplomat/db/repos/categories.js';
|
|
10
|
+
import { correlationsRepo } from '../diplomat/db/repos/correlations.js';
|
|
11
|
+
import { creditCardApplier, creditCardsRepo } from '../diplomat/db/repos/credit-cards.js';
|
|
12
|
+
import { currenciesRepo } from '../diplomat/db/repos/currencies.js';
|
|
13
|
+
import { currencyRateApplier, currencyRatesRepo } from '../diplomat/db/repos/currency-rates.js';
|
|
14
|
+
import { dashboardApplier, dashboardsRepo } from '../diplomat/db/repos/dashboards.js';
|
|
15
|
+
import { healthRepo } from '../diplomat/db/repos/health.js';
|
|
16
|
+
import { instanceRepo } from '../diplomat/db/repos/instance.js';
|
|
17
|
+
import { merchantApplier, merchantCategoryApplier, merchantsRepo } from '../diplomat/db/repos/merchants.js';
|
|
18
|
+
import { recurringRepo, recurringRuleApplier } from '../diplomat/db/repos/recurring.js';
|
|
19
|
+
import { settingsRepo, userSettingsApplier } from '../diplomat/db/repos/settings.js';
|
|
20
|
+
import { subCategoriesRepo } from '../diplomat/db/repos/sub-categories.js';
|
|
21
|
+
import { tagApplier, tagsRepo } from '../diplomat/db/repos/tags.js';
|
|
22
|
+
import { transactionApplier, transactionsRepo } from '../diplomat/db/repos/transactions.js';
|
|
23
|
+
import { transactionTagApplier } from '../diplomat/db/repos/transaction-tags.js';
|
|
24
|
+
import { ACCOUNT_ENTITY_TAG } from '../models/account.js';
|
|
25
|
+
import { BILL_ENTITY_TAG } from '../models/bill.js';
|
|
26
|
+
import { BUDGET_ENTITY_TAG } from '../models/budget.js';
|
|
27
|
+
import { CATEGORY_ENTITY_TAG } from '../models/category.js';
|
|
28
|
+
import { CREDIT_CARD_ENTITY_TAG } from '../models/credit-card.js';
|
|
29
|
+
import { CURRENCY_RATE_ENTITY_TAG } from '../models/currency-rate.js';
|
|
30
|
+
import { DASHBOARD_ENTITY_TAG } from '../models/dashboard.js';
|
|
31
|
+
import { USER_SETTINGS_ENTITY_TAG } from '../models/locale.js';
|
|
32
|
+
import { MERCHANT_CATEGORY_ENTITY_TAG, MERCHANT_ENTITY_TAG } from '../models/merchant.js';
|
|
33
|
+
import { RECURRING_ENTITY_TAG } from '../models/recurring.js';
|
|
34
|
+
import { TAG_ENTITY_TAG } from '../models/tag.js';
|
|
35
|
+
import { TRANSACTION_ENTITY_TAG } from '../models/transaction.js';
|
|
36
|
+
import { TRANSACTION_TAG_ENTITY_TAG } from '../models/transaction-tag.js';
|
|
37
|
+
const reportChangeError = (cause) => {
|
|
38
|
+
console.error('[patty] change notification failed:', cause);
|
|
39
|
+
};
|
|
40
|
+
const applierRegistryFor = (userId) => ({
|
|
41
|
+
[ACCOUNT_ENTITY_TAG]: accountApplier(userId),
|
|
42
|
+
[TRANSACTION_ENTITY_TAG]: transactionApplier(userId),
|
|
43
|
+
[TRANSACTION_TAG_ENTITY_TAG]: transactionTagApplier(userId),
|
|
44
|
+
[MERCHANT_ENTITY_TAG]: merchantApplier,
|
|
45
|
+
[MERCHANT_CATEGORY_ENTITY_TAG]: merchantCategoryApplier(userId),
|
|
46
|
+
[BILL_ENTITY_TAG]: billApplier(userId),
|
|
47
|
+
[BUDGET_ENTITY_TAG]: budgetApplier(userId),
|
|
48
|
+
[TAG_ENTITY_TAG]: tagApplier(userId),
|
|
49
|
+
[CATEGORY_ENTITY_TAG]: categoryApplier(userId),
|
|
50
|
+
[CREDIT_CARD_ENTITY_TAG]: creditCardApplier(userId),
|
|
51
|
+
[CURRENCY_RATE_ENTITY_TAG]: currencyRateApplier,
|
|
52
|
+
[RECURRING_ENTITY_TAG]: recurringRuleApplier(userId),
|
|
53
|
+
[DASHBOARD_ENTITY_TAG]: dashboardApplier(userId),
|
|
54
|
+
[USER_SETTINGS_ENTITY_TAG]: userSettingsApplier(userId),
|
|
55
|
+
});
|
|
56
|
+
const reposFor = (db, userId) => ({
|
|
57
|
+
accounts: accountsRepo(db, userId),
|
|
58
|
+
bills: billsRepo(db, userId),
|
|
59
|
+
budgets: budgetsRepo(db, userId),
|
|
60
|
+
categories: categoriesRepo(db, userId),
|
|
61
|
+
subCategories: subCategoriesRepo(db, userId),
|
|
62
|
+
correlations: correlationsRepo(db, userId),
|
|
63
|
+
creditCards: creditCardsRepo(db, userId),
|
|
64
|
+
dashboards: dashboardsRepo(db, userId),
|
|
65
|
+
merchants: merchantsRepo(db, userId),
|
|
66
|
+
recurring: recurringRepo(db, userId),
|
|
67
|
+
tags: tagsRepo(db, userId),
|
|
68
|
+
transactions: transactionsRepo(db, userId),
|
|
69
|
+
});
|
|
70
|
+
const publishOn = (changeBus) => (userId) => (entities) => changeBus.publish({ userId, entities });
|
|
71
|
+
const runnersOn = (engineContext, changeBus) => {
|
|
72
|
+
const publishFor = publishOn(changeBus);
|
|
73
|
+
return {
|
|
74
|
+
runEffectsFor: ({ userId }) => {
|
|
75
|
+
const registry = applierRegistryFor(userId);
|
|
76
|
+
return (flow) => runEffects(engineContext, registry, flow, publishFor(userId));
|
|
77
|
+
},
|
|
78
|
+
runEffectsSequenceFor: ({ userId }) => {
|
|
79
|
+
const registry = applierRegistryFor(userId);
|
|
80
|
+
return (items, flowFor) => runEffectsSequence(engineContext, registry, items, flowFor, publishFor(userId));
|
|
81
|
+
},
|
|
82
|
+
authRunEffects: (flow) => runEffects(engineContext, AUTH_APPLIERS, flow, publishFor(null)),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export const createRuntime = (db, config, options = {}) => {
|
|
86
|
+
const onChangeError = options.onChangeError ?? reportChangeError;
|
|
87
|
+
const localeResolver = createLocaleResolver(config.PATTY_LOCALE);
|
|
88
|
+
const changeBus = createChangeBus({ onError: onChangeError });
|
|
89
|
+
const health = healthRepo(db);
|
|
90
|
+
const instance = instanceRepo(db);
|
|
91
|
+
const depsFor = ({ userId }) => {
|
|
92
|
+
const settings = settingsRepo(db, userId);
|
|
93
|
+
return {
|
|
94
|
+
...reposFor(db, userId),
|
|
95
|
+
currencies: currenciesRepo(db),
|
|
96
|
+
currencyRates: currencyRatesRepo(db),
|
|
97
|
+
health,
|
|
98
|
+
instance,
|
|
99
|
+
settings,
|
|
100
|
+
clock: options.clock ?? (() => new Date()),
|
|
101
|
+
newId: () => randomUUID(),
|
|
102
|
+
locale: () => localeResolver.locale(userId, settings),
|
|
103
|
+
rateStaleness: { fiatHours: config.FIAT_RATE_STALE_HOURS, cryptoHours: config.CRYPTO_RATE_STALE_HOURS },
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
publicDeps: { health },
|
|
108
|
+
instanceKind: instance.kind,
|
|
109
|
+
instanceLocale: instance.locale,
|
|
110
|
+
depsFor,
|
|
111
|
+
...runnersOn(createEngineContext(db, onChangeError), changeBus),
|
|
112
|
+
resetLocaleFor: ({ userId }) => localeResolver.resetLocale(userId),
|
|
113
|
+
changeBus,
|
|
114
|
+
};
|
|
115
|
+
};
|