@aurabase/core 0.5.4 → 0.6.1
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.cjs +34 -16
- package/dist/index.d.cts +54 -10
- package/dist/index.d.ts +54 -10
- package/dist/index.js +34 -16
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -39,25 +39,41 @@ var AuraError = class _AuraError extends Error {
|
|
|
39
39
|
}
|
|
40
40
|
const rawCode = body?.error?.code;
|
|
41
41
|
const lowerMsg = rawMessage.toLowerCase();
|
|
42
|
-
|
|
43
|
-
if (!isGenericHttpCode) {
|
|
44
|
-
this.code = rawCode;
|
|
45
|
-
} else if (status === 429 || rawCode === "RATE_LIMITED" || rawCode === "http_429") {
|
|
46
|
-
this.code = "rate_limit_exceeded";
|
|
47
|
-
} else if (status === 401 && (lowerMsg.includes("identifiants") || lowerMsg.includes("credentials") || lowerMsg.includes("mot de passe incorrect"))) {
|
|
42
|
+
if (rawCode === "INVALID_CREDENTIALS" || rawCode === "invalid_credentials") {
|
|
48
43
|
this.code = "invalid_credentials";
|
|
49
|
-
} else if (
|
|
50
|
-
this.code = "session_revoked";
|
|
51
|
-
} else if (status === 401 && lowerMsg.includes("expir\xE9")) {
|
|
52
|
-
this.code = "session_expired";
|
|
53
|
-
} else if (status === 400 && (lowerMsg.includes("mot de passe") || lowerMsg.includes("password"))) {
|
|
54
|
-
this.code = "weak_password";
|
|
55
|
-
} else if (status === 409 && (lowerMsg.includes("d\xE9j\xE0 utilis\xE9") || lowerMsg.includes("already exists") || lowerMsg.includes("already in use") || lowerMsg.includes("email"))) {
|
|
44
|
+
} else if (rawCode === "EMAIL_ALREADY_IN_USE" || rawCode === "USER_ALREADY_EXISTS" || rawCode === "email_already_in_use") {
|
|
56
45
|
this.code = "email_already_in_use";
|
|
57
|
-
} else if (
|
|
46
|
+
} else if (rawCode === "WEAK_PASSWORD" || rawCode === "weak_password") {
|
|
47
|
+
this.code = "weak_password";
|
|
48
|
+
} else if (rawCode === "USER_NOT_FOUND" || rawCode === "user_not_found") {
|
|
58
49
|
this.code = "user_not_found";
|
|
50
|
+
} else if (rawCode === "SESSION_EXPIRED" || rawCode === "session_expired") {
|
|
51
|
+
this.code = "session_expired";
|
|
52
|
+
} else if (rawCode === "SESSION_REVOKED" || rawCode === "session_revoked") {
|
|
53
|
+
this.code = "session_revoked";
|
|
54
|
+
} else if (rawCode === "INVALID_OTP" || rawCode === "invalid_otp") {
|
|
55
|
+
this.code = "invalid_otp";
|
|
56
|
+
} else if (rawCode === "RATE_LIMITED" || rawCode === "rate_limit_exceeded" || status === 429) {
|
|
57
|
+
this.code = "rate_limit_exceeded";
|
|
59
58
|
} else {
|
|
60
|
-
|
|
59
|
+
const isGenericHttpCode = typeof rawCode !== "string" || rawCode === "UNAUTHORIZED" || rawCode === "BAD_REQUEST" || rawCode === "CONFLICT" || rawCode.startsWith("http_");
|
|
60
|
+
if (!isGenericHttpCode) {
|
|
61
|
+
this.code = rawCode;
|
|
62
|
+
} else if (status === 401 && (lowerMsg.includes("identifiants") || lowerMsg.includes("credentials") || lowerMsg.includes("mot de passe incorrect"))) {
|
|
63
|
+
this.code = "invalid_credentials";
|
|
64
|
+
} else if (status === 401 && lowerMsg.includes("r\xE9voqu\xE9e")) {
|
|
65
|
+
this.code = "session_revoked";
|
|
66
|
+
} else if (status === 401 && lowerMsg.includes("expir\xE9")) {
|
|
67
|
+
this.code = "session_expired";
|
|
68
|
+
} else if (status === 400 && (lowerMsg.includes("mot de passe") || lowerMsg.includes("password"))) {
|
|
69
|
+
this.code = "weak_password";
|
|
70
|
+
} else if (status === 409 && (lowerMsg.includes("d\xE9j\xE0 utilis\xE9") || lowerMsg.includes("already exists") || lowerMsg.includes("already in use") || lowerMsg.includes("email"))) {
|
|
71
|
+
this.code = "email_already_in_use";
|
|
72
|
+
} else if (status === 404 && lowerMsg.includes("utilisateur")) {
|
|
73
|
+
this.code = "user_not_found";
|
|
74
|
+
} else {
|
|
75
|
+
this.code = rawCode ?? `http_${status}`;
|
|
76
|
+
}
|
|
61
77
|
}
|
|
62
78
|
Object.setPrototypeOf(this, _AuraError.prototype);
|
|
63
79
|
}
|
|
@@ -693,7 +709,9 @@ async function fetchWithAuth(url, init, client) {
|
|
|
693
709
|
}
|
|
694
710
|
}
|
|
695
711
|
if (res.status === 204) {
|
|
696
|
-
|
|
712
|
+
const totalFromCr2 = parseContentRangeTotal(res.headers.get("content-range"));
|
|
713
|
+
if (totalFromCr2 === void 0) return { data: null, error: null };
|
|
714
|
+
return { data: null, error: null, meta: { total: totalFromCr2 }, count: totalFromCr2 };
|
|
697
715
|
}
|
|
698
716
|
if (!res.ok) {
|
|
699
717
|
let body2 = null;
|
package/dist/index.d.cts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - storage/path.ts : invalid_path
|
|
15
15
|
* - db/QueryBuilder.ts: PGRST116 (parité PostgREST : `.single()` sur 0/plusieurs lignes)
|
|
16
16
|
*/
|
|
17
|
-
type AuraErrorCode = 'no_session' | 'timeout' | 'network_error' | 'invalid_response' | 'refresh_discarded' | 'unverifiable_token' | 'no_code_verifier' | 'pkce_generation_failed' | 'missing_email' | 'jwks_fetch_failed' | 'signature_invalid' | 'token_expired' | 'token_not_yet_valid' | 'invalid_jwt' | 'unsupported_alg' | 'no_matching_key' | 'invalid_issuer' | 'invalid_audience' | 'invalid_path' | 'PGRST116' | 'invalid_credentials' | 'weak_password' | 'email_already_in_use' | 'user_not_found' | 'rate_limit_exceeded' | 'session_expired' | 'session_revoked' | (string & {});
|
|
17
|
+
type AuraErrorCode = 'no_session' | 'timeout' | 'network_error' | 'invalid_response' | 'refresh_discarded' | 'unverifiable_token' | 'no_code_verifier' | 'pkce_generation_failed' | 'missing_email' | 'jwks_fetch_failed' | 'signature_invalid' | 'token_expired' | 'token_not_yet_valid' | 'invalid_jwt' | 'unsupported_alg' | 'no_matching_key' | 'invalid_issuer' | 'invalid_audience' | 'invalid_path' | 'PGRST116' | 'invalid_credentials' | 'weak_password' | 'email_already_in_use' | 'user_not_found' | 'rate_limit_exceeded' | 'session_expired' | 'invalid_otp' | 'session_revoked' | (string & {});
|
|
18
18
|
/**
|
|
19
19
|
* Structured error thrown/returned by the Aurabase SDK.
|
|
20
20
|
* Mirrors the backend's `AuraError` JSON shape with semantic DX normalization.
|
|
@@ -260,12 +260,18 @@ interface AuthChangePayload {
|
|
|
260
260
|
interface SignUpRequest {
|
|
261
261
|
email: string;
|
|
262
262
|
password: string;
|
|
263
|
+
name?: string;
|
|
263
264
|
captcha_token?: string;
|
|
265
|
+
options?: {
|
|
266
|
+
emailRedirectTo?: string;
|
|
267
|
+
data?: Record<string, unknown>;
|
|
268
|
+
};
|
|
264
269
|
}
|
|
265
270
|
interface SignInRequest {
|
|
266
271
|
email: string;
|
|
267
272
|
password: string;
|
|
268
273
|
captcha_token?: string;
|
|
274
|
+
mfa?: 'required' | 'optional';
|
|
269
275
|
}
|
|
270
276
|
interface MagicLinkRequest {
|
|
271
277
|
email: string;
|
|
@@ -329,6 +335,10 @@ interface OAuthSignInOptions {
|
|
|
329
335
|
*/
|
|
330
336
|
flowType?: 'pkce' | 'implicit';
|
|
331
337
|
}
|
|
338
|
+
interface OAuthSignInObjectOptions extends OAuthSignInOptions {
|
|
339
|
+
provider: string;
|
|
340
|
+
options?: OAuthSignInOptions;
|
|
341
|
+
}
|
|
332
342
|
interface PasswordResetRequest {
|
|
333
343
|
email: string;
|
|
334
344
|
}
|
|
@@ -646,7 +656,7 @@ interface ObjectMeta {
|
|
|
646
656
|
metadata: Record<string, string>;
|
|
647
657
|
}
|
|
648
658
|
/** Événement serveur brut reçu via WebSocket (union discriminée par type) */
|
|
649
|
-
type ServerMessage = ServerSubscribedMsg | ServerEventMsg | ServerPongMsg | ServerErrorMsg | ServerTokenRefreshedMsg | ServerPresenceStateMsg | BroadcastAckMessage;
|
|
659
|
+
type ServerMessage = ServerSubscribedMsg | ServerEventMsg | ServerPongMsg | ServerErrorMsg | ServerTokenRefreshedMsg | ServerPresenceStateMsg | BroadcastAckMessage | ServerChannelRecoveredMsg;
|
|
650
660
|
interface ServerSubscribedMsg {
|
|
651
661
|
type: 'subscribed';
|
|
652
662
|
channel: string;
|
|
@@ -689,6 +699,14 @@ interface ServerPresenceStateMsg {
|
|
|
689
699
|
channel: string;
|
|
690
700
|
presences: PresenceInfo[];
|
|
691
701
|
}
|
|
702
|
+
/**
|
|
703
|
+
* L'écoute `postgres_changes` qui avait valu une erreur (`CHANNEL_ERROR`) à ce canal est rétablie :
|
|
704
|
+
* les changements reprennent. Le SDK repasse le canal en `SUBSCRIBED`.
|
|
705
|
+
*/
|
|
706
|
+
interface ServerChannelRecoveredMsg {
|
|
707
|
+
type: 'channel_recovered';
|
|
708
|
+
channel: string;
|
|
709
|
+
}
|
|
692
710
|
/** Événement realtime (CDC, broadcast, presence) */
|
|
693
711
|
interface RealtimeEvent<T = Record<string, unknown>> {
|
|
694
712
|
id: string;
|
|
@@ -741,6 +759,11 @@ interface RealtimePostgresUpdatePayload<T = Record<string, unknown>> extends Rea
|
|
|
741
759
|
eventType: 'UPDATE';
|
|
742
760
|
event: 'update';
|
|
743
761
|
new: T;
|
|
762
|
+
/**
|
|
763
|
+
* Colonnes de **clé primaire** de l'ancienne ligne seulement (`{}` si la table n'en a pas), jamais
|
|
764
|
+
* ses autres valeurs : la sécurité au niveau des lignes n'est évaluée que sur la nouvelle ligne.
|
|
765
|
+
* Si la clé a changé, ce sont les valeurs d'avant.
|
|
766
|
+
*/
|
|
744
767
|
old: Partial<T>;
|
|
745
768
|
}
|
|
746
769
|
/** Payload enrichi pour un événement CDC PostgreSQL de suppression */
|
|
@@ -748,6 +771,7 @@ interface RealtimePostgresDeletePayload<T = Record<string, unknown>> extends Rea
|
|
|
748
771
|
eventType: 'DELETE';
|
|
749
772
|
event: 'delete';
|
|
750
773
|
new: null;
|
|
774
|
+
/** Colonnes de **clé primaire** de la ligne supprimée seulement (`{}` si la table n'en a pas). */
|
|
751
775
|
old: Partial<T> | null;
|
|
752
776
|
}
|
|
753
777
|
/** Union discriminée par eventType pour les événements CDC PostgreSQL */
|
|
@@ -803,12 +827,14 @@ interface PostgresChangesFilter {
|
|
|
803
827
|
* (defense-in-depth) : il ne peut que sur-filtrer, jamais faire fuiter un
|
|
804
828
|
* event que le serveur aurait dû exclure.
|
|
805
829
|
*
|
|
830
|
+
* **INSERT / UPDATE** : le prédicat est évalué sur la **nouvelle ligne** (`record`).
|
|
831
|
+
*
|
|
806
832
|
* **DELETE** : le prédicat est évalué sur l'**ancienne ligne** (`old_record`),
|
|
807
|
-
* puisque le `record` d'un DELETE est vide côté CDC.
|
|
808
|
-
*
|
|
809
|
-
*
|
|
810
|
-
*
|
|
811
|
-
*
|
|
833
|
+
* puisque le `record` d'un DELETE est vide côté CDC. `old_record` ne contient
|
|
834
|
+
* que la clé primaire (UPDATE comme DELETE) — un filtre sur une autre colonne
|
|
835
|
+
* exclura systématiquement les DELETE, **sauf `is.null`/`isdistinct`** qui
|
|
836
|
+
* traitent une colonne absente comme `NULL` et peuvent donc matcher même sans
|
|
837
|
+
* cette colonne dans `old_record`.
|
|
812
838
|
*/
|
|
813
839
|
filter?: string;
|
|
814
840
|
}
|
|
@@ -847,9 +873,13 @@ interface BroadcastFilter {
|
|
|
847
873
|
* consultable pour ce canal — laisser passer serait fail-open). C'est le modèle de
|
|
848
874
|
* Phoenix, dont dérive le protocole Supabase Realtime : on rejoint un topic avant d'y
|
|
849
875
|
* pousser quoi que ce soit. Appelez `.subscribe()` — et vérifiez le statut qu'il rend.
|
|
876
|
+
* - `'invalid_payload'` — le `payload` porte lui-même une clé `event`. Le nom de l'événement
|
|
877
|
+
* voyage dans le payload du fil (`{ event, ...payload }`) : une clé `event` du payload
|
|
878
|
+
* l'écraserait et le message serait routé sous un autre nom chez les abonnés. Rien n'est
|
|
879
|
+
* émis ; renommez la clé (`eventName`, `kind`…).
|
|
850
880
|
* - `'error'` — l'envoi lui-même a levé une exception (sérialisation, transport).
|
|
851
881
|
*/
|
|
852
|
-
type BroadcastSendStatus = 'ok' | 'timeout' | 'not_connected' | 'requires_subscription' | 'error';
|
|
882
|
+
type BroadcastSendStatus = 'ok' | 'timeout' | 'not_connected' | 'requires_subscription' | 'invalid_payload' | 'error';
|
|
853
883
|
/** Config pour presence */
|
|
854
884
|
interface PresenceFilter {
|
|
855
885
|
event: 'sync' | 'join' | 'leave';
|
|
@@ -993,6 +1023,19 @@ interface SemanticSearchResult {
|
|
|
993
1023
|
metadata: Record<string, unknown>;
|
|
994
1024
|
similarity: number;
|
|
995
1025
|
}
|
|
1026
|
+
/** Limites d'exécution d'une fonction (`PATCH /v1/functions/{project}/{name}`). */
|
|
1027
|
+
interface FunctionPermissions {
|
|
1028
|
+
/** Domaines autorisés en sortie. Stocké mais non appliqué par le runtime actuel. */
|
|
1029
|
+
allow_net: string[];
|
|
1030
|
+
/** 16 à 1024, défaut 128. */
|
|
1031
|
+
memory_mb: number;
|
|
1032
|
+
/** 1 à 300, défaut 30 — durée maximale (wall-clock). */
|
|
1033
|
+
timeout_secs: number;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Définition d'une fonction. Contient le code source et les variables d'environnement :
|
|
1037
|
+
* `list()` et `get()` exigent donc une clé `service_role` (usage serveur uniquement).
|
|
1038
|
+
*/
|
|
996
1039
|
interface FunctionDef {
|
|
997
1040
|
id: string;
|
|
998
1041
|
project_id: string;
|
|
@@ -1000,7 +1043,8 @@ interface FunctionDef {
|
|
|
1000
1043
|
runtime: string;
|
|
1001
1044
|
code: string;
|
|
1002
1045
|
code_hash: string;
|
|
1003
|
-
env_vars: Record<string,
|
|
1046
|
+
env_vars: Record<string, string>;
|
|
1047
|
+
permissions: FunctionPermissions;
|
|
1004
1048
|
is_active: boolean;
|
|
1005
1049
|
created_at: string;
|
|
1006
1050
|
updated_at: string;
|
|
@@ -2021,4 +2065,4 @@ declare class LocalAuthStore extends BaseAuthStore {
|
|
|
2021
2065
|
private _removeStorage;
|
|
2022
2066
|
}
|
|
2023
2067
|
|
|
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 };
|
|
2068
|
+
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 FunctionPermissions, 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 OAuthSignInObjectOptions, 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 ServerChannelRecoveredMsg, 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
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - storage/path.ts : invalid_path
|
|
15
15
|
* - db/QueryBuilder.ts: PGRST116 (parité PostgREST : `.single()` sur 0/plusieurs lignes)
|
|
16
16
|
*/
|
|
17
|
-
type AuraErrorCode = 'no_session' | 'timeout' | 'network_error' | 'invalid_response' | 'refresh_discarded' | 'unverifiable_token' | 'no_code_verifier' | 'pkce_generation_failed' | 'missing_email' | 'jwks_fetch_failed' | 'signature_invalid' | 'token_expired' | 'token_not_yet_valid' | 'invalid_jwt' | 'unsupported_alg' | 'no_matching_key' | 'invalid_issuer' | 'invalid_audience' | 'invalid_path' | 'PGRST116' | 'invalid_credentials' | 'weak_password' | 'email_already_in_use' | 'user_not_found' | 'rate_limit_exceeded' | 'session_expired' | 'session_revoked' | (string & {});
|
|
17
|
+
type AuraErrorCode = 'no_session' | 'timeout' | 'network_error' | 'invalid_response' | 'refresh_discarded' | 'unverifiable_token' | 'no_code_verifier' | 'pkce_generation_failed' | 'missing_email' | 'jwks_fetch_failed' | 'signature_invalid' | 'token_expired' | 'token_not_yet_valid' | 'invalid_jwt' | 'unsupported_alg' | 'no_matching_key' | 'invalid_issuer' | 'invalid_audience' | 'invalid_path' | 'PGRST116' | 'invalid_credentials' | 'weak_password' | 'email_already_in_use' | 'user_not_found' | 'rate_limit_exceeded' | 'session_expired' | 'invalid_otp' | 'session_revoked' | (string & {});
|
|
18
18
|
/**
|
|
19
19
|
* Structured error thrown/returned by the Aurabase SDK.
|
|
20
20
|
* Mirrors the backend's `AuraError` JSON shape with semantic DX normalization.
|
|
@@ -260,12 +260,18 @@ interface AuthChangePayload {
|
|
|
260
260
|
interface SignUpRequest {
|
|
261
261
|
email: string;
|
|
262
262
|
password: string;
|
|
263
|
+
name?: string;
|
|
263
264
|
captcha_token?: string;
|
|
265
|
+
options?: {
|
|
266
|
+
emailRedirectTo?: string;
|
|
267
|
+
data?: Record<string, unknown>;
|
|
268
|
+
};
|
|
264
269
|
}
|
|
265
270
|
interface SignInRequest {
|
|
266
271
|
email: string;
|
|
267
272
|
password: string;
|
|
268
273
|
captcha_token?: string;
|
|
274
|
+
mfa?: 'required' | 'optional';
|
|
269
275
|
}
|
|
270
276
|
interface MagicLinkRequest {
|
|
271
277
|
email: string;
|
|
@@ -329,6 +335,10 @@ interface OAuthSignInOptions {
|
|
|
329
335
|
*/
|
|
330
336
|
flowType?: 'pkce' | 'implicit';
|
|
331
337
|
}
|
|
338
|
+
interface OAuthSignInObjectOptions extends OAuthSignInOptions {
|
|
339
|
+
provider: string;
|
|
340
|
+
options?: OAuthSignInOptions;
|
|
341
|
+
}
|
|
332
342
|
interface PasswordResetRequest {
|
|
333
343
|
email: string;
|
|
334
344
|
}
|
|
@@ -646,7 +656,7 @@ interface ObjectMeta {
|
|
|
646
656
|
metadata: Record<string, string>;
|
|
647
657
|
}
|
|
648
658
|
/** Événement serveur brut reçu via WebSocket (union discriminée par type) */
|
|
649
|
-
type ServerMessage = ServerSubscribedMsg | ServerEventMsg | ServerPongMsg | ServerErrorMsg | ServerTokenRefreshedMsg | ServerPresenceStateMsg | BroadcastAckMessage;
|
|
659
|
+
type ServerMessage = ServerSubscribedMsg | ServerEventMsg | ServerPongMsg | ServerErrorMsg | ServerTokenRefreshedMsg | ServerPresenceStateMsg | BroadcastAckMessage | ServerChannelRecoveredMsg;
|
|
650
660
|
interface ServerSubscribedMsg {
|
|
651
661
|
type: 'subscribed';
|
|
652
662
|
channel: string;
|
|
@@ -689,6 +699,14 @@ interface ServerPresenceStateMsg {
|
|
|
689
699
|
channel: string;
|
|
690
700
|
presences: PresenceInfo[];
|
|
691
701
|
}
|
|
702
|
+
/**
|
|
703
|
+
* L'écoute `postgres_changes` qui avait valu une erreur (`CHANNEL_ERROR`) à ce canal est rétablie :
|
|
704
|
+
* les changements reprennent. Le SDK repasse le canal en `SUBSCRIBED`.
|
|
705
|
+
*/
|
|
706
|
+
interface ServerChannelRecoveredMsg {
|
|
707
|
+
type: 'channel_recovered';
|
|
708
|
+
channel: string;
|
|
709
|
+
}
|
|
692
710
|
/** Événement realtime (CDC, broadcast, presence) */
|
|
693
711
|
interface RealtimeEvent<T = Record<string, unknown>> {
|
|
694
712
|
id: string;
|
|
@@ -741,6 +759,11 @@ interface RealtimePostgresUpdatePayload<T = Record<string, unknown>> extends Rea
|
|
|
741
759
|
eventType: 'UPDATE';
|
|
742
760
|
event: 'update';
|
|
743
761
|
new: T;
|
|
762
|
+
/**
|
|
763
|
+
* Colonnes de **clé primaire** de l'ancienne ligne seulement (`{}` si la table n'en a pas), jamais
|
|
764
|
+
* ses autres valeurs : la sécurité au niveau des lignes n'est évaluée que sur la nouvelle ligne.
|
|
765
|
+
* Si la clé a changé, ce sont les valeurs d'avant.
|
|
766
|
+
*/
|
|
744
767
|
old: Partial<T>;
|
|
745
768
|
}
|
|
746
769
|
/** Payload enrichi pour un événement CDC PostgreSQL de suppression */
|
|
@@ -748,6 +771,7 @@ interface RealtimePostgresDeletePayload<T = Record<string, unknown>> extends Rea
|
|
|
748
771
|
eventType: 'DELETE';
|
|
749
772
|
event: 'delete';
|
|
750
773
|
new: null;
|
|
774
|
+
/** Colonnes de **clé primaire** de la ligne supprimée seulement (`{}` si la table n'en a pas). */
|
|
751
775
|
old: Partial<T> | null;
|
|
752
776
|
}
|
|
753
777
|
/** Union discriminée par eventType pour les événements CDC PostgreSQL */
|
|
@@ -803,12 +827,14 @@ interface PostgresChangesFilter {
|
|
|
803
827
|
* (defense-in-depth) : il ne peut que sur-filtrer, jamais faire fuiter un
|
|
804
828
|
* event que le serveur aurait dû exclure.
|
|
805
829
|
*
|
|
830
|
+
* **INSERT / UPDATE** : le prédicat est évalué sur la **nouvelle ligne** (`record`).
|
|
831
|
+
*
|
|
806
832
|
* **DELETE** : le prédicat est évalué sur l'**ancienne ligne** (`old_record`),
|
|
807
|
-
* puisque le `record` d'un DELETE est vide côté CDC.
|
|
808
|
-
*
|
|
809
|
-
*
|
|
810
|
-
*
|
|
811
|
-
*
|
|
833
|
+
* puisque le `record` d'un DELETE est vide côté CDC. `old_record` ne contient
|
|
834
|
+
* que la clé primaire (UPDATE comme DELETE) — un filtre sur une autre colonne
|
|
835
|
+
* exclura systématiquement les DELETE, **sauf `is.null`/`isdistinct`** qui
|
|
836
|
+
* traitent une colonne absente comme `NULL` et peuvent donc matcher même sans
|
|
837
|
+
* cette colonne dans `old_record`.
|
|
812
838
|
*/
|
|
813
839
|
filter?: string;
|
|
814
840
|
}
|
|
@@ -847,9 +873,13 @@ interface BroadcastFilter {
|
|
|
847
873
|
* consultable pour ce canal — laisser passer serait fail-open). C'est le modèle de
|
|
848
874
|
* Phoenix, dont dérive le protocole Supabase Realtime : on rejoint un topic avant d'y
|
|
849
875
|
* pousser quoi que ce soit. Appelez `.subscribe()` — et vérifiez le statut qu'il rend.
|
|
876
|
+
* - `'invalid_payload'` — le `payload` porte lui-même une clé `event`. Le nom de l'événement
|
|
877
|
+
* voyage dans le payload du fil (`{ event, ...payload }`) : une clé `event` du payload
|
|
878
|
+
* l'écraserait et le message serait routé sous un autre nom chez les abonnés. Rien n'est
|
|
879
|
+
* émis ; renommez la clé (`eventName`, `kind`…).
|
|
850
880
|
* - `'error'` — l'envoi lui-même a levé une exception (sérialisation, transport).
|
|
851
881
|
*/
|
|
852
|
-
type BroadcastSendStatus = 'ok' | 'timeout' | 'not_connected' | 'requires_subscription' | 'error';
|
|
882
|
+
type BroadcastSendStatus = 'ok' | 'timeout' | 'not_connected' | 'requires_subscription' | 'invalid_payload' | 'error';
|
|
853
883
|
/** Config pour presence */
|
|
854
884
|
interface PresenceFilter {
|
|
855
885
|
event: 'sync' | 'join' | 'leave';
|
|
@@ -993,6 +1023,19 @@ interface SemanticSearchResult {
|
|
|
993
1023
|
metadata: Record<string, unknown>;
|
|
994
1024
|
similarity: number;
|
|
995
1025
|
}
|
|
1026
|
+
/** Limites d'exécution d'une fonction (`PATCH /v1/functions/{project}/{name}`). */
|
|
1027
|
+
interface FunctionPermissions {
|
|
1028
|
+
/** Domaines autorisés en sortie. Stocké mais non appliqué par le runtime actuel. */
|
|
1029
|
+
allow_net: string[];
|
|
1030
|
+
/** 16 à 1024, défaut 128. */
|
|
1031
|
+
memory_mb: number;
|
|
1032
|
+
/** 1 à 300, défaut 30 — durée maximale (wall-clock). */
|
|
1033
|
+
timeout_secs: number;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Définition d'une fonction. Contient le code source et les variables d'environnement :
|
|
1037
|
+
* `list()` et `get()` exigent donc une clé `service_role` (usage serveur uniquement).
|
|
1038
|
+
*/
|
|
996
1039
|
interface FunctionDef {
|
|
997
1040
|
id: string;
|
|
998
1041
|
project_id: string;
|
|
@@ -1000,7 +1043,8 @@ interface FunctionDef {
|
|
|
1000
1043
|
runtime: string;
|
|
1001
1044
|
code: string;
|
|
1002
1045
|
code_hash: string;
|
|
1003
|
-
env_vars: Record<string,
|
|
1046
|
+
env_vars: Record<string, string>;
|
|
1047
|
+
permissions: FunctionPermissions;
|
|
1004
1048
|
is_active: boolean;
|
|
1005
1049
|
created_at: string;
|
|
1006
1050
|
updated_at: string;
|
|
@@ -2021,4 +2065,4 @@ declare class LocalAuthStore extends BaseAuthStore {
|
|
|
2021
2065
|
private _removeStorage;
|
|
2022
2066
|
}
|
|
2023
2067
|
|
|
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 };
|
|
2068
|
+
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 FunctionPermissions, 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 OAuthSignInObjectOptions, 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 ServerChannelRecoveredMsg, 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.js
CHANGED
|
@@ -37,25 +37,41 @@ var AuraError = class _AuraError extends Error {
|
|
|
37
37
|
}
|
|
38
38
|
const rawCode = body?.error?.code;
|
|
39
39
|
const lowerMsg = rawMessage.toLowerCase();
|
|
40
|
-
|
|
41
|
-
if (!isGenericHttpCode) {
|
|
42
|
-
this.code = rawCode;
|
|
43
|
-
} else if (status === 429 || rawCode === "RATE_LIMITED" || rawCode === "http_429") {
|
|
44
|
-
this.code = "rate_limit_exceeded";
|
|
45
|
-
} else if (status === 401 && (lowerMsg.includes("identifiants") || lowerMsg.includes("credentials") || lowerMsg.includes("mot de passe incorrect"))) {
|
|
40
|
+
if (rawCode === "INVALID_CREDENTIALS" || rawCode === "invalid_credentials") {
|
|
46
41
|
this.code = "invalid_credentials";
|
|
47
|
-
} else if (
|
|
48
|
-
this.code = "session_revoked";
|
|
49
|
-
} else if (status === 401 && lowerMsg.includes("expir\xE9")) {
|
|
50
|
-
this.code = "session_expired";
|
|
51
|
-
} else if (status === 400 && (lowerMsg.includes("mot de passe") || lowerMsg.includes("password"))) {
|
|
52
|
-
this.code = "weak_password";
|
|
53
|
-
} else if (status === 409 && (lowerMsg.includes("d\xE9j\xE0 utilis\xE9") || lowerMsg.includes("already exists") || lowerMsg.includes("already in use") || lowerMsg.includes("email"))) {
|
|
42
|
+
} else if (rawCode === "EMAIL_ALREADY_IN_USE" || rawCode === "USER_ALREADY_EXISTS" || rawCode === "email_already_in_use") {
|
|
54
43
|
this.code = "email_already_in_use";
|
|
55
|
-
} else if (
|
|
44
|
+
} else if (rawCode === "WEAK_PASSWORD" || rawCode === "weak_password") {
|
|
45
|
+
this.code = "weak_password";
|
|
46
|
+
} else if (rawCode === "USER_NOT_FOUND" || rawCode === "user_not_found") {
|
|
56
47
|
this.code = "user_not_found";
|
|
48
|
+
} else if (rawCode === "SESSION_EXPIRED" || rawCode === "session_expired") {
|
|
49
|
+
this.code = "session_expired";
|
|
50
|
+
} else if (rawCode === "SESSION_REVOKED" || rawCode === "session_revoked") {
|
|
51
|
+
this.code = "session_revoked";
|
|
52
|
+
} else if (rawCode === "INVALID_OTP" || rawCode === "invalid_otp") {
|
|
53
|
+
this.code = "invalid_otp";
|
|
54
|
+
} else if (rawCode === "RATE_LIMITED" || rawCode === "rate_limit_exceeded" || status === 429) {
|
|
55
|
+
this.code = "rate_limit_exceeded";
|
|
57
56
|
} else {
|
|
58
|
-
|
|
57
|
+
const isGenericHttpCode = typeof rawCode !== "string" || rawCode === "UNAUTHORIZED" || rawCode === "BAD_REQUEST" || rawCode === "CONFLICT" || rawCode.startsWith("http_");
|
|
58
|
+
if (!isGenericHttpCode) {
|
|
59
|
+
this.code = rawCode;
|
|
60
|
+
} else if (status === 401 && (lowerMsg.includes("identifiants") || lowerMsg.includes("credentials") || lowerMsg.includes("mot de passe incorrect"))) {
|
|
61
|
+
this.code = "invalid_credentials";
|
|
62
|
+
} else if (status === 401 && lowerMsg.includes("r\xE9voqu\xE9e")) {
|
|
63
|
+
this.code = "session_revoked";
|
|
64
|
+
} else if (status === 401 && lowerMsg.includes("expir\xE9")) {
|
|
65
|
+
this.code = "session_expired";
|
|
66
|
+
} else if (status === 400 && (lowerMsg.includes("mot de passe") || lowerMsg.includes("password"))) {
|
|
67
|
+
this.code = "weak_password";
|
|
68
|
+
} else if (status === 409 && (lowerMsg.includes("d\xE9j\xE0 utilis\xE9") || lowerMsg.includes("already exists") || lowerMsg.includes("already in use") || lowerMsg.includes("email"))) {
|
|
69
|
+
this.code = "email_already_in_use";
|
|
70
|
+
} else if (status === 404 && lowerMsg.includes("utilisateur")) {
|
|
71
|
+
this.code = "user_not_found";
|
|
72
|
+
} else {
|
|
73
|
+
this.code = rawCode ?? `http_${status}`;
|
|
74
|
+
}
|
|
59
75
|
}
|
|
60
76
|
Object.setPrototypeOf(this, _AuraError.prototype);
|
|
61
77
|
}
|
|
@@ -691,7 +707,9 @@ async function fetchWithAuth(url, init, client) {
|
|
|
691
707
|
}
|
|
692
708
|
}
|
|
693
709
|
if (res.status === 204) {
|
|
694
|
-
|
|
710
|
+
const totalFromCr2 = parseContentRangeTotal(res.headers.get("content-range"));
|
|
711
|
+
if (totalFromCr2 === void 0) return { data: null, error: null };
|
|
712
|
+
return { data: null, error: null, meta: { total: totalFromCr2 }, count: totalFromCr2 };
|
|
695
713
|
}
|
|
696
714
|
if (!res.ok) {
|
|
697
715
|
let body2 = null;
|
package/package.json
CHANGED