@aurabase/core 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -715,6 +715,51 @@ interface CdcPayload {
715
715
  record: Record<string, unknown>;
716
716
  old_record: Record<string, unknown> | null;
717
717
  _truncated?: boolean;
718
+ [key: string]: unknown;
719
+ }
720
+ /** Base commune des métadonnées pour un événement CDC PostgreSQL */
721
+ interface RealtimePostgresChangesBasePayload {
722
+ schema: string;
723
+ table: string;
724
+ commit_timestamp: string;
725
+ errors?: string[];
726
+ id: string;
727
+ topic: string;
728
+ timestamp: string;
729
+ payload: CdcPayload | Record<string, unknown>;
730
+ event: 'insert' | 'update' | 'delete';
731
+ }
732
+ /** Payload enrichi pour un événement CDC PostgreSQL d'insertion */
733
+ interface RealtimePostgresInsertPayload<T = Record<string, unknown>> extends RealtimePostgresChangesBasePayload {
734
+ eventType: 'INSERT';
735
+ event: 'insert';
736
+ new: T;
737
+ old: null;
738
+ }
739
+ /** Payload enrichi pour un événement CDC PostgreSQL de mise à jour */
740
+ interface RealtimePostgresUpdatePayload<T = Record<string, unknown>> extends RealtimePostgresChangesBasePayload {
741
+ eventType: 'UPDATE';
742
+ event: 'update';
743
+ new: T;
744
+ old: Partial<T>;
745
+ }
746
+ /** Payload enrichi pour un événement CDC PostgreSQL de suppression */
747
+ interface RealtimePostgresDeletePayload<T = Record<string, unknown>> extends RealtimePostgresChangesBasePayload {
748
+ eventType: 'DELETE';
749
+ event: 'delete';
750
+ new: null;
751
+ old: Partial<T> | null;
752
+ }
753
+ /** Union discriminée par eventType pour les événements CDC PostgreSQL */
754
+ type RealtimePostgresChangesPayload<T = Record<string, unknown>> = RealtimePostgresInsertPayload<T> | RealtimePostgresUpdatePayload<T> | RealtimePostgresDeletePayload<T>;
755
+ /** Événement broadcast reçu avec payload typé */
756
+ interface RealtimeBroadcastEvent<T = Record<string, unknown>> {
757
+ event: string;
758
+ payload: T;
759
+ id?: string;
760
+ topic?: string;
761
+ timestamp?: string;
762
+ allowed_sub_ids?: string[];
718
763
  }
719
764
  /** Status de subscription */
720
765
  type RealtimeSubscribeStatus = 'SUBSCRIBED' | 'CLOSED' | 'CHANNEL_ERROR' | 'TIMED_OUT';
@@ -832,7 +877,12 @@ interface ChannelConfig {
832
877
  };
833
878
  /** Configuration présence directe */
834
879
  presence?: {
835
- /** Clé de présence — permet de regrouper plusieurs onglets/devices du même user */
880
+ /**
881
+ * @deprecated La présence distribuée est indexée de manière autoritaire par le serveur
882
+ * à l'aide de l'identité vérifiée (`user_id` extrait du JWT) et de l'identifiant de connexion WebSocket
883
+ * (`client_id` dans NATS KV). Une clé libre côté client n'est pas utilisée pour partitionner le cluster
884
+ * afin d'empêcher les collisions d'état et les risques d'usurpation d'identité.
885
+ */
836
886
  key?: string;
837
887
  };
838
888
  /** Configuration compatible Supabase sous `config` */
@@ -842,6 +892,9 @@ interface ChannelConfig {
842
892
  self?: boolean;
843
893
  };
844
894
  presence?: {
895
+ /**
896
+ * @deprecated Voir `ChannelConfig.presence.key`. L'identité de présence est sécurisée par `user_id`/`client_id`.
897
+ */
845
898
  key?: string;
846
899
  };
847
900
  private?: boolean;
@@ -1182,16 +1235,160 @@ interface NotificationStats {
1182
1235
  dead_lettered: number;
1183
1236
  }>;
1184
1237
  }
1238
+ type NotificationChannel = 'email' | 'sms' | 'push' | 'webhook';
1239
+ type NotificationStatus = 'queued' | 'processing' | 'sent' | 'failed' | 'delivered' | 'expired' | 'dead_lettered';
1240
+ type NotificationStatsWindow = '1h' | '24h' | '7d' | '30d';
1241
+ type NotificationAttemptStatus = 'processing' | 'sent' | 'failed' | 'retry_scheduled' | 'dead_lettered';
1242
+ type SettingsSource = 'project' | 'environment' | 'none';
1243
+ interface SmtpPublicSettings {
1244
+ configured: boolean;
1245
+ source: SettingsSource;
1246
+ host?: string | null;
1247
+ port?: number | null;
1248
+ user?: string | null;
1249
+ password_set: boolean;
1250
+ from_email?: string | null;
1251
+ from_name?: string | null;
1252
+ tls: boolean;
1253
+ }
1254
+ interface TwilioPublicSettings {
1255
+ configured: boolean;
1256
+ source: SettingsSource;
1257
+ account_sid_prefix?: string | null;
1258
+ auth_token_set: boolean;
1259
+ from_number?: string | null;
1260
+ status_callback_url?: string | null;
1261
+ }
1262
+ interface FcmPublicSettings {
1263
+ configured: boolean;
1264
+ source: SettingsSource;
1265
+ project_id?: string | null;
1266
+ service_account_json_set: boolean;
1267
+ legacy_server_key_present: boolean;
1268
+ api: string;
1269
+ }
1270
+ interface ApnsPublicSettings {
1271
+ configured: boolean;
1272
+ source: SettingsSource;
1273
+ key_id?: string | null;
1274
+ team_id?: string | null;
1275
+ private_key_set: boolean;
1276
+ bundle_id?: string | null;
1277
+ production: boolean;
1278
+ }
1279
+ interface WebhookPublicSettings {
1280
+ configured: boolean;
1281
+ source: SettingsSource;
1282
+ max_retries: number;
1283
+ retry_delay_ms: number;
1284
+ timeout_secs: number;
1285
+ secret_set: boolean;
1286
+ signature_tolerance_secs: number;
1287
+ }
1288
+ interface QuotaPublicSettings {
1289
+ source: SettingsSource;
1290
+ project_rate_limit_per_minute: number;
1291
+ channel_rate_limit_per_minute: number;
1292
+ batch_max_size: number;
1293
+ }
1294
+ interface SmtpSettingsPatch {
1295
+ host?: string | null;
1296
+ port?: number | null;
1297
+ user?: string | null;
1298
+ password?: string | null;
1299
+ from_email?: string | null;
1300
+ from_name?: string | null;
1301
+ tls?: boolean | null;
1302
+ }
1303
+ interface TwilioSettingsPatch {
1304
+ account_sid?: string | null;
1305
+ auth_token?: string | null;
1306
+ from_number?: string | null;
1307
+ }
1308
+ interface FcmSettingsPatch {
1309
+ project_id?: string | null;
1310
+ service_account_json?: string | null;
1311
+ }
1312
+ interface ApnsSettingsPatch {
1313
+ key_id?: string | null;
1314
+ team_id?: string | null;
1315
+ private_key_b64?: string | null;
1316
+ bundle_id?: string | null;
1317
+ production?: boolean | null;
1318
+ }
1319
+ interface WebhookSettingsPatch {
1320
+ max_retries?: number | null;
1321
+ retry_delay_ms?: number | null;
1322
+ timeout_secs?: number | null;
1323
+ secret?: string | null;
1324
+ }
1325
+ interface QuotaSettingsPatch {
1326
+ project_rate_limit_per_minute?: number | null;
1327
+ channel_rate_limit_per_minute?: number | null;
1328
+ batch_max_size?: number | null;
1329
+ }
1330
+ interface NotificationSettingsPatch {
1331
+ smtp?: SmtpSettingsPatch | null;
1332
+ twilio?: TwilioSettingsPatch | null;
1333
+ fcm?: FcmSettingsPatch | null;
1334
+ apns?: ApnsSettingsPatch | null;
1335
+ webhook?: WebhookSettingsPatch | null;
1336
+ quotas?: QuotaSettingsPatch | null;
1337
+ }
1185
1338
  interface NotificationSettings {
1186
1339
  project_id: string;
1187
- smtp?: Record<string, unknown>;
1188
- twilio?: Record<string, unknown>;
1189
- fcm?: Record<string, unknown>;
1190
- apns?: Record<string, unknown>;
1191
- webhook?: Record<string, unknown>;
1192
- quotas?: Record<string, unknown>;
1340
+ smtp?: SmtpPublicSettings | Record<string, unknown>;
1341
+ twilio?: TwilioPublicSettings | Record<string, unknown>;
1342
+ fcm?: FcmPublicSettings | Record<string, unknown>;
1343
+ apns?: ApnsPublicSettings | Record<string, unknown>;
1344
+ webhook?: WebhookPublicSettings | Record<string, unknown>;
1345
+ quotas?: QuotaPublicSettings | Record<string, unknown>;
1193
1346
  updated_at?: string | null;
1194
1347
  }
1348
+ type NotificationSettingsPublic = NotificationSettings;
1349
+ interface CreateNotificationRuleRequest {
1350
+ name: string;
1351
+ trigger_type: string;
1352
+ condition?: Record<string, unknown>;
1353
+ template_id?: string | null;
1354
+ channel: NotificationChannel;
1355
+ recipient_expr: string;
1356
+ delay_seconds?: number;
1357
+ }
1358
+ interface UpdateNotificationRuleRequest {
1359
+ name?: string;
1360
+ enabled?: boolean;
1361
+ trigger_type?: string;
1362
+ condition?: Record<string, unknown>;
1363
+ template_id?: string | null;
1364
+ channel?: NotificationChannel;
1365
+ recipient_expr?: string;
1366
+ delay_seconds?: number;
1367
+ }
1368
+ interface SendNotificationOptions {
1369
+ channel: NotificationChannel;
1370
+ recipient: string;
1371
+ body?: string;
1372
+ subject?: string;
1373
+ templateId?: string;
1374
+ template_id?: string;
1375
+ variables?: Record<string, unknown>;
1376
+ metadata?: Record<string, unknown>;
1377
+ idempotencyKey?: string;
1378
+ idempotency_key?: string;
1379
+ }
1380
+ interface SendNotificationItem {
1381
+ channel: NotificationChannel;
1382
+ recipient: string;
1383
+ body?: string;
1384
+ subject?: string;
1385
+ templateId?: string;
1386
+ template_id?: string;
1387
+ variables?: Record<string, unknown>;
1388
+ metadata?: Record<string, unknown>;
1389
+ idempotencyKey?: string;
1390
+ idempotency_key?: string;
1391
+ }
1195
1392
  interface NotificationRule {
1196
1393
  id: string;
1197
1394
  project_id: string;
@@ -1199,7 +1396,7 @@ interface NotificationRule {
1199
1396
  trigger_type: string;
1200
1397
  condition: Record<string, unknown>;
1201
1398
  template_id?: string | null;
1202
- channel: 'email' | 'sms' | 'push' | 'webhook';
1399
+ channel: NotificationChannel;
1203
1400
  recipient_expr: string;
1204
1401
  enabled: boolean;
1205
1402
  delay_seconds: number;
@@ -1554,6 +1751,10 @@ interface GetClaimsResult {
1554
1751
  kid?: string;
1555
1752
  typ?: string;
1556
1753
  };
1754
+ sub?: string;
1755
+ email?: string | null;
1756
+ role?: string;
1757
+ [key: string]: unknown;
1557
1758
  }
1558
1759
 
1559
1760
  type AuthChangeCallback = (token: string | null, user: User | null) => void;
@@ -1625,6 +1826,8 @@ interface AuraClientLike {
1625
1826
  */
1626
1827
  readonly baseUrl: string;
1627
1828
  readonly apiKey: string | null;
1829
+ /** Identifiant optionnel du projet résolu ou configuré sur le client */
1830
+ readonly projectId?: string;
1628
1831
  readonly fetchFn: typeof globalThis.fetch;
1629
1832
  readonly authStore: BaseAuthStore;
1630
1833
  /** Consommé uniquement par le service realtime (refresh proactif du token). */
@@ -1818,4 +2021,4 @@ declare class LocalAuthStore extends BaseAuthStore {
1818
2021
  private _removeStorage;
1819
2022
  }
1820
2023
 
1821
- export { AUTH_SETTINGS_WRITABLE_FIELDS, type AdminCreateUserRequest, type AdminSessionInfo, type AdminUpdateUserRequest, type AdminUser, type AuditLogEntry, type AuraClientLike, type AuraClientOptions, AuraError, type AuraErrorCode, type AuraFailure, type AuraNoContent, type AuraObservabilityEvent, type AuraResponse, type AuraSuccess, type AuthChangePayload, type AuthEvent, type AuthSettings, type AuthSettingsUpdate, BaseAuthStore, BaseService, type BatchSendItemResult, type BatchSendResponse, type BroadcastAckMessage, type BroadcastFilter, type BroadcastPayload, type BroadcastSendStatus, type CdcPayload, type ChannelConfig, type ChatMessage, type ChatResponse, type CountMode, type CreatePgFunctionRequest, type CreatePgTriggerRequest, type CronJob, DEFAULT_MAX_RETRIES, DEFAULT_REQUEST_TIMEOUT_MS, type EmailTemplateUpdate, type EmbedRequest, type EmbedResponse, type FetchInit, type FileEntry, type FilterOp, type FunctionDef, type GenerateLinkResult, type GenerateLinkType, type GetClaimsResult, type IdentityInfo, type ImageTransform, type Job, type JwtClaims, LocalAuthStore, type LoginResponse, type MagicLinkRequest, type Meta, type MfaChallenge, type MfaEnrollResponse, type MfaVerifyRequest, type Notification, type NotificationAttempt, type NotificationChannelStats, type NotificationDeadLetter, type NotificationEvent, type NotificationProviderLog, type NotificationQueueStats, type NotificationRule, type NotificationSettings, type NotificationStats, type NotificationTemplate, type NotificationTemplatePreview, type OAuthProviderSetting, type OAuthSignInOptions, type ObjectMeta, type PasswordResetRequest, type PgExecutableRole, type PgFunctionInfo, type PgTriggerInfo, type PostgresChangesFilter, type PresenceFilter, type PresenceInfo, type PresenceState, type QueryFilter, type QueryOptions, RETRYABLE_METHODS, RETRYABLE_STATUS, type RagIngestRequest, type RagIngestResponse, type RagRequest, type RagResponse, type RealtimeEvent, type RealtimeListenType, type RealtimeSubscribeStatus, type SchemaColumn, type SchemaEnum, type SchemaFunction, type SchemaFunctionArg, type SchemaIndex, type SchemaTable, type SemanticSearchResult, type SendNotificationRequest, type SerializeCookieOptions, type ServerErrorMsg, type ServerEventMsg, type ServerMessage, type ServerPongMsg, type ServerPresenceStateMsg, type ServerSubscribedMsg, type ServerTokenRefreshedMsg, type Session, type SessionInfo, type SignInRequest, type SignUpRequest, type StorageBucket, type SubscribeCallback, type TokenPair, type UpdateUserRequest, type UploadResult, type User, type UserStats, abortableSleep, clientScope, computeBackoff, emitAuraEvent, fetchWithAuth, isAbortError, isAuraError, isRetryableMethod, isRetryableStatus, isTokenExpired, parseCookieHeader, parseRetryAfter, refreshOnce, serializeBody, serializeCookieHeader };
2024
+ export { AUTH_SETTINGS_WRITABLE_FIELDS, type AdminCreateUserRequest, type AdminSessionInfo, type AdminUpdateUserRequest, type AdminUser, type ApnsPublicSettings, type ApnsSettingsPatch, type AuditLogEntry, type AuraClientLike, type AuraClientOptions, AuraError, type AuraErrorCode, type AuraFailure, type AuraNoContent, type AuraObservabilityEvent, type AuraResponse, type AuraSuccess, type AuthChangePayload, type AuthEvent, type AuthSettings, type AuthSettingsUpdate, BaseAuthStore, BaseService, type BatchSendItemResult, type BatchSendResponse, type BroadcastAckMessage, type BroadcastFilter, type BroadcastPayload, type BroadcastSendStatus, type CdcPayload, type ChannelConfig, type ChatMessage, type ChatResponse, type CountMode, type CreateNotificationRuleRequest, type CreatePgFunctionRequest, type CreatePgTriggerRequest, type CronJob, DEFAULT_MAX_RETRIES, DEFAULT_REQUEST_TIMEOUT_MS, type EmailTemplateUpdate, type EmbedRequest, type EmbedResponse, type FcmPublicSettings, type FcmSettingsPatch, type FetchInit, type FileEntry, type FilterOp, type FunctionDef, type GenerateLinkResult, type GenerateLinkType, type GetClaimsResult, type IdentityInfo, type ImageTransform, type Job, type JwtClaims, LocalAuthStore, type LoginResponse, type MagicLinkRequest, type Meta, type MfaChallenge, type MfaEnrollResponse, type MfaVerifyRequest, type Notification, type NotificationAttempt, type NotificationAttemptStatus, type NotificationChannel, type NotificationChannelStats, type NotificationDeadLetter, type NotificationEvent, type NotificationProviderLog, type NotificationQueueStats, type NotificationRule, type NotificationSettings, type NotificationSettingsPatch, type NotificationSettingsPublic, type NotificationStats, type NotificationStatsWindow, type NotificationStatus, type NotificationTemplate, type NotificationTemplatePreview, type OAuthProviderSetting, type OAuthSignInOptions, type ObjectMeta, type PasswordResetRequest, type PgExecutableRole, type PgFunctionInfo, type PgTriggerInfo, type PostgresChangesFilter, type PresenceFilter, type PresenceInfo, type PresenceState, type QueryFilter, type QueryOptions, type QuotaPublicSettings, type QuotaSettingsPatch, RETRYABLE_METHODS, RETRYABLE_STATUS, type RagIngestRequest, type RagIngestResponse, type RagRequest, type RagResponse, type RealtimeBroadcastEvent, type RealtimeEvent, type RealtimeListenType, type RealtimePostgresChangesBasePayload, type RealtimePostgresChangesPayload, type RealtimePostgresDeletePayload, type RealtimePostgresInsertPayload, type RealtimePostgresUpdatePayload, type RealtimeSubscribeStatus, type SchemaColumn, type SchemaEnum, type SchemaFunction, type SchemaFunctionArg, type SchemaIndex, type SchemaTable, type SemanticSearchResult, type SendNotificationItem, type SendNotificationOptions, type SendNotificationRequest, type SerializeCookieOptions, type ServerErrorMsg, type ServerEventMsg, type ServerMessage, type ServerPongMsg, type ServerPresenceStateMsg, type ServerSubscribedMsg, type ServerTokenRefreshedMsg, type Session, type SessionInfo, type SettingsSource, type SignInRequest, type SignUpRequest, type SmtpPublicSettings, type SmtpSettingsPatch, type StorageBucket, type SubscribeCallback, type TokenPair, type TwilioPublicSettings, type TwilioSettingsPatch, type UpdateNotificationRuleRequest, type UpdateUserRequest, type UploadResult, type User, type UserStats, type WebhookPublicSettings, type WebhookSettingsPatch, abortableSleep, clientScope, computeBackoff, emitAuraEvent, fetchWithAuth, isAbortError, isAuraError, isRetryableMethod, isRetryableStatus, isTokenExpired, parseCookieHeader, parseRetryAfter, refreshOnce, serializeBody, serializeCookieHeader };
package/dist/index.d.ts CHANGED
@@ -715,6 +715,51 @@ interface CdcPayload {
715
715
  record: Record<string, unknown>;
716
716
  old_record: Record<string, unknown> | null;
717
717
  _truncated?: boolean;
718
+ [key: string]: unknown;
719
+ }
720
+ /** Base commune des métadonnées pour un événement CDC PostgreSQL */
721
+ interface RealtimePostgresChangesBasePayload {
722
+ schema: string;
723
+ table: string;
724
+ commit_timestamp: string;
725
+ errors?: string[];
726
+ id: string;
727
+ topic: string;
728
+ timestamp: string;
729
+ payload: CdcPayload | Record<string, unknown>;
730
+ event: 'insert' | 'update' | 'delete';
731
+ }
732
+ /** Payload enrichi pour un événement CDC PostgreSQL d'insertion */
733
+ interface RealtimePostgresInsertPayload<T = Record<string, unknown>> extends RealtimePostgresChangesBasePayload {
734
+ eventType: 'INSERT';
735
+ event: 'insert';
736
+ new: T;
737
+ old: null;
738
+ }
739
+ /** Payload enrichi pour un événement CDC PostgreSQL de mise à jour */
740
+ interface RealtimePostgresUpdatePayload<T = Record<string, unknown>> extends RealtimePostgresChangesBasePayload {
741
+ eventType: 'UPDATE';
742
+ event: 'update';
743
+ new: T;
744
+ old: Partial<T>;
745
+ }
746
+ /** Payload enrichi pour un événement CDC PostgreSQL de suppression */
747
+ interface RealtimePostgresDeletePayload<T = Record<string, unknown>> extends RealtimePostgresChangesBasePayload {
748
+ eventType: 'DELETE';
749
+ event: 'delete';
750
+ new: null;
751
+ old: Partial<T> | null;
752
+ }
753
+ /** Union discriminée par eventType pour les événements CDC PostgreSQL */
754
+ type RealtimePostgresChangesPayload<T = Record<string, unknown>> = RealtimePostgresInsertPayload<T> | RealtimePostgresUpdatePayload<T> | RealtimePostgresDeletePayload<T>;
755
+ /** Événement broadcast reçu avec payload typé */
756
+ interface RealtimeBroadcastEvent<T = Record<string, unknown>> {
757
+ event: string;
758
+ payload: T;
759
+ id?: string;
760
+ topic?: string;
761
+ timestamp?: string;
762
+ allowed_sub_ids?: string[];
718
763
  }
719
764
  /** Status de subscription */
720
765
  type RealtimeSubscribeStatus = 'SUBSCRIBED' | 'CLOSED' | 'CHANNEL_ERROR' | 'TIMED_OUT';
@@ -832,7 +877,12 @@ interface ChannelConfig {
832
877
  };
833
878
  /** Configuration présence directe */
834
879
  presence?: {
835
- /** Clé de présence — permet de regrouper plusieurs onglets/devices du même user */
880
+ /**
881
+ * @deprecated La présence distribuée est indexée de manière autoritaire par le serveur
882
+ * à l'aide de l'identité vérifiée (`user_id` extrait du JWT) et de l'identifiant de connexion WebSocket
883
+ * (`client_id` dans NATS KV). Une clé libre côté client n'est pas utilisée pour partitionner le cluster
884
+ * afin d'empêcher les collisions d'état et les risques d'usurpation d'identité.
885
+ */
836
886
  key?: string;
837
887
  };
838
888
  /** Configuration compatible Supabase sous `config` */
@@ -842,6 +892,9 @@ interface ChannelConfig {
842
892
  self?: boolean;
843
893
  };
844
894
  presence?: {
895
+ /**
896
+ * @deprecated Voir `ChannelConfig.presence.key`. L'identité de présence est sécurisée par `user_id`/`client_id`.
897
+ */
845
898
  key?: string;
846
899
  };
847
900
  private?: boolean;
@@ -1182,16 +1235,160 @@ interface NotificationStats {
1182
1235
  dead_lettered: number;
1183
1236
  }>;
1184
1237
  }
1238
+ type NotificationChannel = 'email' | 'sms' | 'push' | 'webhook';
1239
+ type NotificationStatus = 'queued' | 'processing' | 'sent' | 'failed' | 'delivered' | 'expired' | 'dead_lettered';
1240
+ type NotificationStatsWindow = '1h' | '24h' | '7d' | '30d';
1241
+ type NotificationAttemptStatus = 'processing' | 'sent' | 'failed' | 'retry_scheduled' | 'dead_lettered';
1242
+ type SettingsSource = 'project' | 'environment' | 'none';
1243
+ interface SmtpPublicSettings {
1244
+ configured: boolean;
1245
+ source: SettingsSource;
1246
+ host?: string | null;
1247
+ port?: number | null;
1248
+ user?: string | null;
1249
+ password_set: boolean;
1250
+ from_email?: string | null;
1251
+ from_name?: string | null;
1252
+ tls: boolean;
1253
+ }
1254
+ interface TwilioPublicSettings {
1255
+ configured: boolean;
1256
+ source: SettingsSource;
1257
+ account_sid_prefix?: string | null;
1258
+ auth_token_set: boolean;
1259
+ from_number?: string | null;
1260
+ status_callback_url?: string | null;
1261
+ }
1262
+ interface FcmPublicSettings {
1263
+ configured: boolean;
1264
+ source: SettingsSource;
1265
+ project_id?: string | null;
1266
+ service_account_json_set: boolean;
1267
+ legacy_server_key_present: boolean;
1268
+ api: string;
1269
+ }
1270
+ interface ApnsPublicSettings {
1271
+ configured: boolean;
1272
+ source: SettingsSource;
1273
+ key_id?: string | null;
1274
+ team_id?: string | null;
1275
+ private_key_set: boolean;
1276
+ bundle_id?: string | null;
1277
+ production: boolean;
1278
+ }
1279
+ interface WebhookPublicSettings {
1280
+ configured: boolean;
1281
+ source: SettingsSource;
1282
+ max_retries: number;
1283
+ retry_delay_ms: number;
1284
+ timeout_secs: number;
1285
+ secret_set: boolean;
1286
+ signature_tolerance_secs: number;
1287
+ }
1288
+ interface QuotaPublicSettings {
1289
+ source: SettingsSource;
1290
+ project_rate_limit_per_minute: number;
1291
+ channel_rate_limit_per_minute: number;
1292
+ batch_max_size: number;
1293
+ }
1294
+ interface SmtpSettingsPatch {
1295
+ host?: string | null;
1296
+ port?: number | null;
1297
+ user?: string | null;
1298
+ password?: string | null;
1299
+ from_email?: string | null;
1300
+ from_name?: string | null;
1301
+ tls?: boolean | null;
1302
+ }
1303
+ interface TwilioSettingsPatch {
1304
+ account_sid?: string | null;
1305
+ auth_token?: string | null;
1306
+ from_number?: string | null;
1307
+ }
1308
+ interface FcmSettingsPatch {
1309
+ project_id?: string | null;
1310
+ service_account_json?: string | null;
1311
+ }
1312
+ interface ApnsSettingsPatch {
1313
+ key_id?: string | null;
1314
+ team_id?: string | null;
1315
+ private_key_b64?: string | null;
1316
+ bundle_id?: string | null;
1317
+ production?: boolean | null;
1318
+ }
1319
+ interface WebhookSettingsPatch {
1320
+ max_retries?: number | null;
1321
+ retry_delay_ms?: number | null;
1322
+ timeout_secs?: number | null;
1323
+ secret?: string | null;
1324
+ }
1325
+ interface QuotaSettingsPatch {
1326
+ project_rate_limit_per_minute?: number | null;
1327
+ channel_rate_limit_per_minute?: number | null;
1328
+ batch_max_size?: number | null;
1329
+ }
1330
+ interface NotificationSettingsPatch {
1331
+ smtp?: SmtpSettingsPatch | null;
1332
+ twilio?: TwilioSettingsPatch | null;
1333
+ fcm?: FcmSettingsPatch | null;
1334
+ apns?: ApnsSettingsPatch | null;
1335
+ webhook?: WebhookSettingsPatch | null;
1336
+ quotas?: QuotaSettingsPatch | null;
1337
+ }
1185
1338
  interface NotificationSettings {
1186
1339
  project_id: string;
1187
- smtp?: Record<string, unknown>;
1188
- twilio?: Record<string, unknown>;
1189
- fcm?: Record<string, unknown>;
1190
- apns?: Record<string, unknown>;
1191
- webhook?: Record<string, unknown>;
1192
- quotas?: Record<string, unknown>;
1340
+ smtp?: SmtpPublicSettings | Record<string, unknown>;
1341
+ twilio?: TwilioPublicSettings | Record<string, unknown>;
1342
+ fcm?: FcmPublicSettings | Record<string, unknown>;
1343
+ apns?: ApnsPublicSettings | Record<string, unknown>;
1344
+ webhook?: WebhookPublicSettings | Record<string, unknown>;
1345
+ quotas?: QuotaPublicSettings | Record<string, unknown>;
1193
1346
  updated_at?: string | null;
1194
1347
  }
1348
+ type NotificationSettingsPublic = NotificationSettings;
1349
+ interface CreateNotificationRuleRequest {
1350
+ name: string;
1351
+ trigger_type: string;
1352
+ condition?: Record<string, unknown>;
1353
+ template_id?: string | null;
1354
+ channel: NotificationChannel;
1355
+ recipient_expr: string;
1356
+ delay_seconds?: number;
1357
+ }
1358
+ interface UpdateNotificationRuleRequest {
1359
+ name?: string;
1360
+ enabled?: boolean;
1361
+ trigger_type?: string;
1362
+ condition?: Record<string, unknown>;
1363
+ template_id?: string | null;
1364
+ channel?: NotificationChannel;
1365
+ recipient_expr?: string;
1366
+ delay_seconds?: number;
1367
+ }
1368
+ interface SendNotificationOptions {
1369
+ channel: NotificationChannel;
1370
+ recipient: string;
1371
+ body?: string;
1372
+ subject?: string;
1373
+ templateId?: string;
1374
+ template_id?: string;
1375
+ variables?: Record<string, unknown>;
1376
+ metadata?: Record<string, unknown>;
1377
+ idempotencyKey?: string;
1378
+ idempotency_key?: string;
1379
+ }
1380
+ interface SendNotificationItem {
1381
+ channel: NotificationChannel;
1382
+ recipient: string;
1383
+ body?: string;
1384
+ subject?: string;
1385
+ templateId?: string;
1386
+ template_id?: string;
1387
+ variables?: Record<string, unknown>;
1388
+ metadata?: Record<string, unknown>;
1389
+ idempotencyKey?: string;
1390
+ idempotency_key?: string;
1391
+ }
1195
1392
  interface NotificationRule {
1196
1393
  id: string;
1197
1394
  project_id: string;
@@ -1199,7 +1396,7 @@ interface NotificationRule {
1199
1396
  trigger_type: string;
1200
1397
  condition: Record<string, unknown>;
1201
1398
  template_id?: string | null;
1202
- channel: 'email' | 'sms' | 'push' | 'webhook';
1399
+ channel: NotificationChannel;
1203
1400
  recipient_expr: string;
1204
1401
  enabled: boolean;
1205
1402
  delay_seconds: number;
@@ -1554,6 +1751,10 @@ interface GetClaimsResult {
1554
1751
  kid?: string;
1555
1752
  typ?: string;
1556
1753
  };
1754
+ sub?: string;
1755
+ email?: string | null;
1756
+ role?: string;
1757
+ [key: string]: unknown;
1557
1758
  }
1558
1759
 
1559
1760
  type AuthChangeCallback = (token: string | null, user: User | null) => void;
@@ -1625,6 +1826,8 @@ interface AuraClientLike {
1625
1826
  */
1626
1827
  readonly baseUrl: string;
1627
1828
  readonly apiKey: string | null;
1829
+ /** Identifiant optionnel du projet résolu ou configuré sur le client */
1830
+ readonly projectId?: string;
1628
1831
  readonly fetchFn: typeof globalThis.fetch;
1629
1832
  readonly authStore: BaseAuthStore;
1630
1833
  /** Consommé uniquement par le service realtime (refresh proactif du token). */
@@ -1818,4 +2021,4 @@ declare class LocalAuthStore extends BaseAuthStore {
1818
2021
  private _removeStorage;
1819
2022
  }
1820
2023
 
1821
- export { AUTH_SETTINGS_WRITABLE_FIELDS, type AdminCreateUserRequest, type AdminSessionInfo, type AdminUpdateUserRequest, type AdminUser, type AuditLogEntry, type AuraClientLike, type AuraClientOptions, AuraError, type AuraErrorCode, type AuraFailure, type AuraNoContent, type AuraObservabilityEvent, type AuraResponse, type AuraSuccess, type AuthChangePayload, type AuthEvent, type AuthSettings, type AuthSettingsUpdate, BaseAuthStore, BaseService, type BatchSendItemResult, type BatchSendResponse, type BroadcastAckMessage, type BroadcastFilter, type BroadcastPayload, type BroadcastSendStatus, type CdcPayload, type ChannelConfig, type ChatMessage, type ChatResponse, type CountMode, type CreatePgFunctionRequest, type CreatePgTriggerRequest, type CronJob, DEFAULT_MAX_RETRIES, DEFAULT_REQUEST_TIMEOUT_MS, type EmailTemplateUpdate, type EmbedRequest, type EmbedResponse, type FetchInit, type FileEntry, type FilterOp, type FunctionDef, type GenerateLinkResult, type GenerateLinkType, type GetClaimsResult, type IdentityInfo, type ImageTransform, type Job, type JwtClaims, LocalAuthStore, type LoginResponse, type MagicLinkRequest, type Meta, type MfaChallenge, type MfaEnrollResponse, type MfaVerifyRequest, type Notification, type NotificationAttempt, type NotificationChannelStats, type NotificationDeadLetter, type NotificationEvent, type NotificationProviderLog, type NotificationQueueStats, type NotificationRule, type NotificationSettings, type NotificationStats, type NotificationTemplate, type NotificationTemplatePreview, type OAuthProviderSetting, type OAuthSignInOptions, type ObjectMeta, type PasswordResetRequest, type PgExecutableRole, type PgFunctionInfo, type PgTriggerInfo, type PostgresChangesFilter, type PresenceFilter, type PresenceInfo, type PresenceState, type QueryFilter, type QueryOptions, RETRYABLE_METHODS, RETRYABLE_STATUS, type RagIngestRequest, type RagIngestResponse, type RagRequest, type RagResponse, type RealtimeEvent, type RealtimeListenType, type RealtimeSubscribeStatus, type SchemaColumn, type SchemaEnum, type SchemaFunction, type SchemaFunctionArg, type SchemaIndex, type SchemaTable, type SemanticSearchResult, type SendNotificationRequest, type SerializeCookieOptions, type ServerErrorMsg, type ServerEventMsg, type ServerMessage, type ServerPongMsg, type ServerPresenceStateMsg, type ServerSubscribedMsg, type ServerTokenRefreshedMsg, type Session, type SessionInfo, type SignInRequest, type SignUpRequest, type StorageBucket, type SubscribeCallback, type TokenPair, type UpdateUserRequest, type UploadResult, type User, type UserStats, abortableSleep, clientScope, computeBackoff, emitAuraEvent, fetchWithAuth, isAbortError, isAuraError, isRetryableMethod, isRetryableStatus, isTokenExpired, parseCookieHeader, parseRetryAfter, refreshOnce, serializeBody, serializeCookieHeader };
2024
+ export { AUTH_SETTINGS_WRITABLE_FIELDS, type AdminCreateUserRequest, type AdminSessionInfo, type AdminUpdateUserRequest, type AdminUser, type ApnsPublicSettings, type ApnsSettingsPatch, type AuditLogEntry, type AuraClientLike, type AuraClientOptions, AuraError, type AuraErrorCode, type AuraFailure, type AuraNoContent, type AuraObservabilityEvent, type AuraResponse, type AuraSuccess, type AuthChangePayload, type AuthEvent, type AuthSettings, type AuthSettingsUpdate, BaseAuthStore, BaseService, type BatchSendItemResult, type BatchSendResponse, type BroadcastAckMessage, type BroadcastFilter, type BroadcastPayload, type BroadcastSendStatus, type CdcPayload, type ChannelConfig, type ChatMessage, type ChatResponse, type CountMode, type CreateNotificationRuleRequest, type CreatePgFunctionRequest, type CreatePgTriggerRequest, type CronJob, DEFAULT_MAX_RETRIES, DEFAULT_REQUEST_TIMEOUT_MS, type EmailTemplateUpdate, type EmbedRequest, type EmbedResponse, type FcmPublicSettings, type FcmSettingsPatch, type FetchInit, type FileEntry, type FilterOp, type FunctionDef, type GenerateLinkResult, type GenerateLinkType, type GetClaimsResult, type IdentityInfo, type ImageTransform, type Job, type JwtClaims, LocalAuthStore, type LoginResponse, type MagicLinkRequest, type Meta, type MfaChallenge, type MfaEnrollResponse, type MfaVerifyRequest, type Notification, type NotificationAttempt, type NotificationAttemptStatus, type NotificationChannel, type NotificationChannelStats, type NotificationDeadLetter, type NotificationEvent, type NotificationProviderLog, type NotificationQueueStats, type NotificationRule, type NotificationSettings, type NotificationSettingsPatch, type NotificationSettingsPublic, type NotificationStats, type NotificationStatsWindow, type NotificationStatus, type NotificationTemplate, type NotificationTemplatePreview, type OAuthProviderSetting, type OAuthSignInOptions, type ObjectMeta, type PasswordResetRequest, type PgExecutableRole, type PgFunctionInfo, type PgTriggerInfo, type PostgresChangesFilter, type PresenceFilter, type PresenceInfo, type PresenceState, type QueryFilter, type QueryOptions, type QuotaPublicSettings, type QuotaSettingsPatch, RETRYABLE_METHODS, RETRYABLE_STATUS, type RagIngestRequest, type RagIngestResponse, type RagRequest, type RagResponse, type RealtimeBroadcastEvent, type RealtimeEvent, type RealtimeListenType, type RealtimePostgresChangesBasePayload, type RealtimePostgresChangesPayload, type RealtimePostgresDeletePayload, type RealtimePostgresInsertPayload, type RealtimePostgresUpdatePayload, type RealtimeSubscribeStatus, type SchemaColumn, type SchemaEnum, type SchemaFunction, type SchemaFunctionArg, type SchemaIndex, type SchemaTable, type SemanticSearchResult, type SendNotificationItem, type SendNotificationOptions, type SendNotificationRequest, type SerializeCookieOptions, type ServerErrorMsg, type ServerEventMsg, type ServerMessage, type ServerPongMsg, type ServerPresenceStateMsg, type ServerSubscribedMsg, type ServerTokenRefreshedMsg, type Session, type SessionInfo, type SettingsSource, type SignInRequest, type SignUpRequest, type SmtpPublicSettings, type SmtpSettingsPatch, type StorageBucket, type SubscribeCallback, type TokenPair, type TwilioPublicSettings, type TwilioSettingsPatch, type UpdateNotificationRuleRequest, type UpdateUserRequest, type UploadResult, type User, type UserStats, type WebhookPublicSettings, type WebhookSettingsPatch, abortableSleep, clientScope, computeBackoff, emitAuraEvent, fetchWithAuth, isAbortError, isAuraError, isRetryableMethod, isRetryableStatus, isTokenExpired, parseCookieHeader, parseRetryAfter, refreshOnce, serializeBody, serializeCookieHeader };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurabase/core",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "Cœur du SDK Aurabase : fetch résilient, erreurs, stores auth, types de réponse (infrastructure interne)",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",