@frontmcp/sdk 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{src/auth → auth}/instances/instance.local-primary-auth.d.ts +1 -1
- package/{src/auth → auth}/instances/instance.remote-primary-auth.d.ts +1 -1
- package/{src/common → common}/interfaces/internal/primary-auth-provider.interface.d.ts +1 -4
- package/{src/common → common}/metadata/front-mcp.metadata.d.ts +1074 -44
- package/common/types/options/auth/app-auth.schema.d.ts +275 -0
- package/common/types/options/auth/auth.interfaces.d.ts +461 -0
- package/common/types/options/auth/auth.schema.d.ts +284 -0
- package/common/types/options/auth/auth.utils.d.ts +32 -0
- package/common/types/options/auth/index.d.ts +16 -0
- package/common/types/options/auth/orchestrated.schema.d.ts +381 -0
- package/common/types/options/auth/public.schema.d.ts +42 -0
- package/common/types/options/auth/shared.schemas.d.ts +120 -0
- package/common/types/options/auth/transparent.schema.d.ts +56 -0
- package/common/types/options/auth/transport.deprecated.d.ts +63 -0
- package/{src/common → common}/types/options/index.d.ts +1 -1
- package/{src/common → common}/types/options/transport.options.d.ts +6 -1
- package/{src/common → common}/utils/decide-request-intent.utils.d.ts +6 -7
- package/esm/index.mjs +22664 -0
- package/esm/mcp-apps/index.mjs +723 -0
- package/esm/package.json +81 -0
- package/index.js +22957 -0
- package/logger/logger.tokens.d.ts +1 -0
- package/mcp-apps/index.js +799 -0
- package/package.json +26 -13
- package/README.md +0 -461
- package/src/adapter/adapter.instance.js +0 -70
- package/src/adapter/adapter.instance.js.map +0 -1
- package/src/adapter/adapter.regsitry.js +0 -54
- package/src/adapter/adapter.regsitry.js.map +0 -1
- package/src/adapter/adapter.utils.js +0 -83
- package/src/adapter/adapter.utils.js.map +0 -1
- package/src/app/app.registry.js +0 -66
- package/src/app/app.registry.js.map +0 -1
- package/src/app/app.utils.js +0 -58
- package/src/app/app.utils.js.map +0 -1
- package/src/app/instances/app.local.instance.js +0 -67
- package/src/app/instances/app.local.instance.js.map +0 -1
- package/src/app/instances/app.remote.instance.js +0 -36
- package/src/app/instances/app.remote.instance.js.map +0 -1
- package/src/app/instances/index.js +0 -6
- package/src/app/instances/index.js.map +0 -1
- package/src/auth/auth.registry.js +0 -219
- package/src/auth/auth.registry.js.map +0 -1
- package/src/auth/auth.utils.js +0 -84
- package/src/auth/auth.utils.js.map +0 -1
- package/src/auth/authorization/authorization.class.js +0 -217
- package/src/auth/authorization/authorization.class.js.map +0 -1
- package/src/auth/authorization/authorization.types.js +0 -79
- package/src/auth/authorization/authorization.types.js.map +0 -1
- package/src/auth/authorization/index.js +0 -19
- package/src/auth/authorization/index.js.map +0 -1
- package/src/auth/authorization/orchestrated.authorization.js +0 -306
- package/src/auth/authorization/orchestrated.authorization.js.map +0 -1
- package/src/auth/authorization/public.authorization.js +0 -132
- package/src/auth/authorization/public.authorization.js.map +0 -1
- package/src/auth/authorization/transparent.authorization.js +0 -147
- package/src/auth/authorization/transparent.authorization.js.map +0 -1
- package/src/auth/consent/consent.types.js +0 -119
- package/src/auth/consent/consent.types.js.map +0 -1
- package/src/auth/consent/index.js +0 -13
- package/src/auth/consent/index.js.map +0 -1
- package/src/auth/detection/auth-provider-detection.js +0 -230
- package/src/auth/detection/auth-provider-detection.js.map +0 -1
- package/src/auth/detection/index.js +0 -15
- package/src/auth/detection/index.js.map +0 -1
- package/src/auth/flows/auth.verify.flow.js +0 -379
- package/src/auth/flows/auth.verify.flow.js.map +0 -1
- package/src/auth/flows/oauth.authorize.flow.js +0 -822
- package/src/auth/flows/oauth.authorize.flow.js.map +0 -1
- package/src/auth/flows/oauth.callback.flow.js +0 -357
- package/src/auth/flows/oauth.callback.flow.js.map +0 -1
- package/src/auth/flows/oauth.register.flow.js +0 -201
- package/src/auth/flows/oauth.register.flow.js.map +0 -1
- package/src/auth/flows/oauth.token.flow.js +0 -319
- package/src/auth/flows/oauth.token.flow.js.map +0 -1
- package/src/auth/flows/session.verify.flow.js +0 -304
- package/src/auth/flows/session.verify.flow.js.map +0 -1
- package/src/auth/flows/well-known.jwks.flow.js +0 -89
- package/src/auth/flows/well-known.jwks.flow.js.map +0 -1
- package/src/auth/flows/well-known.oauth-authorization-server.flow.js +0 -122
- package/src/auth/flows/well-known.oauth-authorization-server.flow.js.map +0 -1
- package/src/auth/flows/well-known.prm.flow.js +0 -106
- package/src/auth/flows/well-known.prm.flow.js.map +0 -1
- package/src/auth/instances/instance.local-primary-auth.js +0 -308
- package/src/auth/instances/instance.local-primary-auth.js.map +0 -1
- package/src/auth/instances/instance.remote-primary-auth.js +0 -49
- package/src/auth/instances/instance.remote-primary-auth.js.map +0 -1
- package/src/auth/jwks/dev-key-persistence.js +0 -219
- package/src/auth/jwks/dev-key-persistence.js.map +0 -1
- package/src/auth/jwks/index.js +0 -7
- package/src/auth/jwks/index.js.map +0 -1
- package/src/auth/jwks/jwks.service.js +0 -303
- package/src/auth/jwks/jwks.service.js.map +0 -1
- package/src/auth/jwks/jwks.types.js +0 -3
- package/src/auth/jwks/jwks.types.js.map +0 -1
- package/src/auth/jwks/jwks.utils.js +0 -32
- package/src/auth/jwks/jwks.utils.js.map +0 -1
- package/src/auth/machine-id.js +0 -32
- package/src/auth/machine-id.js.map +0 -1
- package/src/auth/oauth/flows/oauth.authorize.flow.js +0 -33
- package/src/auth/oauth/flows/oauth.authorize.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.device-authorization.flow.js +0 -48
- package/src/auth/oauth/flows/oauth.device-authorization.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.introspect.flow.js +0 -28
- package/src/auth/oauth/flows/oauth.introspect.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.par.flow.js +0 -29
- package/src/auth/oauth/flows/oauth.par.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.revoke.flow.js +0 -27
- package/src/auth/oauth/flows/oauth.revoke.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.token.flow.js +0 -59
- package/src/auth/oauth/flows/oauth.token.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.userinfo.flow.js +0 -24
- package/src/auth/oauth/flows/oauth.userinfo.flow.js.map +0 -1
- package/src/auth/oauth/flows/oidc.logout.flow.js +0 -20
- package/src/auth/oauth/flows/oidc.logout.flow.js.map +0 -1
- package/src/auth/session/authorization-vault.js +0 -817
- package/src/auth/session/authorization-vault.js.map +0 -1
- package/src/auth/session/authorization.store.js +0 -323
- package/src/auth/session/authorization.store.js.map +0 -1
- package/src/auth/session/encrypted-authorization-vault.js +0 -493
- package/src/auth/session/encrypted-authorization-vault.js.map +0 -1
- package/src/auth/session/index.js +0 -18
- package/src/auth/session/index.js.map +0 -1
- package/src/auth/session/record/session.base.js +0 -125
- package/src/auth/session/record/session.base.js.map +0 -1
- package/src/auth/session/record/session.stateful.js +0 -55
- package/src/auth/session/record/session.stateful.js.map +0 -1
- package/src/auth/session/record/session.stateless.js +0 -32
- package/src/auth/session/record/session.stateless.js.map +0 -1
- package/src/auth/session/record/session.transparent.js +0 -22
- package/src/auth/session/record/session.transparent.js.map +0 -1
- package/src/auth/session/redis-session.store.js +0 -204
- package/src/auth/session/redis-session.store.js.map +0 -1
- package/src/auth/session/session.crypto.js +0 -47
- package/src/auth/session/session.crypto.js.map +0 -1
- package/src/auth/session/session.schema.js +0 -13
- package/src/auth/session/session.schema.js.map +0 -1
- package/src/auth/session/session.service.js +0 -105
- package/src/auth/session/session.service.js.map +0 -1
- package/src/auth/session/session.transport.js +0 -20
- package/src/auth/session/session.transport.js.map +0 -1
- package/src/auth/session/session.types.js +0 -4
- package/src/auth/session/session.types.js.map +0 -1
- package/src/auth/session/token.refresh.js +0 -63
- package/src/auth/session/token.refresh.js.map +0 -1
- package/src/auth/session/token.store.js +0 -53
- package/src/auth/session/token.store.js.map +0 -1
- package/src/auth/session/token.vault.js +0 -54
- package/src/auth/session/token.vault.js.map +0 -1
- package/src/auth/session/transport-session.manager.js +0 -298
- package/src/auth/session/transport-session.manager.js.map +0 -1
- package/src/auth/session/transport-session.types.js +0 -111
- package/src/auth/session/transport-session.types.js.map +0 -1
- package/src/auth/session/utils/auth-token.utils.js +0 -57
- package/src/auth/session/utils/auth-token.utils.js.map +0 -1
- package/src/auth/session/utils/session-id.utils.js +0 -217
- package/src/auth/session/utils/session-id.utils.js.map +0 -1
- package/src/auth/session/utils/tiny-ttl-cache.js +0 -26
- package/src/auth/session/utils/tiny-ttl-cache.js.map +0 -1
- package/src/auth/session/vault-encryption.js +0 -263
- package/src/auth/session/vault-encryption.js.map +0 -1
- package/src/auth/session/vercel-kv-session.store.js +0 -216
- package/src/auth/session/vercel-kv-session.store.js.map +0 -1
- package/src/auth/ui/base-layout.js +0 -279
- package/src/auth/ui/base-layout.js.map +0 -1
- package/src/auth/ui/index.js +0 -34
- package/src/auth/ui/index.js.map +0 -1
- package/src/auth/ui/templates.js +0 -426
- package/src/auth/ui/templates.js.map +0 -1
- package/src/auth/utils/audience.validator.js +0 -196
- package/src/auth/utils/audience.validator.js.map +0 -1
- package/src/auth/utils/index.js +0 -7
- package/src/auth/utils/index.js.map +0 -1
- package/src/auth/utils/www-authenticate.utils.js +0 -183
- package/src/auth/utils/www-authenticate.utils.js.map +0 -1
- package/src/common/common.schema.js +0 -35
- package/src/common/common.schema.js.map +0 -1
- package/src/common/constants.js +0 -13
- package/src/common/constants.js.map +0 -1
- package/src/common/decorators/adapter.decorator.js +0 -20
- package/src/common/decorators/adapter.decorator.js.map +0 -1
- package/src/common/decorators/app.decorator.js +0 -44
- package/src/common/decorators/app.decorator.js.map +0 -1
- package/src/common/decorators/auth-provider.decorator.js +0 -20
- package/src/common/decorators/auth-provider.decorator.js.map +0 -1
- package/src/common/decorators/decorator-utils.js +0 -195
- package/src/common/decorators/decorator-utils.js.map +0 -1
- package/src/common/decorators/flow.decorator.js +0 -19
- package/src/common/decorators/flow.decorator.js.map +0 -1
- package/src/common/decorators/front-mcp.decorator.js +0 -64
- package/src/common/decorators/front-mcp.decorator.js.map +0 -1
- package/src/common/decorators/hook.decorator.js +0 -178
- package/src/common/decorators/hook.decorator.js.map +0 -1
- package/src/common/decorators/index.js +0 -16
- package/src/common/decorators/index.js.map +0 -1
- package/src/common/decorators/logger.decorator.js +0 -20
- package/src/common/decorators/logger.decorator.js.map +0 -1
- package/src/common/decorators/plugin.decorator.js +0 -39
- package/src/common/decorators/plugin.decorator.js.map +0 -1
- package/src/common/decorators/prompt.decorator.js +0 -38
- package/src/common/decorators/prompt.decorator.js.map +0 -1
- package/src/common/decorators/provider.decorator.js +0 -20
- package/src/common/decorators/provider.decorator.js.map +0 -1
- package/src/common/decorators/resource.decorator.js +0 -94
- package/src/common/decorators/resource.decorator.js.map +0 -1
- package/src/common/decorators/tool.decorator.js +0 -45
- package/src/common/decorators/tool.decorator.js.map +0 -1
- package/src/common/dynamic/dynamic.adapter.js +0 -28
- package/src/common/dynamic/dynamic.adapter.js.map +0 -1
- package/src/common/dynamic/dynamic.plugin.js +0 -42
- package/src/common/dynamic/dynamic.plugin.js.map +0 -1
- package/src/common/dynamic/dynamic.utils.js +0 -27
- package/src/common/dynamic/dynamic.utils.js.map +0 -1
- package/src/common/dynamic/index.js +0 -6
- package/src/common/dynamic/index.js.map +0 -1
- package/src/common/entries/adapter.entry.js +0 -8
- package/src/common/entries/adapter.entry.js.map +0 -1
- package/src/common/entries/app.entry.js +0 -9
- package/src/common/entries/app.entry.js.map +0 -1
- package/src/common/entries/auth-provider.entry.js +0 -8
- package/src/common/entries/auth-provider.entry.js.map +0 -1
- package/src/common/entries/base.entry.js +0 -17
- package/src/common/entries/base.entry.js.map +0 -1
- package/src/common/entries/flow.entry.js +0 -21
- package/src/common/entries/flow.entry.js.map +0 -1
- package/src/common/entries/hook.entry.js +0 -20
- package/src/common/entries/hook.entry.js.map +0 -1
- package/src/common/entries/index.js +0 -17
- package/src/common/entries/index.js.map +0 -1
- package/src/common/entries/logger.entry.js +0 -8
- package/src/common/entries/logger.entry.js.map +0 -1
- package/src/common/entries/plugin.entry.js +0 -8
- package/src/common/entries/plugin.entry.js.map +0 -1
- package/src/common/entries/prompt.entry.js +0 -18
- package/src/common/entries/prompt.entry.js.map +0 -1
- package/src/common/entries/provider.entry.js +0 -8
- package/src/common/entries/provider.entry.js.map +0 -1
- package/src/common/entries/resource.entry.js +0 -35
- package/src/common/entries/resource.entry.js.map +0 -1
- package/src/common/entries/scope.entry.js +0 -14
- package/src/common/entries/scope.entry.js.map +0 -1
- package/src/common/entries/tool.entry.js +0 -31
- package/src/common/entries/tool.entry.js.map +0 -1
- package/src/common/flow/flow.utils.js +0 -96
- package/src/common/flow/flow.utils.js.map +0 -1
- package/src/common/index.js +0 -20
- package/src/common/index.js.map +0 -1
- package/src/common/interfaces/adapter.interface.js +0 -3
- package/src/common/interfaces/adapter.interface.js.map +0 -1
- package/src/common/interfaces/app.interface.js +0 -3
- package/src/common/interfaces/app.interface.js.map +0 -1
- package/src/common/interfaces/auth-hook.interface.js +0 -135
- package/src/common/interfaces/auth-hook.interface.js.map +0 -1
- package/src/common/interfaces/auth-provider.interface.js +0 -18
- package/src/common/interfaces/auth-provider.interface.js.map +0 -1
- package/src/common/interfaces/base.interface.js +0 -3
- package/src/common/interfaces/base.interface.js.map +0 -1
- package/src/common/interfaces/execution-context.interface.js +0 -166
- package/src/common/interfaces/execution-context.interface.js.map +0 -1
- package/src/common/interfaces/flow.interface.js +0 -95
- package/src/common/interfaces/flow.interface.js.map +0 -1
- package/src/common/interfaces/front-mcp.interface.js +0 -3
- package/src/common/interfaces/front-mcp.interface.js.map +0 -1
- package/src/common/interfaces/hook.interface.js +0 -3
- package/src/common/interfaces/hook.interface.js.map +0 -1
- package/src/common/interfaces/index.js +0 -21
- package/src/common/interfaces/index.js.map +0 -1
- package/src/common/interfaces/internal/flow.utils.js +0 -83
- package/src/common/interfaces/internal/flow.utils.js.map +0 -1
- package/src/common/interfaces/internal/index.js +0 -7
- package/src/common/interfaces/internal/index.js.map +0 -1
- package/src/common/interfaces/internal/primary-auth-provider.interface.js +0 -81
- package/src/common/interfaces/internal/primary-auth-provider.interface.js.map +0 -1
- package/src/common/interfaces/internal/registry.interface.js +0 -3
- package/src/common/interfaces/internal/registry.interface.js.map +0 -1
- package/src/common/interfaces/logger.interface.js +0 -10
- package/src/common/interfaces/logger.interface.js.map +0 -1
- package/src/common/interfaces/plugin.interface.js +0 -3
- package/src/common/interfaces/plugin.interface.js.map +0 -1
- package/src/common/interfaces/prompt.interface.js +0 -81
- package/src/common/interfaces/prompt.interface.js.map +0 -1
- package/src/common/interfaces/provider.interface.js +0 -18
- package/src/common/interfaces/provider.interface.js.map +0 -1
- package/src/common/interfaces/resource.interface.js +0 -56
- package/src/common/interfaces/resource.interface.js.map +0 -1
- package/src/common/interfaces/scope.interface.js +0 -3
- package/src/common/interfaces/scope.interface.js.map +0 -1
- package/src/common/interfaces/server.interface.js +0 -18
- package/src/common/interfaces/server.interface.js.map +0 -1
- package/src/common/interfaces/session-hook.interface.js +0 -140
- package/src/common/interfaces/session-hook.interface.js.map +0 -1
- package/src/common/interfaces/tool-hook.interface.js +0 -92
- package/src/common/interfaces/tool-hook.interface.js.map +0 -1
- package/src/common/interfaces/tool.interface.js +0 -117
- package/src/common/interfaces/tool.interface.js.map +0 -1
- package/src/common/metadata/adapter.metadata.js +0 -10
- package/src/common/metadata/adapter.metadata.js.map +0 -1
- package/src/common/metadata/app.metadata.js +0 -30
- package/src/common/metadata/app.metadata.js.map +0 -1
- package/src/common/metadata/auth-provider.metadata.js +0 -19
- package/src/common/metadata/auth-provider.metadata.js.map +0 -1
- package/src/common/metadata/flow.metadata.js +0 -15
- package/src/common/metadata/flow.metadata.js.map +0 -1
- package/src/common/metadata/front-mcp.metadata.js +0 -30
- package/src/common/metadata/front-mcp.metadata.js.map +0 -1
- package/src/common/metadata/hook.metadata.js +0 -3
- package/src/common/metadata/hook.metadata.js.map +0 -1
- package/src/common/metadata/index.js +0 -17
- package/src/common/metadata/index.js.map +0 -1
- package/src/common/metadata/logger.metadata.js +0 -10
- package/src/common/metadata/logger.metadata.js.map +0 -1
- package/src/common/metadata/plugin.metadata.js +0 -18
- package/src/common/metadata/plugin.metadata.js.map +0 -1
- package/src/common/metadata/prompt.metadata.js +0 -27
- package/src/common/metadata/prompt.metadata.js.map +0 -1
- package/src/common/metadata/provider.metadata.js +0 -36
- package/src/common/metadata/provider.metadata.js.map +0 -1
- package/src/common/metadata/resource.metadata.js +0 -31
- package/src/common/metadata/resource.metadata.js.map +0 -1
- package/src/common/metadata/tool-ui.metadata.js +0 -12
- package/src/common/metadata/tool-ui.metadata.js.map +0 -1
- package/src/common/metadata/tool.metadata.js +0 -55
- package/src/common/metadata/tool.metadata.js.map +0 -1
- package/src/common/migrate/auth-transport.migrate.js +0 -140
- package/src/common/migrate/auth-transport.migrate.js.map +0 -1
- package/src/common/migrate/index.js +0 -6
- package/src/common/migrate/index.js.map +0 -1
- package/src/common/providers/base-config.provider.js +0 -128
- package/src/common/providers/base-config.provider.js.map +0 -1
- package/src/common/records/adapter.record.js +0 -11
- package/src/common/records/adapter.record.js.map +0 -1
- package/src/common/records/app.record.js +0 -9
- package/src/common/records/app.record.js.map +0 -1
- package/src/common/records/auth-provider.record.js +0 -12
- package/src/common/records/auth-provider.record.js.map +0 -1
- package/src/common/records/flow.record.js +0 -8
- package/src/common/records/flow.record.js.map +0 -1
- package/src/common/records/hook.record.js +0 -8
- package/src/common/records/hook.record.js.map +0 -1
- package/src/common/records/index.js +0 -16
- package/src/common/records/index.js.map +0 -1
- package/src/common/records/logger.record.js +0 -8
- package/src/common/records/logger.record.js.map +0 -1
- package/src/common/records/plugin.record.js +0 -11
- package/src/common/records/plugin.record.js.map +0 -1
- package/src/common/records/prompt.record.js +0 -9
- package/src/common/records/prompt.record.js.map +0 -1
- package/src/common/records/provider.record.js +0 -14
- package/src/common/records/provider.record.js.map +0 -1
- package/src/common/records/resource.record.js +0 -20
- package/src/common/records/resource.record.js.map +0 -1
- package/src/common/records/scope.record.js +0 -9
- package/src/common/records/scope.record.js.map +0 -1
- package/src/common/records/tool.record.js +0 -9
- package/src/common/records/tool.record.js.map +0 -1
- package/src/common/schemas/annotated-class.schema.js +0 -109
- package/src/common/schemas/annotated-class.schema.js.map +0 -1
- package/src/common/schemas/http-input.schema.js +0 -13
- package/src/common/schemas/http-input.schema.js.map +0 -1
- package/src/common/schemas/http-output.schema.js +0 -321
- package/src/common/schemas/http-output.schema.js.map +0 -1
- package/src/common/schemas/index.js +0 -8
- package/src/common/schemas/index.js.map +0 -1
- package/src/common/schemas/session-header.schema.js +0 -42
- package/src/common/schemas/session-header.schema.js.map +0 -1
- package/src/common/tokens/adapter.tokens.js +0 -11
- package/src/common/tokens/adapter.tokens.js.map +0 -1
- package/src/common/tokens/app.tokens.js +0 -30
- package/src/common/tokens/app.tokens.js.map +0 -1
- package/src/common/tokens/auth-provider.tokens.js +0 -12
- package/src/common/tokens/auth-provider.tokens.js.map +0 -1
- package/src/common/tokens/base.tokens.js +0 -9
- package/src/common/tokens/base.tokens.js.map +0 -1
- package/src/common/tokens/flow-hook.tokens.js +0 -9
- package/src/common/tokens/flow-hook.tokens.js.map +0 -1
- package/src/common/tokens/flow.tokens.js +0 -16
- package/src/common/tokens/flow.tokens.js.map +0 -1
- package/src/common/tokens/front-mcp.tokens.js +0 -25
- package/src/common/tokens/front-mcp.tokens.js.map +0 -1
- package/src/common/tokens/index.js +0 -17
- package/src/common/tokens/index.js.map +0 -1
- package/src/common/tokens/logger.tokens.js +0 -11
- package/src/common/tokens/logger.tokens.js.map +0 -1
- package/src/common/tokens/plugin.tokens.js +0 -18
- package/src/common/tokens/plugin.tokens.js.map +0 -1
- package/src/common/tokens/prompt.tokens.js +0 -14
- package/src/common/tokens/prompt.tokens.js.map +0 -1
- package/src/common/tokens/provider.tokens.js +0 -12
- package/src/common/tokens/provider.tokens.js.map +0 -1
- package/src/common/tokens/resource.tokens.js +0 -28
- package/src/common/tokens/resource.tokens.js.map +0 -1
- package/src/common/tokens/server.tokens.js +0 -11
- package/src/common/tokens/server.tokens.js.map +0 -1
- package/src/common/tokens/tool.tokens.js +0 -21
- package/src/common/tokens/tool.tokens.js.map +0 -1
- package/src/common/types/auth/index.js +0 -6
- package/src/common/types/auth/index.js.map +0 -1
- package/src/common/types/auth/jwt.types.js +0 -36
- package/src/common/types/auth/jwt.types.js.map +0 -1
- package/src/common/types/auth/session.types.js +0 -53
- package/src/common/types/auth/session.types.js.map +0 -1
- package/src/common/types/common.types.js +0 -3
- package/src/common/types/common.types.js.map +0 -1
- package/src/common/types/index.js +0 -7
- package/src/common/types/index.js.map +0 -1
- package/src/common/types/options/auth.options.d.ts +0 -1266
- package/src/common/types/options/auth.options.js +0 -560
- package/src/common/types/options/auth.options.js.map +0 -1
- package/src/common/types/options/http.options.js +0 -10
- package/src/common/types/options/http.options.js.map +0 -1
- package/src/common/types/options/index.js +0 -11
- package/src/common/types/options/index.js.map +0 -1
- package/src/common/types/options/logging.options.js +0 -33
- package/src/common/types/options/logging.options.js.map +0 -1
- package/src/common/types/options/redis.options.js +0 -191
- package/src/common/types/options/redis.options.js.map +0 -1
- package/src/common/types/options/server-info.options.js +0 -13
- package/src/common/types/options/server-info.options.js.map +0 -1
- package/src/common/types/options/session.options.js +0 -32
- package/src/common/types/options/session.options.js.map +0 -1
- package/src/common/types/options/transport.options.js +0 -121
- package/src/common/types/options/transport.options.js.map +0 -1
- package/src/common/utils/decide-request-intent.utils.js +0 -391
- package/src/common/utils/decide-request-intent.utils.js.map +0 -1
- package/src/common/utils/global-config.utils.js +0 -44
- package/src/common/utils/global-config.utils.js.map +0 -1
- package/src/common/utils/index.js +0 -7
- package/src/common/utils/index.js.map +0 -1
- package/src/common/utils/path.utils.js +0 -66
- package/src/common/utils/path.utils.js.map +0 -1
- package/src/completion/flows/complete.flow.js +0 -199
- package/src/completion/flows/complete.flow.js.map +0 -1
- package/src/context/frontmcp-context-storage.js +0 -183
- package/src/context/frontmcp-context-storage.js.map +0 -1
- package/src/context/frontmcp-context.js +0 -360
- package/src/context/frontmcp-context.js.map +0 -1
- package/src/context/frontmcp-context.provider.js +0 -61
- package/src/context/frontmcp-context.provider.js.map +0 -1
- package/src/context/index.js +0 -64
- package/src/context/index.js.map +0 -1
- package/src/context/request-context-storage.js +0 -183
- package/src/context/request-context-storage.js.map +0 -1
- package/src/context/request-context.js +0 -209
- package/src/context/request-context.js.map +0 -1
- package/src/context/request-context.provider.js +0 -51
- package/src/context/request-context.provider.js.map +0 -1
- package/src/context/session-key.provider.js +0 -65
- package/src/context/session-key.provider.js.map +0 -1
- package/src/context/trace-context.js +0 -142
- package/src/context/trace-context.js.map +0 -1
- package/src/errors/authorization-required.error.js +0 -274
- package/src/errors/authorization-required.error.js.map +0 -1
- package/src/errors/error-handler.js +0 -107
- package/src/errors/error-handler.js.map +0 -1
- package/src/errors/index.js +0 -45
- package/src/errors/index.js.map +0 -1
- package/src/errors/mcp.error.js +0 -416
- package/src/errors/mcp.error.js.map +0 -1
- package/src/exceptions/mcp-exceptions/session-missing.exception.js +0 -11
- package/src/exceptions/mcp-exceptions/session-missing.exception.js.map +0 -1
- package/src/exceptions/mcp-exceptions/unsupported-client-version.exception.js +0 -15
- package/src/exceptions/mcp-exceptions/unsupported-client-version.exception.js.map +0 -1
- package/src/flows/flow.instance.js +0 -420
- package/src/flows/flow.instance.js.map +0 -1
- package/src/flows/flow.registry.js +0 -121
- package/src/flows/flow.registry.js.map +0 -1
- package/src/flows/flow.stages.js +0 -113
- package/src/flows/flow.stages.js.map +0 -1
- package/src/flows/flow.utils.js +0 -36
- package/src/flows/flow.utils.js.map +0 -1
- package/src/front-mcp/front-mcp.js +0 -63
- package/src/front-mcp/front-mcp.js.map +0 -1
- package/src/front-mcp/front-mcp.providers.js +0 -29
- package/src/front-mcp/front-mcp.providers.js.map +0 -1
- package/src/front-mcp/front-mcp.tokens.js +0 -5
- package/src/front-mcp/front-mcp.tokens.js.map +0 -1
- package/src/front-mcp/index.js +0 -8
- package/src/front-mcp/index.js.map +0 -1
- package/src/front-mcp/serverless-handler.js +0 -61
- package/src/front-mcp/serverless-handler.js.map +0 -1
- package/src/hooks/hook.instance.js +0 -26
- package/src/hooks/hook.instance.js.map +0 -1
- package/src/hooks/hook.registry.js +0 -152
- package/src/hooks/hook.registry.js.map +0 -1
- package/src/hooks/hooks.utils.js +0 -34
- package/src/hooks/hooks.utils.js.map +0 -1
- package/src/index.js +0 -37
- package/src/index.js.map +0 -1
- package/src/logger/instances/instance.console-logger.js +0 -75
- package/src/logger/instances/instance.console-logger.js.map +0 -1
- package/src/logger/instances/instance.logger.js +0 -77
- package/src/logger/instances/instance.logger.js.map +0 -1
- package/src/logger/logger.registry.js +0 -96
- package/src/logger/logger.registry.js.map +0 -1
- package/src/logger/logger.tokens.js +0 -3
- package/src/logger/logger.tokens.js.map +0 -1
- package/src/logger/logger.types.js +0 -8
- package/src/logger/logger.types.js.map +0 -1
- package/src/logger/logger.utils.js +0 -42
- package/src/logger/logger.utils.js.map +0 -1
- package/src/logging/flows/set-level.flow.js +0 -108
- package/src/logging/flows/set-level.flow.js.map +0 -1
- package/src/mcp-apps/csp.js +0 -267
- package/src/mcp-apps/csp.js.map +0 -1
- package/src/mcp-apps/index.js +0 -91
- package/src/mcp-apps/index.js.map +0 -1
- package/src/mcp-apps/schemas.js +0 -345
- package/src/mcp-apps/schemas.js.map +0 -1
- package/src/mcp-apps/template.js +0 -419
- package/src/mcp-apps/template.js.map +0 -1
- package/src/mcp-apps/types.js +0 -59
- package/src/mcp-apps/types.js.map +0 -1
- package/src/notification/index.js +0 -13
- package/src/notification/index.js.map +0 -1
- package/src/notification/notification.service.js +0 -731
- package/src/notification/notification.service.js.map +0 -1
- package/src/plugin/plugin.registry.js +0 -152
- package/src/plugin/plugin.registry.js.map +0 -1
- package/src/plugin/plugin.utils.js +0 -88
- package/src/plugin/plugin.utils.js.map +0 -1
- package/src/prompt/flows/get-prompt.flow.js +0 -214
- package/src/prompt/flows/get-prompt.flow.js.map +0 -1
- package/src/prompt/flows/prompts-list.flow.js +0 -176
- package/src/prompt/flows/prompts-list.flow.js.map +0 -1
- package/src/prompt/index.js +0 -17
- package/src/prompt/index.js.map +0 -1
- package/src/prompt/prompt.events.js +0 -25
- package/src/prompt/prompt.events.js.map +0 -1
- package/src/prompt/prompt.instance.js +0 -120
- package/src/prompt/prompt.instance.js.map +0 -1
- package/src/prompt/prompt.registry.js +0 -380
- package/src/prompt/prompt.registry.js.map +0 -1
- package/src/prompt/prompt.types.js +0 -11
- package/src/prompt/prompt.types.js.map +0 -1
- package/src/prompt/prompt.utils.js +0 -136
- package/src/prompt/prompt.utils.js.map +0 -1
- package/src/provider/provider.registry.js +0 -868
- package/src/provider/provider.registry.js.map +0 -1
- package/src/provider/provider.types.js +0 -3
- package/src/provider/provider.types.js.map +0 -1
- package/src/provider/provider.utils.js +0 -103
- package/src/provider/provider.utils.js.map +0 -1
- package/src/regsitry/index.js +0 -5
- package/src/regsitry/index.js.map +0 -1
- package/src/regsitry/registry.base.js +0 -32
- package/src/regsitry/registry.base.js.map +0 -1
- package/src/resource/flows/read-resource.flow.js +0 -270
- package/src/resource/flows/read-resource.flow.js.map +0 -1
- package/src/resource/flows/resource-templates-list.flow.js +0 -191
- package/src/resource/flows/resource-templates-list.flow.js.map +0 -1
- package/src/resource/flows/resources-list.flow.js +0 -196
- package/src/resource/flows/resources-list.flow.js.map +0 -1
- package/src/resource/flows/subscribe-resource.flow.js +0 -123
- package/src/resource/flows/subscribe-resource.flow.js.map +0 -1
- package/src/resource/flows/unsubscribe-resource.flow.js +0 -107
- package/src/resource/flows/unsubscribe-resource.flow.js.map +0 -1
- package/src/resource/index.js +0 -20
- package/src/resource/index.js.map +0 -1
- package/src/resource/resource.events.js +0 -17
- package/src/resource/resource.events.js.map +0 -1
- package/src/resource/resource.instance.js +0 -163
- package/src/resource/resource.instance.js.map +0 -1
- package/src/resource/resource.registry.js +0 -468
- package/src/resource/resource.registry.js.map +0 -1
- package/src/resource/resource.types.js +0 -11
- package/src/resource/resource.types.js.map +0 -1
- package/src/resource/resource.utils.js +0 -151
- package/src/resource/resource.utils.js.map +0 -1
- package/src/scope/flows/http.request.flow.js +0 -474
- package/src/scope/flows/http.request.flow.js.map +0 -1
- package/src/scope/index.js +0 -6
- package/src/scope/index.js.map +0 -1
- package/src/scope/scope.instance.js +0 -263
- package/src/scope/scope.instance.js.map +0 -1
- package/src/scope/scope.registry.js +0 -94
- package/src/scope/scope.registry.js.map +0 -1
- package/src/scope/scope.utils.js +0 -61
- package/src/scope/scope.utils.js.map +0 -1
- package/src/server/adapters/base.host.adapter.js +0 -8
- package/src/server/adapters/base.host.adapter.js.map +0 -1
- package/src/server/adapters/express.host.adapter.js +0 -70
- package/src/server/adapters/express.host.adapter.js.map +0 -1
- package/src/server/server.instance.js +0 -54
- package/src/server/server.instance.js.map +0 -1
- package/src/server/server.types.js +0 -3
- package/src/server/server.types.js.map +0 -1
- package/src/server/server.validation.js +0 -192
- package/src/server/server.validation.js.map +0 -1
- package/src/store/adapters/store.base.adapter.js +0 -16
- package/src/store/adapters/store.base.adapter.js.map +0 -1
- package/src/store/adapters/store.memory.adapter.js +0 -89
- package/src/store/adapters/store.memory.adapter.js.map +0 -1
- package/src/store/adapters/store.redis.adapter.js +0 -104
- package/src/store/adapters/store.redis.adapter.js.map +0 -1
- package/src/store/adapters/store.vercel-kv.adapter.js +0 -155
- package/src/store/adapters/store.vercel-kv.adapter.js.map +0 -1
- package/src/store/index.js +0 -14
- package/src/store/index.js.map +0 -1
- package/src/store/store.factory.js +0 -194
- package/src/store/store.factory.js.map +0 -1
- package/src/store/store.helpers.js +0 -67
- package/src/store/store.helpers.js.map +0 -1
- package/src/store/store.registry.js +0 -37
- package/src/store/store.registry.js.map +0 -1
- package/src/store/store.tokens.js +0 -7
- package/src/store/store.tokens.js.map +0 -1
- package/src/store/store.types.js +0 -11
- package/src/store/store.types.js.map +0 -1
- package/src/store/store.utils.js +0 -18
- package/src/store/store.utils.js.map +0 -1
- package/src/tool/flows/call-tool.flow.js +0 -616
- package/src/tool/flows/call-tool.flow.js.map +0 -1
- package/src/tool/flows/tools-list.flow.js +0 -328
- package/src/tool/flows/tools-list.flow.js.map +0 -1
- package/src/tool/tool.events.js +0 -16
- package/src/tool/tool.events.js.map +0 -1
- package/src/tool/tool.instance.js +0 -117
- package/src/tool/tool.instance.js.map +0 -1
- package/src/tool/tool.registry.js +0 -353
- package/src/tool/tool.registry.js.map +0 -1
- package/src/tool/tool.types.js +0 -10
- package/src/tool/tool.types.js.map +0 -1
- package/src/tool/tool.utils.js +0 -366
- package/src/tool/tool.utils.js.map +0 -1
- package/src/tool/ui/index.js +0 -63
- package/src/tool/ui/index.js.map +0 -1
- package/src/tool/ui/platform-adapters.js +0 -18
- package/src/tool/ui/platform-adapters.js.map +0 -1
- package/src/tool/ui/template-helpers.js +0 -95
- package/src/tool/ui/template-helpers.js.map +0 -1
- package/src/tool/ui/ui-resource-template.js +0 -64
- package/src/tool/ui/ui-resource-template.js.map +0 -1
- package/src/tool/ui/ui-resource.handler.js +0 -129
- package/src/tool/ui/ui-resource.handler.js.map +0 -1
- package/src/transport/adapters/transport.local.adapter.js +0 -148
- package/src/transport/adapters/transport.local.adapter.js.map +0 -1
- package/src/transport/adapters/transport.sse.adapter.js +0 -65
- package/src/transport/adapters/transport.sse.adapter.js.map +0 -1
- package/src/transport/adapters/transport.streamable-http.adapter.js +0 -112
- package/src/transport/adapters/transport.streamable-http.adapter.js.map +0 -1
- package/src/transport/flows/handle.sse.flow.js +0 -197
- package/src/transport/flows/handle.sse.flow.js.map +0 -1
- package/src/transport/flows/handle.stateless-http.flow.js +0 -102
- package/src/transport/flows/handle.stateless-http.flow.js.map +0 -1
- package/src/transport/flows/handle.streamable-http.flow.js +0 -315
- package/src/transport/flows/handle.streamable-http.flow.js.map +0 -1
- package/src/transport/legacy/legacy.sse.tranporter.js +0 -185
- package/src/transport/legacy/legacy.sse.tranporter.js.map +0 -1
- package/src/transport/mcp-handlers/Initialized-notification.hanlder.js +0 -14
- package/src/transport/mcp-handlers/Initialized-notification.hanlder.js.map +0 -1
- package/src/transport/mcp-handlers/call-tool-request.handler.js +0 -46
- package/src/transport/mcp-handlers/call-tool-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/complete-request.handler.js +0 -11
- package/src/transport/mcp-handlers/complete-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/get-prompt-request.handler.js +0 -11
- package/src/transport/mcp-handlers/get-prompt-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/index.js +0 -57
- package/src/transport/mcp-handlers/index.js.map +0 -1
- package/src/transport/mcp-handlers/initialize-request.handler.js +0 -109
- package/src/transport/mcp-handlers/initialize-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-prompts-request.handler.js +0 -11
- package/src/transport/mcp-handlers/list-prompts-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-resource-templates-request.handler.js +0 -12
- package/src/transport/mcp-handlers/list-resource-templates-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-resources-request.handler.js +0 -12
- package/src/transport/mcp-handlers/list-resources-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-tools-request.handler.js +0 -11
- package/src/transport/mcp-handlers/list-tools-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/logging-set-level-request.handler.js +0 -34
- package/src/transport/mcp-handlers/logging-set-level-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/mcp-handlers.types.js +0 -3
- package/src/transport/mcp-handlers/mcp-handlers.types.js.map +0 -1
- package/src/transport/mcp-handlers/read-resource-request.handler.js +0 -12
- package/src/transport/mcp-handlers/read-resource-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/roots-list-changed-notification.handler.js +0 -26
- package/src/transport/mcp-handlers/roots-list-changed-notification.handler.js.map +0 -1
- package/src/transport/mcp-handlers/subscribe-request.handler.js +0 -34
- package/src/transport/mcp-handlers/subscribe-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/unsubscribe-request.handler.js +0 -34
- package/src/transport/mcp-handlers/unsubscribe-request.handler.js.map +0 -1
- package/src/transport/transport.error.js +0 -25
- package/src/transport/transport.error.js.map +0 -1
- package/src/transport/transport.event-store.js +0 -36
- package/src/transport/transport.event-store.js.map +0 -1
- package/src/transport/transport.local.js +0 -71
- package/src/transport/transport.local.js.map +0 -1
- package/src/transport/transport.registry.js +0 -552
- package/src/transport/transport.registry.js.map +0 -1
- package/src/transport/transport.remote.js +0 -31
- package/src/transport/transport.remote.js.map +0 -1
- package/src/transport/transport.types.js +0 -3
- package/src/transport/transport.types.js.map +0 -1
- package/src/types/drinen-hooks.types.js +0 -3
- package/src/types/drinen-hooks.types.js.map +0 -1
- package/src/types/invoke.type.js +0 -34
- package/src/types/invoke.type.js.map +0 -1
- package/src/types/token.types.js +0 -3
- package/src/types/token.types.js.map +0 -1
- package/src/utils/content.utils.js +0 -194
- package/src/utils/content.utils.js.map +0 -1
- package/src/utils/index.js +0 -55
- package/src/utils/index.js.map +0 -1
- package/src/utils/lineage.utils.js +0 -82
- package/src/utils/lineage.utils.js.map +0 -1
- package/src/utils/metadata.utils.js +0 -26
- package/src/utils/metadata.utils.js.map +0 -1
- package/src/utils/naming.utils.js +0 -136
- package/src/utils/naming.utils.js.map +0 -1
- package/src/utils/server.utils.js +0 -59
- package/src/utils/server.utils.js.map +0 -1
- package/src/utils/string.utils.js +0 -10
- package/src/utils/string.utils.js.map +0 -1
- package/src/utils/token.utils.js +0 -65
- package/src/utils/token.utils.js.map +0 -1
- package/src/utils/types.utils.js +0 -3
- package/src/utils/types.utils.js.map +0 -1
- package/src/utils/uri-template.utils.js +0 -113
- package/src/utils/uri-template.utils.js.map +0 -1
- package/src/utils/uri-validation.utils.js +0 -76
- package/src/utils/uri-validation.utils.js.map +0 -1
- package/{src/adapter → adapter}/adapter.instance.d.ts +0 -0
- package/{src/adapter → adapter}/adapter.regsitry.d.ts +0 -0
- package/{src/adapter → adapter}/adapter.utils.d.ts +0 -0
- package/{src/app → app}/app.registry.d.ts +0 -0
- package/{src/app → app}/app.utils.d.ts +0 -0
- package/{src/app → app}/instances/app.local.instance.d.ts +0 -0
- package/{src/app → app}/instances/app.remote.instance.d.ts +0 -0
- package/{src/app → app}/instances/index.d.ts +0 -0
- package/{src/auth → auth}/auth.registry.d.ts +0 -0
- package/{src/auth → auth}/auth.utils.d.ts +0 -0
- package/{src/auth → auth}/authorization/authorization.class.d.ts +0 -0
- package/{src/auth → auth}/authorization/authorization.types.d.ts +0 -0
- package/{src/auth → auth}/authorization/index.d.ts +0 -0
- package/{src/auth → auth}/authorization/orchestrated.authorization.d.ts +0 -0
- package/{src/auth → auth}/authorization/public.authorization.d.ts +0 -0
- package/{src/auth → auth}/authorization/transparent.authorization.d.ts +0 -0
- package/{src/auth → auth}/consent/consent.types.d.ts +0 -0
- package/{src/auth → auth}/consent/index.d.ts +0 -0
- package/{src/auth → auth}/detection/auth-provider-detection.d.ts +0 -0
- package/{src/auth → auth}/detection/index.d.ts +0 -0
- package/{src/auth → auth}/flows/auth.verify.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.authorize.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.callback.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.register.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.token.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/session.verify.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/well-known.jwks.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/well-known.oauth-authorization-server.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/well-known.prm.flow.d.ts +0 -0
- package/{src/auth → auth}/jwks/dev-key-persistence.d.ts +0 -0
- package/{src/auth → auth}/jwks/index.d.ts +0 -0
- package/{src/auth → auth}/jwks/jwks.service.d.ts +0 -0
- package/{src/auth → auth}/jwks/jwks.types.d.ts +0 -0
- package/{src/auth → auth}/jwks/jwks.utils.d.ts +0 -0
- package/{src/auth → auth}/machine-id.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.authorize.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.device-authorization.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.introspect.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.par.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.revoke.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.token.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.userinfo.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oidc.logout.flow.d.ts +0 -0
- package/{src/auth → auth}/session/authorization-vault.d.ts +0 -0
- package/{src/auth → auth}/session/authorization.store.d.ts +0 -0
- package/{src/auth → auth}/session/encrypted-authorization-vault.d.ts +0 -0
- package/{src/auth → auth}/session/index.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.base.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.stateful.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.stateless.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.transparent.d.ts +0 -0
- package/{src/auth → auth}/session/redis-session.store.d.ts +0 -0
- package/{src/auth → auth}/session/session.crypto.d.ts +0 -0
- package/{src/auth → auth}/session/session.schema.d.ts +0 -0
- package/{src/auth → auth}/session/session.service.d.ts +0 -0
- package/{src/auth → auth}/session/session.transport.d.ts +0 -0
- package/{src/auth → auth}/session/session.types.d.ts +0 -0
- package/{src/auth → auth}/session/token.refresh.d.ts +0 -0
- package/{src/auth → auth}/session/token.store.d.ts +0 -0
- package/{src/auth → auth}/session/token.vault.d.ts +0 -0
- package/{src/auth → auth}/session/transport-session.manager.d.ts +0 -0
- package/{src/auth → auth}/session/transport-session.types.d.ts +0 -0
- package/{src/auth → auth}/session/utils/auth-token.utils.d.ts +0 -0
- package/{src/auth → auth}/session/utils/session-id.utils.d.ts +0 -0
- package/{src/auth → auth}/session/utils/tiny-ttl-cache.d.ts +0 -0
- package/{src/auth → auth}/session/vault-encryption.d.ts +0 -0
- package/{src/auth → auth}/session/vercel-kv-session.store.d.ts +0 -0
- package/{src/auth → auth}/ui/base-layout.d.ts +0 -0
- package/{src/auth → auth}/ui/index.d.ts +0 -0
- package/{src/auth → auth}/ui/templates.d.ts +0 -0
- package/{src/auth → auth}/utils/audience.validator.d.ts +0 -0
- package/{src/auth → auth}/utils/index.d.ts +0 -0
- package/{src/auth → auth}/utils/www-authenticate.utils.d.ts +0 -0
- package/{src/common → common}/common.schema.d.ts +0 -0
- package/{src/common → common}/constants.d.ts +0 -0
- package/{src/common → common}/decorators/adapter.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/app.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/auth-provider.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/decorator-utils.d.ts +0 -0
- package/{src/common → common}/decorators/flow.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/front-mcp.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/hook.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/index.d.ts +0 -0
- package/{src/common → common}/decorators/logger.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/plugin.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/prompt.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/provider.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/resource.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/tool.decorator.d.ts +0 -0
- package/{src/common → common}/dynamic/dynamic.adapter.d.ts +0 -0
- package/{src/common → common}/dynamic/dynamic.plugin.d.ts +0 -0
- package/{src/common → common}/dynamic/dynamic.utils.d.ts +0 -0
- package/{src/common → common}/dynamic/index.d.ts +0 -0
- package/{src/common → common}/entries/adapter.entry.d.ts +0 -0
- package/{src/common → common}/entries/app.entry.d.ts +0 -0
- package/{src/common → common}/entries/auth-provider.entry.d.ts +0 -0
- package/{src/common → common}/entries/base.entry.d.ts +0 -0
- package/{src/common → common}/entries/flow.entry.d.ts +0 -0
- package/{src/common → common}/entries/hook.entry.d.ts +0 -0
- package/{src/common → common}/entries/index.d.ts +0 -0
- package/{src/common → common}/entries/logger.entry.d.ts +0 -0
- package/{src/common → common}/entries/plugin.entry.d.ts +0 -0
- package/{src/common → common}/entries/prompt.entry.d.ts +0 -0
- package/{src/common → common}/entries/provider.entry.d.ts +0 -0
- package/{src/common → common}/entries/resource.entry.d.ts +0 -0
- package/{src/common → common}/entries/scope.entry.d.ts +0 -0
- package/{src/common → common}/entries/tool.entry.d.ts +0 -0
- package/{src/common → common}/flow/flow.utils.d.ts +0 -0
- package/{src/common → common}/index.d.ts +0 -0
- package/{src/common → common}/interfaces/adapter.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/app.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/auth-hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/auth-provider.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/base.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/execution-context.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/flow.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/front-mcp.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/index.d.ts +0 -0
- package/{src/common → common}/interfaces/internal/flow.utils.d.ts +0 -0
- package/{src/common → common}/interfaces/internal/index.d.ts +0 -0
- package/{src/common → common}/interfaces/internal/registry.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/logger.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/plugin.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/prompt.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/provider.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/resource.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/scope.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/server.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/session-hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/tool-hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/tool.interface.d.ts +0 -0
- package/{src/common → common}/metadata/adapter.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/app.metadata.d.ts +42 -42
- package/{src/common → common}/metadata/auth-provider.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/flow.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/hook.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/index.d.ts +0 -0
- package/{src/common → common}/metadata/logger.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/plugin.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/prompt.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/provider.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/resource.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/tool-ui.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/tool.metadata.d.ts +0 -0
- package/{src/common → common}/migrate/auth-transport.migrate.d.ts +0 -0
- package/{src/common → common}/migrate/index.d.ts +0 -0
- package/{src/common → common}/providers/base-config.provider.d.ts +0 -0
- package/{src/common → common}/records/adapter.record.d.ts +0 -0
- package/{src/common → common}/records/app.record.d.ts +0 -0
- package/{src/common → common}/records/auth-provider.record.d.ts +0 -0
- package/{src/common → common}/records/flow.record.d.ts +0 -0
- package/{src/common → common}/records/hook.record.d.ts +0 -0
- package/{src/common → common}/records/index.d.ts +0 -0
- package/{src/common → common}/records/logger.record.d.ts +0 -0
- package/{src/common → common}/records/plugin.record.d.ts +0 -0
- package/{src/common → common}/records/prompt.record.d.ts +0 -0
- package/{src/common → common}/records/provider.record.d.ts +0 -0
- package/{src/common → common}/records/resource.record.d.ts +0 -0
- package/{src/common → common}/records/scope.record.d.ts +0 -0
- package/{src/common → common}/records/tool.record.d.ts +0 -0
- package/{src/common → common}/schemas/annotated-class.schema.d.ts +0 -0
- package/{src/common → common}/schemas/http-input.schema.d.ts +0 -0
- package/{src/common → common}/schemas/http-output.schema.d.ts +0 -0
- package/{src/common → common}/schemas/index.d.ts +0 -0
- package/{src/common → common}/schemas/session-header.schema.d.ts +0 -0
- package/{src/common → common}/tokens/adapter.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/app.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/auth-provider.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/base.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/flow-hook.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/flow.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/front-mcp.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/index.d.ts +0 -0
- package/{src/common → common}/tokens/logger.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/plugin.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/prompt.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/provider.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/resource.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/server.tokens.d.ts +0 -0
- package/{src/common → common}/tokens/tool.tokens.d.ts +0 -0
- package/{src/common → common}/types/auth/index.d.ts +0 -0
- package/{src/common → common}/types/auth/jwt.types.d.ts +0 -0
- package/{src/common → common}/types/auth/session.types.d.ts +0 -0
- package/{src/common → common}/types/common.types.d.ts +0 -0
- package/{src/common → common}/types/index.d.ts +0 -0
- package/{src/logger/logger.tokens.d.ts → common/types/options/auth/auth.typecheck.d.ts} +0 -0
- package/{src/common → common}/types/options/http.options.d.ts +0 -0
- package/{src/common → common}/types/options/logging.options.d.ts +0 -0
- package/{src/common → common}/types/options/redis.options.d.ts +0 -0
- package/{src/common → common}/types/options/server-info.options.d.ts +0 -0
- package/{src/common → common}/types/options/session.options.d.ts +0 -0
- package/{src/common → common}/utils/global-config.utils.d.ts +0 -0
- package/{src/common → common}/utils/index.d.ts +0 -0
- package/{src/common → common}/utils/path.utils.d.ts +0 -0
- package/{src/completion → completion}/flows/complete.flow.d.ts +0 -0
- package/{src/context → context}/frontmcp-context-storage.d.ts +0 -0
- package/{src/context → context}/frontmcp-context.d.ts +0 -0
- package/{src/context → context}/frontmcp-context.provider.d.ts +0 -0
- package/{src/context → context}/index.d.ts +0 -0
- package/{src/context → context}/request-context-storage.d.ts +0 -0
- package/{src/context → context}/request-context.d.ts +0 -0
- package/{src/context → context}/request-context.provider.d.ts +0 -0
- package/{src/context → context}/session-key.provider.d.ts +0 -0
- package/{src/context → context}/trace-context.d.ts +0 -0
- package/{src/errors → errors}/authorization-required.error.d.ts +0 -0
- package/{src/errors → errors}/error-handler.d.ts +0 -0
- package/{src/errors → errors}/index.d.ts +0 -0
- package/{src/errors → errors}/mcp.error.d.ts +0 -0
- package/{src/exceptions → exceptions}/mcp-exceptions/session-missing.exception.d.ts +0 -0
- package/{src/exceptions → exceptions}/mcp-exceptions/unsupported-client-version.exception.d.ts +0 -0
- package/{src/flows → flows}/flow.instance.d.ts +0 -0
- package/{src/flows → flows}/flow.registry.d.ts +0 -0
- package/{src/flows → flows}/flow.stages.d.ts +0 -0
- package/{src/flows → flows}/flow.utils.d.ts +0 -0
- package/{src/front-mcp → front-mcp}/front-mcp.d.ts +0 -0
- package/{src/front-mcp → front-mcp}/front-mcp.providers.d.ts +38 -38
- /package/{src/front-mcp → front-mcp}/front-mcp.tokens.d.ts +0 -0
- /package/{src/front-mcp → front-mcp}/index.d.ts +0 -0
- /package/{src/front-mcp → front-mcp}/serverless-handler.d.ts +0 -0
- /package/{src/hooks → hooks}/hook.instance.d.ts +0 -0
- /package/{src/hooks → hooks}/hook.registry.d.ts +0 -0
- /package/{src/hooks → hooks}/hooks.utils.d.ts +0 -0
- /package/{src/index.d.ts → index.d.ts} +0 -0
- /package/{src/logger → logger}/instances/instance.console-logger.d.ts +0 -0
- /package/{src/logger → logger}/instances/instance.logger.d.ts +0 -0
- /package/{src/logger → logger}/logger.registry.d.ts +0 -0
- /package/{src/logger → logger}/logger.types.d.ts +0 -0
- /package/{src/logger → logger}/logger.utils.d.ts +0 -0
- /package/{src/logging → logging}/flows/set-level.flow.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/csp.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/index.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/schemas.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/template.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/types.d.ts +0 -0
- /package/{src/notification → notification}/index.d.ts +0 -0
- /package/{src/notification → notification}/notification.service.d.ts +0 -0
- /package/{src/plugin → plugin}/plugin.registry.d.ts +0 -0
- /package/{src/plugin → plugin}/plugin.utils.d.ts +0 -0
- /package/{src/prompt → prompt}/flows/get-prompt.flow.d.ts +0 -0
- /package/{src/prompt → prompt}/flows/prompts-list.flow.d.ts +0 -0
- /package/{src/prompt → prompt}/index.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.events.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.instance.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.registry.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.types.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.utils.d.ts +0 -0
- /package/{src/provider → provider}/provider.registry.d.ts +0 -0
- /package/{src/provider → provider}/provider.types.d.ts +0 -0
- /package/{src/provider → provider}/provider.utils.d.ts +0 -0
- /package/{src/regsitry → regsitry}/index.d.ts +0 -0
- /package/{src/regsitry → regsitry}/registry.base.d.ts +0 -0
- /package/{src/resource → resource}/flows/read-resource.flow.d.ts +0 -0
- /package/{src/resource → resource}/flows/resource-templates-list.flow.d.ts +0 -0
- /package/{src/resource → resource}/flows/resources-list.flow.d.ts +0 -0
- /package/{src/resource → resource}/flows/subscribe-resource.flow.d.ts +0 -0
- /package/{src/resource → resource}/flows/unsubscribe-resource.flow.d.ts +0 -0
- /package/{src/resource → resource}/index.d.ts +0 -0
- /package/{src/resource → resource}/resource.events.d.ts +0 -0
- /package/{src/resource → resource}/resource.instance.d.ts +0 -0
- /package/{src/resource → resource}/resource.registry.d.ts +0 -0
- /package/{src/resource → resource}/resource.types.d.ts +0 -0
- /package/{src/resource → resource}/resource.utils.d.ts +0 -0
- /package/{src/scope → scope}/flows/http.request.flow.d.ts +0 -0
- /package/{src/scope → scope}/index.d.ts +0 -0
- /package/{src/scope → scope}/scope.instance.d.ts +0 -0
- /package/{src/scope → scope}/scope.registry.d.ts +0 -0
- /package/{src/scope → scope}/scope.utils.d.ts +0 -0
- /package/{src/server → server}/adapters/base.host.adapter.d.ts +0 -0
- /package/{src/server → server}/adapters/express.host.adapter.d.ts +0 -0
- /package/{src/server → server}/server.instance.d.ts +0 -0
- /package/{src/server → server}/server.types.d.ts +0 -0
- /package/{src/server → server}/server.validation.d.ts +0 -0
- /package/{src/store → store}/adapters/store.base.adapter.d.ts +0 -0
- /package/{src/store → store}/adapters/store.memory.adapter.d.ts +0 -0
- /package/{src/store → store}/adapters/store.redis.adapter.d.ts +0 -0
- /package/{src/store → store}/adapters/store.vercel-kv.adapter.d.ts +0 -0
- /package/{src/store → store}/index.d.ts +0 -0
- /package/{src/store → store}/store.factory.d.ts +0 -0
- /package/{src/store → store}/store.helpers.d.ts +0 -0
- /package/{src/store → store}/store.registry.d.ts +0 -0
- /package/{src/store → store}/store.tokens.d.ts +0 -0
- /package/{src/store → store}/store.types.d.ts +0 -0
- /package/{src/store → store}/store.utils.d.ts +0 -0
- /package/{src/tool → tool}/flows/call-tool.flow.d.ts +0 -0
- /package/{src/tool → tool}/flows/tools-list.flow.d.ts +0 -0
- /package/{src/tool → tool}/tool.events.d.ts +0 -0
- /package/{src/tool → tool}/tool.instance.d.ts +0 -0
- /package/{src/tool → tool}/tool.registry.d.ts +0 -0
- /package/{src/tool → tool}/tool.types.d.ts +0 -0
- /package/{src/tool → tool}/tool.utils.d.ts +0 -0
- /package/{src/tool → tool}/ui/index.d.ts +0 -0
- /package/{src/tool → tool}/ui/platform-adapters.d.ts +0 -0
- /package/{src/tool → tool}/ui/template-helpers.d.ts +0 -0
- /package/{src/tool → tool}/ui/ui-resource-template.d.ts +0 -0
- /package/{src/tool → tool}/ui/ui-resource.handler.d.ts +0 -0
- /package/{src/transport → transport}/adapters/transport.local.adapter.d.ts +0 -0
- /package/{src/transport → transport}/adapters/transport.sse.adapter.d.ts +0 -0
- /package/{src/transport → transport}/adapters/transport.streamable-http.adapter.d.ts +0 -0
- /package/{src/transport → transport}/flows/handle.sse.flow.d.ts +0 -0
- /package/{src/transport → transport}/flows/handle.stateless-http.flow.d.ts +0 -0
- /package/{src/transport → transport}/flows/handle.streamable-http.flow.d.ts +0 -0
- /package/{src/transport → transport}/legacy/legacy.sse.tranporter.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/Initialized-notification.hanlder.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/call-tool-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/complete-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/get-prompt-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/index.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/initialize-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/list-prompts-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/list-resource-templates-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/list-resources-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/list-tools-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/logging-set-level-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/mcp-handlers.types.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/read-resource-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/roots-list-changed-notification.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/subscribe-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/unsubscribe-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/transport.error.d.ts +0 -0
- /package/{src/transport → transport}/transport.event-store.d.ts +0 -0
- /package/{src/transport → transport}/transport.local.d.ts +0 -0
- /package/{src/transport → transport}/transport.registry.d.ts +0 -0
- /package/{src/transport → transport}/transport.remote.d.ts +0 -0
- /package/{src/transport → transport}/transport.types.d.ts +0 -0
- /package/{src/types → types}/drinen-hooks.types.d.ts +0 -0
- /package/{src/types → types}/invoke.type.d.ts +0 -0
- /package/{src/types → types}/token.types.d.ts +0 -0
- /package/{src/utils → utils}/content.utils.d.ts +0 -0
- /package/{src/utils → utils}/index.d.ts +0 -0
- /package/{src/utils → utils}/lineage.utils.d.ts +0 -0
- /package/{src/utils → utils}/metadata.utils.d.ts +0 -0
- /package/{src/utils → utils}/naming.utils.d.ts +0 -0
- /package/{src/utils → utils}/server.utils.d.ts +0 -0
- /package/{src/utils → utils}/string.utils.d.ts +0 -0
- /package/{src/utils → utils}/token.utils.d.ts +0 -0
- /package/{src/utils → utils}/types.utils.d.ts +0 -0
- /package/{src/utils → utils}/uri-template.utils.d.ts +0 -0
- /package/{src/utils → utils}/uri-validation.utils.d.ts +0 -0
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Vercel KV Session Store
|
|
4
|
-
*
|
|
5
|
-
* Session store implementation using Vercel KV (edge-compatible REST-based key-value store).
|
|
6
|
-
* Uses dynamic import to avoid bundling @vercel/kv for non-Vercel deployments.
|
|
7
|
-
*
|
|
8
|
-
* @see https://vercel.com/docs/storage/vercel-kv
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.VercelKvSessionStore = void 0;
|
|
12
|
-
const crypto_1 = require("crypto");
|
|
13
|
-
const transport_session_types_1 = require("./transport-session.types");
|
|
14
|
-
/**
|
|
15
|
-
* Vercel KV-backed session store implementation
|
|
16
|
-
*
|
|
17
|
-
* Provides persistent session storage for edge deployments using Vercel KV.
|
|
18
|
-
* Sessions are stored as JSON with optional TTL.
|
|
19
|
-
*/
|
|
20
|
-
class VercelKvSessionStore {
|
|
21
|
-
kv = null;
|
|
22
|
-
connectPromise = null;
|
|
23
|
-
keyPrefix;
|
|
24
|
-
defaultTtlMs;
|
|
25
|
-
logger;
|
|
26
|
-
config;
|
|
27
|
-
constructor(config, logger) {
|
|
28
|
-
this.config = config;
|
|
29
|
-
this.keyPrefix = config.keyPrefix ?? 'mcp:session:';
|
|
30
|
-
this.defaultTtlMs = config.defaultTtlMs ?? 3600000;
|
|
31
|
-
this.logger = logger;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Connect to Vercel KV
|
|
35
|
-
* Uses dynamic import to avoid bundling @vercel/kv when not used.
|
|
36
|
-
* Thread-safe: concurrent calls will share the same connection promise.
|
|
37
|
-
*/
|
|
38
|
-
async connect() {
|
|
39
|
-
if (this.kv)
|
|
40
|
-
return;
|
|
41
|
-
// Prevent concurrent connection attempts
|
|
42
|
-
if (this.connectPromise) {
|
|
43
|
-
return this.connectPromise;
|
|
44
|
-
}
|
|
45
|
-
this.connectPromise = this.doConnect();
|
|
46
|
-
try {
|
|
47
|
-
await this.connectPromise;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
// Reset promise on failure to allow retry
|
|
51
|
-
this.connectPromise = null;
|
|
52
|
-
throw error;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
async doConnect() {
|
|
56
|
-
const { createClient } = await import('@vercel/kv');
|
|
57
|
-
const url = this.config.url || process.env['KV_REST_API_URL'];
|
|
58
|
-
const token = this.config.token || process.env['KV_REST_API_TOKEN'];
|
|
59
|
-
if (!url || !token) {
|
|
60
|
-
throw new Error('Vercel KV requires url and token. Set KV_REST_API_URL and KV_REST_API_TOKEN environment variables or provide them in config.');
|
|
61
|
-
}
|
|
62
|
-
// Cast to our interface to avoid type compatibility issues
|
|
63
|
-
this.kv = createClient({ url, token });
|
|
64
|
-
}
|
|
65
|
-
async ensureConnected() {
|
|
66
|
-
await this.connect();
|
|
67
|
-
if (!this.kv) {
|
|
68
|
-
throw new Error('[VercelKvSessionStore] Connection failed - client not initialized');
|
|
69
|
-
}
|
|
70
|
-
return this.kv;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get the full key for a session ID
|
|
74
|
-
* @throws Error if sessionId is empty
|
|
75
|
-
*/
|
|
76
|
-
key(sessionId) {
|
|
77
|
-
if (!sessionId || sessionId.trim() === '') {
|
|
78
|
-
throw new Error('[VercelKvSessionStore] sessionId cannot be empty');
|
|
79
|
-
}
|
|
80
|
-
return `${this.keyPrefix}${sessionId}`;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get a stored session by ID
|
|
84
|
-
*
|
|
85
|
-
* Note: Vercel KV doesn't support GETEX, so we use GET + PEXPIRE separately.
|
|
86
|
-
* This is slightly less atomic than Redis GETEX but sufficient for most use cases.
|
|
87
|
-
*/
|
|
88
|
-
async get(sessionId) {
|
|
89
|
-
const kv = await this.ensureConnected();
|
|
90
|
-
const key = this.key(sessionId);
|
|
91
|
-
// Get the session
|
|
92
|
-
const raw = await kv.get(key);
|
|
93
|
-
if (!raw)
|
|
94
|
-
return null;
|
|
95
|
-
// Extend TTL (fire-and-forget, similar to Redis GETEX behavior)
|
|
96
|
-
kv.pexpire(key, this.defaultTtlMs).catch(() => void 0);
|
|
97
|
-
try {
|
|
98
|
-
const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;
|
|
99
|
-
const result = transport_session_types_1.storedSessionSchema.safeParse(parsed);
|
|
100
|
-
if (!result.success) {
|
|
101
|
-
this.logger?.warn('[VercelKvSessionStore] Invalid session format', {
|
|
102
|
-
sessionId: sessionId.slice(0, 20),
|
|
103
|
-
errors: result.error.issues.slice(0, 3).map((i) => ({ path: i.path, message: i.message })),
|
|
104
|
-
});
|
|
105
|
-
// Delete invalid session data
|
|
106
|
-
this.delete(sessionId).catch(() => void 0);
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
const session = result.data;
|
|
110
|
-
// Check application-level expiration (separate from KV TTL)
|
|
111
|
-
if (session.session.expiresAt && session.session.expiresAt < Date.now()) {
|
|
112
|
-
// Session is logically expired - delete it
|
|
113
|
-
await this.delete(sessionId);
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
// Bound TTL by session.expiresAt to avoid keeping expired sessions
|
|
117
|
-
if (session.session.expiresAt) {
|
|
118
|
-
const ttlMs = Math.min(this.defaultTtlMs, session.session.expiresAt - Date.now());
|
|
119
|
-
if (ttlMs > 0 && ttlMs < this.defaultTtlMs) {
|
|
120
|
-
// Fire-and-forget - we're only optimizing cache eviction timing
|
|
121
|
-
kv.pexpire(key, ttlMs).catch(() => void 0);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// Update last accessed timestamp (in the returned object)
|
|
125
|
-
const updatedSession = {
|
|
126
|
-
...session,
|
|
127
|
-
lastAccessedAt: Date.now(),
|
|
128
|
-
};
|
|
129
|
-
return updatedSession;
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
this.logger?.warn('[VercelKvSessionStore] Failed to parse session', {
|
|
133
|
-
sessionId: sessionId.slice(0, 20),
|
|
134
|
-
error: error.message,
|
|
135
|
-
});
|
|
136
|
-
// Delete corrupted session payloads to prevent repeated failures
|
|
137
|
-
this.delete(sessionId).catch(() => void 0);
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Store a session with optional TTL
|
|
143
|
-
*/
|
|
144
|
-
async set(sessionId, session, ttlMs) {
|
|
145
|
-
const kv = await this.ensureConnected();
|
|
146
|
-
const key = this.key(sessionId);
|
|
147
|
-
const value = JSON.stringify(session);
|
|
148
|
-
if (ttlMs && ttlMs > 0) {
|
|
149
|
-
// Use px for millisecond precision
|
|
150
|
-
await kv.set(key, value, { px: ttlMs });
|
|
151
|
-
}
|
|
152
|
-
else if (session.session.expiresAt) {
|
|
153
|
-
// Use session's expiration if available
|
|
154
|
-
const ttl = session.session.expiresAt - Date.now();
|
|
155
|
-
if (ttl > 0) {
|
|
156
|
-
await kv.set(key, value, { px: ttl });
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
// Already expired, but store anyway (will be cleaned up on next access)
|
|
160
|
-
await kv.set(key, value);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
// No TTL - session persists until explicitly deleted
|
|
165
|
-
await kv.set(key, value);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Delete a session
|
|
170
|
-
*/
|
|
171
|
-
async delete(sessionId) {
|
|
172
|
-
const kv = await this.ensureConnected();
|
|
173
|
-
await kv.del(this.key(sessionId));
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Check if a session exists
|
|
177
|
-
*/
|
|
178
|
-
async exists(sessionId) {
|
|
179
|
-
const kv = await this.ensureConnected();
|
|
180
|
-
return (await kv.exists(this.key(sessionId))) === 1;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Allocate a new session ID
|
|
184
|
-
*/
|
|
185
|
-
allocId() {
|
|
186
|
-
return (0, crypto_1.randomUUID)();
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Disconnect from Vercel KV
|
|
190
|
-
* Vercel KV uses REST API, so there's no persistent connection to close
|
|
191
|
-
*/
|
|
192
|
-
async disconnect() {
|
|
193
|
-
this.kv = null;
|
|
194
|
-
this.connectPromise = null;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Test Vercel KV connection by setting and getting a test key.
|
|
198
|
-
* Useful for validating connection on startup.
|
|
199
|
-
*
|
|
200
|
-
* @returns true if connection is healthy, false otherwise
|
|
201
|
-
*/
|
|
202
|
-
async ping() {
|
|
203
|
-
try {
|
|
204
|
-
const kv = await this.ensureConnected();
|
|
205
|
-
const testKey = `${this.keyPrefix}__ping__`;
|
|
206
|
-
await kv.set(testKey, 'pong', { ex: 1 });
|
|
207
|
-
const result = await kv.get(testKey);
|
|
208
|
-
return result === 'pong';
|
|
209
|
-
}
|
|
210
|
-
catch {
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
exports.VercelKvSessionStore = VercelKvSessionStore;
|
|
216
|
-
//# sourceMappingURL=vercel-kv-session.store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-kv-session.store.js","sourceRoot":"","sources":["../../../../src/auth/session/vercel-kv-session.store.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,mCAAoC;AACpC,uEAA6F;AAwC7F;;;;;GAKG;AACH,MAAa,oBAAoB;IACvB,EAAE,GAA0B,IAAI,CAAC;IACjC,cAAc,GAAyB,IAAI,CAAC;IACnC,SAAS,CAAS;IAClB,YAAY,CAAS;IACrB,MAAM,CAAkB;IACxB,MAAM,CAAwB;IAE/C,YAAY,MAAuD,EAAE,MAAuB;QAC1F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,cAAc,CAAC;QACpD,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,OAAO,CAAC;QACnD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,EAAE;YAAE,OAAO;QAEpB,yCAAyC;QACzC,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QACvC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,cAAc,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,0CAA0C;YAC1C,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e,EAAE,CAAC;QACxC,OAAO,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAA,mBAAU,GAAE,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;QACf,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;YACxC,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,SAAS,UAAU,CAAC;YAC5C,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;YACzC,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAS,OAAO,CAAC,CAAC;YAC7C,OAAO,MAAM,KAAK,MAAM,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAvND,oDAuNC","sourcesContent":["/**\n * Vercel KV Session Store\n *\n * Session store implementation using Vercel KV (edge-compatible REST-based key-value store).\n * Uses dynamic import to avoid bundling @vercel/kv for non-Vercel deployments.\n *\n * @see https://vercel.com/docs/storage/vercel-kv\n */\n\nimport { randomUUID } from 'crypto';\nimport { SessionStore, StoredSession, storedSessionSchema } from './transport-session.types';\nimport { FrontMcpLogger } from '../../common/interfaces/logger.interface';\nimport type { VercelKvProviderOptions } from '../../common/types/options/redis.options';\n\n// Interface for the Vercel KV client (matches @vercel/kv API)\n// Using custom interface to avoid type compatibility issues with optional dependency\ninterface VercelKVClient {\n get<T = unknown>(key: string): Promise<T | null>;\n set(key: string, value: unknown, options?: { ex?: number; px?: number }): Promise<void>;\n del(...keys: string[]): Promise<number>;\n exists(...keys: string[]): Promise<number>;\n pexpire(key: string, milliseconds: number): Promise<number>;\n}\n\nexport interface VercelKvSessionConfig {\n /**\n * KV REST API URL\n * @default process.env.KV_REST_API_URL\n */\n url?: string;\n\n /**\n * KV REST API Token\n * @default process.env.KV_REST_API_TOKEN\n */\n token?: string;\n\n /**\n * Key prefix for session keys\n * @default 'mcp:session:'\n */\n keyPrefix?: string;\n\n /**\n * Default TTL in milliseconds for session extension on access\n * @default 3600000 (1 hour)\n */\n defaultTtlMs?: number;\n}\n\n/**\n * Vercel KV-backed session store implementation\n *\n * Provides persistent session storage for edge deployments using Vercel KV.\n * Sessions are stored as JSON with optional TTL.\n */\nexport class VercelKvSessionStore implements SessionStore {\n private kv: VercelKVClient | null = null;\n private connectPromise: Promise<void> | null = null;\n private readonly keyPrefix: string;\n private readonly defaultTtlMs: number;\n private readonly logger?: FrontMcpLogger;\n private readonly config: VercelKvSessionConfig;\n\n constructor(config: VercelKvSessionConfig | VercelKvProviderOptions, logger?: FrontMcpLogger) {\n this.config = config;\n this.keyPrefix = config.keyPrefix ?? 'mcp:session:';\n this.defaultTtlMs = config.defaultTtlMs ?? 3600000;\n this.logger = logger;\n }\n\n /**\n * Connect to Vercel KV\n * Uses dynamic import to avoid bundling @vercel/kv when not used.\n * Thread-safe: concurrent calls will share the same connection promise.\n */\n async connect(): Promise<void> {\n if (this.kv) return;\n\n // Prevent concurrent connection attempts\n if (this.connectPromise) {\n return this.connectPromise;\n }\n\n this.connectPromise = this.doConnect();\n try {\n await this.connectPromise;\n } catch (error) {\n // Reset promise on failure to allow retry\n this.connectPromise = null;\n throw error;\n }\n }\n\n private async doConnect(): Promise<void> {\n const { createClient } = await import('@vercel/kv');\n\n const url = this.config.url || process.env['KV_REST_API_URL'];\n const token = this.config.token || process.env['KV_REST_API_TOKEN'];\n\n if (!url || !token) {\n throw new Error(\n 'Vercel KV requires url and token. Set KV_REST_API_URL and KV_REST_API_TOKEN environment variables or provide them in config.',\n );\n }\n\n // Cast to our interface to avoid type compatibility issues\n this.kv = createClient({ url, token }) as unknown as VercelKVClient;\n }\n\n private async ensureConnected(): Promise<VercelKVClient> {\n await this.connect();\n if (!this.kv) {\n throw new Error('[VercelKvSessionStore] Connection failed - client not initialized');\n }\n return this.kv;\n }\n\n /**\n * Get the full key for a session ID\n * @throws Error if sessionId is empty\n */\n private key(sessionId: string): string {\n if (!sessionId || sessionId.trim() === '') {\n throw new Error('[VercelKvSessionStore] sessionId cannot be empty');\n }\n return `${this.keyPrefix}${sessionId}`;\n }\n\n /**\n * Get a stored session by ID\n *\n * Note: Vercel KV doesn't support GETEX, so we use GET + PEXPIRE separately.\n * This is slightly less atomic than Redis GETEX but sufficient for most use cases.\n */\n async get(sessionId: string): Promise<StoredSession | null> {\n const kv = await this.ensureConnected();\n const key = this.key(sessionId);\n\n // Get the session\n const raw = await kv.get<string>(key);\n if (!raw) return null;\n\n // Extend TTL (fire-and-forget, similar to Redis GETEX behavior)\n kv.pexpire(key, this.defaultTtlMs).catch(() => void 0);\n\n try {\n const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;\n const result = storedSessionSchema.safeParse(parsed);\n\n if (!result.success) {\n this.logger?.warn('[VercelKvSessionStore] Invalid session format', {\n sessionId: sessionId.slice(0, 20),\n errors: result.error.issues.slice(0, 3).map((i) => ({ path: i.path, message: i.message })),\n });\n // Delete invalid session data\n this.delete(sessionId).catch(() => void 0);\n return null;\n }\n\n const session = result.data;\n\n // Check application-level expiration (separate from KV TTL)\n if (session.session.expiresAt && session.session.expiresAt < Date.now()) {\n // Session is logically expired - delete it\n await this.delete(sessionId);\n return null;\n }\n\n // Bound TTL by session.expiresAt to avoid keeping expired sessions\n if (session.session.expiresAt) {\n const ttlMs = Math.min(this.defaultTtlMs, session.session.expiresAt - Date.now());\n if (ttlMs > 0 && ttlMs < this.defaultTtlMs) {\n // Fire-and-forget - we're only optimizing cache eviction timing\n kv.pexpire(key, ttlMs).catch(() => void 0);\n }\n }\n\n // Update last accessed timestamp (in the returned object)\n const updatedSession: StoredSession = {\n ...session,\n lastAccessedAt: Date.now(),\n };\n\n return updatedSession;\n } catch (error) {\n this.logger?.warn('[VercelKvSessionStore] Failed to parse session', {\n sessionId: sessionId.slice(0, 20),\n error: (error as Error).message,\n });\n // Delete corrupted session payloads to prevent repeated failures\n this.delete(sessionId).catch(() => void 0);\n return null;\n }\n }\n\n /**\n * Store a session with optional TTL\n */\n async set(sessionId: string, session: StoredSession, ttlMs?: number): Promise<void> {\n const kv = await this.ensureConnected();\n const key = this.key(sessionId);\n const value = JSON.stringify(session);\n\n if (ttlMs && ttlMs > 0) {\n // Use px for millisecond precision\n await kv.set(key, value, { px: ttlMs });\n } else if (session.session.expiresAt) {\n // Use session's expiration if available\n const ttl = session.session.expiresAt - Date.now();\n if (ttl > 0) {\n await kv.set(key, value, { px: ttl });\n } else {\n // Already expired, but store anyway (will be cleaned up on next access)\n await kv.set(key, value);\n }\n } else {\n // No TTL - session persists until explicitly deleted\n await kv.set(key, value);\n }\n }\n\n /**\n * Delete a session\n */\n async delete(sessionId: string): Promise<void> {\n const kv = await this.ensureConnected();\n await kv.del(this.key(sessionId));\n }\n\n /**\n * Check if a session exists\n */\n async exists(sessionId: string): Promise<boolean> {\n const kv = await this.ensureConnected();\n return (await kv.exists(this.key(sessionId))) === 1;\n }\n\n /**\n * Allocate a new session ID\n */\n allocId(): string {\n return randomUUID();\n }\n\n /**\n * Disconnect from Vercel KV\n * Vercel KV uses REST API, so there's no persistent connection to close\n */\n async disconnect(): Promise<void> {\n this.kv = null;\n this.connectPromise = null;\n }\n\n /**\n * Test Vercel KV connection by setting and getting a test key.\n * Useful for validating connection on startup.\n *\n * @returns true if connection is healthy, false otherwise\n */\n async ping(): Promise<boolean> {\n try {\n const kv = await this.ensureConnected();\n const testKey = `${this.keyPrefix}__ping__`;\n await kv.set(testKey, 'pong', { ex: 1 });\n const result = await kv.get<string>(testKey);\n return result === 'pong';\n } catch {\n return false;\n }\n }\n}\n"]}
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Base Layout for Server-Rendered Pages
|
|
4
|
-
*
|
|
5
|
-
* Provides a consistent HTML shell with all CDN resources pre-configured:
|
|
6
|
-
* - Tailwind CSS v4 (Browser CDN) - Utility-first CSS framework with @theme support
|
|
7
|
-
* - Google Fonts (Inter) - Modern UI typography
|
|
8
|
-
*
|
|
9
|
-
* No build step required - all resources loaded from CDN at runtime.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* // Basic usage
|
|
14
|
-
* const html = baseLayout('<div>content</div>', { title: 'Page' });
|
|
15
|
-
*
|
|
16
|
-
* // With custom theme
|
|
17
|
-
* const html = baseLayout('<div>content</div>', {
|
|
18
|
-
* title: 'Page',
|
|
19
|
-
* theme: {
|
|
20
|
-
* colors: {
|
|
21
|
-
* primary: '#3b82f6',
|
|
22
|
-
* 'primary-dark': '#2563eb',
|
|
23
|
-
* },
|
|
24
|
-
* },
|
|
25
|
-
* });
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.authLayout = exports.DEFAULT_THEME = exports.CDN = void 0;
|
|
30
|
-
exports.escapeHtml = escapeHtml;
|
|
31
|
-
exports.baseLayout = baseLayout;
|
|
32
|
-
exports.createLayout = createLayout;
|
|
33
|
-
exports.centeredCardLayout = centeredCardLayout;
|
|
34
|
-
exports.wideLayout = wideLayout;
|
|
35
|
-
exports.extraWideLayout = extraWideLayout;
|
|
36
|
-
// ============================================
|
|
37
|
-
// CDN Configuration
|
|
38
|
-
// ============================================
|
|
39
|
-
/**
|
|
40
|
-
* CDN URLs and versions - centralized for easy updates
|
|
41
|
-
*/
|
|
42
|
-
exports.CDN = {
|
|
43
|
-
/** Tailwind CSS v4 Browser CDN - generates styles on-the-fly with @theme support */
|
|
44
|
-
tailwind: 'https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4',
|
|
45
|
-
/** Google Fonts - Inter for modern UI */
|
|
46
|
-
fonts: {
|
|
47
|
-
preconnect: ['https://fonts.googleapis.com', 'https://fonts.gstatic.com'],
|
|
48
|
-
stylesheet: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap',
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Default theme with FrontMCP branding
|
|
53
|
-
*/
|
|
54
|
-
exports.DEFAULT_THEME = {
|
|
55
|
-
colors: {
|
|
56
|
-
primary: '#3b82f6', // blue-500
|
|
57
|
-
'primary-dark': '#2563eb', // blue-600
|
|
58
|
-
secondary: '#8b5cf6', // violet-500
|
|
59
|
-
accent: '#06b6d4', // cyan-500
|
|
60
|
-
success: '#22c55e', // green-500
|
|
61
|
-
warning: '#f59e0b', // amber-500
|
|
62
|
-
danger: '#ef4444', // red-500
|
|
63
|
-
},
|
|
64
|
-
fonts: {
|
|
65
|
-
sans: 'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
// ============================================
|
|
69
|
-
// Utility Functions
|
|
70
|
-
// ============================================
|
|
71
|
-
/**
|
|
72
|
-
* Escape HTML special characters to prevent XSS
|
|
73
|
-
* Per OWASP guidelines, escapes: & < > " ' /
|
|
74
|
-
*
|
|
75
|
-
* @param str - The string to escape
|
|
76
|
-
* @returns The escaped string safe for HTML content and attributes
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* escapeHtml('<script>alert("xss")</script>')
|
|
80
|
-
* // => '<script>alert("xss")</script>'
|
|
81
|
-
*/
|
|
82
|
-
function escapeHtml(str) {
|
|
83
|
-
return str
|
|
84
|
-
.replace(/&/g, '&')
|
|
85
|
-
.replace(/</g, '<')
|
|
86
|
-
.replace(/>/g, '>')
|
|
87
|
-
.replace(/"/g, '"')
|
|
88
|
-
.replace(/'/g, ''')
|
|
89
|
-
.replace(/\//g, '/');
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Build the @theme CSS block from theme configuration
|
|
93
|
-
*/
|
|
94
|
-
function buildThemeCss(theme) {
|
|
95
|
-
const lines = [];
|
|
96
|
-
// Add color variables
|
|
97
|
-
if (theme.colors) {
|
|
98
|
-
for (const [key, value] of Object.entries(theme.colors)) {
|
|
99
|
-
if (value) {
|
|
100
|
-
lines.push(`--color-${key}: ${value};`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// Add font variables
|
|
105
|
-
if (theme.fonts) {
|
|
106
|
-
for (const [key, value] of Object.entries(theme.fonts)) {
|
|
107
|
-
if (value) {
|
|
108
|
-
lines.push(`--font-${key}: ${value};`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// Add custom variables
|
|
113
|
-
if (theme.customVars) {
|
|
114
|
-
lines.push(theme.customVars);
|
|
115
|
-
}
|
|
116
|
-
return lines.join('\n ');
|
|
117
|
-
}
|
|
118
|
-
// ============================================
|
|
119
|
-
// Layout Builder
|
|
120
|
-
// ============================================
|
|
121
|
-
/**
|
|
122
|
-
* Build the complete HTML document with CDN resources
|
|
123
|
-
*
|
|
124
|
-
* @param content - The page content (HTML string)
|
|
125
|
-
* @param options - Layout configuration options
|
|
126
|
-
* @returns Complete HTML document string
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```typescript
|
|
130
|
-
* const html = baseLayout('<div>My content</div>', {
|
|
131
|
-
* title: 'Sign In',
|
|
132
|
-
* description: 'Sign in to your account',
|
|
133
|
-
* theme: {
|
|
134
|
-
* colors: {
|
|
135
|
-
* primary: '#ff6b6b',
|
|
136
|
-
* },
|
|
137
|
-
* },
|
|
138
|
-
* });
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
function baseLayout(content, options) {
|
|
142
|
-
const { title, description, includeTailwind = true, includeFonts = true, headExtra = '', bodyClass = 'bg-gray-50 min-h-screen font-sans antialiased', theme, } = options;
|
|
143
|
-
// Merge theme with defaults
|
|
144
|
-
const mergedTheme = {
|
|
145
|
-
colors: { ...exports.DEFAULT_THEME.colors, ...theme?.colors },
|
|
146
|
-
fonts: { ...exports.DEFAULT_THEME.fonts, ...theme?.fonts },
|
|
147
|
-
customVars: theme?.customVars,
|
|
148
|
-
customCss: theme?.customCss,
|
|
149
|
-
};
|
|
150
|
-
// Build font preconnect links
|
|
151
|
-
const fontPreconnect = includeFonts
|
|
152
|
-
? exports.CDN.fonts.preconnect
|
|
153
|
-
.map((url, i) => `<link rel="preconnect" href="${url}"${i > 0 ? ' crossorigin' : ''}>`)
|
|
154
|
-
.join('\n ')
|
|
155
|
-
: '';
|
|
156
|
-
// Build font stylesheet
|
|
157
|
-
const fontStylesheet = includeFonts ? `<link href="${exports.CDN.fonts.stylesheet}" rel="stylesheet">` : '';
|
|
158
|
-
// Build Tailwind v4 script and theme styles
|
|
159
|
-
const themeCss = buildThemeCss(mergedTheme);
|
|
160
|
-
const customCss = mergedTheme.customCss || '';
|
|
161
|
-
const tailwindBlock = includeTailwind
|
|
162
|
-
? `<script src="${exports.CDN.tailwind}"></script>
|
|
163
|
-
<style type="text/tailwindcss">
|
|
164
|
-
@theme {
|
|
165
|
-
${themeCss}
|
|
166
|
-
}
|
|
167
|
-
${customCss}
|
|
168
|
-
</style>`
|
|
169
|
-
: '';
|
|
170
|
-
// Build meta description
|
|
171
|
-
const metaDescription = description ? `<meta name="description" content="${escapeHtml(description)}">` : '';
|
|
172
|
-
return `<!DOCTYPE html>
|
|
173
|
-
<html lang="en">
|
|
174
|
-
<head>
|
|
175
|
-
<meta charset="UTF-8">
|
|
176
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
177
|
-
<title>${escapeHtml(title)} - FrontMCP</title>
|
|
178
|
-
${metaDescription}
|
|
179
|
-
|
|
180
|
-
<!-- Google Fonts CDN - Inter (modern UI font) -->
|
|
181
|
-
${fontPreconnect}
|
|
182
|
-
${fontStylesheet}
|
|
183
|
-
|
|
184
|
-
<!-- Tailwind CSS v4 Browser CDN with @theme support -->
|
|
185
|
-
${tailwindBlock}
|
|
186
|
-
${headExtra}
|
|
187
|
-
</head>
|
|
188
|
-
<body class="${escapeHtml(bodyClass)}">
|
|
189
|
-
${content}
|
|
190
|
-
</body>
|
|
191
|
-
</html>`;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Create a layout wrapper function with preset options
|
|
195
|
-
*
|
|
196
|
-
* @param defaultOptions - Default options to apply to all pages
|
|
197
|
-
* @returns A function that wraps content with the layout
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* ```typescript
|
|
201
|
-
* const brandedLayout = createLayout({
|
|
202
|
-
* theme: {
|
|
203
|
-
* colors: {
|
|
204
|
-
* primary: '#ff6b6b',
|
|
205
|
-
* 'primary-dark': '#ee5a5a',
|
|
206
|
-
* },
|
|
207
|
-
* },
|
|
208
|
-
* });
|
|
209
|
-
*
|
|
210
|
-
* const html = brandedLayout('<div>Content</div>', { title: 'Page' });
|
|
211
|
-
* ```
|
|
212
|
-
*/
|
|
213
|
-
function createLayout(defaultOptions) {
|
|
214
|
-
return (content, options) => {
|
|
215
|
-
// Deep merge themes
|
|
216
|
-
const mergedTheme = defaultOptions.theme || options.theme
|
|
217
|
-
? {
|
|
218
|
-
colors: { ...defaultOptions.theme?.colors, ...options.theme?.colors },
|
|
219
|
-
fonts: { ...defaultOptions.theme?.fonts, ...options.theme?.fonts },
|
|
220
|
-
customVars: options.theme?.customVars ?? defaultOptions.theme?.customVars,
|
|
221
|
-
customCss: options.theme?.customCss ?? defaultOptions.theme?.customCss,
|
|
222
|
-
}
|
|
223
|
-
: undefined;
|
|
224
|
-
return baseLayout(content, {
|
|
225
|
-
...defaultOptions,
|
|
226
|
-
...options,
|
|
227
|
-
theme: mergedTheme,
|
|
228
|
-
});
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
// ============================================
|
|
232
|
-
// Pre-configured Layouts
|
|
233
|
-
// ============================================
|
|
234
|
-
/**
|
|
235
|
-
* Default auth layout with standard styling
|
|
236
|
-
*/
|
|
237
|
-
exports.authLayout = createLayout({
|
|
238
|
-
bodyClass: 'bg-gray-50 min-h-screen font-sans antialiased',
|
|
239
|
-
});
|
|
240
|
-
/**
|
|
241
|
-
* Centered card layout for login/auth pages
|
|
242
|
-
*/
|
|
243
|
-
function centeredCardLayout(content, options) {
|
|
244
|
-
const wrappedContent = `
|
|
245
|
-
<div class="min-h-screen flex items-center justify-center p-4">
|
|
246
|
-
<div class="w-full max-w-md">
|
|
247
|
-
${content}
|
|
248
|
-
</div>
|
|
249
|
-
</div>`;
|
|
250
|
-
return baseLayout(wrappedContent, {
|
|
251
|
-
...options,
|
|
252
|
-
bodyClass: 'bg-gradient-to-br from-primary to-secondary min-h-screen font-sans antialiased',
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Wide layout for consent/selection pages
|
|
257
|
-
*/
|
|
258
|
-
function wideLayout(content, options) {
|
|
259
|
-
const wrappedContent = `
|
|
260
|
-
<div class="min-h-screen py-8 px-4">
|
|
261
|
-
<div class="max-w-2xl mx-auto">
|
|
262
|
-
${content}
|
|
263
|
-
</div>
|
|
264
|
-
</div>`;
|
|
265
|
-
return baseLayout(wrappedContent, options);
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Extra wide layout for tool selection pages
|
|
269
|
-
*/
|
|
270
|
-
function extraWideLayout(content, options) {
|
|
271
|
-
const wrappedContent = `
|
|
272
|
-
<div class="min-h-screen py-8 px-4">
|
|
273
|
-
<div class="max-w-3xl mx-auto">
|
|
274
|
-
${content}
|
|
275
|
-
</div>
|
|
276
|
-
</div>`;
|
|
277
|
-
return baseLayout(wrappedContent, options);
|
|
278
|
-
}
|
|
279
|
-
//# sourceMappingURL=base-layout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-layout.js","sourceRoot":"","sources":["../../../../src/auth/ui/base-layout.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AA2IH,gCAQC;AA0DD,gCAkEC;AAsBD,oCAqBC;AAgBD,gDAYC;AAKD,gCASC;AAKD,0CASC;AAhXD,+CAA+C;AAC/C,oBAAoB;AACpB,+CAA+C;AAE/C;;GAEG;AACU,QAAA,GAAG,GAAG;IACjB,oFAAoF;IACpF,QAAQ,EAAE,qDAAqD;IAE/D,yCAAyC;IACzC,KAAK,EAAE;QACL,UAAU,EAAE,CAAC,8BAA8B,EAAE,2BAA2B,CAAC;QACzE,UAAU,EAAE,kFAAkF;KAC/F;CACO,CAAC;AA0DX;;GAEG;AACU,QAAA,aAAa,GAAgB;IACxC,MAAM,EAAE;QACN,OAAO,EAAE,SAAS,EAAE,WAAW;QAC/B,cAAc,EAAE,SAAS,EAAE,WAAW;QACtC,SAAS,EAAE,SAAS,EAAE,aAAa;QACnC,MAAM,EAAE,SAAS,EAAE,WAAW;QAC9B,OAAO,EAAE,SAAS,EAAE,YAAY;QAChC,OAAO,EAAE,SAAS,EAAE,YAAY;QAChC,MAAM,EAAE,SAAS,EAAE,UAAU;KAC9B;IACD,KAAK,EAAE;QACL,IAAI,EAAE,qFAAqF;KAC5F;CACF,CAAC;AAgCF,+CAA+C;AAC/C,oBAAoB;AACpB,+CAA+C;AAE/C;;;;;;;;;;GAUG;AACH,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG;SACP,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,O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;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,OAAe,EAAE,OAA0B;IACpE,MAAM,cAAc,GAAG;;;QAGjB,OAAO;;SAEN,CAAC;IAER,OAAO,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,OAAe,EAAE,OAA0B;IACzE,MAAM,cAAc,GAAG;;;QAGjB,OAAO;;SAEN,CAAC;IAER,OAAO,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * Base Layout for Server-Rendered Pages\n *\n * Provides a consistent HTML shell with all CDN resources pre-configured:\n * - Tailwind CSS v4 (Browser CDN) - Utility-first CSS framework with @theme support\n * - Google Fonts (Inter) - Modern UI typography\n *\n * No build step required - all resources loaded from CDN at runtime.\n *\n * @example\n * ```typescript\n * // Basic usage\n * const html = baseLayout('<div>content</div>', { title: 'Page' });\n *\n * // With custom theme\n * const html = baseLayout('<div>content</div>', {\n * title: 'Page',\n * theme: {\n * colors: {\n * primary: '#3b82f6',\n * 'primary-dark': '#2563eb',\n * },\n * },\n * });\n * ```\n */\n\n// ============================================\n// CDN Configuration\n// ============================================\n\n/**\n * CDN URLs and versions - centralized for easy updates\n */\nexport const CDN = {\n /** Tailwind CSS v4 Browser CDN - generates styles on-the-fly with @theme support */\n tailwind: 'https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4',\n\n /** Google Fonts - Inter for modern UI */\n fonts: {\n preconnect: ['https://fonts.googleapis.com', 'https://fonts.gstatic.com'],\n stylesheet: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap',\n },\n} as const;\n\n// ============================================\n// Theme Configuration\n// ============================================\n\n/**\n * Theme color configuration\n * Keys become CSS custom properties: --color-{key}\n */\nexport interface ThemeColors {\n /** Primary brand color */\n primary?: string;\n /** Darker primary for hover states */\n 'primary-dark'?: string;\n /** Secondary brand color */\n secondary?: string;\n /** Accent color for highlights */\n accent?: string;\n /** Success state color */\n success?: string;\n /** Warning state color */\n warning?: string;\n /** Error/danger state color */\n danger?: string;\n /** Custom colors (any additional colors) */\n [key: string]: string | undefined;\n}\n\n/**\n * Theme font configuration\n * Keys become CSS custom properties: --font-{key}\n */\nexport interface ThemeFonts {\n /** Sans-serif font family */\n sans?: string;\n /** Serif font family */\n serif?: string;\n /** Monospace font family */\n mono?: string;\n /** Custom fonts */\n [key: string]: string | undefined;\n}\n\n/**\n * Complete theme configuration for FrontMCP UI\n */\nexport interface ThemeConfig {\n /** Custom colors */\n colors?: ThemeColors;\n /** Custom fonts */\n fonts?: ThemeFonts;\n /** Additional custom CSS variables (raw @theme content) */\n customVars?: string;\n /** Additional custom CSS (outside @theme) */\n customCss?: string;\n}\n\n/**\n * Default theme with FrontMCP branding\n */\nexport const DEFAULT_THEME: ThemeConfig = {\n colors: {\n primary: '#3b82f6', // blue-500\n 'primary-dark': '#2563eb', // blue-600\n secondary: '#8b5cf6', // violet-500\n accent: '#06b6d4', // cyan-500\n success: '#22c55e', // green-500\n warning: '#f59e0b', // amber-500\n danger: '#ef4444', // red-500\n },\n fonts: {\n sans: 'Inter, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n },\n};\n\n// ============================================\n// Layout Options\n// ============================================\n\n/**\n * Options for the base layout\n */\nexport interface BaseLayoutOptions {\n /** Page title (will be suffixed with \" - FrontMCP\") */\n title: string;\n\n /** Optional description for meta tag */\n description?: string;\n\n /** Include Tailwind CSS (default: true) */\n includeTailwind?: boolean;\n\n /** Include Google Fonts (default: true) */\n includeFonts?: boolean;\n\n /** Additional head content (scripts, styles, meta tags) */\n headExtra?: string;\n\n /** Body classes (default: 'bg-gray-50 min-h-screen font-sans antialiased') */\n bodyClass?: string;\n\n /** Theme configuration - colors, fonts, and custom CSS */\n theme?: ThemeConfig;\n}\n\n// ============================================\n// Utility Functions\n// ============================================\n\n/**\n * Escape HTML special characters to prevent XSS\n * Per OWASP guidelines, escapes: & < > \" ' /\n *\n * @param str - The string to escape\n * @returns The escaped string safe for HTML content and attributes\n *\n * @example\n * escapeHtml('<script>alert(\"xss\")</script>')\n * // => '<script>alert("xss")</script>'\n */\nexport function escapeHtml(str: string): string {\n return str\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n .replace(/\\//g, '/');\n}\n\n/**\n * Build the @theme CSS block from theme configuration\n */\nfunction buildThemeCss(theme: ThemeConfig): string {\n const lines: string[] = [];\n\n // Add color variables\n if (theme.colors) {\n for (const [key, value] of Object.entries(theme.colors)) {\n if (value) {\n lines.push(`--color-${key}: ${value};`);\n }\n }\n }\n\n // Add font variables\n if (theme.fonts) {\n for (const [key, value] of Object.entries(theme.fonts)) {\n if (value) {\n lines.push(`--font-${key}: ${value};`);\n }\n }\n }\n\n // Add custom variables\n if (theme.customVars) {\n lines.push(theme.customVars);\n }\n\n return lines.join('\\n ');\n}\n\n// ============================================\n// Layout Builder\n// ============================================\n\n/**\n * Build the complete HTML document with CDN resources\n *\n * @param content - The page content (HTML string)\n * @param options - Layout configuration options\n * @returns Complete HTML document string\n *\n * @example\n * ```typescript\n * const html = baseLayout('<div>My content</div>', {\n * title: 'Sign In',\n * description: 'Sign in to your account',\n * theme: {\n * colors: {\n * primary: '#ff6b6b',\n * },\n * },\n * });\n * ```\n */\nexport function baseLayout(content: string, options: BaseLayoutOptions): string {\n const {\n title,\n description,\n includeTailwind = true,\n includeFonts = true,\n headExtra = '',\n bodyClass = 'bg-gray-50 min-h-screen font-sans antialiased',\n theme,\n } = options;\n\n // Merge theme with defaults\n const mergedTheme: ThemeConfig = {\n colors: { ...DEFAULT_THEME.colors, ...theme?.colors },\n fonts: { ...DEFAULT_THEME.fonts, ...theme?.fonts },\n customVars: theme?.customVars,\n customCss: theme?.customCss,\n };\n\n // Build font preconnect links\n const fontPreconnect = includeFonts\n ? CDN.fonts.preconnect\n .map((url, i) => `<link rel=\"preconnect\" href=\"${url}\"${i > 0 ? ' crossorigin' : ''}>`)\n .join('\\n ')\n : '';\n\n // Build font stylesheet\n const fontStylesheet = includeFonts ? `<link href=\"${CDN.fonts.stylesheet}\" rel=\"stylesheet\">` : '';\n\n // Build Tailwind v4 script and theme styles\n const themeCss = buildThemeCss(mergedTheme);\n const customCss = mergedTheme.customCss || '';\n\n const tailwindBlock = includeTailwind\n ? `<script src=\"${CDN.tailwind}\"></script>\n <style type=\"text/tailwindcss\">\n @theme {\n ${themeCss}\n }\n ${customCss}\n </style>`\n : '';\n\n // Build meta description\n const metaDescription = description ? `<meta name=\"description\" content=\"${escapeHtml(description)}\">` : '';\n\n return `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${escapeHtml(title)} - FrontMCP</title>\n ${metaDescription}\n\n <!-- Google Fonts CDN - Inter (modern UI font) -->\n ${fontPreconnect}\n ${fontStylesheet}\n\n <!-- Tailwind CSS v4 Browser CDN with @theme support -->\n ${tailwindBlock}\n ${headExtra}\n</head>\n<body class=\"${escapeHtml(bodyClass)}\">\n ${content}\n</body>\n</html>`;\n}\n\n/**\n * Create a layout wrapper function with preset options\n *\n * @param defaultOptions - Default options to apply to all pages\n * @returns A function that wraps content with the layout\n *\n * @example\n * ```typescript\n * const brandedLayout = createLayout({\n * theme: {\n * colors: {\n * primary: '#ff6b6b',\n * 'primary-dark': '#ee5a5a',\n * },\n * },\n * });\n *\n * const html = brandedLayout('<div>Content</div>', { title: 'Page' });\n * ```\n */\nexport function createLayout(\n defaultOptions: Partial<BaseLayoutOptions>,\n): (content: string, options: BaseLayoutOptions) => string {\n return (content: string, options: BaseLayoutOptions) => {\n // Deep merge themes\n const mergedTheme: ThemeConfig | undefined =\n defaultOptions.theme || options.theme\n ? {\n colors: { ...defaultOptions.theme?.colors, ...options.theme?.colors },\n fonts: { ...defaultOptions.theme?.fonts, ...options.theme?.fonts },\n customVars: options.theme?.customVars ?? defaultOptions.theme?.customVars,\n customCss: options.theme?.customCss ?? defaultOptions.theme?.customCss,\n }\n : undefined;\n\n return baseLayout(content, {\n ...defaultOptions,\n ...options,\n theme: mergedTheme,\n });\n };\n}\n\n// ============================================\n// Pre-configured Layouts\n// ============================================\n\n/**\n * Default auth layout with standard styling\n */\nexport const authLayout = createLayout({\n bodyClass: 'bg-gray-50 min-h-screen font-sans antialiased',\n});\n\n/**\n * Centered card layout for login/auth pages\n */\nexport function centeredCardLayout(content: string, options: BaseLayoutOptions): string {\n const wrappedContent = `\n <div class=\"min-h-screen flex items-center justify-center p-4\">\n <div class=\"w-full max-w-md\">\n ${content}\n </div>\n </div>`;\n\n return baseLayout(wrappedContent, {\n ...options,\n bodyClass: 'bg-gradient-to-br from-primary to-secondary min-h-screen font-sans antialiased',\n });\n}\n\n/**\n * Wide layout for consent/selection pages\n */\nexport function wideLayout(content: string, options: BaseLayoutOptions): string {\n const wrappedContent = `\n <div class=\"min-h-screen py-8 px-4\">\n <div class=\"max-w-2xl mx-auto\">\n ${content}\n </div>\n </div>`;\n\n return baseLayout(wrappedContent, options);\n}\n\n/**\n * Extra wide layout for tool selection pages\n */\nexport function extraWideLayout(content: string, options: BaseLayoutOptions): string {\n const wrappedContent = `\n <div class=\"min-h-screen py-8 px-4\">\n <div class=\"max-w-3xl mx-auto\">\n ${content}\n </div>\n </div>`;\n\n return baseLayout(wrappedContent, options);\n}\n"]}
|
package/src/auth/ui/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Auth UI Module
|
|
4
|
-
*
|
|
5
|
-
* Server-rendered UI templates for OAuth flows with Tailwind CSS (CDN)
|
|
6
|
-
* and Google Fonts.
|
|
7
|
-
*
|
|
8
|
-
* No build step required - all rendering is done at runtime.
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.renderToHtml = exports.buildErrorPage = exports.buildLoginPage = exports.buildToolConsentPage = exports.buildFederatedLoginPage = exports.buildIncrementalAuthPage = exports.buildConsentPage = exports.escapeHtml = exports.extraWideLayout = exports.wideLayout = exports.centeredCardLayout = exports.authLayout = exports.createLayout = exports.baseLayout = exports.DEFAULT_THEME = exports.CDN = void 0;
|
|
12
|
-
// Base layout exports
|
|
13
|
-
var base_layout_1 = require("./base-layout");
|
|
14
|
-
Object.defineProperty(exports, "CDN", { enumerable: true, get: function () { return base_layout_1.CDN; } });
|
|
15
|
-
Object.defineProperty(exports, "DEFAULT_THEME", { enumerable: true, get: function () { return base_layout_1.DEFAULT_THEME; } });
|
|
16
|
-
Object.defineProperty(exports, "baseLayout", { enumerable: true, get: function () { return base_layout_1.baseLayout; } });
|
|
17
|
-
Object.defineProperty(exports, "createLayout", { enumerable: true, get: function () { return base_layout_1.createLayout; } });
|
|
18
|
-
Object.defineProperty(exports, "authLayout", { enumerable: true, get: function () { return base_layout_1.authLayout; } });
|
|
19
|
-
Object.defineProperty(exports, "centeredCardLayout", { enumerable: true, get: function () { return base_layout_1.centeredCardLayout; } });
|
|
20
|
-
Object.defineProperty(exports, "wideLayout", { enumerable: true, get: function () { return base_layout_1.wideLayout; } });
|
|
21
|
-
Object.defineProperty(exports, "extraWideLayout", { enumerable: true, get: function () { return base_layout_1.extraWideLayout; } });
|
|
22
|
-
Object.defineProperty(exports, "escapeHtml", { enumerable: true, get: function () { return base_layout_1.escapeHtml; } });
|
|
23
|
-
// Template builder exports
|
|
24
|
-
var templates_1 = require("./templates");
|
|
25
|
-
// Template builders
|
|
26
|
-
Object.defineProperty(exports, "buildConsentPage", { enumerable: true, get: function () { return templates_1.buildConsentPage; } });
|
|
27
|
-
Object.defineProperty(exports, "buildIncrementalAuthPage", { enumerable: true, get: function () { return templates_1.buildIncrementalAuthPage; } });
|
|
28
|
-
Object.defineProperty(exports, "buildFederatedLoginPage", { enumerable: true, get: function () { return templates_1.buildFederatedLoginPage; } });
|
|
29
|
-
Object.defineProperty(exports, "buildToolConsentPage", { enumerable: true, get: function () { return templates_1.buildToolConsentPage; } });
|
|
30
|
-
Object.defineProperty(exports, "buildLoginPage", { enumerable: true, get: function () { return templates_1.buildLoginPage; } });
|
|
31
|
-
Object.defineProperty(exports, "buildErrorPage", { enumerable: true, get: function () { return templates_1.buildErrorPage; } });
|
|
32
|
-
// Utility functions
|
|
33
|
-
Object.defineProperty(exports, "renderToHtml", { enumerable: true, get: function () { return templates_1.renderToHtml; } });
|
|
34
|
-
//# sourceMappingURL=index.js.map
|
package/src/auth/ui/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/auth/ui/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,sBAAsB;AACtB,6CAcuB;AAbrB,kGAAA,GAAG,OAAA;AACH,4GAAA,aAAa,OAAA;AAKb,yGAAA,UAAU,OAAA;AACV,2GAAA,YAAY,OAAA;AACZ,yGAAA,UAAU,OAAA;AACV,iHAAA,kBAAkB,OAAA;AAClB,yGAAA,UAAU,OAAA;AACV,8GAAA,eAAe,OAAA;AACf,yGAAA,UAAU,OAAA;AAGZ,2BAA2B;AAC3B,yCAcqB;AATnB,oBAAoB;AACpB,6GAAA,gBAAgB,OAAA;AAChB,qHAAA,wBAAwB,OAAA;AACxB,oHAAA,uBAAuB,OAAA;AACvB,iHAAA,oBAAoB,OAAA;AACpB,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AACd,oBAAoB;AACpB,yGAAA,YAAY,OAAA","sourcesContent":["/**\n * Auth UI Module\n *\n * Server-rendered UI templates for OAuth flows with Tailwind CSS (CDN)\n * and Google Fonts.\n *\n * No build step required - all rendering is done at runtime.\n */\n\n// Base layout exports\nexport {\n CDN,\n DEFAULT_THEME,\n type ThemeColors,\n type ThemeFonts,\n type ThemeConfig,\n type BaseLayoutOptions,\n baseLayout,\n createLayout,\n authLayout,\n centeredCardLayout,\n wideLayout,\n extraWideLayout,\n escapeHtml,\n} from './base-layout';\n\n// Template builder exports\nexport {\n // Types\n type AppAuthCard,\n type ProviderCard,\n type ToolCard,\n // Template builders\n buildConsentPage,\n buildIncrementalAuthPage,\n buildFederatedLoginPage,\n buildToolConsentPage,\n buildLoginPage,\n buildErrorPage,\n // Utility functions\n renderToHtml,\n} from './templates';\n"]}
|