@aurabase/aurabase-js 0.3.0 → 0.4.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 +26 -795
- package/{packages/aurabase/dist/AuraClient-DAtDbfPB.d.ts → dist/AuraClient-BcFE8u1v.d.cts} +1 -1
- package/{packages/aurabase/dist/AuraClient-DAtDbfPB.d.cts → dist/AuraClient-BcFE8u1v.d.ts} +1 -1
- package/{packages/aurabase/dist → dist}/index.d.cts +1 -1
- package/{packages/aurabase/dist → dist}/index.d.ts +1 -1
- package/{packages/aurabase/dist → dist}/ssr.d.cts +1 -1
- package/{packages/aurabase/dist → dist}/ssr.d.ts +1 -1
- package/package.json +72 -82
- package/.changeset/config.json +0 -11
- package/CHANGELOG.md +0 -30
- package/packages/ai/LICENSE +0 -21
- package/packages/ai/README.md +0 -106
- package/packages/ai/dist/index.cjs +0 -229
- package/packages/ai/dist/index.d.cts +0 -139
- package/packages/ai/dist/index.d.ts +0 -139
- package/packages/ai/dist/index.js +0 -226
- package/packages/ai/node_modules/.bin/esbuild +0 -19
- package/packages/ai/node_modules/.bin/tsc +0 -22
- package/packages/ai/node_modules/.bin/tsserver +0 -22
- package/packages/ai/node_modules/.bin/tsup +0 -22
- package/packages/ai/node_modules/.bin/tsup-node +0 -22
- package/packages/ai/node_modules/.bin/vite +0 -22
- package/packages/ai/node_modules/.bin/vitest +0 -22
- package/packages/ai/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/ai/package.json +0 -61
- package/packages/ai/src/AiService.ts +0 -226
- package/packages/ai/src/index.ts +0 -18
- package/packages/ai/src/sse.ts +0 -141
- package/packages/ai/src/types.ts +0 -30
- package/packages/ai/tests/chat-stream.test.ts +0 -151
- package/packages/ai/tests/rag-namespaces.test.ts +0 -54
- package/packages/ai/tests/sse.test.ts +0 -69
- package/packages/ai/tsconfig.json +0 -5
- package/packages/ai/tsup.config.ts +0 -11
- package/packages/aurabase/LICENSE +0 -21
- package/packages/aurabase/README.md +0 -64
- package/packages/aurabase/node_modules/.bin/esbuild +0 -19
- package/packages/aurabase/node_modules/.bin/tsc +0 -22
- package/packages/aurabase/node_modules/.bin/tsserver +0 -22
- package/packages/aurabase/node_modules/.bin/tsup +0 -22
- package/packages/aurabase/node_modules/.bin/tsup-node +0 -22
- package/packages/aurabase/node_modules/.bin/vite +0 -22
- package/packages/aurabase/node_modules/.bin/vitest +0 -22
- package/packages/aurabase/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/aurabase/package.json +0 -80
- package/packages/aurabase/src/AuraClient.ts +0 -237
- package/packages/aurabase/src/index.ts +0 -152
- package/packages/aurabase/src/ssr.ts +0 -156
- package/packages/aurabase/tests/ai-streaming-rag-e2e.test.ts +0 -82
- package/packages/aurabase/tests/ai.test.ts +0 -111
- package/packages/aurabase/tests/auth-admin.test.ts +0 -515
- package/packages/aurabase/tests/auth-e2e.test.ts +0 -135
- package/packages/aurabase/tests/auth-hardening.test.ts +0 -206
- package/packages/aurabase/tests/auth.test.ts +0 -947
- package/packages/aurabase/tests/database.test.ts +0 -230
- package/packages/aurabase/tests/db-types-e2e.test.ts +0 -217
- package/packages/aurabase/tests/dispose.test.ts +0 -23
- package/packages/aurabase/tests/foreign-token.e2e.test.ts +0 -129
- package/packages/aurabase/tests/functions.test.ts +0 -107
- package/packages/aurabase/tests/integration.test.ts +0 -413
- package/packages/aurabase/tests/live-production-validation.js +0 -241
- package/packages/aurabase/tests/live-sdk-production-validation.js +0 -293
- package/packages/aurabase/tests/mocks.ts +0 -139
- package/packages/aurabase/tests/notifications.test.ts +0 -314
- package/packages/aurabase/tests/observability-backup.test.ts +0 -186
- package/packages/aurabase/tests/observability-hook.test.ts +0 -130
- package/packages/aurabase/tests/production-robustness.test.ts +0 -268
- package/packages/aurabase/tests/public-api-surface.test.ts +0 -53
- package/packages/aurabase/tests/query-builder.test.ts +0 -329
- package/packages/aurabase/tests/readme-smoke-e2e.test.ts +0 -231
- package/packages/aurabase/tests/realtime-filter-e2e.test.ts +0 -344
- package/packages/aurabase/tests/refresh-locks.test.ts +0 -210
- package/packages/aurabase/tests/retry-option.test.ts +0 -17
- package/packages/aurabase/tests/rpc-e2e.test.ts +0 -254
- package/packages/aurabase/tests/rs256-local-e2e.test.ts +0 -114
- package/packages/aurabase/tests/rt-alias-public-e2e.test.ts +0 -235
- package/packages/aurabase/tests/rt-http-broadcast-e2e.test.ts +0 -124
- package/packages/aurabase/tests/service-role-guard.test.ts +0 -99
- package/packages/aurabase/tests/ssr.test.ts +0 -91
- package/packages/aurabase/tests/storage-backend-e2e.test.ts +0 -481
- package/packages/aurabase/tests/storage-sdk-parity-e2e.test.ts +0 -104
- package/packages/aurabase/tests/storage-transform-e2e.test.ts +0 -684
- package/packages/aurabase/tests/storage.test.ts +0 -55
- package/packages/aurabase/tests/types/client-generic.test-d.ts +0 -79
- package/packages/aurabase/tests/types/docs-snippets.test-d.ts +0 -571
- package/packages/aurabase/tests/types/error-code.test-d.ts +0 -53
- package/packages/aurabase/tsconfig.json +0 -5
- package/packages/aurabase/tsconfig.test-d.json +0 -5
- package/packages/aurabase/tsup.config.ts +0 -11
- package/packages/aurabase/vitest.config.ts +0 -16
- package/packages/aurabase/vitest.e2e.config.ts +0 -9
- package/packages/auth/LICENSE +0 -21
- package/packages/auth/README.md +0 -215
- package/packages/auth/dist/index.cjs +0 -1175
- package/packages/auth/dist/index.d.cts +0 -397
- package/packages/auth/dist/index.d.ts +0 -397
- package/packages/auth/dist/index.js +0 -1170
- package/packages/auth/node_modules/.bin/esbuild +0 -19
- package/packages/auth/node_modules/.bin/tsc +0 -22
- package/packages/auth/node_modules/.bin/tsserver +0 -22
- package/packages/auth/node_modules/.bin/tsup +0 -22
- package/packages/auth/node_modules/.bin/tsup-node +0 -22
- package/packages/auth/node_modules/.bin/vite +0 -22
- package/packages/auth/node_modules/.bin/vitest +0 -22
- package/packages/auth/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/auth/package.json +0 -61
- package/packages/auth/src/AuthAdminService.ts +0 -149
- package/packages/auth/src/AuthService.ts +0 -1166
- package/packages/auth/src/SessionManager.ts +0 -92
- package/packages/auth/src/index.ts +0 -17
- package/packages/auth/src/jwks.ts +0 -337
- package/packages/auth/src/pkce.ts +0 -27
- package/packages/auth/src/types.ts +0 -89
- package/packages/auth/tests/auth-lifecycle.test.ts +0 -149
- package/packages/auth/tests/detect-session.test.ts +0 -361
- package/packages/auth/tests/getclaims.test.ts +0 -780
- package/packages/auth/tests/is-mfa-challenge.test.ts +0 -27
- package/packages/auth/tests/password-recovery.test.ts +0 -124
- package/packages/auth/tests/pkce.test.ts +0 -192
- package/packages/auth/tests/session-manager.test.ts +0 -103
- package/packages/auth/tests/set-session.test.ts +0 -139
- package/packages/auth/tests/verify-otp.test.ts +0 -153
- package/packages/auth/tsconfig.json +0 -5
- package/packages/auth/tsup.config.ts +0 -11
- package/packages/core/LICENSE +0 -21
- package/packages/core/README.md +0 -132
- package/packages/core/dist/index.cjs +0 -695
- package/packages/core/dist/index.d.cts +0 -1137
- package/packages/core/dist/index.d.ts +0 -1137
- package/packages/core/dist/index.js +0 -673
- package/packages/core/node_modules/.bin/esbuild +0 -22
- package/packages/core/node_modules/.bin/tsc +0 -22
- package/packages/core/node_modules/.bin/tsserver +0 -22
- package/packages/core/node_modules/.bin/tsup +0 -22
- package/packages/core/node_modules/.bin/tsup-node +0 -22
- package/packages/core/node_modules/.bin/vite +0 -22
- package/packages/core/node_modules/.bin/vitest +0 -22
- package/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/core/package.json +0 -57
- package/packages/core/src/AuraError.ts +0 -89
- package/packages/core/src/BaseService.ts +0 -44
- package/packages/core/src/client.ts +0 -34
- package/packages/core/src/cookie-utils.ts +0 -42
- package/packages/core/src/fetch.ts +0 -435
- package/packages/core/src/index.ts +0 -22
- package/packages/core/src/retry.ts +0 -63
- package/packages/core/src/serialize.ts +0 -6
- package/packages/core/src/stores/BaseAuthStore.ts +0 -164
- package/packages/core/src/stores/LocalAuthStore.ts +0 -199
- package/packages/core/src/types.ts +0 -1042
- package/packages/core/tests/auth-store.test.ts +0 -300
- package/packages/core/tests/error-code.test.ts +0 -61
- package/packages/core/tests/error.test.ts +0 -24
- package/packages/core/tests/fetch.test.ts +0 -286
- package/packages/core/tests/mocks.ts +0 -139
- package/packages/core/tests/observability.test.ts +0 -86
- package/packages/core/tests/refresh-hardening.test.ts +0 -164
- package/packages/core/tests/refresh-observability.test.ts +0 -111
- package/packages/core/tests/retry.test.ts +0 -106
- package/packages/core/tests/serialize.test.ts +0 -12
- package/packages/core/tests/timeout.test.ts +0 -79
- package/packages/core/tsconfig.json +0 -5
- package/packages/core/tsup.config.ts +0 -11
- package/packages/db/LICENSE +0 -21
- package/packages/db/README.md +0 -152
- package/packages/db/VENDORED.md +0 -93
- package/packages/db/dist/index.cjs +0 -544
- package/packages/db/dist/index.d.cts +0 -1111
- package/packages/db/dist/index.d.ts +0 -1111
- package/packages/db/dist/index.js +0 -541
- package/packages/db/node_modules/.bin/esbuild +0 -19
- package/packages/db/node_modules/.bin/tsc +0 -22
- package/packages/db/node_modules/.bin/tsserver +0 -22
- package/packages/db/node_modules/.bin/tsup +0 -22
- package/packages/db/node_modules/.bin/tsup-node +0 -22
- package/packages/db/node_modules/.bin/vite +0 -22
- package/packages/db/node_modules/.bin/vitest +0 -22
- package/packages/db/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/db/package.json +0 -62
- package/packages/db/src/DatabaseService.ts +0 -170
- package/packages/db/src/QueryBuilder.ts +0 -830
- package/packages/db/src/index.ts +0 -2
- package/packages/db/src/pgrst-types/common/common.ts +0 -86
- package/packages/db/src/pgrst-types/common/rpc.ts +0 -151
- package/packages/db/src/pgrst-types/feature-flags.ts +0 -20
- package/packages/db/src/pgrst-types/types.ts +0 -134
- package/packages/db/src/select-query-parser/parser.ts +0 -479
- package/packages/db/src/select-query-parser/result.ts +0 -553
- package/packages/db/src/select-query-parser/types.ts +0 -132
- package/packages/db/src/select-query-parser/utils.ts +0 -707
- package/packages/db/tests/filters.test.ts +0 -81
- package/packages/db/tests/mutations-filtered.e2e.test.ts +0 -132
- package/packages/db/tests/mutations-filtered.test.ts +0 -188
- package/packages/db/tests/order.test.ts +0 -45
- package/packages/db/tests/rpc.test.ts +0 -41
- package/packages/db/tests/scale/build-large-schema.ts +0 -94
- package/packages/db/tests/scale/scale-compile.test.ts +0 -167
- package/packages/db/tests/schema.test.ts +0 -77
- package/packages/db/tests/single-accept.e2e.test.ts +0 -123
- package/packages/db/tests/single.test.ts +0 -211
- package/packages/db/tests/types/filters.test-d.ts +0 -52
- package/packages/db/tests/types/fixtures.ts +0 -40
- package/packages/db/tests/types/from-views.test-d.ts +0 -18
- package/packages/db/tests/types/mutations.test-d.ts +0 -23
- package/packages/db/tests/types/rpc.test-d.ts +0 -60
- package/packages/db/tests/types/schema-shape.test-d.ts +0 -8
- package/packages/db/tests/types/select-inference.test-d.ts +0 -38
- package/packages/db/tests/vendored/fixtures.ts +0 -83
- package/packages/db/tests/vendored/get-result.test-d.ts +0 -75
- package/packages/db/tsconfig.json +0 -5
- package/packages/db/tsconfig.test-d.json +0 -5
- package/packages/db/tsup.config.ts +0 -11
- package/packages/db/vitest.config.ts +0 -8
- package/packages/functions/LICENSE +0 -21
- package/packages/functions/README.md +0 -96
- package/packages/functions/dist/index.cjs +0 -173
- package/packages/functions/dist/index.d.cts +0 -81
- package/packages/functions/dist/index.d.ts +0 -81
- package/packages/functions/dist/index.js +0 -168
- package/packages/functions/node_modules/.bin/esbuild +0 -19
- package/packages/functions/node_modules/.bin/tsc +0 -22
- package/packages/functions/node_modules/.bin/tsserver +0 -22
- package/packages/functions/node_modules/.bin/tsup +0 -22
- package/packages/functions/node_modules/.bin/tsup-node +0 -22
- package/packages/functions/node_modules/.bin/vite +0 -22
- package/packages/functions/node_modules/.bin/vitest +0 -22
- package/packages/functions/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/functions/package.json +0 -60
- package/packages/functions/src/FunctionsService.ts +0 -188
- package/packages/functions/src/errors.ts +0 -70
- package/packages/functions/src/index.ts +0 -6
- package/packages/functions/tests/invoke.test.ts +0 -97
- package/packages/functions/tests/response-type-errors.test.ts +0 -135
- package/packages/functions/tsconfig.json +0 -5
- package/packages/functions/tsup.config.ts +0 -11
- package/packages/gen/LICENSE +0 -21
- package/packages/gen/README.md +0 -84
- package/packages/gen/dist/cli.cjs +0 -334
- package/packages/gen/dist/cli.d.cts +0 -1
- package/packages/gen/dist/cli.d.ts +0 -1
- package/packages/gen/dist/cli.js +0 -332
- package/packages/gen/dist/index.cjs +0 -257
- package/packages/gen/dist/index.d.cts +0 -12
- package/packages/gen/dist/index.d.ts +0 -12
- package/packages/gen/dist/index.js +0 -255
- package/packages/gen/node_modules/.bin/esbuild +0 -19
- package/packages/gen/node_modules/.bin/tsc +0 -22
- package/packages/gen/node_modules/.bin/tsserver +0 -22
- package/packages/gen/node_modules/.bin/tsup +0 -22
- package/packages/gen/node_modules/.bin/tsup-node +0 -22
- package/packages/gen/node_modules/.bin/vite +0 -22
- package/packages/gen/node_modules/.bin/vitest +0 -22
- package/packages/gen/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/gen/package.json +0 -66
- package/packages/gen/src/cli.ts +0 -67
- package/packages/gen/src/generate.ts +0 -0
- package/packages/gen/src/index.ts +0 -2
- package/packages/gen/tests/compile.test.ts +0 -213
- package/packages/gen/tests/e2e.test.ts +0 -130
- package/packages/gen/tests/generate.test.ts +0 -396
- package/packages/gen/tsconfig.json +0 -5
- package/packages/gen/tsup.config.ts +0 -11
- package/packages/notifications/LICENSE +0 -21
- package/packages/notifications/README.md +0 -134
- package/packages/notifications/dist/index.cjs +0 -128
- package/packages/notifications/dist/index.d.cts +0 -81
- package/packages/notifications/dist/index.d.ts +0 -81
- package/packages/notifications/dist/index.js +0 -125
- package/packages/notifications/node_modules/.bin/esbuild +0 -19
- package/packages/notifications/node_modules/.bin/tsc +0 -22
- package/packages/notifications/node_modules/.bin/tsserver +0 -22
- package/packages/notifications/node_modules/.bin/tsup +0 -22
- package/packages/notifications/node_modules/.bin/tsup-node +0 -22
- package/packages/notifications/node_modules/.bin/vite +0 -22
- package/packages/notifications/node_modules/.bin/vitest +0 -22
- package/packages/notifications/package.json +0 -60
- package/packages/notifications/src/NotificationsService.ts +0 -230
- package/packages/notifications/src/index.ts +0 -19
- package/packages/notifications/tsconfig.json +0 -5
- package/packages/notifications/tsup.config.ts +0 -11
- package/packages/realtime/LICENSE +0 -21
- package/packages/realtime/README.md +0 -183
- package/packages/realtime/dist/index.cjs +0 -977
- package/packages/realtime/dist/index.d.cts +0 -259
- package/packages/realtime/dist/index.d.ts +0 -259
- package/packages/realtime/dist/index.js +0 -973
- package/packages/realtime/node_modules/.bin/esbuild +0 -19
- package/packages/realtime/node_modules/.bin/tsc +0 -22
- package/packages/realtime/node_modules/.bin/tsserver +0 -22
- package/packages/realtime/node_modules/.bin/tsup +0 -22
- package/packages/realtime/node_modules/.bin/tsup-node +0 -22
- package/packages/realtime/node_modules/.bin/vite +0 -22
- package/packages/realtime/node_modules/.bin/vitest +0 -22
- package/packages/realtime/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/realtime/package.json +0 -60
- package/packages/realtime/src/AuraChannel.ts +0 -485
- package/packages/realtime/src/HeartbeatManager.ts +0 -73
- package/packages/realtime/src/RealtimeService.ts +0 -505
- package/packages/realtime/src/columnFilter.ts +0 -301
- package/packages/realtime/src/index.ts +0 -4
- package/packages/realtime/tests/ack-routing.test.ts +0 -81
- package/packages/realtime/tests/column-filter.test.ts +0 -144
- package/packages/realtime/tests/dispatch.test.ts +0 -191
- package/packages/realtime/tests/heartbeat.test.ts +0 -67
- package/packages/realtime/tests/http-broadcast.test.ts +0 -68
- package/packages/realtime/tests/realtime-token.test.ts +0 -43
- package/packages/realtime/tests/reconnect-race.test.ts +0 -149
- package/packages/realtime/tests/ref-id.test.ts +0 -34
- package/packages/realtime/tests/set-auth.test.ts +0 -70
- package/packages/realtime/tsconfig.json +0 -5
- package/packages/realtime/tsup.config.ts +0 -11
- package/packages/storage/LICENSE +0 -21
- package/packages/storage/README.md +0 -141
- package/packages/storage/dist/index.cjs +0 -333
- package/packages/storage/dist/index.d.cts +0 -185
- package/packages/storage/dist/index.d.ts +0 -185
- package/packages/storage/dist/index.js +0 -329
- package/packages/storage/node_modules/.bin/esbuild +0 -19
- package/packages/storage/node_modules/.bin/tsc +0 -22
- package/packages/storage/node_modules/.bin/tsserver +0 -22
- package/packages/storage/node_modules/.bin/tsup +0 -22
- package/packages/storage/node_modules/.bin/tsup-node +0 -22
- package/packages/storage/node_modules/.bin/vite +0 -22
- package/packages/storage/node_modules/.bin/vitest +0 -22
- package/packages/storage/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/storage/package.json +0 -60
- package/packages/storage/src/DownloadBuilder.ts +0 -60
- package/packages/storage/src/StorageService.ts +0 -323
- package/packages/storage/src/index.ts +0 -2
- package/packages/storage/src/path.ts +0 -35
- package/packages/storage/src/transform.ts +0 -15
- package/packages/storage/tests/download.test.ts +0 -64
- package/packages/storage/tests/parity.test.ts +0 -154
- package/packages/storage/tests/path.test.ts +0 -87
- package/packages/storage/tests/transform.test.ts +0 -79
- package/packages/storage/tsconfig.json +0 -5
- package/packages/storage/tsup.config.ts +0 -11
- package/pnpm-workspace.yaml +0 -24
- package/tsconfig.base.json +0 -15
- /package/{packages/aurabase/dist → dist}/index.cjs +0 -0
- /package/{packages/aurabase/dist → dist}/index.js +0 -0
- /package/{packages/aurabase/dist → dist}/ssr.cjs +0 -0
- /package/{packages/aurabase/dist → dist}/ssr.js +0 -0
|
@@ -1,1042 +0,0 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------
|
|
2
|
-
// Shared TypeScript types for the Aurabase SDK
|
|
3
|
-
// ---------------------------------------------------------------------------
|
|
4
|
-
|
|
5
|
-
// ---- Generic response wrapper ---------------------------------------------
|
|
6
|
-
|
|
7
|
-
// E18 : une seule source de vérité pour les erreurs — la CLASSE `AuraError`
|
|
8
|
-
// (avec `status`, `isUnauthorized`, etc.). L'ancienne interface POJO menait à des
|
|
9
|
-
// `error` sans méthodes alors que le type promettait la classe.
|
|
10
|
-
export { AuraError } from './AuraError'
|
|
11
|
-
import type { AuraError } from './AuraError'
|
|
12
|
-
export type { AuraErrorCode } from './AuraError'
|
|
13
|
-
|
|
14
|
-
export interface Meta {
|
|
15
|
-
total?: number
|
|
16
|
-
next_cursor?: string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface AuraResponse<T> {
|
|
20
|
-
data: T | null
|
|
21
|
-
error: AuraError | null
|
|
22
|
-
meta?: Meta
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// ---- Auth -----------------------------------------------------------------
|
|
26
|
-
|
|
27
|
-
export interface User {
|
|
28
|
-
id: string
|
|
29
|
-
email: string | null
|
|
30
|
-
phone?: string | null
|
|
31
|
-
role: string
|
|
32
|
-
email_verified: boolean
|
|
33
|
-
is_banned: boolean
|
|
34
|
-
is_anonymous: boolean
|
|
35
|
-
mfa_enabled: boolean
|
|
36
|
-
avatar_url?: string | null
|
|
37
|
-
name?: string | null
|
|
38
|
-
user_metadata: Record<string, unknown>
|
|
39
|
-
app_metadata: Record<string, unknown>
|
|
40
|
-
created_at: string
|
|
41
|
-
last_sign_in_at?: string | null
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface TokenPair {
|
|
45
|
-
access_token: string
|
|
46
|
-
refresh_token: string
|
|
47
|
-
token_type: string
|
|
48
|
-
expires_in: number
|
|
49
|
-
user: User
|
|
50
|
-
provider_token?: string | null
|
|
51
|
-
provider_refresh_token?: string | null
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface MfaChallenge {
|
|
55
|
-
mfa_required: true
|
|
56
|
-
mfa_token: string
|
|
57
|
-
mfa_setup_required?: boolean
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export type LoginResponse = TokenPair | MfaChallenge
|
|
61
|
-
|
|
62
|
-
export type AuthEvent =
|
|
63
|
-
| 'INITIAL_SESSION'
|
|
64
|
-
| 'SIGNED_IN'
|
|
65
|
-
| 'SIGNED_OUT'
|
|
66
|
-
| 'TOKEN_REFRESHED'
|
|
67
|
-
| 'USER_UPDATED'
|
|
68
|
-
| 'MFA_CHALLENGE'
|
|
69
|
-
| 'PASSWORD_RECOVERY'
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Payload émis par `onAuthStateChange`. NOTE (LOT 3, 3.4) : `mfaToken`/`mfaSetupRequired`
|
|
73
|
-
* ne sont présents QUE lorsque `event === 'MFA_CHALLENGE'` (posés par `AuthService`
|
|
74
|
-
* uniquement sur cet événement — voir `_emitEvent` dans `AuthService.ts`) ; sur tout
|
|
75
|
-
* autre `event`, ces deux champs sont `undefined`. Le type reste une interface plate
|
|
76
|
-
* (pas une union discriminée) pour ne pas casser les consommateurs existants qui
|
|
77
|
-
* déstructurent `{event, user, accessToken}` sans varier selon `event` — mais un
|
|
78
|
-
* consommateur qui lit `mfaToken` DOIT d'abord vérifier `event === 'MFA_CHALLENGE'`.
|
|
79
|
-
*/
|
|
80
|
-
export interface AuthChangePayload {
|
|
81
|
-
event: AuthEvent
|
|
82
|
-
user: User | null
|
|
83
|
-
accessToken: string | null
|
|
84
|
-
/** Présent uniquement si `event === 'MFA_CHALLENGE'`. */
|
|
85
|
-
mfaToken?: string
|
|
86
|
-
/** Présent uniquement si `event === 'MFA_CHALLENGE'`. */
|
|
87
|
-
mfaSetupRequired?: boolean
|
|
88
|
-
/**
|
|
89
|
-
* Token de récupération opaque à passer à `resetPassword(token, newPassword)`.
|
|
90
|
-
* Présent uniquement si `event === 'PASSWORD_RECOVERY'` (extrait du lien email
|
|
91
|
-
* `?token=…&type=recovery` par `detectSessionInUrl`). `undefined` sur tout autre
|
|
92
|
-
* événement.
|
|
93
|
-
*/
|
|
94
|
-
recoveryToken?: string
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface SignUpRequest {
|
|
98
|
-
email: string
|
|
99
|
-
password: string
|
|
100
|
-
captcha_token?: string
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export interface SignInRequest {
|
|
104
|
-
email: string
|
|
105
|
-
password: string
|
|
106
|
-
captcha_token?: string
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface MagicLinkRequest {
|
|
110
|
-
email: string
|
|
111
|
-
create_user?: boolean
|
|
112
|
-
captcha_token?: string
|
|
113
|
-
redirect_url?: string
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface OAuthSignInOptions {
|
|
117
|
-
redirectTo?: string
|
|
118
|
-
scopes?: string
|
|
119
|
-
queryParams?: Record<string, string>
|
|
120
|
-
/**
|
|
121
|
-
* Active le flux PKCE (génère + stocke un `code_verifier`, envoie
|
|
122
|
-
* `code_challenge`/`code_challenge_method=S256` au provider). Opt-in :
|
|
123
|
-
* absent ou `'implicit'` conserve le comportement existant (aucun
|
|
124
|
-
* paramètre PKCE) pour ne pas casser silencieusement les consommateurs
|
|
125
|
-
* actuels du flux implicite.
|
|
126
|
-
*/
|
|
127
|
-
flowType?: 'pkce' | 'implicit'
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface PasswordResetRequest {
|
|
131
|
-
email: string
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface UpdateUserRequest {
|
|
135
|
-
email?: string
|
|
136
|
-
phone?: string
|
|
137
|
-
password?: string
|
|
138
|
-
current_password?: string
|
|
139
|
-
data?: Record<string, unknown>
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export interface MfaEnrollResponse {
|
|
143
|
-
otpauth_url: string
|
|
144
|
-
secret: string
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export interface MfaVerifyRequest {
|
|
148
|
-
mfa_token: string
|
|
149
|
-
code: string
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface SessionInfo {
|
|
153
|
-
id: string
|
|
154
|
-
device_info?: string | null
|
|
155
|
-
ip_address?: string | null
|
|
156
|
-
created_at: string
|
|
157
|
-
expires_at: string
|
|
158
|
-
last_used_at: string
|
|
159
|
-
is_current: boolean
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// ---- Database / Query -----------------------------------------------------
|
|
163
|
-
|
|
164
|
-
export type FilterOp =
|
|
165
|
-
| 'eq'
|
|
166
|
-
| 'neq'
|
|
167
|
-
| 'gt'
|
|
168
|
-
| 'gte'
|
|
169
|
-
| 'lt'
|
|
170
|
-
| 'lte'
|
|
171
|
-
| 'in'
|
|
172
|
-
| 'not_in'
|
|
173
|
-
| 'like'
|
|
174
|
-
| 'ilike'
|
|
175
|
-
| 'is_null'
|
|
176
|
-
| 'is_not_null'
|
|
177
|
-
| 'between'
|
|
178
|
-
|
|
179
|
-
export interface QueryFilter {
|
|
180
|
-
column: string
|
|
181
|
-
op: string
|
|
182
|
-
value: unknown
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export type CountMode = 'exact' | 'estimated'
|
|
186
|
-
|
|
187
|
-
export interface QueryOptions {
|
|
188
|
-
select?: string[]
|
|
189
|
-
filters?: QueryFilter[]
|
|
190
|
-
sort_by?: string
|
|
191
|
-
sort_order?: 'asc' | 'desc'
|
|
192
|
-
limit?: number
|
|
193
|
-
offset?: number
|
|
194
|
-
count?: CountMode
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export interface SchemaColumn {
|
|
198
|
-
name: string
|
|
199
|
-
col_type: string
|
|
200
|
-
nullable: boolean
|
|
201
|
-
unique: boolean
|
|
202
|
-
default_val?: string | null
|
|
203
|
-
references?: { table: string; column: string; constraint_name?: string | null } | null
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export interface SchemaIndex {
|
|
207
|
-
name: string
|
|
208
|
-
columns: string[]
|
|
209
|
-
unique: boolean
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export interface SchemaTable {
|
|
213
|
-
name: string
|
|
214
|
-
columns: SchemaColumn[]
|
|
215
|
-
primary_key?: string
|
|
216
|
-
indexes: SchemaIndex[]
|
|
217
|
-
rls_enabled: boolean
|
|
218
|
-
realtime_enabled: boolean
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export interface SchemaFunctionArg {
|
|
222
|
-
name: string
|
|
223
|
-
data_type: string
|
|
224
|
-
mode: string
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export interface SchemaFunction {
|
|
228
|
-
name: string
|
|
229
|
-
args: SchemaFunctionArg[]
|
|
230
|
-
returns: string
|
|
231
|
-
is_set_returning: boolean
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Type enum Postgres (`pg_type.typtype='e'`) exposé par `GET /schema` (LOT B).
|
|
236
|
-
* `values` est ordonné (`enumsortorder`). Le générateur SDK (`@aurabase/gen`)
|
|
237
|
-
* en dérive une union de littéraux `Database['public']['Enums'][name]`.
|
|
238
|
-
*/
|
|
239
|
-
export interface SchemaEnum {
|
|
240
|
-
name: string
|
|
241
|
-
values: string[]
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// ---- Storage --------------------------------------------------------------
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Options de transformation d'image (vocabulaire façon Supabase) appliquées
|
|
248
|
-
* côté rendu backend (`GET /v1/storage/{pid}/{bucket}/{key}?width=&height=&
|
|
249
|
-
* fit=&format=&quality=`). Voir `renderTransformParams` (`@aurabase/storage`)
|
|
250
|
-
* pour le mapping vers les query params du backend.
|
|
251
|
-
*/
|
|
252
|
-
export interface ImageTransform {
|
|
253
|
-
width?: number
|
|
254
|
-
height?: number
|
|
255
|
-
resize?: 'cover' | 'contain' | 'fill'
|
|
256
|
-
quality?: number
|
|
257
|
-
format?: 'origin' | 'jpeg' | 'png' | 'webp' | 'gif'
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export interface StorageBucket {
|
|
261
|
-
id: string
|
|
262
|
-
name: string
|
|
263
|
-
public: boolean
|
|
264
|
-
file_size_limit?: number | null
|
|
265
|
-
allowed_mime_types?: string[] | null
|
|
266
|
-
created_at: string
|
|
267
|
-
updated_at: string
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export interface UploadResult {
|
|
271
|
-
/** Clé unique de l'objet (`<uuid>.<ext>`) relative au bucket. */
|
|
272
|
-
key: string
|
|
273
|
-
url: string
|
|
274
|
-
size: number
|
|
275
|
-
mime_type: string
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
export interface FileEntry {
|
|
279
|
-
name: string
|
|
280
|
-
id?: string
|
|
281
|
-
bucket_id: string
|
|
282
|
-
size: number
|
|
283
|
-
mime_type: string
|
|
284
|
-
created_at: string
|
|
285
|
-
updated_at: string
|
|
286
|
-
metadata?: Record<string, unknown>
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/** Métadonnées d'un objet storage — forme réelle retournée par getMetadata() */
|
|
290
|
-
export interface ObjectMeta {
|
|
291
|
-
key: string
|
|
292
|
-
bucket: string
|
|
293
|
-
size: number
|
|
294
|
-
content_type: string
|
|
295
|
-
etag?: string | null
|
|
296
|
-
last_modified?: string | null
|
|
297
|
-
metadata: Record<string, string>
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// ---- Realtime -------------------------------------------------------------
|
|
301
|
-
|
|
302
|
-
/** Événement serveur brut reçu via WebSocket (union discriminée par type) */
|
|
303
|
-
export type ServerMessage =
|
|
304
|
-
| ServerSubscribedMsg
|
|
305
|
-
| ServerEventMsg
|
|
306
|
-
| ServerPongMsg
|
|
307
|
-
| ServerErrorMsg
|
|
308
|
-
| ServerTokenRefreshedMsg
|
|
309
|
-
| ServerPresenceStateMsg
|
|
310
|
-
| BroadcastAckMessage
|
|
311
|
-
|
|
312
|
-
export interface ServerSubscribedMsg {
|
|
313
|
-
type: 'subscribed'
|
|
314
|
-
channel: string
|
|
315
|
-
subscription_id?: string
|
|
316
|
-
history: RealtimeEvent[]
|
|
317
|
-
ref_id?: string
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
export interface ServerEventMsg {
|
|
321
|
-
type: 'event'
|
|
322
|
-
// Serde flatten : les champs de RealtimeEvent sont au top-level
|
|
323
|
-
id: string
|
|
324
|
-
event: 'insert' | 'update' | 'delete' | 'broadcast' | 'presence' | 'system'
|
|
325
|
-
topic: string
|
|
326
|
-
payload: Record<string, unknown>
|
|
327
|
-
timestamp: string
|
|
328
|
-
allowed_sub_ids?: string[]
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
export interface ServerPongMsg { type: 'pong' }
|
|
332
|
-
export interface ServerErrorMsg { type: 'error'; message: string }
|
|
333
|
-
export interface ServerTokenRefreshedMsg { type: 'token_refreshed' }
|
|
334
|
-
|
|
335
|
-
export interface ServerPresenceStateMsg {
|
|
336
|
-
type: 'presence_state'
|
|
337
|
-
channel: string
|
|
338
|
-
presences: PresenceInfo[]
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/** Événement realtime (CDC, broadcast, presence) */
|
|
342
|
-
export interface RealtimeEvent<T = Record<string, unknown>> {
|
|
343
|
-
id: string
|
|
344
|
-
event: 'insert' | 'update' | 'delete' | 'broadcast' | 'presence' | 'system'
|
|
345
|
-
topic: string
|
|
346
|
-
payload: T
|
|
347
|
-
timestamp: string
|
|
348
|
-
/** IDs des subscriptions autorisées par RLS. Absent = pas de filtre. */
|
|
349
|
-
allowed_sub_ids?: string[]
|
|
350
|
-
/** Ref ID corrélé à la requête client (si fourni) */
|
|
351
|
-
ref_id?: string
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/** Accusé de réception d'un broadcast (envoyé si config.broadcast.ack = true) */
|
|
355
|
-
export interface BroadcastAckMessage {
|
|
356
|
-
type: 'broadcast_ack'
|
|
357
|
-
message_id: string
|
|
358
|
-
ref_id?: string
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/** Payload CDC (postgres_changes) avec old_record et type d'operation */
|
|
362
|
-
export interface CdcPayload {
|
|
363
|
-
schema: string
|
|
364
|
-
table: string
|
|
365
|
-
type: 'INSERT' | 'UPDATE' | 'DELETE'
|
|
366
|
-
record: Record<string, unknown>
|
|
367
|
-
old_record: Record<string, unknown> | null
|
|
368
|
-
_truncated?: boolean
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/** Status de subscription */
|
|
372
|
-
export type RealtimeSubscribeStatus = 'SUBSCRIBED' | 'CLOSED' | 'CHANNEL_ERROR' | 'TIMED_OUT'
|
|
373
|
-
|
|
374
|
-
/** Callback de subscription */
|
|
375
|
-
export type SubscribeCallback = (status: RealtimeSubscribeStatus, err?: Error) => void
|
|
376
|
-
|
|
377
|
-
/** Types d'écoute supportés (pattern Supabase) */
|
|
378
|
-
export type RealtimeListenType = 'postgres_changes' | 'broadcast' | 'presence'
|
|
379
|
-
|
|
380
|
-
/** Config pour postgres_changes */
|
|
381
|
-
export interface PostgresChangesFilter {
|
|
382
|
-
event: 'INSERT' | 'UPDATE' | 'DELETE' | '*'
|
|
383
|
-
schema?: string
|
|
384
|
-
table?: string
|
|
385
|
-
/**
|
|
386
|
-
* Filtre sur colonne, syntaxe PostgREST/Supabase : `"column=operator.value"`.
|
|
387
|
-
*
|
|
388
|
-
* **Opérateurs supportés** : `eq, neq, lt, lte, gt, gte, in, like, ilike, is,
|
|
389
|
-
* match, imatch, isdistinct`.
|
|
390
|
-
*
|
|
391
|
-
* - `eq`/`neq` : égalité/inégalité (comparaison textuelle).
|
|
392
|
-
* - `lt`/`lte`/`gt`/`gte` : comparaison numérique (échoue — pas de match — si
|
|
393
|
-
* la valeur n'est pas numérique).
|
|
394
|
-
* - `in` : appartenance à une liste, `"status=in.(active,pending)"`.
|
|
395
|
-
* - `like`/`ilike` : motif SQL (`%` = sous-chaîne, `_` = 1 caractère), `ilike`
|
|
396
|
-
* insensible à la casse. Ex: `"name=like.jo%"`.
|
|
397
|
-
* - `is` : `"col=is.null"` / `"col=is.true"` / `"col=is.false"` — compare la
|
|
398
|
-
* valeur JSON réelle, pas sa représentation texte.
|
|
399
|
-
* - `match`/`imatch` : expression régulière (`imatch` insensible à la casse).
|
|
400
|
-
* - `isdistinct` : distinct au sens SQL — `NULL` est distinct de toute valeur
|
|
401
|
-
* non-NULL.
|
|
402
|
-
*
|
|
403
|
-
* **Négation** : préfixer l'opérateur par `not.`, ex: `"status=not.eq.done"`.
|
|
404
|
-
*
|
|
405
|
-
* **AND** : plusieurs conditions séparées par des virgules, ex:
|
|
406
|
-
* `"room_id=eq.42,qty=gt.5"` (toutes doivent matcher). Les virgules internes
|
|
407
|
-
* d'un `in.(a,b,c)` ne séparent PAS les conditions.
|
|
408
|
-
*
|
|
409
|
-
* **Où c'est évalué** : le serveur `aura-realtime` filtre ces conditions de
|
|
410
|
-
* façon **autoritaire** avant l'envoi au client — un `filter` invalide y est
|
|
411
|
-
* fail-closed (l'event est exclu, jamais laissé passer par défaut). Le SDK
|
|
412
|
-
* réévalue ensuite la même syntaxe côté client comme second rideau
|
|
413
|
-
* (defense-in-depth) : il ne peut que sur-filtrer, jamais faire fuiter un
|
|
414
|
-
* event que le serveur aurait dû exclure.
|
|
415
|
-
*
|
|
416
|
-
* **DELETE** : le prédicat est évalué sur l'**ancienne ligne** (`old_record`),
|
|
417
|
-
* puisque le `record` d'un DELETE est vide côté CDC. Si votre table utilise
|
|
418
|
-
* `REPLICA IDENTITY DEFAULT`, `old_record` ne contient que la clé primaire —
|
|
419
|
-
* un filtre sur une autre colonne exclura systématiquement les DELETE, **sauf
|
|
420
|
-
* `is.null`/`isdistinct`** qui traitent une colonne absente comme `NULL` et
|
|
421
|
-
* peuvent donc matcher même sans cette colonne dans `old_record`.
|
|
422
|
-
*/
|
|
423
|
-
filter?: string
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
/** Config pour broadcast */
|
|
427
|
-
export interface BroadcastFilter {
|
|
428
|
-
event: string
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/** Config pour presence */
|
|
432
|
-
export interface PresenceFilter {
|
|
433
|
-
event: 'sync' | 'join' | 'leave'
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/** Options de channel — compatible Supabase */
|
|
437
|
-
export interface ChannelConfig {
|
|
438
|
-
private?: boolean
|
|
439
|
-
/** Configuration broadcast pour ce channel */
|
|
440
|
-
broadcast?: {
|
|
441
|
-
/** Si true, le serveur ACK chaque send() (résout la Promise) */
|
|
442
|
-
ack?: boolean
|
|
443
|
-
/** Si true, le client reçoit ses propres broadcasts (self-echo) */
|
|
444
|
-
self?: boolean
|
|
445
|
-
}
|
|
446
|
-
/** Configuration présence */
|
|
447
|
-
config?: {
|
|
448
|
-
presence?: {
|
|
449
|
-
/** Clé de présence — permet de regrouper plusieurs onglets/devices du même user */
|
|
450
|
-
key?: string
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
/** Payload d'un broadcast à envoyer */
|
|
456
|
-
export interface BroadcastPayload {
|
|
457
|
-
type: 'broadcast'
|
|
458
|
-
event: string
|
|
459
|
-
payload: Record<string, unknown>
|
|
460
|
-
/** Ref ID pour la corrélation request/response (optionnel) */
|
|
461
|
-
ref_id?: string
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
/** Presence state (map de key → presences) */
|
|
465
|
-
export type PresenceState = Record<string, PresenceInfo[]>
|
|
466
|
-
|
|
467
|
-
export interface PresenceInfo {
|
|
468
|
-
client_id: string
|
|
469
|
-
user_id?: string | null
|
|
470
|
-
metadata: Record<string, unknown>
|
|
471
|
-
joined_at: string
|
|
472
|
-
last_seen: string
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
// ---- AI -------------------------------------------------------------------
|
|
476
|
-
|
|
477
|
-
export interface ChatMessage {
|
|
478
|
-
role: 'system' | 'user' | 'assistant'
|
|
479
|
-
content: string
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
export interface ChatResponse {
|
|
483
|
-
model: string
|
|
484
|
-
content: string
|
|
485
|
-
input_tokens?: number
|
|
486
|
-
output_tokens?: number
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
export interface EmbedRequest {
|
|
490
|
-
text: string
|
|
491
|
-
namespace: string
|
|
492
|
-
metadata?: Record<string, unknown>
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
export interface EmbedResponse {
|
|
496
|
-
id: string
|
|
497
|
-
dimensions: number
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
export interface RagRequest {
|
|
501
|
-
question: string
|
|
502
|
-
namespace: string
|
|
503
|
-
history?: ChatMessage[]
|
|
504
|
-
system?: string
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
export interface RagResponse {
|
|
508
|
-
answer: string
|
|
509
|
-
sources: Array<{ id: string; content: string; metadata: Record<string, unknown>; similarity: number }>
|
|
510
|
-
model: string
|
|
511
|
-
tokens?: number
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
export interface RagIngestRequest {
|
|
515
|
-
namespace: string
|
|
516
|
-
content: string
|
|
517
|
-
metadata?: Record<string, unknown>
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
export interface RagIngestResponse {
|
|
521
|
-
id: string
|
|
522
|
-
chunks: number
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
export interface SemanticSearchResult {
|
|
526
|
-
id: string
|
|
527
|
-
content: string
|
|
528
|
-
metadata: Record<string, unknown>
|
|
529
|
-
similarity: number
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
// ---- Functions ------------------------------------------------------------
|
|
533
|
-
|
|
534
|
-
export interface FunctionDef {
|
|
535
|
-
id: string
|
|
536
|
-
project_id: string
|
|
537
|
-
name: string
|
|
538
|
-
runtime: string
|
|
539
|
-
code: string
|
|
540
|
-
code_hash: string
|
|
541
|
-
env_vars: Record<string, unknown>
|
|
542
|
-
is_active: boolean
|
|
543
|
-
created_at: string
|
|
544
|
-
updated_at: string
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
export interface Job {
|
|
548
|
-
id: string
|
|
549
|
-
project_id: string
|
|
550
|
-
function_name: string
|
|
551
|
-
status: 'pending' | 'running' | 'completed' | 'failed' | 'dead'
|
|
552
|
-
payload: unknown
|
|
553
|
-
attempts: number
|
|
554
|
-
max_attempts: number
|
|
555
|
-
error?: string | null
|
|
556
|
-
scheduled_at: string
|
|
557
|
-
started_at?: string | null
|
|
558
|
-
created_at: string
|
|
559
|
-
completed_at?: string | null
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
export interface CronJob {
|
|
563
|
-
id: string
|
|
564
|
-
project_id: string
|
|
565
|
-
name: string
|
|
566
|
-
schedule: string
|
|
567
|
-
function_name: string
|
|
568
|
-
payload: unknown
|
|
569
|
-
is_active: boolean
|
|
570
|
-
last_run?: string | null
|
|
571
|
-
next_run?: string | null
|
|
572
|
-
created_at: string
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
// ---- Notifications --------------------------------------------------------
|
|
576
|
-
|
|
577
|
-
export interface Notification {
|
|
578
|
-
id: string
|
|
579
|
-
project_id?: string
|
|
580
|
-
channel: 'email' | 'sms' | 'push' | 'webhook'
|
|
581
|
-
recipient: string
|
|
582
|
-
subject?: string | null
|
|
583
|
-
body: string
|
|
584
|
-
status: 'queued' | 'processing' | 'sent' | 'failed' | 'delivered' | 'expired' | 'dead_lettered'
|
|
585
|
-
error?: string | null
|
|
586
|
-
metadata?: Record<string, unknown>
|
|
587
|
-
attempt_count?: number
|
|
588
|
-
last_attempt_at?: string | null
|
|
589
|
-
next_attempt_at?: string | null
|
|
590
|
-
locked_until?: string | null
|
|
591
|
-
lock_owner?: string | null
|
|
592
|
-
provider_message_id?: string | null
|
|
593
|
-
delivered_at?: string | null
|
|
594
|
-
expires_at?: string | null
|
|
595
|
-
idempotency_key?: string | null
|
|
596
|
-
payload_hash?: string | null
|
|
597
|
-
last_error?: string | null
|
|
598
|
-
last_error_code?: string | null
|
|
599
|
-
last_provider_response?: string | null
|
|
600
|
-
processing_started_at?: string | null
|
|
601
|
-
completed_at?: string | null
|
|
602
|
-
updated_at?: string
|
|
603
|
-
sent_at?: string | null
|
|
604
|
-
created_at: string
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
export interface SendNotificationRequest {
|
|
608
|
-
channel: 'email' | 'sms' | 'push' | 'webhook'
|
|
609
|
-
recipient: string
|
|
610
|
-
body?: string
|
|
611
|
-
subject?: string
|
|
612
|
-
template_id?: string
|
|
613
|
-
variables?: Record<string, unknown>
|
|
614
|
-
metadata?: Record<string, unknown>
|
|
615
|
-
idempotency_key?: string
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
export interface BatchSendItemResult {
|
|
619
|
-
index: number
|
|
620
|
-
status: 'queued' | 'error'
|
|
621
|
-
notification?: Notification | null
|
|
622
|
-
error?: string | null
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
export interface BatchSendResponse {
|
|
626
|
-
items: BatchSendItemResult[]
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
export interface NotificationTemplate {
|
|
630
|
-
id: string
|
|
631
|
-
name: string
|
|
632
|
-
channel: 'email' | 'sms' | 'push' | 'webhook'
|
|
633
|
-
subject?: string | null
|
|
634
|
-
body: string
|
|
635
|
-
variables?: string[]
|
|
636
|
-
created_at: string
|
|
637
|
-
updated_at: string
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
export interface NotificationTemplatePreview {
|
|
641
|
-
subject?: string | null
|
|
642
|
-
body: string
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
export interface NotificationAttempt {
|
|
646
|
-
id: string
|
|
647
|
-
notification_id: string
|
|
648
|
-
project_id: string
|
|
649
|
-
channel: 'email' | 'sms' | 'push' | 'webhook'
|
|
650
|
-
provider: string
|
|
651
|
-
attempt_number: number
|
|
652
|
-
status: 'processing' | 'sent' | 'failed' | 'retry_scheduled' | 'dead_lettered'
|
|
653
|
-
started_at: string
|
|
654
|
-
completed_at?: string | null
|
|
655
|
-
duration_ms?: number | null
|
|
656
|
-
error_code?: string | null
|
|
657
|
-
error_message?: string | null
|
|
658
|
-
provider_response?: string | null
|
|
659
|
-
created_at: string
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
export interface NotificationDeadLetter {
|
|
663
|
-
id: string
|
|
664
|
-
notification_id: string
|
|
665
|
-
project_id: string
|
|
666
|
-
channel: 'email' | 'sms' | 'push' | 'webhook'
|
|
667
|
-
recipient: string
|
|
668
|
-
subject?: string | null
|
|
669
|
-
body: string
|
|
670
|
-
metadata?: Record<string, unknown>
|
|
671
|
-
payload_hash?: string | null
|
|
672
|
-
idempotency_key?: string | null
|
|
673
|
-
attempt_count: number
|
|
674
|
-
last_error: string
|
|
675
|
-
last_error_code: string
|
|
676
|
-
last_provider_response?: string | null
|
|
677
|
-
failed_at: string
|
|
678
|
-
created_at: string
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
export interface NotificationEvent {
|
|
682
|
-
id: string
|
|
683
|
-
project_id: string
|
|
684
|
-
subject: string
|
|
685
|
-
event_type: string
|
|
686
|
-
status: 'received' | 'matched' | 'ignored' | 'failed' | 'enqueued'
|
|
687
|
-
rule_id?: string | null
|
|
688
|
-
notification_id?: string | null
|
|
689
|
-
error?: string | null
|
|
690
|
-
metadata?: Record<string, unknown>
|
|
691
|
-
created_at: string
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
export interface NotificationProviderLog {
|
|
695
|
-
timestamp: string
|
|
696
|
-
notification_id: string
|
|
697
|
-
channel: 'email' | 'sms' | 'push' | 'webhook'
|
|
698
|
-
provider: string
|
|
699
|
-
status: string
|
|
700
|
-
duration_ms?: number | null
|
|
701
|
-
error_code?: string | null
|
|
702
|
-
error_message?: string | null
|
|
703
|
-
provider_response?: string | null
|
|
704
|
-
provider_message_id?: string | null
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
export interface NotificationQueueStats {
|
|
708
|
-
queued_count: number
|
|
709
|
-
processing_count: number
|
|
710
|
-
retry_scheduled_count: number
|
|
711
|
-
expired_processing_count: number
|
|
712
|
-
next_retry_at_min?: string | null
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
export interface NotificationChannelStats {
|
|
716
|
-
channel: 'email' | 'sms' | 'push' | 'webhook'
|
|
717
|
-
total: number
|
|
718
|
-
sent: number
|
|
719
|
-
delivered: number
|
|
720
|
-
failed: number
|
|
721
|
-
dead_lettered: number
|
|
722
|
-
queued: number
|
|
723
|
-
processing: number
|
|
724
|
-
success_rate: number
|
|
725
|
-
failure_rate: number
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
export interface NotificationStats {
|
|
729
|
-
window: string
|
|
730
|
-
channel?: 'email' | 'sms' | 'push' | 'webhook' | null
|
|
731
|
-
total: number
|
|
732
|
-
sent: number
|
|
733
|
-
delivered: number
|
|
734
|
-
failed: number
|
|
735
|
-
dead_lettered: number
|
|
736
|
-
queued: number
|
|
737
|
-
processing: number
|
|
738
|
-
success_rate: number
|
|
739
|
-
failure_rate: number
|
|
740
|
-
by_status: Array<{ status: string; count: number }>
|
|
741
|
-
by_channel: NotificationChannelStats[]
|
|
742
|
-
timeline: Array<{
|
|
743
|
-
bucket: string
|
|
744
|
-
total: number
|
|
745
|
-
sent: number
|
|
746
|
-
delivered: number
|
|
747
|
-
failed: number
|
|
748
|
-
dead_lettered: number
|
|
749
|
-
}>
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
export interface NotificationSettings {
|
|
753
|
-
project_id: string
|
|
754
|
-
smtp?: Record<string, unknown>
|
|
755
|
-
twilio?: Record<string, unknown>
|
|
756
|
-
fcm?: Record<string, unknown>
|
|
757
|
-
apns?: Record<string, unknown>
|
|
758
|
-
webhook?: Record<string, unknown>
|
|
759
|
-
quotas?: Record<string, unknown>
|
|
760
|
-
updated_at?: string | null
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
export interface NotificationRule {
|
|
764
|
-
id: string
|
|
765
|
-
project_id: string
|
|
766
|
-
name: string
|
|
767
|
-
trigger_type: string
|
|
768
|
-
condition: Record<string, unknown>
|
|
769
|
-
template_id?: string | null
|
|
770
|
-
channel: 'email' | 'sms' | 'push' | 'webhook'
|
|
771
|
-
recipient_expr: string
|
|
772
|
-
enabled: boolean
|
|
773
|
-
delay_seconds: number
|
|
774
|
-
fire_count: number
|
|
775
|
-
last_fired_at?: string | null
|
|
776
|
-
created_at: string
|
|
777
|
-
updated_at: string
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
// ---- Observability (LOT 3, finding I8) -------------------------------------
|
|
781
|
-
|
|
782
|
-
/**
|
|
783
|
-
* Événement d'observabilité interne du SDK. Émis best-effort via le hook `onEvent`
|
|
784
|
-
* (option client) et/ou `console.debug` (option `debug: true`) — voir `emitAuraEvent`.
|
|
785
|
-
* Les erreurs sont massivement avalées ailleurs dans le SDK (`catch {}` JWKS/storage/
|
|
786
|
-
* cookie/subscribers) : ce hook rend visibles les retries, timeouts, refresh
|
|
787
|
-
* silencieux et échecs JWKS/storage sans changer le contrat `AuraResponse`.
|
|
788
|
-
*/
|
|
789
|
-
export type AuraObservabilityEvent =
|
|
790
|
-
| { kind: 'retry'; attempt: number; status?: number; url: string }
|
|
791
|
-
| { kind: 'timeout'; url: string }
|
|
792
|
-
| { kind: 'refresh-success' }
|
|
793
|
-
| { kind: 'refresh-discarded'; reason: string }
|
|
794
|
-
| { kind: 'jwks-fetch-failed'; baseUrl: string }
|
|
795
|
-
| { kind: 'storage-blocked'; op: string }
|
|
796
|
-
|
|
797
|
-
/**
|
|
798
|
-
* Émet un `AuraObservabilityEvent` vers le hook `onEvent` et/ou `console.debug`
|
|
799
|
-
* (si `debug: true`). NE THROW JAMAIS : un hook `onEvent` fourni par le consommateur
|
|
800
|
-
* qui lève une exception ne doit jamais interrompre le flux SDK (retry/refresh/
|
|
801
|
-
* storage restent fonctionnels) — d'où le try/catch autour de l'appel.
|
|
802
|
-
*/
|
|
803
|
-
/**
|
|
804
|
-
* Rédige une URL avant journalisation (minor SEC 6a) : retire la query ET le fragment.
|
|
805
|
-
* Ils peuvent porter des CAPACITÉS bearer — `?apikey=`, `?token=`, `?sig=`, une URL
|
|
806
|
-
* signée de storage — qu'on ne doit jamais exposer via l'observabilité (`onEvent`
|
|
807
|
-
* consommateur ou `console.debug`). On ne garde que schéma + host + chemin.
|
|
808
|
-
*/
|
|
809
|
-
function redactUrl(u: string): string {
|
|
810
|
-
const cut = u.search(/[?#]/)
|
|
811
|
-
return cut === -1 ? u : u.slice(0, cut)
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
export function emitAuraEvent(
|
|
815
|
-
onEvent: ((event: AuraObservabilityEvent) => void) | undefined,
|
|
816
|
-
debug: boolean | undefined,
|
|
817
|
-
event: AuraObservabilityEvent,
|
|
818
|
-
): void {
|
|
819
|
-
// Minor SEC 6a : rédige tout champ `url` porteur de query/fragment (retry/timeout)
|
|
820
|
-
// AVANT de l'émettre. `baseUrl` (jwks-fetch-failed) est déjà une base sans query.
|
|
821
|
-
const safe: AuraObservabilityEvent =
|
|
822
|
-
'url' in event && typeof event.url === 'string'
|
|
823
|
-
? { ...event, url: redactUrl(event.url) }
|
|
824
|
-
: event
|
|
825
|
-
if (debug && typeof console !== 'undefined' && typeof console.debug === 'function') {
|
|
826
|
-
try {
|
|
827
|
-
console.debug('[aurabase]', safe)
|
|
828
|
-
} catch {
|
|
829
|
-
// ignore — le logging ne doit jamais casser le SDK
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
if (!onEvent) return
|
|
833
|
-
try {
|
|
834
|
-
onEvent(safe)
|
|
835
|
-
} catch {
|
|
836
|
-
// le hook consommateur ne doit JAMAIS throw / casser le SDK
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
// ---- Client options -------------------------------------------------------
|
|
841
|
-
|
|
842
|
-
export interface AuraClientOptions {
|
|
843
|
-
auth?: {
|
|
844
|
-
persistSession?: boolean
|
|
845
|
-
storage?: import('./stores/BaseAuthStore').BaseAuthStore
|
|
846
|
-
/** Refresh proactif en arrière-plan + synchro multi-onglets (défaut true). */
|
|
847
|
-
autoRefresh?: boolean
|
|
848
|
-
/**
|
|
849
|
-
* Détecte et consomme automatiquement une session présente dans l'URL au boot
|
|
850
|
-
* du client (callback OAuth) : fragment `#access_token=…` (flux implicit) ou
|
|
851
|
-
* query `?code=…` (flux PKCE), puis nettoie l'URL via `history.replaceState`.
|
|
852
|
-
* Défaut : `true` en navigateur, no-op hors navigateur (SSR/Node).
|
|
853
|
-
*/
|
|
854
|
-
detectSessionInUrl?: boolean
|
|
855
|
-
}
|
|
856
|
-
apiKey?: string
|
|
857
|
-
fetch?: typeof globalThis.fetch
|
|
858
|
-
/**
|
|
859
|
-
* SEC-F5 : si une clé `service_role` (`aura_sk_…`) est fournie en contexte NAVIGATEUR
|
|
860
|
-
* (thread principal ou Web Worker navigateur), `true` (DÉFAUT) fait ÉCHOUER la
|
|
861
|
-
* construction du client (`throw`) — cette clé à privilèges élevés (BYPASSRLS)
|
|
862
|
-
* fuiterait dans le bundle JS = compromission totale du projet. `false` rétrograde
|
|
863
|
-
* en simple `console.warn` (échappatoire explicite, à n'utiliser qu'en connaissance
|
|
864
|
-
* de cause). Sans effet côté serveur (où service_role est légitime).
|
|
865
|
-
*/
|
|
866
|
-
refuseServiceRoleInBrowser?: boolean
|
|
867
|
-
/** Retry transitoire des GET/HEAD (activé par défaut). `false` désactive. */
|
|
868
|
-
retry?: boolean | { enabled?: boolean; maxRetries?: number }
|
|
869
|
-
/**
|
|
870
|
-
* Timeout par défaut (ms) des requêtes JSON sans `signal` fourni (borne un serveur
|
|
871
|
-
* qui « hang »). N'affecte ni les uploads FormData ni les appels gérant leur propre
|
|
872
|
-
* annulation (invoke, download). `0` désactive. Défaut : 30 000 ms.
|
|
873
|
-
*/
|
|
874
|
-
requestTimeoutMs?: number
|
|
875
|
-
/**
|
|
876
|
-
* Hook d'observabilité (LOT 3, finding I8) : reçoit chaque `AuraObservabilityEvent`
|
|
877
|
-
* (retry transitoire, timeout, refresh de session réussi/écarté, échec fetch JWKS,
|
|
878
|
-
* storage bloqué). Best-effort — le SDK l'appelle dans un try/catch, ce hook ne
|
|
879
|
-
* peut jamais faire échouer une requête. `undefined` par défaut (aucune émission).
|
|
880
|
-
*/
|
|
881
|
-
onEvent?: (event: AuraObservabilityEvent) => void
|
|
882
|
-
/**
|
|
883
|
-
* Si `true`, chaque `AuraObservabilityEvent` est aussi journalisé via
|
|
884
|
-
* `console.debug('[aurabase]', event)`, en plus (ou à la place) du hook `onEvent`.
|
|
885
|
-
* Défaut `false`.
|
|
886
|
-
*/
|
|
887
|
-
debug?: boolean
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
// Phase 2 additions
|
|
891
|
-
|
|
892
|
-
export interface IdentityInfo {
|
|
893
|
-
id: string
|
|
894
|
-
provider: string
|
|
895
|
-
provider_id: string
|
|
896
|
-
identity_data: Record<string, unknown>
|
|
897
|
-
auto_linked: boolean
|
|
898
|
-
created_at: string
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
// AdminUser : le backend renvoie PublicUser (pas de is_active/password_hash ; a `name`).
|
|
902
|
-
export interface AdminUser extends User {}
|
|
903
|
-
|
|
904
|
-
export interface AuditLogEntry {
|
|
905
|
-
id: string
|
|
906
|
-
user_id?: string | null
|
|
907
|
-
action: string
|
|
908
|
-
ip_address?: string | null
|
|
909
|
-
user_agent?: string | null
|
|
910
|
-
created_at: string
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
export interface UserStats {
|
|
914
|
-
total: number
|
|
915
|
-
verified: number
|
|
916
|
-
banned: number
|
|
917
|
-
mfa_enabled: number
|
|
918
|
-
new_7d: number
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
/**
|
|
922
|
-
* Sessions vues depuis l'admin (endpoint `admin/sessions`) : contient `user_id`
|
|
923
|
-
* (toutes sessions, tous utilisateurs) mais pas `is_current` (contrairement à
|
|
924
|
-
* `SessionInfo`, qui décrit les sessions de l'utilisateur courant).
|
|
925
|
-
*/
|
|
926
|
-
export interface AdminSessionInfo {
|
|
927
|
-
id: string
|
|
928
|
-
user_id: string
|
|
929
|
-
device_info?: string | null
|
|
930
|
-
ip_address?: string | null
|
|
931
|
-
created_at: string
|
|
932
|
-
expires_at: string
|
|
933
|
-
last_used_at: string
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
export interface AuthSettings {
|
|
937
|
-
allow_signup: boolean
|
|
938
|
-
email_confirmation_required: boolean
|
|
939
|
-
password_min_length: number
|
|
940
|
-
mfa_enabled: boolean
|
|
941
|
-
allow_anonymous_users: boolean
|
|
942
|
-
jwt_expiry_seconds: number
|
|
943
|
-
refresh_token_expiry_days: number
|
|
944
|
-
site_url?: string | null
|
|
945
|
-
oauth_providers: Record<string, { enabled?: boolean; client_id?: string; client_secret?: string }>
|
|
946
|
-
new_device_alerts_enabled: boolean
|
|
947
|
-
webhook_url?: string | null
|
|
948
|
-
// SMTP
|
|
949
|
-
smtp_host?: string | null
|
|
950
|
-
smtp_port?: number | null
|
|
951
|
-
smtp_username?: string | null
|
|
952
|
-
smtp_password_set?: boolean
|
|
953
|
-
smtp_from_email?: string | null
|
|
954
|
-
smtp_from_name?: string | null
|
|
955
|
-
// OAuth credentials (masked)
|
|
956
|
-
oauth_credentials: Record<string, Record<string, string>>
|
|
957
|
-
// CAPTCHA
|
|
958
|
-
captcha_enabled: boolean
|
|
959
|
-
captcha_provider?: string | null
|
|
960
|
-
captcha_site_key?: string | null
|
|
961
|
-
captcha_secret_key_set?: boolean
|
|
962
|
-
// HaveIBeenPwned
|
|
963
|
-
password_check_hibp: boolean
|
|
964
|
-
// SMS
|
|
965
|
-
sms_provider?: string | null
|
|
966
|
-
sms_api_key_set?: boolean
|
|
967
|
-
sms_from_number?: string | null
|
|
968
|
-
// URLs
|
|
969
|
-
redirect_urls: string[]
|
|
970
|
-
// Session
|
|
971
|
-
session_inactivity_timeout_seconds: number
|
|
972
|
-
// Hooks
|
|
973
|
-
hook_send_sms_url?: string | null
|
|
974
|
-
hook_send_email_url?: string | null
|
|
975
|
-
hook_mfa_verification_url?: string | null
|
|
976
|
-
hook_password_verification_url?: string | null
|
|
977
|
-
auto_link_by_email: boolean
|
|
978
|
-
// Hardening
|
|
979
|
-
revoke_on_new_device: boolean
|
|
980
|
-
enforce_ip_binding: boolean
|
|
981
|
-
allowed_email_domains: string[]
|
|
982
|
-
blocked_email_domains: string[]
|
|
983
|
-
updated_at: string
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
// Aligné sur UpsertTemplateRequest (backend) : subject + html_body requis.
|
|
987
|
-
export interface EmailTemplateUpdate {
|
|
988
|
-
subject: string
|
|
989
|
-
html_body: string
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
export interface AdminCreateUserRequest {
|
|
993
|
-
email: string
|
|
994
|
-
password?: string
|
|
995
|
-
role?: string
|
|
996
|
-
email_verified?: boolean
|
|
997
|
-
user_metadata?: Record<string, unknown>
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
export interface AdminUpdateUserRequest {
|
|
1001
|
-
password?: string
|
|
1002
|
-
role?: string
|
|
1003
|
-
is_active?: boolean
|
|
1004
|
-
is_banned?: boolean
|
|
1005
|
-
email_verified?: boolean
|
|
1006
|
-
user_metadata?: Record<string, unknown>
|
|
1007
|
-
app_metadata?: Record<string, unknown>
|
|
1008
|
-
mfa_enabled?: boolean
|
|
1009
|
-
revoke_sessions?: boolean
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
// GenerateLink (admin)
|
|
1013
|
-
export type GenerateLinkType = 'magic' | 'recovery' | 'invite'
|
|
1014
|
-
|
|
1015
|
-
export interface GenerateLinkResult {
|
|
1016
|
-
link: string
|
|
1017
|
-
token: string
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
// JwtClaims (getClaims)
|
|
1021
|
-
//
|
|
1022
|
-
// `exp`/`iat` sont OPTIONNELS (honnêteté de type) : sur le chemin de fallback
|
|
1023
|
-
// (`getUser()`, cas HS256/JWKS vide/fetch KO), les claims sont dérivées de
|
|
1024
|
-
// l'identité serveur et NE contiennent PAS les champs temporels du JWT. Seul le
|
|
1025
|
-
// chemin de vérification LOCALE (RS256/ES256) renseigne `exp`/`iat` réels. Un
|
|
1026
|
-
// consommateur doit donc traiter `claims.exp` comme potentiellement `undefined`
|
|
1027
|
-
// (pas de `claims.exp * 1000` → `NaN` silencieux).
|
|
1028
|
-
export interface JwtClaims {
|
|
1029
|
-
sub: string
|
|
1030
|
-
exp?: number
|
|
1031
|
-
iat?: number
|
|
1032
|
-
nbf?: number
|
|
1033
|
-
iss?: string
|
|
1034
|
-
aud?: string | string[]
|
|
1035
|
-
role?: string
|
|
1036
|
-
[key: string]: unknown
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
export interface GetClaimsResult {
|
|
1040
|
-
claims: JwtClaims
|
|
1041
|
-
header: { alg: string; kid?: string; typ?: string }
|
|
1042
|
-
}
|