mcpmake 0.1.1 → 0.2.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/dist/commands/bundle.d.ts +1 -0
- package/dist/commands/bundle.d.ts.map +1 -0
- package/dist/commands/bundle.js +5 -4
- package/dist/commands/bundle.js.map +1 -0
- package/dist/commands/ci.d.ts +1 -0
- package/dist/commands/ci.d.ts.map +1 -0
- package/dist/commands/ci.js +3 -2
- package/dist/commands/ci.js.map +1 -0
- package/dist/commands/deploy.d.ts +1 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +4 -3
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/diff.d.ts +1 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +5 -4
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/from/describe.d.ts +1 -0
- package/dist/commands/from/describe.d.ts.map +1 -0
- package/dist/commands/from/describe.js +11 -10
- package/dist/commands/from/describe.js.map +1 -0
- package/dist/commands/from/har.d.ts +1 -0
- package/dist/commands/from/har.d.ts.map +1 -0
- package/dist/commands/from/har.js +14 -13
- package/dist/commands/from/har.js.map +1 -0
- package/dist/commands/from/openapi.d.ts +1 -0
- package/dist/commands/from/openapi.d.ts.map +1 -0
- package/dist/commands/from/openapi.js +17 -16
- package/dist/commands/from/openapi.js.map +1 -0
- package/dist/commands/from/postman.d.ts +1 -0
- package/dist/commands/from/postman.d.ts.map +1 -0
- package/dist/commands/from/postman.js +13 -12
- package/dist/commands/from/postman.js.map +1 -0
- package/dist/commands/from/stainless.d.ts +110 -0
- package/dist/commands/from/stainless.d.ts.map +1 -0
- package/dist/commands/from/stainless.js +272 -0
- package/dist/commands/from/stainless.js.map +1 -0
- package/dist/commands/from/target-support.d.ts +1 -0
- package/dist/commands/from/target-support.d.ts.map +1 -0
- package/dist/commands/from/target-support.js +2 -1
- package/dist/commands/from/target-support.js.map +1 -0
- package/dist/commands/from/url.d.ts +1 -0
- package/dist/commands/from/url.d.ts.map +1 -0
- package/dist/commands/from/url.js +14 -13
- package/dist/commands/from/url.js.map +1 -0
- package/dist/commands/from/website.d.ts +1 -0
- package/dist/commands/from/website.d.ts.map +1 -0
- package/dist/commands/from/website.js +17 -16
- package/dist/commands/from/website.js.map +1 -0
- package/dist/commands/lint.d.ts +1 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +6 -5
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/merge.d.ts +1 -0
- package/dist/commands/merge.d.ts.map +1 -0
- package/dist/commands/merge.js +3 -2
- package/dist/commands/merge.js.map +1 -0
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +4 -3
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/rescan.d.ts +1 -0
- package/dist/commands/rescan.d.ts.map +1 -0
- package/dist/commands/rescan.js +12 -11
- package/dist/commands/rescan.js.map +1 -0
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +10 -9
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/verify.d.ts +1 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +7 -6
- package/dist/commands/verify.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -0
- package/dist/registry/official-registry.d.ts +1 -0
- package/dist/registry/official-registry.d.ts.map +1 -0
- package/dist/registry/official-registry.js +1 -0
- package/dist/registry/official-registry.js.map +1 -0
- package/package.json +20 -46
- package/README.md +0 -691
- package/dist/analyzer/auth-detector.d.ts +0 -12
- package/dist/analyzer/auth-detector.js +0 -142
- package/dist/analyzer/dom-parser.d.ts +0 -10
- package/dist/analyzer/dom-parser.js +0 -259
- package/dist/analyzer/goal-crawler.d.ts +0 -25
- package/dist/analyzer/goal-crawler.js +0 -177
- package/dist/analyzer/hybrid-detector.d.ts +0 -28
- package/dist/analyzer/hybrid-detector.js +0 -96
- package/dist/analyzer/index.d.ts +0 -12
- package/dist/analyzer/index.js +0 -8
- package/dist/analyzer/screenshot-capture.d.ts +0 -29
- package/dist/analyzer/screenshot-capture.js +0 -42
- package/dist/analyzer/selector-builder.d.ts +0 -19
- package/dist/analyzer/selector-builder.js +0 -199
- package/dist/analyzer/semantic-analyzer.d.ts +0 -13
- package/dist/analyzer/semantic-analyzer.js +0 -145
- package/dist/analyzer/site-crawler.d.ts +0 -38
- package/dist/analyzer/site-crawler.js +0 -235
- package/dist/cloud/billing/billing-engine.d.ts +0 -44
- package/dist/cloud/billing/billing-engine.js +0 -81
- package/dist/cloud/billing/credit-store.d.ts +0 -64
- package/dist/cloud/billing/credit-store.js +0 -168
- package/dist/cloud/billing/index.d.ts +0 -4
- package/dist/cloud/billing/index.js +0 -2
- package/dist/cloud/billing/usage-store.d.ts +0 -42
- package/dist/cloud/billing/usage-store.js +0 -85
- package/dist/cloud/billing/usage-tracker.d.ts +0 -38
- package/dist/cloud/billing/usage-tracker.js +0 -95
- package/dist/cloud/build-pipeline.d.ts +0 -39
- package/dist/cloud/build-pipeline.js +0 -310
- package/dist/cloud/build-queue.d.ts +0 -30
- package/dist/cloud/build-queue.js +0 -70
- package/dist/cloud/caddy-manager.d.ts +0 -18
- package/dist/cloud/caddy-manager.js +0 -97
- package/dist/cloud/container-backend.d.ts +0 -62
- package/dist/cloud/container-backend.js +0 -59
- package/dist/cloud/container-manager.d.ts +0 -64
- package/dist/cloud/container-manager.js +0 -301
- package/dist/cloud/crypto.d.ts +0 -27
- package/dist/cloud/crypto.js +0 -63
- package/dist/cloud/db/index.d.ts +0 -27
- package/dist/cloud/db/index.js +0 -53
- package/dist/cloud/db/migrations.d.ts +0 -12
- package/dist/cloud/db/migrations.js +0 -329
- package/dist/cloud/db/pg-store.d.ts +0 -45
- package/dist/cloud/db/pg-store.js +0 -336
- package/dist/cloud/failure-tracker.d.ts +0 -51
- package/dist/cloud/failure-tracker.js +0 -102
- package/dist/cloud/idle-monitor.d.ts +0 -30
- package/dist/cloud/idle-monitor.js +0 -70
- package/dist/cloud/mailer.d.ts +0 -21
- package/dist/cloud/mailer.js +0 -193
- package/dist/cloud/mcp-proxy.d.ts +0 -58
- package/dist/cloud/mcp-proxy.js +0 -203
- package/dist/cloud/metric-samples.d.ts +0 -43
- package/dist/cloud/metric-samples.js +0 -85
- package/dist/cloud/metrics.d.ts +0 -26
- package/dist/cloud/metrics.js +0 -59
- package/dist/cloud/multipart.d.ts +0 -26
- package/dist/cloud/multipart.js +0 -132
- package/dist/cloud/observability.d.ts +0 -27
- package/dist/cloud/observability.js +0 -98
- package/dist/cloud/rate-limiter.d.ts +0 -31
- package/dist/cloud/rate-limiter.js +0 -58
- package/dist/cloud/request-security.d.ts +0 -5
- package/dist/cloud/request-security.js +0 -74
- package/dist/cloud/resource-monitor.d.ts +0 -69
- package/dist/cloud/resource-monitor.js +0 -130
- package/dist/cloud/secret-store.d.ts +0 -38
- package/dist/cloud/secret-store.js +0 -103
- package/dist/cloud/security.d.ts +0 -26
- package/dist/cloud/security.js +0 -142
- package/dist/cloud/server.d.ts +0 -21
- package/dist/cloud/server.js +0 -1079
- package/dist/cloud/shared-state.d.ts +0 -72
- package/dist/cloud/shared-state.js +0 -159
- package/dist/cloud/ssrf.d.ts +0 -43
- package/dist/cloud/ssrf.js +0 -150
- package/dist/cloud/store.d.ts +0 -41
- package/dist/cloud/store.js +0 -75
- package/dist/cloud/stripe.d.ts +0 -78
- package/dist/cloud/stripe.js +0 -317
- package/dist/cloud/telemetry-store.d.ts +0 -53
- package/dist/cloud/telemetry-store.js +0 -108
- package/dist/cloud/web/auth.d.ts +0 -225
- package/dist/cloud/web/auth.js +0 -555
- package/dist/cloud/web/charts.d.ts +0 -70
- package/dist/cloud/web/charts.js +0 -178
- package/dist/cloud/web/csrf.d.ts +0 -14
- package/dist/cloud/web/csrf.js +0 -22
- package/dist/cloud/web/docs.d.ts +0 -40
- package/dist/cloud/web/docs.js +0 -174
- package/dist/cloud/web/router.d.ts +0 -25
- package/dist/cloud/web/router.js +0 -1921
- package/dist/cloud/web/static/alpine.min.js +0 -5
- package/dist/cloud/web/static/favicon.svg +0 -4
- package/dist/cloud/web/static/htmx-sse.js +0 -290
- package/dist/cloud/web/static/htmx.min.js +0 -1
- package/dist/cloud/web/static/style.css +0 -2683
- package/dist/cloud/web/static-server.d.ts +0 -13
- package/dist/cloud/web/static-server.js +0 -73
- package/dist/cloud/web/template-engine.d.ts +0 -27
- package/dist/cloud/web/template-engine.js +0 -146
- package/dist/cloud/web/templates/layouts/admin.hbs +0 -57
- package/dist/cloud/web/templates/layouts/auth.hbs +0 -138
- package/dist/cloud/web/templates/layouts/base.hbs +0 -16
- package/dist/cloud/web/templates/layouts/dashboard.hbs +0 -39
- package/dist/cloud/web/templates/layouts/landing.hbs +0 -82
- package/dist/cloud/web/templates/pages/admin/overview.hbs +0 -123
- package/dist/cloud/web/templates/pages/admin/servers.hbs +0 -129
- package/dist/cloud/web/templates/pages/admin/telemetry.hbs +0 -39
- package/dist/cloud/web/templates/pages/admin/user-edit.hbs +0 -91
- package/dist/cloud/web/templates/pages/admin/users.hbs +0 -179
- package/dist/cloud/web/templates/pages/auth/forgot-password.hbs +0 -25
- package/dist/cloud/web/templates/pages/auth/login.hbs +0 -33
- package/dist/cloud/web/templates/pages/auth/register.hbs +0 -32
- package/dist/cloud/web/templates/pages/auth/reset-password.hbs +0 -34
- package/dist/cloud/web/templates/pages/dashboard/billing.hbs +0 -140
- package/dist/cloud/web/templates/pages/dashboard/create.hbs +0 -173
- package/dist/cloud/web/templates/pages/dashboard/index.hbs +0 -8
- package/dist/cloud/web/templates/pages/dashboard/server-detail.hbs +0 -280
- package/dist/cloud/web/templates/pages/dashboard/server-logs.hbs +0 -35
- package/dist/cloud/web/templates/pages/dashboard/server-metrics.hbs +0 -63
- package/dist/cloud/web/templates/pages/dashboard/servers-partial.hbs +0 -21
- package/dist/cloud/web/templates/pages/dashboard/servers.hbs +0 -44
- package/dist/cloud/web/templates/pages/docs/show.hbs +0 -16
- package/dist/cloud/web/templates/pages/errors/404.hbs +0 -9
- package/dist/cloud/web/templates/pages/errors/500.hbs +0 -8
- package/dist/cloud/web/templates/pages/landing/index.hbs +0 -223
- package/dist/cloud/web/templates/pages/legal/privacy.hbs +0 -71
- package/dist/cloud/web/templates/pages/legal/terms.hbs +0 -73
- package/dist/cloud/web/templates/partials/admin-stats.hbs +0 -52
- package/dist/cloud/web/templates/partials/flash-message.hbs +0 -6
- package/dist/cloud/web/templates/partials/pricing-table.hbs +0 -103
- package/dist/cloud/web/templates/partials/server-card.hbs +0 -19
- package/dist/cloud/web/templates/partials/status-badge.hbs +0 -1
- package/dist/config/configurable-command.d.ts +0 -13
- package/dist/config/configurable-command.js +0 -70
- package/dist/config/mcpmake-config.d.ts +0 -68
- package/dist/config/mcpmake-config.js +0 -207
- package/dist/docs/cli.md +0 -400
- package/dist/docs/mcp-2026-07-28-migration.md +0 -78
- package/dist/docs/migrate-from-stainless.md +0 -94
- package/dist/docs/quickstart.md +0 -166
- package/dist/docs/show-hn.md +0 -26
- package/dist/docs/website-servers.md +0 -169
- package/dist/emitter/code-writer.d.ts +0 -8
- package/dist/emitter/code-writer.js +0 -25
- package/dist/emitter/index.d.ts +0 -32
- package/dist/emitter/index.js +0 -280
- package/dist/emitter/mcpb-bundler.d.ts +0 -31
- package/dist/emitter/mcpb-bundler.js +0 -172
- package/dist/emitter/project-scaffolder.d.ts +0 -4
- package/dist/emitter/project-scaffolder.js +0 -89
- package/dist/emitter/python-template-loader.d.ts +0 -4
- package/dist/emitter/python-template-loader.js +0 -30
- package/dist/emitter/python-templates/dockerfile.hbs +0 -14
- package/dist/emitter/python-templates/env.example.hbs +0 -6
- package/dist/emitter/python-templates/requirements.txt.hbs +0 -4
- package/dist/emitter/python-templates/server.py.hbs +0 -77
- package/dist/emitter/site-scaffolder.d.ts +0 -13
- package/dist/emitter/site-scaffolder.js +0 -70
- package/dist/emitter/site-template-loader.d.ts +0 -5
- package/dist/emitter/site-template-loader.js +0 -47
- package/dist/emitter/site-templates/browser-manager.ts.hbs +0 -233
- package/dist/emitter/site-templates/config.ts.hbs +0 -28
- package/dist/emitter/site-templates/dockerfile.hbs +0 -31
- package/dist/emitter/site-templates/env.example.hbs +0 -19
- package/dist/emitter/site-templates/package.json.hbs +0 -26
- package/dist/emitter/site-templates/server-main-http.ts.hbs +0 -108
- package/dist/emitter/site-templates/server-main.ts.hbs +0 -23
- package/dist/emitter/site-templates/tool-handler-action.ts.hbs +0 -86
- package/dist/emitter/site-templates/tool-handler-form.ts.hbs +0 -116
- package/dist/emitter/site-templates/tool-handler-lifecycle.ts.hbs +0 -146
- package/dist/emitter/site-templates/tool-index.ts.hbs +0 -11
- package/dist/emitter/template-loader.d.ts +0 -1
- package/dist/emitter/template-loader.js +0 -27
- package/dist/emitter/templates/auth-provider.ts.hbs +0 -57
- package/dist/emitter/templates/config.ts.hbs +0 -63
- package/dist/emitter/templates/discovery.ts.hbs +0 -301
- package/dist/emitter/templates/dockerfile.hbs +0 -34
- package/dist/emitter/templates/env.example.hbs +0 -28
- package/dist/emitter/templates/gitignore.hbs +0 -5
- package/dist/emitter/templates/http-executor.ts.hbs +0 -117
- package/dist/emitter/templates/oauth.ts.hbs +0 -188
- package/dist/emitter/templates/package.json.hbs +0 -25
- package/dist/emitter/templates/prompts.ts.hbs +0 -22
- package/dist/emitter/templates/readme.md.hbs +0 -123
- package/dist/emitter/templates/resources.ts.hbs +0 -63
- package/dist/emitter/templates/server-main-http.ts.hbs +0 -407
- package/dist/emitter/templates/server-main.ts.hbs +0 -40
- package/dist/emitter/templates/task-handlers.ts.hbs +0 -189
- package/dist/emitter/templates/task-manager.ts.hbs +0 -139
- package/dist/emitter/templates/task-sse.ts.hbs +0 -105
- package/dist/emitter/templates/tool-handler.ts.hbs +0 -124
- package/dist/emitter/templates/tool-index.ts.hbs +0 -11
- package/dist/emitter/templates/tool-test.ts.hbs +0 -57
- package/dist/emitter/templates/trace.ts.hbs +0 -79
- package/dist/emitter/templates/tsconfig.json.hbs +0 -16
- package/dist/emitter/templates/types.ts.hbs +0 -5
- package/dist/emitter/worker-template-loader.d.ts +0 -5
- package/dist/emitter/worker-template-loader.js +0 -33
- package/dist/emitter/worker-templates/config.ts.hbs +0 -54
- package/dist/emitter/worker-templates/dev-vars.example.hbs +0 -10
- package/dist/emitter/worker-templates/gitignore.hbs +0 -6
- package/dist/emitter/worker-templates/package.json.hbs +0 -24
- package/dist/emitter/worker-templates/readme.md.hbs +0 -53
- package/dist/emitter/worker-templates/server.test.ts.hbs +0 -20
- package/dist/emitter/worker-templates/tool-handler.ts.hbs +0 -85
- package/dist/emitter/worker-templates/tool-index.ts.hbs +0 -28
- package/dist/emitter/worker-templates/tsconfig.json.hbs +0 -17
- package/dist/emitter/worker-templates/worker.ts.hbs +0 -242
- package/dist/emitter/worker-templates/wrangler.toml.hbs +0 -19
- package/dist/generator/spec-generator.d.ts +0 -6
- package/dist/generator/spec-generator.js +0 -50
- package/dist/parser/har-filter.d.ts +0 -8
- package/dist/parser/har-filter.js +0 -71
- package/dist/parser/har-loader.d.ts +0 -2
- package/dist/parser/har-loader.js +0 -14
- package/dist/parser/har-normalizer.d.ts +0 -20
- package/dist/parser/har-normalizer.js +0 -78
- package/dist/parser/index.d.ts +0 -10
- package/dist/parser/index.js +0 -6
- package/dist/parser/openapi-loader.d.ts +0 -6
- package/dist/parser/openapi-loader.js +0 -308
- package/dist/parser/operation-extractor.d.ts +0 -13
- package/dist/parser/operation-extractor.js +0 -155
- package/dist/parser/overlay-loader.d.ts +0 -10
- package/dist/parser/overlay-loader.js +0 -184
- package/dist/parser/postman-loader.d.ts +0 -9
- package/dist/parser/postman-loader.js +0 -106
- package/dist/parser/schema-converter.d.ts +0 -12
- package/dist/parser/schema-converter.js +0 -117
- package/dist/plugins/adapter.d.ts +0 -40
- package/dist/plugins/adapter.js +0 -15
- package/dist/plugins/loader.d.ts +0 -25
- package/dist/plugins/loader.js +0 -58
- package/dist/pricing.d.ts +0 -55
- package/dist/pricing.js +0 -133
- package/dist/providers/index.d.ts +0 -15
- package/dist/providers/index.js +0 -56
- package/dist/recorder/browser-recorder.d.ts +0 -22
- package/dist/recorder/browser-recorder.js +0 -205
- package/dist/rescan/diff-engine.d.ts +0 -5
- package/dist/rescan/diff-engine.js +0 -312
- package/dist/rescan/index.d.ts +0 -3
- package/dist/rescan/index.js +0 -2
- package/dist/rescan/rescan-runner.d.ts +0 -42
- package/dist/rescan/rescan-runner.js +0 -69
- package/dist/rescan/rescan-scheduler.d.ts +0 -41
- package/dist/rescan/rescan-scheduler.js +0 -179
- package/dist/site-transformer/browser-tools.d.ts +0 -10
- package/dist/site-transformer/browser-tools.js +0 -59
- package/dist/site-transformer/index.d.ts +0 -2
- package/dist/site-transformer/index.js +0 -2
- package/dist/site-transformer/selector-healer.d.ts +0 -8
- package/dist/site-transformer/selector-healer.js +0 -106
- package/dist/site-transformer/tool-generator.d.ts +0 -13
- package/dist/site-transformer/tool-generator.js +0 -245
- package/dist/transformer/auth-detector.d.ts +0 -13
- package/dist/transformer/auth-detector.js +0 -90
- package/dist/transformer/catalog-builder.d.ts +0 -18
- package/dist/transformer/catalog-builder.js +0 -56
- package/dist/transformer/client-compat.d.ts +0 -6
- package/dist/transformer/client-compat.js +0 -44
- package/dist/transformer/har-clusterer.d.ts +0 -9
- package/dist/transformer/har-clusterer.js +0 -27
- package/dist/transformer/har-dedup.d.ts +0 -10
- package/dist/transformer/har-dedup.js +0 -81
- package/dist/transformer/har-schema-inferrer.d.ts +0 -15
- package/dist/transformer/har-schema-inferrer.js +0 -90
- package/dist/transformer/har-to-operations.d.ts +0 -13
- package/dist/transformer/har-to-operations.js +0 -192
- package/dist/transformer/index.d.ts +0 -8
- package/dist/transformer/index.js +0 -6
- package/dist/transformer/llm-namer.d.ts +0 -6
- package/dist/transformer/llm-namer.js +0 -59
- package/dist/transformer/naming.d.ts +0 -4
- package/dist/transformer/naming.js +0 -30
- package/dist/transformer/operation-filter.d.ts +0 -13
- package/dist/transformer/operation-filter.js +0 -52
- package/dist/transformer/resource-builder.d.ts +0 -12
- package/dist/transformer/resource-builder.js +0 -80
- package/dist/transformer/schema-merger.d.ts +0 -14
- package/dist/transformer/schema-merger.js +0 -65
- package/dist/transformer/tool-builder.d.ts +0 -3
- package/dist/transformer/tool-builder.js +0 -114
- package/dist/types/index.d.ts +0 -131
- package/dist/types/index.js +0 -1
- package/dist/types/site.d.ts +0 -284
- package/dist/types/site.js +0 -8
- package/dist/utils/fail.d.ts +0 -48
- package/dist/utils/fail.js +0 -204
- package/dist/utils/fs.d.ts +0 -5
- package/dist/utils/fs.js +0 -28
- package/dist/utils/interactive.d.ts +0 -6
- package/dist/utils/interactive.js +0 -30
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +0 -2
- package/dist/utils/sanitize.d.ts +0 -28
- package/dist/utils/sanitize.js +0 -44
- package/dist/utils/watcher.d.ts +0 -11
- package/dist/utils/watcher.js +0 -36
package/dist/cloud/web/auth.d.ts
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User accounts and session management.
|
|
3
|
-
*
|
|
4
|
-
* Uses Node.js built-in crypto for password hashing (scrypt) and
|
|
5
|
-
* session token generation. Zero external dependencies.
|
|
6
|
-
*/
|
|
7
|
-
import http from 'node:http';
|
|
8
|
-
export interface UserRecord {
|
|
9
|
-
id: string;
|
|
10
|
-
email: string;
|
|
11
|
-
passwordHash: string;
|
|
12
|
-
plan: 'free' | 'hobbyist' | 'pro' | 'team' | 'enterprise';
|
|
13
|
-
isAdmin: boolean;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
lastLoginAt: string;
|
|
16
|
-
stripeCustomerId?: string;
|
|
17
|
-
passwordResetTokenHash?: string;
|
|
18
|
-
passwordResetExpiresAt?: number;
|
|
19
|
-
/** Whether the user has confirmed their email address. */
|
|
20
|
-
emailVerified?: boolean;
|
|
21
|
-
/** SHA-256 hash of the pending email verification token. */
|
|
22
|
-
emailVerificationTokenHash?: string;
|
|
23
|
-
/** Epoch ms of the current Stripe subscription period end (billing anchor). */
|
|
24
|
-
subscriptionPeriodEnd?: number;
|
|
25
|
-
/**
|
|
26
|
-
* Persistent balance of promotional bonus tool-calls. Consumed when the user
|
|
27
|
-
* is over their plan's monthly call quota, before the 429 hard cap. The
|
|
28
|
-
* canonical balance lives in the credit store ({@link getCreditStore}); this
|
|
29
|
-
* mirrors the `credits_calls` column in Pg mode for convenience.
|
|
30
|
-
*/
|
|
31
|
-
creditsCalls?: number;
|
|
32
|
-
}
|
|
33
|
-
export interface SessionRecord {
|
|
34
|
-
token: string;
|
|
35
|
-
userId: string;
|
|
36
|
-
csrfToken: string;
|
|
37
|
-
createdAt: number;
|
|
38
|
-
expiresAt: number;
|
|
39
|
-
pendingServerTokens?: Record<string, string>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Hash a password using scrypt.
|
|
43
|
-
* Returns "salt:hash" where salt is 16 random bytes hex, hash is 64-byte scrypt output hex.
|
|
44
|
-
*/
|
|
45
|
-
export declare function hashPassword(password: string): Promise<string>;
|
|
46
|
-
/**
|
|
47
|
-
* Verify a password against a stored "salt:hash" string.
|
|
48
|
-
* Uses constant-time comparison to prevent timing attacks.
|
|
49
|
-
*/
|
|
50
|
-
export declare function verifyPassword(password: string, stored: string): Promise<boolean>;
|
|
51
|
-
export declare class UserStore {
|
|
52
|
-
private users;
|
|
53
|
-
create(record: UserRecord): void;
|
|
54
|
-
getById(id: string): UserRecord | undefined;
|
|
55
|
-
getByEmail(email: string): UserRecord | undefined;
|
|
56
|
-
list(): UserRecord[];
|
|
57
|
-
update(id: string, updates: Partial<UserRecord>): void;
|
|
58
|
-
delete(id: string): void;
|
|
59
|
-
getByResetToken(tokenHash: string): UserRecord | undefined;
|
|
60
|
-
getByVerificationToken(tokenHash: string): UserRecord | undefined;
|
|
61
|
-
getByStripeCustomerId(customerId: string): UserRecord | undefined;
|
|
62
|
-
count(): number;
|
|
63
|
-
}
|
|
64
|
-
export declare class SessionStore {
|
|
65
|
-
private sessions;
|
|
66
|
-
create(userId: string): SessionRecord;
|
|
67
|
-
get(token: string): SessionRecord | undefined;
|
|
68
|
-
destroy(token: string): void;
|
|
69
|
-
setPendingServerToken(sessionToken: string, slug: string, token: string): void;
|
|
70
|
-
consumePendingServerToken(sessionToken: string, slug: string): string | undefined;
|
|
71
|
-
cleanup(): void;
|
|
72
|
-
}
|
|
73
|
-
export declare const userStore: UserStore;
|
|
74
|
-
export declare const sessionStore: SessionStore;
|
|
75
|
-
/**
|
|
76
|
-
* Look up a user by ID, preferring the Pg store when available.
|
|
77
|
-
*/
|
|
78
|
-
export declare function getUserById(id: string): Promise<UserRecord | undefined>;
|
|
79
|
-
/**
|
|
80
|
-
* Look up a user by email, preferring the Pg store when available.
|
|
81
|
-
*/
|
|
82
|
-
export declare function getUserByEmail(email: string): Promise<UserRecord | undefined>;
|
|
83
|
-
/**
|
|
84
|
-
* Look up a user by Stripe customer ID, preferring the Pg store when available.
|
|
85
|
-
*/
|
|
86
|
-
export declare function getUserByStripeCustomerId(customerId: string): Promise<UserRecord | undefined>;
|
|
87
|
-
/**
|
|
88
|
-
* Look up a user by email verification token hash.
|
|
89
|
-
*/
|
|
90
|
-
export declare function getUserByVerificationToken(tokenHash: string): Promise<UserRecord | undefined>;
|
|
91
|
-
/**
|
|
92
|
-
* Create a user, persisting to Pg when available, otherwise in-memory.
|
|
93
|
-
*/
|
|
94
|
-
export declare function createUser(record: UserRecord): Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
* Update a user, persisting to Pg when available, otherwise in-memory.
|
|
97
|
-
*/
|
|
98
|
-
export declare function updateUser(id: string, updates: Partial<UserRecord>): Promise<void>;
|
|
99
|
-
/**
|
|
100
|
-
* Delete a user, removing from Pg when available, otherwise in-memory.
|
|
101
|
-
*/
|
|
102
|
-
export declare function deleteUser(id: string): Promise<void>;
|
|
103
|
-
/**
|
|
104
|
-
* Count users, preferring Pg when available.
|
|
105
|
-
*/
|
|
106
|
-
export declare function countUsers(): Promise<number>;
|
|
107
|
-
/**
|
|
108
|
-
* List all users, preferring Pg when available.
|
|
109
|
-
*/
|
|
110
|
-
export declare function listUsers(): Promise<UserRecord[]>;
|
|
111
|
-
/**
|
|
112
|
-
* Get a session by token, preferring Pg when available.
|
|
113
|
-
*/
|
|
114
|
-
export declare function getSession(token: string): Promise<SessionRecord | undefined>;
|
|
115
|
-
/**
|
|
116
|
-
* Create a session, persisting to Pg when available, otherwise in-memory.
|
|
117
|
-
* Note: anonymous sessions (userId === '__anon__') always use in-memory
|
|
118
|
-
* because the Pg sessions table has a FK constraint on users(id).
|
|
119
|
-
*/
|
|
120
|
-
export declare function createSession(userId: string): Promise<SessionRecord>;
|
|
121
|
-
/**
|
|
122
|
-
* Destroy a session, removing from Pg when available, otherwise in-memory.
|
|
123
|
-
* Destroys from both stores to handle sessions that may have been created
|
|
124
|
-
* in-memory (anon sessions) even when Pg is available.
|
|
125
|
-
*/
|
|
126
|
-
export declare function destroySession(token: string): Promise<void>;
|
|
127
|
-
/**
|
|
128
|
-
* Set a pending server token on a session.
|
|
129
|
-
*/
|
|
130
|
-
export declare function setPendingToken(sessionToken: string, slug: string, serverBearerToken: string): Promise<void>;
|
|
131
|
-
/**
|
|
132
|
-
* Consume a pending server token from a session.
|
|
133
|
-
*/
|
|
134
|
-
export declare function consumePendingToken(sessionToken: string, slug: string): Promise<string | undefined>;
|
|
135
|
-
/**
|
|
136
|
-
* Clean up expired sessions from both stores.
|
|
137
|
-
*/
|
|
138
|
-
export declare function cleanupSessions(): Promise<void>;
|
|
139
|
-
/**
|
|
140
|
-
* Generate a password reset token.
|
|
141
|
-
* Returns the raw token (for the email link) and its SHA-256 hash (for storage).
|
|
142
|
-
*/
|
|
143
|
-
export declare function generateResetToken(): {
|
|
144
|
-
token: string;
|
|
145
|
-
hash: string;
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Hash a reset token for lookup.
|
|
149
|
-
*/
|
|
150
|
-
export declare function hashResetToken(token: string): string;
|
|
151
|
-
/**
|
|
152
|
-
* Store a password reset token for a user.
|
|
153
|
-
*/
|
|
154
|
-
export declare function setPasswordResetToken(userId: string, tokenHash: string): Promise<void>;
|
|
155
|
-
/**
|
|
156
|
-
* Look up a user by their password reset token hash.
|
|
157
|
-
* Returns undefined if token is invalid or expired.
|
|
158
|
-
*/
|
|
159
|
-
export declare function getUserByResetToken(tokenHash: string): Promise<UserRecord | undefined>;
|
|
160
|
-
/**
|
|
161
|
-
* Whether email verification is enforced for this deployment. Enforced when a
|
|
162
|
-
* mailer is configured (production) or explicitly requested. In pure dev (no
|
|
163
|
-
* SMTP) the flow still works — the link is logged to the console — but server
|
|
164
|
-
* creation is not blocked, so local testing isn't impeded.
|
|
165
|
-
*/
|
|
166
|
-
export declare function isEmailVerificationRequired(): boolean;
|
|
167
|
-
/**
|
|
168
|
-
* Generate an email verification token. Returns the raw token (for the link)
|
|
169
|
-
* and its SHA-256 hash (for storage).
|
|
170
|
-
*/
|
|
171
|
-
export declare function generateVerificationToken(): {
|
|
172
|
-
token: string;
|
|
173
|
-
hash: string;
|
|
174
|
-
};
|
|
175
|
-
/** Hash a verification token for lookup. */
|
|
176
|
-
export declare function hashVerificationToken(token: string): string;
|
|
177
|
-
/** Store a pending email verification token hash for a user. */
|
|
178
|
-
export declare function setEmailVerificationToken(userId: string, tokenHash: string): Promise<void>;
|
|
179
|
-
/** Mark a user's email as verified and clear the pending token. */
|
|
180
|
-
export declare function markEmailVerified(userId: string): Promise<void>;
|
|
181
|
-
/** Clear a user's email verification token. */
|
|
182
|
-
export declare function clearEmailVerificationToken(userId: string): Promise<void>;
|
|
183
|
-
/**
|
|
184
|
-
* Clear a user's password reset token after successful reset.
|
|
185
|
-
*/
|
|
186
|
-
export declare function clearPasswordResetToken(userId: string): Promise<void>;
|
|
187
|
-
/**
|
|
188
|
-
* Parse the mf_session cookie from request headers.
|
|
189
|
-
*/
|
|
190
|
-
export declare function getSessionToken(req: http.IncomingMessage): string | undefined;
|
|
191
|
-
/**
|
|
192
|
-
* Set session cookie on response.
|
|
193
|
-
* Cookie: mf_session={token}; HttpOnly; SameSite=Strict; Path=/; Max-Age=604800
|
|
194
|
-
* Adds Secure when the request is HTTPS or forwarded as HTTPS.
|
|
195
|
-
*/
|
|
196
|
-
export declare function setSessionCookie(res: http.ServerResponse, req: http.IncomingMessage, token: string): void;
|
|
197
|
-
/**
|
|
198
|
-
* Clear session cookie on response.
|
|
199
|
-
*/
|
|
200
|
-
export declare function clearSessionCookie(res: http.ServerResponse, req: http.IncomingMessage): void;
|
|
201
|
-
/**
|
|
202
|
-
* Get authenticated user from request, or null.
|
|
203
|
-
* Reads the mf_session cookie, looks up the session, then the user.
|
|
204
|
-
* Tries Pg stores first when available, falls back to in-memory.
|
|
205
|
-
*/
|
|
206
|
-
export declare function getAuthenticatedUser(req: http.IncomingMessage): Promise<{
|
|
207
|
-
user: UserRecord;
|
|
208
|
-
session: SessionRecord;
|
|
209
|
-
} | null>;
|
|
210
|
-
/**
|
|
211
|
-
* Require authentication. Returns user+session or sends 302 redirect to /login.
|
|
212
|
-
* Returns null if the redirect was sent (caller should stop processing).
|
|
213
|
-
*/
|
|
214
|
-
export declare function requireAuth(req: http.IncomingMessage, res: http.ServerResponse): Promise<{
|
|
215
|
-
user: UserRecord;
|
|
216
|
-
session: SessionRecord;
|
|
217
|
-
} | null>;
|
|
218
|
-
/**
|
|
219
|
-
* Require admin. Returns user+session or sends 403.
|
|
220
|
-
* Returns null if the error response was sent (caller should stop processing).
|
|
221
|
-
*/
|
|
222
|
-
export declare function requireAdmin(req: http.IncomingMessage, res: http.ServerResponse): Promise<{
|
|
223
|
-
user: UserRecord;
|
|
224
|
-
session: SessionRecord;
|
|
225
|
-
} | null>;
|