@estifanos-sh/convex-auth 0.0.1-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/dist/_generated/component.d.ts +2981 -0
- package/dist/bin.js +7194 -0
- package/dist/browser/index.d.ts +22 -0
- package/dist/browser/index.js +61 -0
- package/dist/browser/locks.js +20 -0
- package/dist/browser/navigation.js +14 -0
- package/dist/browser/runtime.js +90 -0
- package/dist/browser/webauthn.js +99 -0
- package/dist/client/core/types.d.ts +615 -0
- package/dist/client/core/types.js +23 -0
- package/dist/client/errors.js +30 -0
- package/dist/client/factors/device.js +100 -0
- package/dist/client/factors/totp.js +111 -0
- package/dist/client/factors/webauthn.js +69 -0
- package/dist/client/index.d.ts +60 -0
- package/dist/client/index.js +976 -0
- package/dist/client/runtime/invite.js +50 -0
- package/dist/client/runtime/mutex.js +25 -0
- package/dist/client/runtime/proxy.js +75 -0
- package/dist/client/runtime/storage.js +65 -0
- package/dist/component/_generated/api.js +26 -0
- package/dist/component/_generated/component.d.ts +2981 -0
- package/dist/component/_generated/component.js +1 -0
- package/dist/component/_generated/dataModel.js +1 -0
- package/dist/component/_generated/server.js +74 -0
- package/dist/component/account.js +197 -0
- package/dist/component/connection/audit.js +152 -0
- package/dist/component/connection/cache.js +205 -0
- package/dist/component/connection/domain/verification.js +63 -0
- package/dist/component/connection/domain.js +108 -0
- package/dist/component/connection/saml/assertion.js +41 -0
- package/dist/component/connection/saml/request.js +61 -0
- package/dist/component/connection/scim/config.js +55 -0
- package/dist/component/connection/scim/identity.js +162 -0
- package/dist/component/connection/secret.js +65 -0
- package/dist/component/connection/webhook/delivery.js +396 -0
- package/dist/component/connection/webhook/endpoint.js +77 -0
- package/dist/component/connection.js +204 -0
- package/dist/component/convex.config.d.ts +7 -0
- package/dist/component/convex.config.js +15 -0
- package/dist/component/crons.js +27 -0
- package/dist/component/event.js +341 -0
- package/dist/component/factor/device.js +141 -0
- package/dist/component/factor/passkey.js +385 -0
- package/dist/component/factor/totp.js +253 -0
- package/dist/component/functions.js +3 -0
- package/dist/component/group/active.js +63 -0
- package/dist/component/group/invite.js +300 -0
- package/dist/component/group/member.js +188 -0
- package/dist/component/group.js +431 -0
- package/dist/component/http.js +9 -0
- package/dist/component/index.d.ts +5 -0
- package/dist/component/index.js +3 -0
- package/dist/component/limits.js +103 -0
- package/dist/component/maintenance.js +205 -0
- package/dist/component/migrations.js +277 -0
- package/dist/component/model.d.ts +384 -0
- package/dist/component/model.js +709 -0
- package/dist/component/modules.js +53 -0
- package/dist/component/oauth/client.js +196 -0
- package/dist/component/oauth/code.js +97 -0
- package/dist/component/oauth/refresh.js +230 -0
- package/dist/component/schema.d.ts +1530 -0
- package/dist/component/schema.js +401 -0
- package/dist/component/session.js +134 -0
- package/dist/component/token/pkce.js +121 -0
- package/dist/component/token/refresh.js +189 -0
- package/dist/component/token/verification.js +155 -0
- package/dist/component/user/email.js +147 -0
- package/dist/component/user/key.js +273 -0
- package/dist/component/user.js +173 -0
- package/dist/core/index.d.ts +531 -0
- package/dist/core/index.js +81 -0
- package/dist/expo/index.d.ts +43 -0
- package/dist/expo/index.js +131 -0
- package/dist/expo/webauthn.js +88 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/NoopLogger.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/api/logs.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/index.d.ts +7 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/AnyValue.d.ts +21 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/LogRecord.d.ts +36 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/Logger.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/LoggerOptions.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/LoggerProvider.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/baggage/propagation/W3CBaggagePropagator.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/baggage/utils.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/attributes.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/global-error-handler.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/logging-error-handler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/time.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/types.d.ts +16 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/index.d.ts +13 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/propagation/composite.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/TraceState.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/W3CTraceContextPropagator.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/rpc-metadata.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/suppress-tracing.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/utils/configuration.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/LogRecordProcessor.d.ts +24 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/LoggerProvider.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/config/LoggerConfigurators.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/BatchLogRecordProcessorBase.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/ConsoleLogRecordExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/InMemoryLogRecordExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/LogRecordExporter.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/ReadableLogRecord.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/SdkLogRecord.d.ts +71 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/SimpleLogRecordProcessor.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/index.d.ts +11 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/platform/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/platform/node/export/BatchLogRecordProcessor.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/platform/node/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/types.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/InstrumentDescriptor.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/MeterProvider.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Drop.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/ExponentialHistogram.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Histogram.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/LastValue.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Sum.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/index.d.ts +6 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/types.d.ts +53 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/AggregationSelector.d.ts +16 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/AggregationTemporality.d.ts +11 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/CardinalitySelector.d.ts +10 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/ConsoleMetricExporter.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/InMemoryMetricExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricData.d.ts +148 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricProducer.d.ts +27 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.d.ts +138 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/PeriodicExportingMetricReader.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/index.d.ts +15 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/types.d.ts +10 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/utils.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/Aggregation.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/AggregationOption.d.ts +41 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/AttributesProcessor.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/InstrumentSelector.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/View.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/BasicTracerProvider.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/IdGenerator.d.ts +11 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/Sampler.d.ts +74 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/Span.d.ts +17 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/SpanProcessor.d.ts +43 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/TimedEvent.d.ts +19 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/BatchSpanProcessorBase.d.ts +6 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/ConsoleSpanExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/InMemorySpanExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/NoopSpanProcessor.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/ReadableSpan.d.ts +29 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/SimpleSpanProcessor.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/SpanExporter.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/index.d.ts +18 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/platform/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/platform/node/export/BatchSpanProcessor.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/platform/node/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/AlwaysOffSampler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/AlwaysOnSampler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/ParentBasedSampler.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/TraceIdRatioBasedSampler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/types.d.ts +66 -0
- package/dist/otel.d.ts +73 -0
- package/dist/otel.js +82 -0
- package/dist/permissions/index.d.ts +81 -0
- package/dist/permissions/index.js +18 -0
- package/dist/providers/anonymous.d.ts +35 -0
- package/dist/providers/anonymous.js +40 -0
- package/dist/providers/apple.d.ts +61 -0
- package/dist/providers/apple.js +57 -0
- package/dist/providers/connection.d.ts +30 -0
- package/dist/providers/connection.js +33 -0
- package/dist/providers/credentials.d.ts +78 -0
- package/dist/providers/credentials.js +31 -0
- package/dist/providers/custom.d.ts +96 -0
- package/dist/providers/custom.js +108 -0
- package/dist/providers/device.d.ts +33 -0
- package/dist/providers/device.js +30 -0
- package/dist/providers/email.d.ts +45 -0
- package/dist/providers/email.js +52 -0
- package/dist/providers/github.d.ts +56 -0
- package/dist/providers/github.js +79 -0
- package/dist/providers/google.d.ts +56 -0
- package/dist/providers/google.js +59 -0
- package/dist/providers/index.d.ts +16 -0
- package/dist/providers/index.js +16 -0
- package/dist/providers/microsoft.d.ts +59 -0
- package/dist/providers/microsoft.js +98 -0
- package/dist/providers/password.d.ts +68 -0
- package/dist/providers/password.js +348 -0
- package/dist/providers/phone.d.ts +33 -0
- package/dist/providers/phone.js +35 -0
- package/dist/providers/redirect.d.ts +1 -0
- package/dist/providers/redirect.js +11 -0
- package/dist/providers/totp.d.ts +29 -0
- package/dist/providers/totp.js +29 -0
- package/dist/providers/webauthn/attestation.d.ts +42 -0
- package/dist/providers/webauthn/attestation.js +167 -0
- package/dist/providers/webauthn.d.ts +83 -0
- package/dist/providers/webauthn.js +57 -0
- package/dist/react/index.d.ts +55 -0
- package/dist/react/index.js +80 -0
- package/dist/server/auth.d.ts +443 -0
- package/dist/server/auth.js +178 -0
- package/dist/server/cache/context.js +94 -0
- package/dist/server/component/api.d.ts +14 -0
- package/dist/server/component/api.js +13 -0
- package/dist/server/component/context.d.ts +16 -0
- package/dist/server/component/context.js +1 -0
- package/dist/server/component/factor/db.js +71 -0
- package/dist/server/config.d.ts +3 -0
- package/dist/server/config.js +78 -0
- package/dist/server/connection/config.js +101 -0
- package/dist/server/connection/domain.d.ts +878 -0
- package/dist/server/connection/domain.js +1122 -0
- package/dist/server/connection/group/service.d.ts +25 -0
- package/dist/server/connection/group/service.js +250 -0
- package/dist/server/connection/http.js +1485 -0
- package/dist/server/connection/oidc.js +366 -0
- package/dist/server/connection/policy/domain.js +59 -0
- package/dist/server/connection/policy.d.ts +1 -0
- package/dist/server/connection/policy.js +163 -0
- package/dist/server/connection/profile.js +22 -0
- package/dist/server/connection/provision.js +182 -0
- package/dist/server/connection/saml/api.js +70 -0
- package/dist/server/connection/saml/binding/post.js +140 -0
- package/dist/server/connection/saml/binding/redirect.js +139 -0
- package/dist/server/connection/saml/binding/shared.js +18 -0
- package/dist/server/connection/saml/c14n.js +224 -0
- package/dist/server/connection/saml/constants.js +100 -0
- package/dist/server/connection/saml/crypto.js +170 -0
- package/dist/server/connection/saml/dom/select.js +299 -0
- package/dist/server/connection/saml/encoding.js +93 -0
- package/dist/server/connection/saml/encryption.js +34 -0
- package/dist/server/connection/saml/entity.js +24 -0
- package/dist/server/connection/saml/extractor.js +408 -0
- package/dist/server/connection/saml/flow.js +150 -0
- package/dist/server/connection/saml/identity/provider.js +66 -0
- package/dist/server/connection/saml/index.js +5 -0
- package/dist/server/connection/saml/metadata.js +294 -0
- package/dist/server/connection/saml/service/provider.js +117 -0
- package/dist/server/connection/saml/signature.js +214 -0
- package/dist/server/connection/saml/template.js +68 -0
- package/dist/server/connection/saml/types.js +1 -0
- package/dist/server/connection/saml/validator.js +32 -0
- package/dist/server/connection/saml/xml/builder.js +68 -0
- package/dist/server/connection/saml/xmldsig.js +598 -0
- package/dist/server/connection/saml/xmlenc.js +162 -0
- package/dist/server/connection/saml.d.ts +56 -0
- package/dist/server/connection/saml.js +762 -0
- package/dist/server/connection/scim.js +115 -0
- package/dist/server/connection/shared.js +74 -0
- package/dist/server/connection/webhook.js +163 -0
- package/dist/server/context.d.ts +137 -0
- package/dist/server/context.js +108 -0
- package/dist/server/contract.d.ts +48 -0
- package/dist/server/contract.js +107 -0
- package/dist/server/cookies.js +90 -0
- package/dist/server/core.js +163 -0
- package/dist/server/cors.d.ts +22 -0
- package/dist/server/cors.js +93 -0
- package/dist/server/crypto.js +43 -0
- package/dist/server/db.js +88 -0
- package/dist/server/device.js +140 -0
- package/dist/server/domains/access.js +29 -0
- package/dist/server/domains/account.d.ts +16 -0
- package/dist/server/domains/account.js +92 -0
- package/dist/server/domains/factor.d.ts +28 -0
- package/dist/server/domains/factor.js +115 -0
- package/dist/server/domains/group.js +87 -0
- package/dist/server/domains/invite.js +76 -0
- package/dist/server/domains/key.js +253 -0
- package/dist/server/domains/member.js +149 -0
- package/dist/server/domains/session.js +29 -0
- package/dist/server/domains/user.js +119 -0
- package/dist/server/env.d.ts +46 -0
- package/dist/server/env.js +96 -0
- package/dist/server/errors.js +38 -0
- package/dist/server/events.d.ts +880 -0
- package/dist/server/events.js +406 -0
- package/dist/server/facade.d.ts +83 -0
- package/dist/server/facade.js +124 -0
- package/dist/server/http.d.ts +125 -0
- package/dist/server/http.js +566 -0
- package/dist/server/identity/claims.js +58 -0
- package/dist/server/identity/convex.d.ts +15 -0
- package/dist/server/identity/convex.js +1 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/server/index.js +11 -0
- package/dist/server/keys.js +60 -0
- package/dist/server/limits.js +41 -0
- package/dist/server/log.js +28 -0
- package/dist/server/mcp.d.ts +19 -0
- package/dist/server/mcp.js +250 -0
- package/dist/server/mutations/account.js +47 -0
- package/dist/server/mutations/calls.js +16 -0
- package/dist/server/mutations/code.js +91 -0
- package/dist/server/mutations/credentials/signin.js +210 -0
- package/dist/server/mutations/invalidate.js +60 -0
- package/dist/server/mutations/oauth.js +251 -0
- package/dist/server/mutations/refresh.js +152 -0
- package/dist/server/mutations/register.js +93 -0
- package/dist/server/mutations/retrieve.js +66 -0
- package/dist/server/mutations/signature.js +36 -0
- package/dist/server/mutations/signin.js +81 -0
- package/dist/server/mutations/signout.js +61 -0
- package/dist/server/mutations/store/refs.js +15 -0
- package/dist/server/mutations/store.js +82 -0
- package/dist/server/mutations/verifier.js +25 -0
- package/dist/server/mutations/verify.js +199 -0
- package/dist/server/oauth/authorize.js +98 -0
- package/dist/server/oauth/client.d.ts +93 -0
- package/dist/server/oauth/client.js +115 -0
- package/dist/server/oauth/code.d.ts +63 -0
- package/dist/server/oauth/code.js +124 -0
- package/dist/server/oauth/domain.d.ts +23 -0
- package/dist/server/oauth/domain.js +1 -0
- package/dist/server/oauth/factory.js +46 -0
- package/dist/server/oauth/grant.js +46 -0
- package/dist/server/oauth/handlers.js +108 -0
- package/dist/server/oauth/manage.js +121 -0
- package/dist/server/oauth/normalize.js +27 -0
- package/dist/server/oauth/refresh.d.ts +71 -0
- package/dist/server/oauth/refresh.js +132 -0
- package/dist/server/oauth/register.js +147 -0
- package/dist/server/oauth/runtime.js +280 -0
- package/dist/server/oauth/token.js +355 -0
- package/dist/server/payloads.d.ts +16 -0
- package/dist/server/payloads.js +30 -0
- package/dist/server/preload.d.ts +249 -0
- package/dist/server/preload.js +673 -0
- package/dist/server/random.js +25 -0
- package/dist/server/redirects.js +85 -0
- package/dist/server/runtime.d.ts +845 -0
- package/dist/server/runtime.js +387 -0
- package/dist/server/secret.js +46 -0
- package/dist/server/services/factors.js +117 -0
- package/dist/server/services/providers.js +23 -0
- package/dist/server/services/resolve.js +17 -0
- package/dist/server/session/lifecycle.d.ts +23 -0
- package/dist/server/session/lifecycle.js +139 -0
- package/dist/server/signin/flow.js +359 -0
- package/dist/server/telemetry.js +68 -0
- package/dist/server/templates.js +91 -0
- package/dist/server/token/refresh.js +35 -0
- package/dist/server/tokens.js +164 -0
- package/dist/server/totp.js +282 -0
- package/dist/server/types.d.ts +1154 -0
- package/dist/server/types.js +1 -0
- package/dist/server/url.js +43 -0
- package/dist/server/user/account.js +325 -0
- package/dist/server/utils/bearer.js +24 -0
- package/dist/server/utils/cache.js +51 -0
- package/dist/server/utils/retry.js +3 -0
- package/dist/server/utils/span.js +59 -0
- package/dist/server/validators.d.ts +2061 -0
- package/dist/server/validators.js +320 -0
- package/dist/server/webauthn.js +699 -0
- package/dist/server/wellknown.d.ts +74 -0
- package/dist/server/wellknown.js +195 -0
- package/dist/shared/brand.d.ts +28 -0
- package/dist/shared/brand.js +13 -0
- package/dist/shared/codes.d.ts +99 -0
- package/dist/shared/codes.js +98 -0
- package/dist/shared/compare.js +23 -0
- package/dist/shared/errors.js +24 -0
- package/dist/shared/event/kinds.d.ts +188 -0
- package/dist/shared/event/kinds.js +103 -0
- package/dist/shared/fetch/guard.js +189 -0
- package/dist/shared/log.js +62 -0
- package/dist/shared/results.d.ts +58 -0
- package/dist/shared/retry.js +27 -0
- package/dist/shared/webauthn.js +9 -0
- package/dist/svelte/AuthLoading.svelte +13 -0
- package/dist/svelte/AuthLoading.svelte.d.ts +8 -0
- package/dist/svelte/SignedIn.svelte +14 -0
- package/dist/svelte/SignedIn.svelte.d.ts +8 -0
- package/dist/svelte/SignedOut.svelte +13 -0
- package/dist/svelte/SignedOut.svelte.d.ts +8 -0
- package/dist/svelte/context.svelte.d.ts +26 -0
- package/dist/svelte/context.svelte.js +61 -0
- package/dist/svelte/index.d.ts +5 -0
- package/dist/svelte/index.js +4 -0
- package/dist/test.d.ts +48 -0
- package/dist/test.js +54 -0
- package/package.json +247 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { actionGeneric, httpActionGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, mutationGeneric, queryGeneric } from "convex/server";
|
|
2
|
+
|
|
3
|
+
//#region src/component/_generated/server.ts
|
|
4
|
+
/**
|
|
5
|
+
* Define a query in this Convex app's public API.
|
|
6
|
+
*
|
|
7
|
+
* This function will be allowed to read your Convex database and will be accessible from the client.
|
|
8
|
+
*
|
|
9
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
10
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
11
|
+
*/
|
|
12
|
+
const query = queryGeneric;
|
|
13
|
+
/**
|
|
14
|
+
* Define a query that is only accessible from other Convex functions (but not from the client).
|
|
15
|
+
*
|
|
16
|
+
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
|
|
17
|
+
*
|
|
18
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
19
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
20
|
+
*/
|
|
21
|
+
const internalQuery = internalQueryGeneric;
|
|
22
|
+
/**
|
|
23
|
+
* Define a mutation in this Convex app's public API.
|
|
24
|
+
*
|
|
25
|
+
* This function will be allowed to modify your Convex database and will be accessible from the client.
|
|
26
|
+
*
|
|
27
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
28
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
29
|
+
*/
|
|
30
|
+
const mutation = mutationGeneric;
|
|
31
|
+
/**
|
|
32
|
+
* Define a mutation that is only accessible from other Convex functions (but not from the client).
|
|
33
|
+
*
|
|
34
|
+
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
|
|
35
|
+
*
|
|
36
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
37
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
38
|
+
*/
|
|
39
|
+
const internalMutation = internalMutationGeneric;
|
|
40
|
+
/**
|
|
41
|
+
* Define an action in this Convex app's public API.
|
|
42
|
+
*
|
|
43
|
+
* An action is a function which can execute any JavaScript code, including non-deterministic
|
|
44
|
+
* code and code with side-effects, like calling third-party services.
|
|
45
|
+
* They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
|
|
46
|
+
* They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
|
|
47
|
+
*
|
|
48
|
+
* @param func - The action. It receives an {@link ActionCtx} as its first argument.
|
|
49
|
+
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
|
|
50
|
+
*/
|
|
51
|
+
const action = actionGeneric;
|
|
52
|
+
/**
|
|
53
|
+
* Define an action that is only accessible from other Convex functions (but not from the client).
|
|
54
|
+
*
|
|
55
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
|
|
56
|
+
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
|
|
57
|
+
*/
|
|
58
|
+
const internalAction = internalActionGeneric;
|
|
59
|
+
/**
|
|
60
|
+
* Define an HTTP action.
|
|
61
|
+
*
|
|
62
|
+
* The wrapped function will be used to respond to HTTP requests received
|
|
63
|
+
* by a Convex deployment if the requests matches the path and method where
|
|
64
|
+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
|
|
65
|
+
*
|
|
66
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
|
|
67
|
+
* and a Fetch API `Request` object as its second.
|
|
68
|
+
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
69
|
+
*/
|
|
70
|
+
const httpAction = httpActionGeneric;
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { action, httpAction, internalAction, internalMutation, internalQuery, mutation, query };
|
|
74
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { ErrorCode } from "../shared/codes.js";
|
|
2
|
+
import { vAccountDoc, vUserDoc } from "./model.js";
|
|
3
|
+
import { mutation, query } from "./_generated/server.js";
|
|
4
|
+
import { recordSignInLimit, resetSignInLimit } from "./limits.js";
|
|
5
|
+
import { createSessionRows } from "./session.js";
|
|
6
|
+
import { ConvexError, v } from "convex/values";
|
|
7
|
+
|
|
8
|
+
//#region src/component/account.ts
|
|
9
|
+
/**
|
|
10
|
+
* `component.account.*` — provider-linked auth accounts.
|
|
11
|
+
*
|
|
12
|
+
* Reads collapse into one overloaded `get`; `list`
|
|
13
|
+
* takes the owning `userId`.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
const ACCOUNT_LIST_BATCH = 128;
|
|
18
|
+
/** Reserve a password attempt and load all sign-in state in one transaction. */
|
|
19
|
+
const beginCredentialsSignIn = mutation({
|
|
20
|
+
args: {
|
|
21
|
+
provider: v.string(),
|
|
22
|
+
providerAccountId: v.string(),
|
|
23
|
+
maxAttemptsPerHour: v.number(),
|
|
24
|
+
reserveAttempt: v.boolean(),
|
|
25
|
+
includeTotp: v.boolean()
|
|
26
|
+
},
|
|
27
|
+
returns: v.union(v.object({ status: v.literal("invalid") }), v.object({ status: v.literal("limited") }), v.object({
|
|
28
|
+
status: v.literal("ready"),
|
|
29
|
+
account: vAccountDoc,
|
|
30
|
+
user: vUserDoc,
|
|
31
|
+
hasTotp: v.boolean()
|
|
32
|
+
})),
|
|
33
|
+
handler: async (ctx, args) => {
|
|
34
|
+
const account = await ctx.db.query("Account").withIndex("provider_account_id", (q) => q.eq("provider", args.provider).eq("providerAccountId", args.providerAccountId)).unique();
|
|
35
|
+
if (account === null) return { status: "invalid" };
|
|
36
|
+
const [user, totp, limit] = await Promise.all([
|
|
37
|
+
ctx.db.get("User", account.userId),
|
|
38
|
+
args.includeTotp ? ctx.db.query("TotpFactor").withIndex("user_id_verified", (q) => q.eq("userId", account.userId).eq("verified", true)).first() : Promise.resolve(null),
|
|
39
|
+
args.reserveAttempt ? recordSignInLimit(ctx, {
|
|
40
|
+
identifier: account._id,
|
|
41
|
+
maxAttemptsPerHour: args.maxAttemptsPerHour
|
|
42
|
+
}) : Promise.resolve({
|
|
43
|
+
ok: true,
|
|
44
|
+
retryAfter: void 0
|
|
45
|
+
})
|
|
46
|
+
]);
|
|
47
|
+
if (!limit.ok) return { status: "limited" };
|
|
48
|
+
if (user === null) return { status: "invalid" };
|
|
49
|
+
return {
|
|
50
|
+
status: "ready",
|
|
51
|
+
account,
|
|
52
|
+
user,
|
|
53
|
+
hasTotp: totp !== null
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
/** Refund a verified password attempt and optionally issue its session atomically. */
|
|
58
|
+
const completeCredentialsSignIn = mutation({
|
|
59
|
+
args: {
|
|
60
|
+
accountId: v.id("Account"),
|
|
61
|
+
issueSession: v.boolean(),
|
|
62
|
+
generateTokens: v.boolean(),
|
|
63
|
+
replaceSessionId: v.optional(v.id("Session")),
|
|
64
|
+
sessionExpirationTime: v.number(),
|
|
65
|
+
refreshTokenExpirationTime: v.number()
|
|
66
|
+
},
|
|
67
|
+
returns: v.union(v.object({ status: v.literal("rejected") }), v.object({ status: v.literal("reset") }), v.object({
|
|
68
|
+
status: v.literal("accepted"),
|
|
69
|
+
user: vUserDoc,
|
|
70
|
+
sessionId: v.id("Session"),
|
|
71
|
+
refreshTokenId: v.optional(v.id("RefreshToken")),
|
|
72
|
+
replacedSessionId: v.optional(v.id("Session"))
|
|
73
|
+
})),
|
|
74
|
+
handler: async (ctx, args) => {
|
|
75
|
+
const account = await ctx.db.get("Account", args.accountId);
|
|
76
|
+
if (account === null) return { status: "rejected" };
|
|
77
|
+
await resetSignInLimit(ctx, account._id);
|
|
78
|
+
if (!args.issueSession) return { status: "reset" };
|
|
79
|
+
const created = await createSessionRows(ctx, {
|
|
80
|
+
userId: account.userId,
|
|
81
|
+
replaceSessionId: args.replaceSessionId,
|
|
82
|
+
sessionExpirationTime: args.sessionExpirationTime,
|
|
83
|
+
refreshTokenExpirationTime: args.generateTokens ? args.refreshTokenExpirationTime : void 0
|
|
84
|
+
});
|
|
85
|
+
if (created === null) return { status: "rejected" };
|
|
86
|
+
return {
|
|
87
|
+
status: "accepted",
|
|
88
|
+
user: created.user,
|
|
89
|
+
sessionId: created.sessionId,
|
|
90
|
+
...created.refreshTokenId === void 0 ? {} : { refreshTokenId: created.refreshTokenId },
|
|
91
|
+
...created.replacedSessionId === void 0 ? {} : { replacedSessionId: created.replacedSessionId }
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* Read an account by id, or by `{ provider, providerAccountId }` when both
|
|
97
|
+
* are given. Returns `null` when no selector matches.
|
|
98
|
+
*/
|
|
99
|
+
const get = query({
|
|
100
|
+
args: {
|
|
101
|
+
id: v.optional(v.id("Account")),
|
|
102
|
+
provider: v.optional(v.string()),
|
|
103
|
+
providerAccountId: v.optional(v.string())
|
|
104
|
+
},
|
|
105
|
+
returns: v.union(vAccountDoc, v.null()),
|
|
106
|
+
handler: async (ctx, args) => {
|
|
107
|
+
if (args.provider !== void 0 && args.providerAccountId !== void 0) return await ctx.db.query("Account").withIndex("provider_account_id", (q) => q.eq("provider", args.provider).eq("providerAccountId", args.providerAccountId)).unique();
|
|
108
|
+
if (args.id === void 0) return null;
|
|
109
|
+
return await ctx.db.get("Account", args.id);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
/** List the accounts owned by a user. */
|
|
113
|
+
const list = query({
|
|
114
|
+
args: { userId: v.id("User") },
|
|
115
|
+
returns: v.array(vAccountDoc),
|
|
116
|
+
handler: async (ctx, { userId }) => {
|
|
117
|
+
return await ctx.db.query("Account").withIndex("user_id_provider", (q) => q.eq("userId", userId)).take(ACCOUNT_LIST_BATCH);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
/** Insert a new account. */
|
|
121
|
+
const create = mutation({
|
|
122
|
+
args: {
|
|
123
|
+
userId: v.id("User"),
|
|
124
|
+
provider: v.string(),
|
|
125
|
+
providerAccountId: v.string(),
|
|
126
|
+
secret: v.optional(v.string()),
|
|
127
|
+
extend: v.optional(v.any())
|
|
128
|
+
},
|
|
129
|
+
returns: v.id("Account"),
|
|
130
|
+
handler: async (ctx, args) => {
|
|
131
|
+
const existing = await ctx.db.query("Account").withIndex("provider_account_id", (q) => q.eq("provider", args.provider).eq("providerAccountId", args.providerAccountId)).first();
|
|
132
|
+
if (existing !== null) {
|
|
133
|
+
if (existing.userId !== args.userId) throw new ConvexError({
|
|
134
|
+
code: ErrorCode.ACCOUNT_ALREADY_LINKED,
|
|
135
|
+
message: "This account is already linked to another user."
|
|
136
|
+
});
|
|
137
|
+
return existing._id;
|
|
138
|
+
}
|
|
139
|
+
return await ctx.db.insert("Account", args);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
/** Patch fields on an account. */
|
|
143
|
+
const update = mutation({
|
|
144
|
+
args: {
|
|
145
|
+
id: v.id("Account"),
|
|
146
|
+
patch: v.object({
|
|
147
|
+
userId: v.optional(v.id("User")),
|
|
148
|
+
provider: v.optional(v.string()),
|
|
149
|
+
providerAccountId: v.optional(v.string()),
|
|
150
|
+
secret: v.optional(v.string()),
|
|
151
|
+
emailVerified: v.optional(v.string()),
|
|
152
|
+
phoneVerified: v.optional(v.string()),
|
|
153
|
+
extend: v.optional(v.any())
|
|
154
|
+
})
|
|
155
|
+
},
|
|
156
|
+
returns: v.null(),
|
|
157
|
+
handler: async (ctx, { id: accountId, patch }) => {
|
|
158
|
+
await ctx.db.patch("Account", accountId, patch);
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
/**
|
|
163
|
+
* Delete an account. When `requireOtherAccount` is set, refuses to delete the
|
|
164
|
+
* user's last remaining account so they are never left with none.
|
|
165
|
+
*/
|
|
166
|
+
const remove = mutation({
|
|
167
|
+
args: {
|
|
168
|
+
id: v.id("Account"),
|
|
169
|
+
userId: v.optional(v.id("User")),
|
|
170
|
+
requireOtherAccount: v.optional(v.boolean())
|
|
171
|
+
},
|
|
172
|
+
returns: v.null(),
|
|
173
|
+
handler: async (ctx, { id: accountId, userId, requireOtherAccount }) => {
|
|
174
|
+
const doc = await ctx.db.get("Account", accountId);
|
|
175
|
+
if (doc === null || userId !== void 0 && doc.userId !== userId) throw new ConvexError({
|
|
176
|
+
code: ErrorCode.ACCOUNT_NOT_FOUND,
|
|
177
|
+
message: "Account not found."
|
|
178
|
+
});
|
|
179
|
+
if (requireOtherAccount === true) {
|
|
180
|
+
let otherFound = false;
|
|
181
|
+
for await (const sibling of ctx.db.query("Account").withIndex("user_id_provider", (q) => q.eq("userId", doc.userId))) if (sibling._id !== accountId) {
|
|
182
|
+
otherFound = true;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
if (!otherFound) throw new ConvexError({
|
|
186
|
+
code: ErrorCode.INVALID_PARAMETERS,
|
|
187
|
+
message: "The provided parameters are invalid."
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
await ctx.db.delete("Account", accountId);
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
//#endregion
|
|
196
|
+
export { beginCredentialsSignIn, completeCredentialsSignIn, create, get, list, remove, update };
|
|
197
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { ErrorCode } from "../../shared/codes.js";
|
|
2
|
+
import { vAuthEventProjectionDoc, vPaginated } from "../model.js";
|
|
3
|
+
import schema_default from "../schema.js";
|
|
4
|
+
import { query } from "../_generated/server.js";
|
|
5
|
+
import { ConvexError, v } from "convex/values";
|
|
6
|
+
import { paginationOptsValidator } from "convex/server";
|
|
7
|
+
import { paginator } from "convex-helpers/server/pagination";
|
|
8
|
+
|
|
9
|
+
//#region src/component/connection/audit.ts
|
|
10
|
+
/**
|
|
11
|
+
* `component.connection.audit.*` - Connection audit projections backed by auth events.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
const PUBLIC_DATA_KEYS = {
|
|
16
|
+
user: [
|
|
17
|
+
"type",
|
|
18
|
+
"provider",
|
|
19
|
+
"existingUserId"
|
|
20
|
+
],
|
|
21
|
+
session: [
|
|
22
|
+
"provider",
|
|
23
|
+
"method",
|
|
24
|
+
"reason"
|
|
25
|
+
],
|
|
26
|
+
account: ["provider", "accountId"],
|
|
27
|
+
password: ["userId"],
|
|
28
|
+
passkey: ["passkeyId"],
|
|
29
|
+
totp: ["totpId"],
|
|
30
|
+
email: ["userId"],
|
|
31
|
+
phone: ["userId"],
|
|
32
|
+
api_key: [
|
|
33
|
+
"keyId",
|
|
34
|
+
"name",
|
|
35
|
+
"prefix",
|
|
36
|
+
"reason"
|
|
37
|
+
],
|
|
38
|
+
oauth: [
|
|
39
|
+
"clientId",
|
|
40
|
+
"codeId",
|
|
41
|
+
"scopes",
|
|
42
|
+
"grantType",
|
|
43
|
+
"resource"
|
|
44
|
+
],
|
|
45
|
+
connection: [
|
|
46
|
+
"connectionId",
|
|
47
|
+
"protocol",
|
|
48
|
+
"domain",
|
|
49
|
+
"recordName",
|
|
50
|
+
"expiresAt",
|
|
51
|
+
"verifiedAt",
|
|
52
|
+
"metadataUrl",
|
|
53
|
+
"domains",
|
|
54
|
+
"version",
|
|
55
|
+
"errorCode",
|
|
56
|
+
"issuer",
|
|
57
|
+
"discoveryUrl",
|
|
58
|
+
"jwksUri",
|
|
59
|
+
"audience",
|
|
60
|
+
"tokenEndpointAuthMethod"
|
|
61
|
+
],
|
|
62
|
+
scim: [
|
|
63
|
+
"scimConfigId",
|
|
64
|
+
"resourceType",
|
|
65
|
+
"resourceId",
|
|
66
|
+
"operation",
|
|
67
|
+
"externalId",
|
|
68
|
+
"active",
|
|
69
|
+
"groupId",
|
|
70
|
+
"userId"
|
|
71
|
+
],
|
|
72
|
+
webhook: [
|
|
73
|
+
"endpointId",
|
|
74
|
+
"deliveryId",
|
|
75
|
+
"sourceEventId",
|
|
76
|
+
"sourceEventType",
|
|
77
|
+
"attemptCount",
|
|
78
|
+
"status",
|
|
79
|
+
"error"
|
|
80
|
+
],
|
|
81
|
+
security: ["reason", "errorCode"]
|
|
82
|
+
};
|
|
83
|
+
function publicData(kind, value) {
|
|
84
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
85
|
+
const keys = PUBLIC_DATA_KEYS[kind.startsWith("api_key.") ? "api_key" : kind.slice(0, kind.indexOf("."))] ?? [];
|
|
86
|
+
const source = value;
|
|
87
|
+
const redacted = {};
|
|
88
|
+
for (const key of keys) {
|
|
89
|
+
const nested = source[key];
|
|
90
|
+
if (nested !== void 0) redacted[key] = nested;
|
|
91
|
+
}
|
|
92
|
+
return Object.keys(redacted).length === 0 ? void 0 : redacted;
|
|
93
|
+
}
|
|
94
|
+
function publicProjection(doc) {
|
|
95
|
+
return {
|
|
96
|
+
_id: doc._id,
|
|
97
|
+
_creationTime: doc._creationTime,
|
|
98
|
+
eventId: doc.eventId,
|
|
99
|
+
targetKind: doc.targetKind,
|
|
100
|
+
targetId: doc.targetId,
|
|
101
|
+
kind: doc.kind,
|
|
102
|
+
category: doc.category,
|
|
103
|
+
occurredAt: doc.occurredAt,
|
|
104
|
+
actorType: doc.actorType,
|
|
105
|
+
actorId: doc.actorId,
|
|
106
|
+
subjectType: doc.subjectType,
|
|
107
|
+
subjectId: doc.subjectId,
|
|
108
|
+
outcome: doc.outcome,
|
|
109
|
+
errorCode: doc.errorCode,
|
|
110
|
+
requestId: doc.requestId,
|
|
111
|
+
ip: void 0,
|
|
112
|
+
data: publicData(doc.kind, doc.data)
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* List audit-event projections for a connection or a group, newest first and
|
|
117
|
+
* paginated. Rows are redacted to public fields (IP dropped, `data` narrowed to
|
|
118
|
+
* an allowlist). Requires exactly one of `connectionId` or `groupId` — passing
|
|
119
|
+
* neither throws rather than scanning the entire audit log.
|
|
120
|
+
*/
|
|
121
|
+
const list = query({
|
|
122
|
+
args: {
|
|
123
|
+
connectionId: v.optional(v.id("GroupConnection")),
|
|
124
|
+
groupId: v.optional(v.id("Group")),
|
|
125
|
+
paginationOpts: paginationOptsValidator
|
|
126
|
+
},
|
|
127
|
+
returns: vPaginated(vAuthEventProjectionDoc),
|
|
128
|
+
handler: async (ctx, args) => {
|
|
129
|
+
if (args.connectionId !== void 0) {
|
|
130
|
+
const result = await paginator(ctx.db, schema_default).query("AuthEventProjection").withIndex("target_time", (idx) => idx.eq("targetKind", "connection").eq("targetId", args.connectionId)).order("desc").paginate(args.paginationOpts);
|
|
131
|
+
return {
|
|
132
|
+
...result,
|
|
133
|
+
page: result.page.map(publicProjection)
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (args.groupId !== void 0) {
|
|
137
|
+
const result = await paginator(ctx.db, schema_default).query("AuthEventProjection").withIndex("target_time", (idx) => idx.eq("targetKind", "group").eq("targetId", args.groupId)).order("desc").paginate(args.paginationOpts);
|
|
138
|
+
return {
|
|
139
|
+
...result,
|
|
140
|
+
page: result.page.map(publicProjection)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
throw new ConvexError({
|
|
144
|
+
code: ErrorCode.INVALID_PARAMETERS,
|
|
145
|
+
message: "connection.audit.list requires either `connectionId` or `groupId` to target the query. Passing neither would walk the entire audit log."
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
//#endregion
|
|
151
|
+
export { list };
|
|
152
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { assertSafeIdpFetchUrl, assertSafeIdpHost } from "../../shared/fetch/guard.js";
|
|
2
|
+
import { components, internal } from "../_generated/api.js";
|
|
3
|
+
import { action, internalAction, mutation } from "../_generated/server.js";
|
|
4
|
+
import { v } from "convex/values";
|
|
5
|
+
import { ActionCache } from "@convex-dev/action-cache";
|
|
6
|
+
|
|
7
|
+
//#region src/component/connection/cache.ts
|
|
8
|
+
/**
|
|
9
|
+
* `component.connection.cache.*` — read-through cache for external Connection
|
|
10
|
+
* HTTP fetches (OIDC discovery, SAML metadata, OIDC status validation).
|
|
11
|
+
*
|
|
12
|
+
* Each cache wraps an `internalAction` that performs the fetch on miss.
|
|
13
|
+
* The cache key is `(name, args)` where `args` is the URL (plus optional
|
|
14
|
+
* proxy hints). Cache entries persist in the action-cache component's
|
|
15
|
+
* tables, so concurrent / sequential requests for the same URL share
|
|
16
|
+
* results.
|
|
17
|
+
*
|
|
18
|
+
* Direct callers go through the exposed `*Discovery`, `*Metadata`,
|
|
19
|
+
* `*StatusDiscovery` actions which are thin wrappers over the cache's
|
|
20
|
+
* `.fetch()` method. Server-side code at `server/connection/` invokes these via
|
|
21
|
+
* `ctx.runAction(components.auth.connection.cache.X, args)`.
|
|
22
|
+
*
|
|
23
|
+
* To invalidate (e.g. when an admin updates `discoveryUrl` or
|
|
24
|
+
* `metadataUrl`), call the matching `invalidate*` mutation.
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* One isolated typed bridge across `ActionCache.fetch`'s ctx boundary. An
|
|
30
|
+
* `action` handler's ctx supplies `runQuery`/`runMutation`/`runAction`, but over
|
|
31
|
+
* this component's concrete DataModel, which TS treats as incompatible with the
|
|
32
|
+
* action-cache's `GenericDataModel` under invariance — so the two cannot be
|
|
33
|
+
* unified positively. Each caller infers the exact target from the `.fetch`
|
|
34
|
+
* parameter, so results stay precisely typed.
|
|
35
|
+
*/
|
|
36
|
+
function asActionCacheCtx(ctx) {
|
|
37
|
+
return ctx;
|
|
38
|
+
}
|
|
39
|
+
const fetchUrlArgs = {
|
|
40
|
+
url: v.string(),
|
|
41
|
+
runtimeOrigin: v.optional(v.string()),
|
|
42
|
+
externalHost: v.optional(v.string())
|
|
43
|
+
};
|
|
44
|
+
const vOidcDiscovery = v.object({
|
|
45
|
+
issuer: v.string(),
|
|
46
|
+
authorization_endpoint: v.string(),
|
|
47
|
+
token_endpoint: v.string(),
|
|
48
|
+
jwks_uri: v.string(),
|
|
49
|
+
userinfo_endpoint: v.optional(v.string()),
|
|
50
|
+
token_endpoint_auth_methods_supported: v.optional(v.array(v.string())),
|
|
51
|
+
id_token_signing_alg_values_supported: v.optional(v.array(v.string()))
|
|
52
|
+
});
|
|
53
|
+
const requestOidcDiscoveryRef = internal.connection.cache.requestOidcDiscovery;
|
|
54
|
+
const requestTextRef = internal.connection.cache.requestText;
|
|
55
|
+
function normalizeOidcDiscovery(data) {
|
|
56
|
+
if (typeof data !== "object" || data === null) throw new Error("OIDC discovery response is not an object.");
|
|
57
|
+
const source = data;
|
|
58
|
+
if (typeof source.issuer !== "string") throw new Error("OIDC discovery is missing 'issuer'.");
|
|
59
|
+
if (typeof source.authorization_endpoint !== "string") throw new Error("OIDC discovery is missing 'authorization_endpoint'.");
|
|
60
|
+
if (typeof source.token_endpoint !== "string") throw new Error("OIDC discovery is missing 'token_endpoint'.");
|
|
61
|
+
if (typeof source.jwks_uri !== "string") throw new Error("OIDC discovery is missing 'jwks_uri'.");
|
|
62
|
+
return {
|
|
63
|
+
issuer: source.issuer,
|
|
64
|
+
authorization_endpoint: source.authorization_endpoint,
|
|
65
|
+
token_endpoint: source.token_endpoint,
|
|
66
|
+
jwks_uri: source.jwks_uri,
|
|
67
|
+
userinfo_endpoint: typeof source.userinfo_endpoint === "string" ? source.userinfo_endpoint : void 0,
|
|
68
|
+
token_endpoint_auth_methods_supported: Array.isArray(source.token_endpoint_auth_methods_supported) ? source.token_endpoint_auth_methods_supported.filter((value) => typeof value === "string") : void 0,
|
|
69
|
+
id_token_signing_alg_values_supported: Array.isArray(source.id_token_signing_alg_values_supported) ? source.id_token_signing_alg_values_supported.filter((value) => typeof value === "string") : void 0
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function normalizeRuntimeOrigin(runtimeOrigin) {
|
|
73
|
+
if (runtimeOrigin === void 0) return;
|
|
74
|
+
let parsed;
|
|
75
|
+
try {
|
|
76
|
+
parsed = new URL(runtimeOrigin);
|
|
77
|
+
} catch {
|
|
78
|
+
throw new Error("runtimeOrigin must be a valid absolute URL.");
|
|
79
|
+
}
|
|
80
|
+
if (parsed.username !== "" || parsed.password !== "" || parsed.pathname !== "/" || parsed.search !== "" || parsed.hash !== "") throw new Error("runtimeOrigin must be an origin with no path, query, hash, or credentials.");
|
|
81
|
+
assertSafeIdpFetchUrl(parsed.origin);
|
|
82
|
+
return parsed.origin;
|
|
83
|
+
}
|
|
84
|
+
function validateExternalHost(externalHost, runtimeOrigin) {
|
|
85
|
+
if (externalHost === void 0) return;
|
|
86
|
+
if (runtimeOrigin === void 0) throw new Error("externalHost requires runtimeOrigin.");
|
|
87
|
+
assertSafeIdpHost(externalHost);
|
|
88
|
+
}
|
|
89
|
+
const buildRequestUrl = (url, runtimeOrigin, externalHost) => {
|
|
90
|
+
assertSafeIdpFetchUrl(url);
|
|
91
|
+
const normalizedRuntimeOrigin = normalizeRuntimeOrigin(runtimeOrigin);
|
|
92
|
+
validateExternalHost(externalHost, normalizedRuntimeOrigin);
|
|
93
|
+
const parsed = new URL(url);
|
|
94
|
+
const rewritten = normalizedRuntimeOrigin !== void 0 && parsed.origin !== normalizedRuntimeOrigin ? new URL(`${normalizedRuntimeOrigin}${parsed.pathname}${parsed.search}`) : parsed;
|
|
95
|
+
assertSafeIdpFetchUrl(rewritten.toString());
|
|
96
|
+
const headers = new Headers();
|
|
97
|
+
if (normalizedRuntimeOrigin !== void 0 && externalHost !== void 0) headers.set("host", externalHost);
|
|
98
|
+
return {
|
|
99
|
+
url: rewritten,
|
|
100
|
+
headers
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
/** Request an OIDC discovery URL and return the normalized fields used by auth. @internal */
|
|
104
|
+
const requestOidcDiscovery = internalAction({
|
|
105
|
+
args: fetchUrlArgs,
|
|
106
|
+
returns: vOidcDiscovery,
|
|
107
|
+
handler: async (_ctx, { url, runtimeOrigin, externalHost }) => {
|
|
108
|
+
const req = buildRequestUrl(url, runtimeOrigin, externalHost);
|
|
109
|
+
const response = await fetch(req.url, {
|
|
110
|
+
headers: req.headers,
|
|
111
|
+
redirect: "manual",
|
|
112
|
+
signal: AbortSignal.timeout(1e4)
|
|
113
|
+
});
|
|
114
|
+
if (!response.ok) throw new Error(`HTTP ${response.status} fetching ${url}`);
|
|
115
|
+
return normalizeOidcDiscovery(await response.json());
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
/** Request a URL and return the response body as text. @internal */
|
|
119
|
+
const requestText = internalAction({
|
|
120
|
+
args: fetchUrlArgs,
|
|
121
|
+
returns: v.string(),
|
|
122
|
+
handler: async (_ctx, { url, runtimeOrigin, externalHost }) => {
|
|
123
|
+
const req = buildRequestUrl(url, runtimeOrigin, externalHost);
|
|
124
|
+
const response = await fetch(req.url, {
|
|
125
|
+
headers: req.headers,
|
|
126
|
+
redirect: "manual",
|
|
127
|
+
signal: AbortSignal.timeout(15e3)
|
|
128
|
+
});
|
|
129
|
+
if (!response.ok) throw new Error(`HTTP ${response.status} fetching ${url}`);
|
|
130
|
+
return await response.text();
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
const ONE_HOUR = 3600 * 1e3;
|
|
134
|
+
const TWO_HOURS = 2 * ONE_HOUR;
|
|
135
|
+
const ONE_DAY = 24 * ONE_HOUR;
|
|
136
|
+
const oidcDiscoveryCache = new ActionCache(components.connectionFetchCache, {
|
|
137
|
+
action: requestOidcDiscoveryRef,
|
|
138
|
+
name: "oidcDiscovery",
|
|
139
|
+
ttl: ONE_HOUR
|
|
140
|
+
});
|
|
141
|
+
const oidcStatusDiscoveryCache = new ActionCache(components.connectionFetchCache, {
|
|
142
|
+
action: requestOidcDiscoveryRef,
|
|
143
|
+
name: "oidcStatusDiscovery",
|
|
144
|
+
ttl: TWO_HOURS
|
|
145
|
+
});
|
|
146
|
+
const samlMetadataCache = new ActionCache(components.connectionFetchCache, {
|
|
147
|
+
action: requestTextRef,
|
|
148
|
+
name: "samlMetadata",
|
|
149
|
+
ttl: ONE_DAY
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* Read-through fetch for OIDC discovery JSON. Cached 1h per URL.
|
|
153
|
+
*/
|
|
154
|
+
const oidcDiscovery = action({
|
|
155
|
+
args: fetchUrlArgs,
|
|
156
|
+
returns: vOidcDiscovery,
|
|
157
|
+
handler: async (ctx, args) => {
|
|
158
|
+
return await oidcDiscoveryCache.fetch(asActionCacheCtx(ctx), args);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
/**
|
|
162
|
+
* Read-through fetch for OIDC discovery during admin status validation.
|
|
163
|
+
* Cached 2h per URL (separate from the runtime sign-in path so admin
|
|
164
|
+
* dashboards don't share keys with hot-path traffic).
|
|
165
|
+
*/
|
|
166
|
+
const oidcStatusDiscovery = action({
|
|
167
|
+
args: fetchUrlArgs,
|
|
168
|
+
returns: vOidcDiscovery,
|
|
169
|
+
handler: async (ctx, args) => {
|
|
170
|
+
return await oidcStatusDiscoveryCache.fetch(asActionCacheCtx(ctx), args);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
/**
|
|
174
|
+
* Read-through fetch for SAML IdP metadata XML. Cached 24h per URL.
|
|
175
|
+
*/
|
|
176
|
+
const samlMetadata = action({
|
|
177
|
+
args: fetchUrlArgs,
|
|
178
|
+
returns: v.string(),
|
|
179
|
+
handler: async (ctx, args) => {
|
|
180
|
+
return await samlMetadataCache.fetch(asActionCacheCtx(ctx), args);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
/** Invalidate a cached OIDC discovery entry (e.g. on `discoveryUrl` update). */
|
|
184
|
+
const invalidateOidcDiscovery = mutation({
|
|
185
|
+
args: fetchUrlArgs,
|
|
186
|
+
returns: v.null(),
|
|
187
|
+
handler: async (ctx, args) => {
|
|
188
|
+
await oidcDiscoveryCache.remove(ctx, args);
|
|
189
|
+
await oidcStatusDiscoveryCache.remove(ctx, args);
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
/** Invalidate a cached SAML metadata entry (e.g. on `metadataUrl` update). */
|
|
194
|
+
const invalidateSamlMetadata = mutation({
|
|
195
|
+
args: fetchUrlArgs,
|
|
196
|
+
returns: v.null(),
|
|
197
|
+
handler: async (ctx, args) => {
|
|
198
|
+
await samlMetadataCache.remove(ctx, args);
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
//#endregion
|
|
204
|
+
export { invalidateOidcDiscovery, invalidateSamlMetadata, oidcDiscovery, oidcStatusDiscovery, requestOidcDiscovery, requestText, samlMetadata };
|
|
205
|
+
//# sourceMappingURL=cache.js.map
|