@rfc0/patty 0.0.0-stage → 1.0.0
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 +493 -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 +1716 -0
- package/ui/dashboards/cards.html +4032 -0
- package/ui/dashboards/categories.html +4694 -0
- package/ui/dashboards/comparative.html +2464 -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 +2517 -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,44 @@
|
|
|
1
|
+
import * as R from 'remeda';
|
|
2
|
+
export const fold = (s) => s
|
|
3
|
+
.toLowerCase()
|
|
4
|
+
.normalize('NFD')
|
|
5
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
6
|
+
.trim();
|
|
7
|
+
const toResolution = (matches, query, allCandidates) => {
|
|
8
|
+
const single = R.first(matches);
|
|
9
|
+
if (single && matches.length === 1)
|
|
10
|
+
return { kind: 'found', entity: single };
|
|
11
|
+
if (matches.length > 1)
|
|
12
|
+
return { kind: 'ambiguous', query, candidates: R.map(matches, (e) => e.name) };
|
|
13
|
+
return { kind: 'none', query, candidates: R.map(allCandidates, (e) => e.name) };
|
|
14
|
+
};
|
|
15
|
+
export const resolveByName = (entities, query) => {
|
|
16
|
+
const q = fold(query);
|
|
17
|
+
const exact = entities.filter((e) => fold(e.name) === q);
|
|
18
|
+
const exactResult = toResolution(exact, query, entities);
|
|
19
|
+
if (exactResult.kind !== 'none')
|
|
20
|
+
return exactResult;
|
|
21
|
+
const partial = entities.filter((e) => {
|
|
22
|
+
const fn = fold(e.name);
|
|
23
|
+
return fn.includes(q) || q.includes(fn);
|
|
24
|
+
});
|
|
25
|
+
return toResolution(partial, query, entities);
|
|
26
|
+
};
|
|
27
|
+
export const resolveByNames = (entities, query, synonyms) => {
|
|
28
|
+
const primary = resolveByName(entities, query);
|
|
29
|
+
if (primary.kind !== 'none')
|
|
30
|
+
return primary;
|
|
31
|
+
const q = fold(query);
|
|
32
|
+
const withFolded = R.map(entities, (e) => ({ entity: e, folded: R.map(synonyms(e), fold) }));
|
|
33
|
+
const exactMatches = withFolded.filter(({ folded }) => folded.some((fs) => fs === q)).map(({ entity }) => entity);
|
|
34
|
+
const exactResult = toResolution(exactMatches, query, entities);
|
|
35
|
+
if (exactResult.kind !== 'none')
|
|
36
|
+
return exactResult;
|
|
37
|
+
const partialMatches = withFolded
|
|
38
|
+
.filter(({ folded }) => folded.some((fs) => fs.includes(q) || q.includes(fs)))
|
|
39
|
+
.map(({ entity }) => entity);
|
|
40
|
+
const partialResult = toResolution(partialMatches, query, entities);
|
|
41
|
+
if (partialResult.kind !== 'none')
|
|
42
|
+
return partialResult;
|
|
43
|
+
return primary;
|
|
44
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as R from 'remeda';
|
|
2
|
+
import { purry } from 'remeda';
|
|
3
|
+
import { localizeCategoryName } from './category.js';
|
|
4
|
+
import { roundToDecimals } from './money.js';
|
|
5
|
+
import { TransactionType } from '../models/transaction.js';
|
|
6
|
+
import { uncategorizedLabels } from '../models/aggregate.js';
|
|
7
|
+
const sumOf = (rows, type, decimals) => roundToDecimals(R.pipe(rows, R.filter((r) => r.type === type), R.sumBy((r) => r.total)), decimals);
|
|
8
|
+
const _toCurrencySummary = ([currency, rows], locale, decimalsFor) => {
|
|
9
|
+
const code = currency;
|
|
10
|
+
const decimals = decimalsFor(code);
|
|
11
|
+
const income = sumOf(rows, TransactionType.enum.income, decimals);
|
|
12
|
+
const expenses = sumOf(rows, TransactionType.enum.expense, decimals);
|
|
13
|
+
return {
|
|
14
|
+
currency: code,
|
|
15
|
+
income,
|
|
16
|
+
expenses,
|
|
17
|
+
balance: roundToDecimals(income - expenses, decimals),
|
|
18
|
+
byCategory: R.pipe(rows, R.map((r) => ({
|
|
19
|
+
category: localizeCategoryName(r.category, r.categoryNames, locale) ?? uncategorizedLabels[locale],
|
|
20
|
+
type: r.type,
|
|
21
|
+
total: roundToDecimals(r.total, decimals),
|
|
22
|
+
count: r.count,
|
|
23
|
+
})), R.sortBy([(c) => c.total, 'desc'])),
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
function toCurrencySummary(...args) {
|
|
27
|
+
return purry(_toCurrencySummary, args);
|
|
28
|
+
}
|
|
29
|
+
export const summarize = (rows, locale, decimalsFor) => R.pipe(rows, R.groupBy((r) => r.currency), R.entries(), R.map(toCurrencySummary(locale, decimalsFor)), R.sortBy((s) => s.currency));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as R from 'remeda';
|
|
2
|
+
import { TRANSACTION_TAG_ENTITY_TAG } from '../models/transaction-tag.js';
|
|
3
|
+
import { insert, outcomeFor } from './persistence.js';
|
|
4
|
+
export const resolveTagIds = (names, allTags) => {
|
|
5
|
+
const idByName = new Map(allTags.map((tag) => [tag.name, tag.id]));
|
|
6
|
+
return R.pipe(names, R.unique(), R.map((name) => idByName.get(name)), R.filter(R.isNonNullish));
|
|
7
|
+
};
|
|
8
|
+
export const resolveTagNames = (names, allTags) => {
|
|
9
|
+
const knownNames = new Set(allTags.map((tag) => tag.name));
|
|
10
|
+
return R.pipe(names, R.unique(), R.filter((name) => knownNames.has(name)));
|
|
11
|
+
};
|
|
12
|
+
export const tagSetPersistable = (transactionId, tagIds) => insert({ entity: TRANSACTION_TAG_ENTITY_TAG, model: { transactionId, tagIds } });
|
|
13
|
+
export const overlayResolvedTags = (view, tagNames, outcomes) => (outcomeFor(TRANSACTION_TAG_ENTITY_TAG, outcomes).applied ? { ...view, tags: tagNames } : view);
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { purry } from 'remeda';
|
|
3
|
+
import { IsoDate } from '../models/date.js';
|
|
4
|
+
import { roundToDecimals } from './money.js';
|
|
5
|
+
import { CURSOR_VERSION, decodeCursor, encodeCursor } from '../models/page.js';
|
|
6
|
+
import { ClassificationMethod, transactionErrors, TRANSACTION_ENTITY_TAG, TransactionCursorSchema, TransactionSortField, TransactionStatus, TransactionType, LOW_CONFIDENCE_THRESHOLD, } from '../models/transaction.js';
|
|
7
|
+
import { outcomeFor } from './persistence.js';
|
|
8
|
+
import { CategoryKind } from '../models/category.js';
|
|
9
|
+
import { err, ok } from 'neverthrow';
|
|
10
|
+
import * as R from 'remeda';
|
|
11
|
+
import { localizeCategoryName } from './category.js';
|
|
12
|
+
import { pickClassification, userClassification } from './classify.js';
|
|
13
|
+
import { localizeTransactionStatus, localizeTransactionType } from './localize.js';
|
|
14
|
+
import { normalizeMerchant } from './merchant.js';
|
|
15
|
+
export const defaultStatusFor = (date, today) => date > today ? TransactionStatus.enum.pending : TransactionStatus.enum.effective;
|
|
16
|
+
export const hasCategory = (input) => R.isNonNullish(input.category);
|
|
17
|
+
export const hasSubCategory = (input) => R.isNonNullish(input.subCategory);
|
|
18
|
+
export const assertExclusiveCategorySubCategory = (input) => !(hasCategory(input) && hasSubCategory(input));
|
|
19
|
+
export const isCategoryKindAllowed = (txType, categoryKind) => categoryKind === CategoryKind.enum.both || categoryKind === txType;
|
|
20
|
+
const isValidCursorValue = {
|
|
21
|
+
[TransactionSortField.enum.date]: (value) => typeof value === 'string' && IsoDate.safeParse(value).success,
|
|
22
|
+
[TransactionSortField.enum.amount]: (value) => typeof value === 'number' && Number.isFinite(value),
|
|
23
|
+
};
|
|
24
|
+
export const resolveCursorKey = (input) => {
|
|
25
|
+
if (!input.cursor)
|
|
26
|
+
return ok(null);
|
|
27
|
+
const decoded = decodeCursor(TransactionCursorSchema, input.cursor);
|
|
28
|
+
if (!decoded || decoded.sort !== input.sort || decoded.dir !== input.dir) {
|
|
29
|
+
return err(transactionErrors.invalidCursor);
|
|
30
|
+
}
|
|
31
|
+
if (!isValidCursorValue[decoded.sort](decoded.key.value)) {
|
|
32
|
+
return err(transactionErrors.invalidCursor);
|
|
33
|
+
}
|
|
34
|
+
return ok(decoded.key);
|
|
35
|
+
};
|
|
36
|
+
const CURSOR_VALUE_OF = {
|
|
37
|
+
[TransactionSortField.enum.date]: (row) => row.date,
|
|
38
|
+
[TransactionSortField.enum.amount]: (row) => row.amount,
|
|
39
|
+
};
|
|
40
|
+
export const nextCursorAfter = (lastRow, sort, dir) => encodeCursor({
|
|
41
|
+
v: CURSOR_VERSION,
|
|
42
|
+
sort,
|
|
43
|
+
dir,
|
|
44
|
+
key: { value: CURSOR_VALUE_OF[sort](lastRow), id: lastRow.id },
|
|
45
|
+
});
|
|
46
|
+
export const isTransfer = (t) => t.type === TransactionType.enum.transfer;
|
|
47
|
+
export const resolveEffectiveType = (existing, input) => {
|
|
48
|
+
const resolved = input.type ?? existing.type;
|
|
49
|
+
return resolved !== TransactionType.enum.transfer ? resolved : undefined;
|
|
50
|
+
};
|
|
51
|
+
export const entityFromExisting = (existing) => ({
|
|
52
|
+
id: existing.id,
|
|
53
|
+
description: existing.description,
|
|
54
|
+
amount: existing.amount,
|
|
55
|
+
type: existing.type,
|
|
56
|
+
status: existing.status,
|
|
57
|
+
date: existing.date,
|
|
58
|
+
currency: existing.currency,
|
|
59
|
+
source: existing.source,
|
|
60
|
+
classification: existing.classification,
|
|
61
|
+
rawInput: existing.rawInput,
|
|
62
|
+
note: existing.note,
|
|
63
|
+
refs: {
|
|
64
|
+
accountId: existing.accountId,
|
|
65
|
+
toAccountId: existing.toAccountId,
|
|
66
|
+
cardId: existing.cardId,
|
|
67
|
+
billId: existing.billId,
|
|
68
|
+
categoryId: existing.categoryId,
|
|
69
|
+
subCategoryId: existing.subCategoryId,
|
|
70
|
+
merchantKey: existing.merchant,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
const patchedNote = (note, existing) => note === undefined ? existing : note || undefined;
|
|
74
|
+
const patchedClassification = (existing, selection) => selection ? { method: ClassificationMethod.enum.user, confidence: 1 } : existing.classification;
|
|
75
|
+
const patchedCategoryRefs = (existing, selection) => selection
|
|
76
|
+
? { categoryId: selection.categoryId, subCategoryId: selection.subCategoryId }
|
|
77
|
+
: { categoryId: existing.categoryId, subCategoryId: existing.subCategoryId };
|
|
78
|
+
const patchedFunding = (existing, overrides) => ({
|
|
79
|
+
currency: overrides.account?.currency ?? existing.currency,
|
|
80
|
+
accountId: overrides.account?.id ?? existing.accountId,
|
|
81
|
+
billId: overrides.billId ?? existing.billId,
|
|
82
|
+
});
|
|
83
|
+
export const mergePatch = (existing, input, categorySelection, overrides = {}) => {
|
|
84
|
+
const base = entityFromExisting(existing);
|
|
85
|
+
const { currency, ...fundingRefs } = patchedFunding(existing, overrides);
|
|
86
|
+
return {
|
|
87
|
+
...base,
|
|
88
|
+
description: input.description ?? existing.description,
|
|
89
|
+
amount: input.amount ?? existing.amount,
|
|
90
|
+
type: input.type ?? existing.type,
|
|
91
|
+
date: input.date ?? existing.date,
|
|
92
|
+
currency,
|
|
93
|
+
classification: patchedClassification(existing, categorySelection),
|
|
94
|
+
note: patchedNote(input.note, existing.note),
|
|
95
|
+
refs: { ...base.refs, ...fundingRefs, ...patchedCategoryRefs(existing, categorySelection) },
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
const classifyNew = (selection, candidates) => selection
|
|
99
|
+
? userClassification({ id: selection.categoryId, name: selection.categoryName })
|
|
100
|
+
: pickClassification(candidates);
|
|
101
|
+
const merchantKeyFor = (classification, description, keepsUnmatched) => classification.merchantKey ?? (keepsUnmatched ? normalizeMerchant(description) || undefined : undefined);
|
|
102
|
+
export const planNewTransaction = (facts) => {
|
|
103
|
+
const { input, type, currency, funding } = facts;
|
|
104
|
+
const date = input.date ?? facts.today;
|
|
105
|
+
const classification = classifyNew(facts.categorySelection, facts.candidates);
|
|
106
|
+
const entity = {
|
|
107
|
+
id: facts.id,
|
|
108
|
+
description: input.description,
|
|
109
|
+
amount: input.amount,
|
|
110
|
+
type,
|
|
111
|
+
status: input.status ?? defaultStatusFor(date, facts.today),
|
|
112
|
+
date,
|
|
113
|
+
currency,
|
|
114
|
+
source: facts.source,
|
|
115
|
+
classification,
|
|
116
|
+
rawInput: input.rawInput,
|
|
117
|
+
note: input.note,
|
|
118
|
+
refs: {
|
|
119
|
+
...funding.refs,
|
|
120
|
+
categoryId: classification.categoryId,
|
|
121
|
+
subCategoryId: facts.categorySelection?.subCategoryId,
|
|
122
|
+
merchantKey: merchantKeyFor(classification, input.description, facts.keepsUnmatchedMerchant),
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
const idempotencyKey = deriveIdempotencyKey({
|
|
126
|
+
fundingSourceId: funding.sourceId,
|
|
127
|
+
billPeriodKey: funding.billPeriodKey,
|
|
128
|
+
type,
|
|
129
|
+
currency,
|
|
130
|
+
date,
|
|
131
|
+
description: input.description,
|
|
132
|
+
amount: input.amount,
|
|
133
|
+
}, facts.decimals, input.discriminator);
|
|
134
|
+
return { entity, classification, idempotencyKey };
|
|
135
|
+
};
|
|
136
|
+
export const deriveIdempotencyKey = (identity, decimals, discriminator) => {
|
|
137
|
+
// JSON.stringify, not a joined string: the discriminator is free text and could forge a field boundary.
|
|
138
|
+
const canonical = JSON.stringify([
|
|
139
|
+
identity.fundingSourceId ?? null,
|
|
140
|
+
identity.counterpartyId ?? null,
|
|
141
|
+
identity.billPeriodKey ?? null,
|
|
142
|
+
identity.type,
|
|
143
|
+
identity.currency,
|
|
144
|
+
identity.date,
|
|
145
|
+
normalizeMerchant(identity.description),
|
|
146
|
+
// Rounded first: toFixed alone truncates at a float boundary such as 1.005.
|
|
147
|
+
roundToDecimals(identity.amount, decimals).toFixed(decimals),
|
|
148
|
+
discriminator ?? null,
|
|
149
|
+
]);
|
|
150
|
+
return createHash('sha256').update(canonical).digest('hex');
|
|
151
|
+
};
|
|
152
|
+
export const defaultStatementLines = (today, lines, rawInput) => lines.map((line) => ({ ...line, date: line.date ?? today, rawInput }));
|
|
153
|
+
export const needsReview = (c) => c.method === ClassificationMethod.enum.none || c.confidence < LOW_CONFIDENCE_THRESHOLD;
|
|
154
|
+
export const toBulkItemResult = (result, description) => result.match((r) => !r.created
|
|
155
|
+
? { status: 'duplicate', transaction: r.transaction }
|
|
156
|
+
: {
|
|
157
|
+
status: needsReview(r.classification) ? 'needs_review' : 'created',
|
|
158
|
+
transaction: r.transaction,
|
|
159
|
+
classification: r.classification,
|
|
160
|
+
}, (error) => ({ status: 'error', description, error }));
|
|
161
|
+
export const summarizeBulkItems = (items) => {
|
|
162
|
+
const counts = R.countBy(items, (i) => i.status);
|
|
163
|
+
return {
|
|
164
|
+
created: counts['created'] ?? 0,
|
|
165
|
+
needsReview: counts['needs_review'] ?? 0,
|
|
166
|
+
duplicates: counts['duplicate'] ?? 0,
|
|
167
|
+
errors: counts['error'] ?? 0,
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
const _addLocalizedLabels = (tx, locale) => {
|
|
171
|
+
const { categoryNames, subCategoryNames, version, ...base } = tx;
|
|
172
|
+
return {
|
|
173
|
+
...base,
|
|
174
|
+
typeLabel: localizeTransactionType(tx.type, locale),
|
|
175
|
+
statusLabel: localizeTransactionStatus(tx.status, locale),
|
|
176
|
+
categoryName: localizeCategoryName(tx.categoryName, categoryNames, locale),
|
|
177
|
+
subCategoryName: localizeCategoryName(tx.subCategoryName, subCategoryNames, locale),
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
export function addLocalizedLabels(...args) {
|
|
181
|
+
return purry(_addLocalizedLabels, args);
|
|
182
|
+
}
|
|
183
|
+
const _viewFromOutcome = (outcome, locale) => addLocalizedLabels(outcome.read, locale);
|
|
184
|
+
export function viewFromOutcome(...args) {
|
|
185
|
+
return purry(_viewFromOutcome, args);
|
|
186
|
+
}
|
|
187
|
+
const _buildTransactionView = (outcomes, locale) => viewFromOutcome(outcomeFor(TRANSACTION_ENTITY_TAG, outcomes), locale);
|
|
188
|
+
export function buildTransactionView(...args) {
|
|
189
|
+
return purry(_buildTransactionView, args);
|
|
190
|
+
}
|
|
191
|
+
const _buildUpsertResult = (outcomes, classification, locale) => {
|
|
192
|
+
const outcome = outcomeFor(TRANSACTION_ENTITY_TAG, outcomes);
|
|
193
|
+
return { transaction: viewFromOutcome(outcome, locale), created: outcome.applied, classification };
|
|
194
|
+
};
|
|
195
|
+
export function buildUpsertResult(...args) {
|
|
196
|
+
return purry(_buildUpsertResult, args);
|
|
197
|
+
}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { isPortInUse, portInUseMessage } from './common/net.js';
|
|
3
|
+
import { loadHttpModule } from './composition/lazy-modules.js';
|
|
4
|
+
import { loadConfig, McpTransport } from './config.js';
|
|
5
|
+
import { startupRefusalMessage } from './models/startup.js';
|
|
6
|
+
// Each flow is a composition module, loaded only when it runs: the CLI never pays for a server, a stdio start never
|
|
7
|
+
// loads Fastify (the stdio module loads it itself only when the sidecar is on), and an HTTP start never loads the CLI.
|
|
8
|
+
const loadCliModule = () => import('./composition/cli.js');
|
|
9
|
+
const loadStdioModule = () => import('./composition/stdio.js');
|
|
10
|
+
/** The exit status of a process that could not start. */
|
|
11
|
+
const EXIT_FAILURE = 1;
|
|
12
|
+
const refuseIfNotStarted = (started) => {
|
|
13
|
+
if (started.isOk())
|
|
14
|
+
return;
|
|
15
|
+
console.error(startupRefusalMessage(started.error));
|
|
16
|
+
process.exit(EXIT_FAILURE);
|
|
17
|
+
};
|
|
18
|
+
const main = async () => {
|
|
19
|
+
// Any argument is a command: an unknown one is a usage error, never a reason to start a server.
|
|
20
|
+
if (process.argv.length > 2) {
|
|
21
|
+
const { runCommandLine } = await loadCliModule();
|
|
22
|
+
// Not process.exit: let the event loop drain, so everything the command printed has been flushed.
|
|
23
|
+
process.exitCode = await runCommandLine(process.argv.slice(2));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const config = loadConfig();
|
|
27
|
+
if (config.MCP_TRANSPORT === McpTransport.enum.stdio) {
|
|
28
|
+
const { runStdio } = await loadStdioModule();
|
|
29
|
+
return refuseIfNotStarted(await runStdio(config));
|
|
30
|
+
}
|
|
31
|
+
const { runHttp } = await loadHttpModule();
|
|
32
|
+
return refuseIfNotStarted(await runHttp(config));
|
|
33
|
+
};
|
|
34
|
+
main().catch((e) => {
|
|
35
|
+
if (isPortInUse(e)) {
|
|
36
|
+
console.error(portInUseMessage(e));
|
|
37
|
+
process.exit(EXIT_FAILURE);
|
|
38
|
+
}
|
|
39
|
+
// Only unexpected errors get here (a refused start is a Result, handled above): the stack is the diagnosis.
|
|
40
|
+
console.error(e);
|
|
41
|
+
process.exit(EXIT_FAILURE);
|
|
42
|
+
});
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Id } from './id.js';
|
|
3
|
+
import { ConvertedValueSchema } from './currency-rate.js';
|
|
4
|
+
import { CurrencyCode, Money } from './money.js';
|
|
5
|
+
import { IsoDate } from './date.js';
|
|
6
|
+
import { withPersistenceMeta } from '@rfc0/effect-runner';
|
|
7
|
+
import { CreateTransactionSchema, DISCRIMINATOR_DESCRIPTION, STATEMENT_ITEMS_DESCRIPTION, STATEMENT_RAW_INPUT_DESCRIPTION, TransactionStatus, UpdateTransactionSchema, } from './transaction.js';
|
|
8
|
+
import { validationWithRemedy, } from './error.js';
|
|
9
|
+
import { Remedy } from './remedy.js';
|
|
10
|
+
export const AccountType = z.enum(['checking', 'savings', 'wallet', 'investment', 'credit']);
|
|
11
|
+
export const accountTypeLabels = {
|
|
12
|
+
checking: { en: 'Checking', pt: 'Conta corrente', es: 'Cuenta corriente' },
|
|
13
|
+
savings: { en: 'Savings', pt: 'Poupança', es: 'Ahorros' },
|
|
14
|
+
wallet: { en: 'Wallet', pt: 'Carteira', es: 'Billetera' },
|
|
15
|
+
investment: { en: 'Investment', pt: 'Investimentos', es: 'Inversiones' },
|
|
16
|
+
credit: { en: 'Credit card', pt: 'Cartão de crédito', es: 'Tarjeta de crédito' },
|
|
17
|
+
};
|
|
18
|
+
// `.describe()` is domain information — it states what each field is and represents.
|
|
19
|
+
// Defaults split by intent: integrity defaults (a value that must exist for the entity to be
|
|
20
|
+
// valid, e.g. initialBalance → 0) live here; quality-of-life convenience defaults live at the
|
|
21
|
+
// wire boundary (see wire/in/accounts.ts), keeping the domain contract honest about what is required.
|
|
22
|
+
export const AccountSchema = z.object({
|
|
23
|
+
id: Id,
|
|
24
|
+
name: z.string().min(1).describe('Account name'),
|
|
25
|
+
type: AccountType.describe('checking | savings | wallet | investment (credit is card-managed)'),
|
|
26
|
+
typeLabel: z.string().optional(),
|
|
27
|
+
currency: CurrencyCode.describe('Account currency (ISO code); fixed once the account has activity'),
|
|
28
|
+
initialBalance: z.number().default(0).describe('Balance at account creation; current balance is always derived'),
|
|
29
|
+
});
|
|
30
|
+
// The persistence-side entity (docs/canonical/functional-core-imperative-shell.md): `Account` plus
|
|
31
|
+
// the optimistic-concurrency `version` token. Never sent over the wire — kept off `AccountSchema`
|
|
32
|
+
// itself so every existing account-returning flow (which reuses `AccountSchema` as its wire/out
|
|
33
|
+
// shape) stays unchanged. Only flows that build `Persistable`s and `adapters/accounts.ts`'s
|
|
34
|
+
// model→row adaptation (`modelToDb`/`persistableToDb`) speak `AccountEntity` — the applier itself
|
|
35
|
+
// doesn't: by the time a batch reaches `diplomat/db`, it's already been adapted to a plain row
|
|
36
|
+
// (`versionedTableApplier` in `diplomat/db/effects.ts` is entity-agnostic).
|
|
37
|
+
export const AccountEntitySchema = withPersistenceMeta(AccountSchema);
|
|
38
|
+
// The account aggregate owns its own entity tag — `@rfc0/effect-runner`'s `Persistable` is generic over any
|
|
39
|
+
// entity's tag/model and never lists this constant itself, so adding a new converted aggregate
|
|
40
|
+
// never means editing that shared file.
|
|
41
|
+
export const ACCOUNT_ENTITY_TAG = 'account';
|
|
42
|
+
export const CreateAccountSchema = AccountSchema.omit({ id: true, typeLabel: true });
|
|
43
|
+
export const UpdateAccountSchema = AccountSchema.omit({ id: true, typeLabel: true })
|
|
44
|
+
.partial({ initialBalance: true, type: true, currency: true })
|
|
45
|
+
.extend({ newName: z.string().min(1).optional().describe('New account name') });
|
|
46
|
+
export const AccountBalanceSchema = AccountSchema.extend({
|
|
47
|
+
balance: z.number(),
|
|
48
|
+
income: z.number(),
|
|
49
|
+
expenses: z.number(),
|
|
50
|
+
transfersIn: z.number(),
|
|
51
|
+
transfersOut: z.number(),
|
|
52
|
+
projectedBalance: z.number().optional().describe('Effective balance + pending through projectedAsOf, if supplied'),
|
|
53
|
+
converted: ConvertedValueSchema.optional().describe('Read-time valuation of balance in the base currency (ADR-026); absent when no exchange rate is on file'),
|
|
54
|
+
});
|
|
55
|
+
export const ConsolidatedNetWorthSchema = z.object({
|
|
56
|
+
baseCurrency: CurrencyCode.describe('The base currency all included balances are summed in'),
|
|
57
|
+
total: z.number().describe('Sum of every included balance converted value'),
|
|
58
|
+
excluded: z
|
|
59
|
+
.array(Id)
|
|
60
|
+
.describe('Account ids left out of total because no exchange rate is on file for their currency'),
|
|
61
|
+
});
|
|
62
|
+
export const AccountBalancesResultSchema = z.object({
|
|
63
|
+
balances: z.array(AccountBalanceSchema),
|
|
64
|
+
consolidatedNetWorth: ConsolidatedNetWorthSchema,
|
|
65
|
+
});
|
|
66
|
+
/** Natural input for an account expense/income: the transaction core's minimal
|
|
67
|
+
* `CreateTransactionSchema` plus `account`, minus `type` (the movement kind is the tool
|
|
68
|
+
* itself — `add_account_expense` vs. `add_account_income` — not a field; card/bill-assignment
|
|
69
|
+
* vocabulary never reaches this schema at all, since the core no longer carries it). `account`
|
|
70
|
+
* stays optional: an omitted account records an unattached (e.g. cash) movement. Depends on the
|
|
71
|
+
* transaction core's schema (aggregate → core, the allowed direction) — never the reverse.
|
|
72
|
+
* `.strict()`: `card`/`type`/`billMonth`/`billYear` are meaningful fields on the sibling aggregate
|
|
73
|
+
* schema (`AddCardPurchaseSchema`), not server-managed ones — a caller who mistakenly sends them
|
|
74
|
+
* here should get a validation error, not have them silently stripped by zod's default unknown-key
|
|
75
|
+
* behavior (REST boundary only; the MCP tool's inputSchema is a raw shape, which the MCP SDK
|
|
76
|
+
* reconstructs into its own non-strict object internally). */
|
|
77
|
+
export const AddAccountMovementSchema = CreateTransactionSchema.extend({
|
|
78
|
+
account: z.string().min(1).optional().describe('Account name, e.g. "Nubank"'),
|
|
79
|
+
})
|
|
80
|
+
.omit({ type: true })
|
|
81
|
+
.strict();
|
|
82
|
+
/** A single line of an `import_account_statement` request: the transaction core's minimal
|
|
83
|
+
* `CreateTransactionSchema` minus `rawInput`/`subCategory`/`tags` (statement-level concerns) — no
|
|
84
|
+
* `account` (fixed once, at the statement's top level — single-source, no per-line account) and no
|
|
85
|
+
* `card`/`billMonth`/`billYear` (card/bill-assignment vocabulary the core never carries). Unlike
|
|
86
|
+
* `AddAccountMovementSchema`, `type` stays required — a statement line still needs its own
|
|
87
|
+
* expense-vs-income marker, since the movement kind isn't fixed by which tool was called. */
|
|
88
|
+
export const ImportAccountStatementItemSchema = CreateTransactionSchema.omit({
|
|
89
|
+
rawInput: true,
|
|
90
|
+
subCategory: true,
|
|
91
|
+
tags: true,
|
|
92
|
+
}).strict();
|
|
93
|
+
/** Account statement import: single-source — every item is an expense or income (per item's
|
|
94
|
+
* `type`) on the ONE account named here (omit for unattached, e.g. cash, movements), via
|
|
95
|
+
* `addAccountExpense`/`addAccountIncome`. A statement can't carry a conflicting per-line owner
|
|
96
|
+
* by construction. */
|
|
97
|
+
export const ImportAccountStatementSchema = z.object({
|
|
98
|
+
account: z
|
|
99
|
+
.string()
|
|
100
|
+
.min(1)
|
|
101
|
+
.optional()
|
|
102
|
+
.describe('Account name — every item in this statement belongs to this one account; omit for unattached (e.g. cash) movements'),
|
|
103
|
+
items: z.array(ImportAccountStatementItemSchema).min(1).max(200).describe(STATEMENT_ITEMS_DESCRIPTION),
|
|
104
|
+
rawInput: z.string().optional().describe(STATEMENT_RAW_INPUT_DESCRIPTION),
|
|
105
|
+
});
|
|
106
|
+
/** Account-aggregate update schema: `.extend`s the core's minimal `UpdateTransactionSchema` with
|
|
107
|
+
* `account` — the core no longer carries bill-assignment (`billMonth`/`billYear`) at all, so it
|
|
108
|
+
* structurally can't reach this schema (mirrors `AddAccountMovementSchema`'s create-side shape).
|
|
109
|
+
* `.strict()`: same REST-boundary-only reasoning as `AddAccountMovementSchema` above. */
|
|
110
|
+
export const UpdateAccountTransactionSchema = UpdateTransactionSchema.extend({
|
|
111
|
+
account: z.string().min(1).optional().describe('New account name'),
|
|
112
|
+
}).strict();
|
|
113
|
+
/** Natural input for a transfer: account-context vocabulary — a transfer request is an
|
|
114
|
+
* account-aggregate concern even though it persists as a transaction row via the shared core
|
|
115
|
+
* primitive (account → core, the allowed direction). `.strict()`: same REST-boundary-only
|
|
116
|
+
* reasoning as `AddAccountMovementSchema` above. */
|
|
117
|
+
export const CreateTransferSchema = z
|
|
118
|
+
.object({
|
|
119
|
+
from: z.string().min(1).describe('Source account name'),
|
|
120
|
+
to: z.string().min(1).describe('Destination account name'),
|
|
121
|
+
amount: Money.describe('Transfer amount in full units'),
|
|
122
|
+
status: TransactionStatus.optional().describe('pending | effective; omit for date-aware default'),
|
|
123
|
+
date: IsoDate.optional().describe('YYYY-MM-DD; defaults to today'),
|
|
124
|
+
description: z.string().optional().describe('e.g. "aporte mensal"'),
|
|
125
|
+
discriminator: z.string().min(1).optional().describe(DISCRIMINATOR_DESCRIPTION),
|
|
126
|
+
})
|
|
127
|
+
.strict();
|
|
128
|
+
const CREDIT_REJECTED_MESSAGE = 'credit accounts are managed by their credit card — use the card flow instead';
|
|
129
|
+
const creditTransferFromMessage = (name) => `cannot transfer from a credit account (${name}) — pay the card's bill instead`;
|
|
130
|
+
const creditTransferToMessage = (name) => `cannot transfer to a credit account (${name}) — pay the card's bill instead`;
|
|
131
|
+
export const accountErrors = {
|
|
132
|
+
creditRejected: (remedy) => validationWithRemedy(CREDIT_REJECTED_MESSAGE, remedy),
|
|
133
|
+
duplicateName: (name) => ({ code: 'duplicate_name', entity: 'account', name }),
|
|
134
|
+
inUse: (name, references) => ({
|
|
135
|
+
code: 'in_use',
|
|
136
|
+
entity: 'account',
|
|
137
|
+
name,
|
|
138
|
+
references,
|
|
139
|
+
}),
|
|
140
|
+
typeImmutable: (transactions) => ({
|
|
141
|
+
code: 'validation',
|
|
142
|
+
issues: [`type cannot be changed — account has ${transactions} transaction(s)`],
|
|
143
|
+
}),
|
|
144
|
+
currencyImmutableTransactions: (transactions) => ({
|
|
145
|
+
code: 'validation',
|
|
146
|
+
issues: [`currency cannot be changed — account has ${transactions} transaction(s)`],
|
|
147
|
+
}),
|
|
148
|
+
currencyImmutableRecurring: {
|
|
149
|
+
code: 'validation',
|
|
150
|
+
issues: ['currency cannot be changed — account has recurring rules that persist the original currency'],
|
|
151
|
+
},
|
|
152
|
+
currencyImmutableCards: {
|
|
153
|
+
code: 'validation',
|
|
154
|
+
issues: ['currency cannot be changed — account is a credit card payment account'],
|
|
155
|
+
},
|
|
156
|
+
creditPostRejected: {
|
|
157
|
+
code: 'validation',
|
|
158
|
+
issues: ['cannot post directly to a credit account — use the card parameter instead'],
|
|
159
|
+
},
|
|
160
|
+
creditTransferFromRejected: (name) => validationWithRemedy(creditTransferFromMessage(name), Remedy.enum.pay_bill),
|
|
161
|
+
creditTransferToRejected: (name) => validationWithRemedy(creditTransferToMessage(name), Remedy.enum.pay_bill),
|
|
162
|
+
creditPaymentRejected: {
|
|
163
|
+
code: 'validation',
|
|
164
|
+
issues: ['payment account cannot be a credit account'],
|
|
165
|
+
},
|
|
166
|
+
currencyMismatch: (cardCurrency, payerCurrency) => ({
|
|
167
|
+
code: 'validation',
|
|
168
|
+
issues: [`currency mismatch: card is ${cardCurrency}, payer is ${payerCurrency}`],
|
|
169
|
+
}),
|
|
170
|
+
sameAccount: {
|
|
171
|
+
code: 'validation',
|
|
172
|
+
issues: ['from and to must be different accounts'],
|
|
173
|
+
},
|
|
174
|
+
crossCurrencyTransfer: (from, to) => ({
|
|
175
|
+
code: 'validation',
|
|
176
|
+
issues: [
|
|
177
|
+
`cross-currency transfer not supported yet: ${from.name} is ${from.currency}, ${to.name} is ${to.currency}`,
|
|
178
|
+
],
|
|
179
|
+
}),
|
|
180
|
+
// Transfer mutation policy: only the account aggregate's update ever reaches a mutable transfer
|
|
181
|
+
// (the credit-card aggregate's only transfer, the bill-payment transfer, is blocked outright by
|
|
182
|
+
// its own bill-process guard, never by these).
|
|
183
|
+
transferTypeImmutable: {
|
|
184
|
+
code: 'validation',
|
|
185
|
+
issues: ['cannot change the type of a transfer transaction'],
|
|
186
|
+
},
|
|
187
|
+
transferCategoryRejected: {
|
|
188
|
+
code: 'validation',
|
|
189
|
+
issues: ['transfer transactions cannot have a category or sub-category'],
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
export const ACCOUNT_OWNED_TYPES = new Set([
|
|
193
|
+
AccountType.enum.checking,
|
|
194
|
+
AccountType.enum.savings,
|
|
195
|
+
AccountType.enum.wallet,
|
|
196
|
+
AccountType.enum.investment,
|
|
197
|
+
]);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ConvertedTotalSchema } from './currency-rate.js';
|
|
3
|
+
import { PeriodSchema, RangeFrom, RangeTo } from './date.js';
|
|
4
|
+
import { CurrencyCode } from './money.js';
|
|
5
|
+
import { MovementType } from './transaction.js';
|
|
6
|
+
export const AggregateGroupBy = z.enum(['category', 'account', 'tag', 'month', 'merchant']);
|
|
7
|
+
export const AggregateMetric = z.enum(['sum', 'count', 'avg']);
|
|
8
|
+
export const AggregateSort = z.enum(['asc', 'desc']);
|
|
9
|
+
export const AggregateSpendingSchema = z.object({
|
|
10
|
+
groupBy: AggregateGroupBy.describe('Dimension to group by: category, account, tag, month, or merchant'),
|
|
11
|
+
metric: AggregateMetric.optional().describe('Aggregation metric: sum, count, or avg of amount'),
|
|
12
|
+
month: PeriodSchema.shape.month.optional(),
|
|
13
|
+
year: PeriodSchema.shape.year.optional(),
|
|
14
|
+
from: RangeFrom,
|
|
15
|
+
to: RangeTo,
|
|
16
|
+
account: z.string().min(1).optional().describe('Filter by account name'),
|
|
17
|
+
category: z.string().min(1).optional().describe('Filter by category name'),
|
|
18
|
+
type: MovementType.optional().describe('Filter by movement type: expense or income'),
|
|
19
|
+
tags: z.array(z.string().min(1)).optional().describe('Filter to transactions having any of these tags'),
|
|
20
|
+
limit: z.number().int().min(1).max(100).optional().describe('Return only the top-N rows per currency'),
|
|
21
|
+
sort: AggregateSort.optional().describe('Sort order by metric value: asc or desc'),
|
|
22
|
+
displayCurrency: CurrencyCode.optional().describe('Opt-in: also return a converted grand total of the per-currency block totals in this currency. ' +
|
|
23
|
+
'Only attached when metric is sum — a block total is a genuine money quantity to convert; count/avg are not.'),
|
|
24
|
+
});
|
|
25
|
+
const AggregateRowSchema = z.object({
|
|
26
|
+
key: z.string().describe('Group key (category id, account id, tag name, YYYY-MM, merchant key)'),
|
|
27
|
+
label: z.string().describe('Human-readable label (locale-resolved for categories)'),
|
|
28
|
+
value: z.number().describe('Metric value'),
|
|
29
|
+
count: z.number().int().describe('Number of transactions in this group'),
|
|
30
|
+
pct: z.number().describe('Percentage of the currency total'),
|
|
31
|
+
});
|
|
32
|
+
const CurrencyBlockSchema = z.object({
|
|
33
|
+
currency: CurrencyCode,
|
|
34
|
+
total: z.number().describe('Sum of all row values for this currency'),
|
|
35
|
+
rows: z.array(AggregateRowSchema),
|
|
36
|
+
});
|
|
37
|
+
export const AggregateResultSchema = z.object({
|
|
38
|
+
groupBy: AggregateGroupBy,
|
|
39
|
+
metric: AggregateMetric,
|
|
40
|
+
currencies: z.array(CurrencyBlockSchema),
|
|
41
|
+
converted: ConvertedTotalSchema.optional().describe('Opt-in converted grand total of the per-currency block totals — present only when displayCurrency ' +
|
|
42
|
+
'was supplied and metric is sum'),
|
|
43
|
+
});
|
|
44
|
+
export const aggregateErrors = {
|
|
45
|
+
missingPeriod: {
|
|
46
|
+
code: 'validation',
|
|
47
|
+
issues: ['provide month+year or at least one of from/to'],
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export const UNCATEGORIZED_KEY = 'uncategorized';
|
|
51
|
+
export const uncategorizedLabels = {
|
|
52
|
+
en: 'Uncategorized',
|
|
53
|
+
pt: 'Sem categoria',
|
|
54
|
+
es: 'Sin categoría',
|
|
55
|
+
};
|
|
56
|
+
export const UNKNOWN_KEY = 'unknown';
|
|
57
|
+
export const unknownLabels = {
|
|
58
|
+
en: 'Unknown',
|
|
59
|
+
pt: 'Desconhecido',
|
|
60
|
+
es: 'Desconocido',
|
|
61
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PRODUCT_NAME } from '../package.js';
|
|
2
|
+
export const BEARER_SCHEME = 'Bearer';
|
|
3
|
+
export const BEARER_HEADER = new RegExp(`^${BEARER_SCHEME}[ \\t]+(\\S+)$`, 'i');
|
|
4
|
+
export const RESOURCE_NAME = PRODUCT_NAME;
|
|
5
|
+
export const BEARER_METHOD_HEADER = 'header';
|
|
6
|
+
/** The HTTP surfaces a bearer token is accepted on. `/ui` is a browser surface and stays session-only. */
|
|
7
|
+
export const API_PATH_PREFIX = '/api';
|
|
8
|
+
export const MCP_PATH = '/mcp';
|
|
9
|
+
/** RFC 9728 §3: the metadata of resource `<origin>/mcp` lives at the well-known URI with the path inserted. */
|
|
10
|
+
export const PRM_WELL_KNOWN_PATH = '/.well-known/oauth-protected-resource';
|
|
11
|
+
export const MCP_PRM_PATH = `${PRM_WELL_KNOWN_PATH}${MCP_PATH}`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const USER_ENTITY_TAG = 'user';
|
|
2
|
+
export const SESSION_ENTITY_TAG = 'session';
|
|
3
|
+
export const SETUP_CODE_ENTITY_TAG = 'setup_code';
|
|
4
|
+
export const ACCESS_TOKEN_ENTITY_TAG = 'access_token';
|
|
5
|
+
export const CLIENT_GRANT_ENTITY_TAG = 'client_grant';
|
|
6
|
+
export const INVITE_ENTITY_TAG = 'invite';
|
|
7
|
+
export const INSTANCE_SETTINGS_ENTITY_TAG = 'instance_settings';
|
|
8
|
+
/** Entities the auth flows write — never worth telling a dashboard about. */
|
|
9
|
+
export const AUTH_ENTITY_TAGS = [
|
|
10
|
+
USER_ENTITY_TAG,
|
|
11
|
+
SESSION_ENTITY_TAG,
|
|
12
|
+
SETUP_CODE_ENTITY_TAG,
|
|
13
|
+
ACCESS_TOKEN_ENTITY_TAG,
|
|
14
|
+
CLIENT_GRANT_ENTITY_TAG,
|
|
15
|
+
INVITE_ENTITY_TAG,
|
|
16
|
+
INSTANCE_SETTINGS_ENTITY_TAG,
|
|
17
|
+
];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { validation } from '../error.js';
|
|
2
|
+
import { AUTH_MESSAGES } from './message.js';
|
|
3
|
+
export const authErrors = {
|
|
4
|
+
unauthenticated: { code: 'unauthenticated' },
|
|
5
|
+
// One message for unknown user, wrong password, unclaimed owner and disabled user alike — the
|
|
6
|
+
// response must not say which (ADR-033 §2).
|
|
7
|
+
invalidCredentials: { code: 'invalid_credentials' },
|
|
8
|
+
// Wrong, expired and already-used codes are indistinguishable by design.
|
|
9
|
+
invalidSetupCode: { code: 'invalid_setup_code' },
|
|
10
|
+
setupUnavailable: { code: 'setup_unavailable' },
|
|
11
|
+
unknownUser: (username) => ({ code: 'unknown_user', username }),
|
|
12
|
+
ownerUnclaimed: { code: 'owner_unclaimed' },
|
|
13
|
+
rateLimited: { code: 'rate_limited' },
|
|
14
|
+
// CSRF (ADR-033 §2): a cookie-authenticated unsafe request whose Origin is not ours.
|
|
15
|
+
crossOrigin: { code: 'forbidden_origin', hint: AUTH_MESSAGES.crossOrigin },
|
|
16
|
+
// Auth disabled: only a loopback Host (and Origin, if any) is answered — the DNS-rebinding / cross-site guard.
|
|
17
|
+
nonLoopbackRequest: { code: 'forbidden_origin', hint: AUTH_MESSAGES.nonLoopbackRequest },
|
|
18
|
+
unknownOrigin: { code: 'forbidden_origin', hint: AUTH_MESSAGES.crossOriginUnknownOrigin },
|
|
19
|
+
// Bearer credential present but unusable: malformed, unknown, revoked, expired, or its owner can't log in.
|
|
20
|
+
invalidToken: { code: 'invalid_token' },
|
|
21
|
+
insufficientScope: (scope) => ({ code: 'insufficient_scope', scope }),
|
|
22
|
+
// Token management is for a person at a browser, never for a bearer token.
|
|
23
|
+
sessionRequired: { code: 'session_required' },
|
|
24
|
+
unknownToken: (id) => ({ code: 'unknown_token', id }),
|
|
25
|
+
// A `patty login` request has no "session" to tie a sign-in to.
|
|
26
|
+
sessionDurationRefused: validation(['a sign-in requested by `patty login` cannot last "this session only"']),
|
|
27
|
+
// Unknown, expired, denied, already-approved or already-redeemed: indistinguishable, like a setup code.
|
|
28
|
+
invalidGrant: { code: 'invalid_grant' },
|
|
29
|
+
// User management is for signed-in admins; to anyone else it reads as a page that does not exist.
|
|
30
|
+
adminRequired: { code: 'admin_required' },
|
|
31
|
+
usernameTaken: (username) => ({ code: 'username_taken', username }),
|
|
32
|
+
cannotChangeSelf: { code: 'cannot_change_self' },
|
|
33
|
+
lastAdmin: { code: 'last_admin' },
|
|
34
|
+
// Wrong, expired, used, revoked and foreign invites are indistinguishable by design, like a setup code.
|
|
35
|
+
invalidInvite: { code: 'invalid_invite' },
|
|
36
|
+
userDisabled: { code: 'user_disabled' },
|
|
37
|
+
// No PUBLIC_URL and a non-loopback Host: the instance cannot name the resource it would describe.
|
|
38
|
+
metadataUnavailable: {
|
|
39
|
+
code: 'resource_metadata_unavailable',
|
|
40
|
+
hint: AUTH_MESSAGES.prmNeedsOrigin,
|
|
41
|
+
},
|
|
42
|
+
};
|