@palbase/backend 9.0.1 → 10.1.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.
@@ -2,6 +2,21 @@ import { ZodSchema, z } from 'zod';
2
2
 
3
3
  /** Supported HTTP methods for endpoints. */
4
4
  type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
5
+ /**
6
+ * Verified device claim, minted at the platform attestation boundary (App
7
+ * Attest / Play Integrity). Server-owned and immutable: it is populated ONLY
8
+ * from a successful, request-bound verification — never from a raw client
9
+ * header or from user/JWT metadata.
10
+ */
11
+ interface VerifiedDevice {
12
+ /** Server-minted `auth.installations` anchor (`ins_…`); may be "" until the installation binding is wired at the verify boundary. */
13
+ installationId: string;
14
+ /** Palauth device record (`dev_…`) proven by the App Attest assertion. Absent on the Android integrity path. */
15
+ authDeviceId?: string;
16
+ platform: "ios" | "android" | "web";
17
+ /** Proven verification tier — never a string-matched or header-asserted value. */
18
+ assurance: "attested" | "app_integrity" | "registered";
19
+ }
5
20
  /** Authenticated user attached to the request context. */
6
21
  interface User {
7
22
  id: string;
@@ -9,6 +24,12 @@ interface User {
9
24
  email?: string;
10
25
  role: string;
11
26
  metadata: Record<string, unknown>;
27
+ /**
28
+ * Reserved, server-owned verified device claim. `null` on an authenticated
29
+ * request with no verified device. The context assembler is the sole writer;
30
+ * user/JWT metadata can never populate it.
31
+ */
32
+ device: VerifiedDevice | null;
12
33
  }
13
34
  /** Authentication configuration for an endpoint. */
14
35
  interface AuthConfig {
@@ -29,7 +50,6 @@ interface MiddlewareContext extends PalbaseModuleClients {
29
50
  log: Logger;
30
51
  cache: CacheClient;
31
52
  requestId: string;
32
- projectId: string;
33
53
  environmentId: string;
34
54
  }
35
55
  /** Middleware function signature — receives context and next function. */
@@ -513,8 +533,8 @@ interface PalbaseRegisterDeviceParams {
513
533
  /** Email template view (camelCase). */
514
534
  interface PalbaseEmailTemplate {
515
535
  id: string;
516
- projectId: string;
517
536
  slug: string;
537
+ locale: string;
518
538
  subject: string;
519
539
  htmlBody: string;
520
540
  textBody?: string;
@@ -526,6 +546,7 @@ interface PalbaseEmailTemplate {
526
546
  /** Payload for templates.email.create. */
527
547
  interface PalbaseCreateEmailTemplateInput {
528
548
  slug: string;
549
+ locale?: string;
529
550
  subject: string;
530
551
  htmlBody: string;
531
552
  textBody?: string;
@@ -541,8 +562,8 @@ interface PalbaseUpdateEmailTemplateInput {
541
562
  /** SMS template view (camelCase). No subject / html / text distinction. */
542
563
  interface PalbaseSMSTemplate {
543
564
  id: string;
544
- projectId: string;
545
565
  slug: string;
566
+ locale: string;
546
567
  body: string;
547
568
  variables: string[];
548
569
  isDefault: boolean;
@@ -552,6 +573,7 @@ interface PalbaseSMSTemplate {
552
573
  /** Payload for templates.sms.create. */
553
574
  interface PalbaseCreateSMSTemplateInput {
554
575
  slug: string;
576
+ locale?: string;
555
577
  body: string;
556
578
  variables?: string[];
557
579
  }
@@ -1576,4 +1598,4 @@ type Middleware = (ctx: MiddlewareContext, next: () => Promise<void>) => Promise
1576
1598
  */
1577
1599
  type AuthSpec = boolean | Partial<AuthConfig>;
1578
1600
 
1579
- export { type PalbaseDeviceTokenView as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseBatchOverrideOperation as G, HttpError as H, type PalbaseBatchSetOverridesResult as I, type PalbaseBindDeviceParams as J, type PalbaseBucketClient as K, type Logger as L, type Middleware as M, NotFound as N, type PalbaseClearAllOverridesResult as O, type PBRequest as P, type QueueClient as Q, type RateLimitConfig as R, type PalbaseClearOverrideResult as S, type PalbaseCohortQueryInput as T, type User as U, type PalbaseCohortResult as V, type PalbaseCollectionRef as W, type PalbaseCountQueryInput as X, type PalbaseCountResult as Y, type PalbaseCreateLinkParams as Z, type PalbaseDeviceInfo as _, type PalbaseModuleClients as a, type PalbaseVerifyRequestSignatureParams as a$, type PalbaseDocumentRef as a0, type PalbaseDocumentSnapshot as a1, type PalbaseEmailClient as a2, type PalbaseEmailSendParams as a3, type PalbaseEmailSendResponse as a4, type PalbaseEventNamesResult as a5, type PalbaseEventsQueryInput as a6, type PalbaseEventsResult as a7, type PalbaseFileObject as a8, type PalbaseFlag as a9, type PalbaseOverviewResult as aA, type PalbasePreferences as aB, type PalbasePreferencesClient as aC, type PalbasePublicUrlResponse as aD, type PalbasePushClient as aE, type PalbasePushSendParams as aF, type PalbasePushSendResponse as aG, type PalbaseQrCodeOptions as aH, type PalbaseQuerySnapshot as aI, type PalbaseRegisterDeviceParams as aJ, type PalbaseResult as aK, type PalbaseRetentionQueryInput as aL, type PalbaseRetentionResult as aM, type PalbaseSession as aN, type PalbaseSetOverrideResult as aO, type PalbaseSetOverridesResult as aP, type PalbaseSignedUrlResponse as aQ, type PalbaseSmsClient as aR, type PalbaseSmsSendParams as aS, type PalbaseSmsSendResponse as aT, type PalbaseTransformOptions as aU, type PalbaseUpdateLinkParams as aV, type PalbaseUploadOptions as aW, type PalbaseUser as aX, type PalbaseUserDetailResult as aY, type PalbaseUsersQueryInput as aZ, type PalbaseUsersResult as a_, type PalbaseFlagContext as aa, type PalbaseFlagSource as ab, type PalbaseFlagValue as ac, type PalbaseFlagVariant as ad, type PalbaseFlagsServiceClient as ae, type PalbaseFunctionsClient as af, type PalbaseFunnelQueryInput as ag, type PalbaseFunnelResult as ah, type PalbaseIdentifyTraits as ai, type PalbaseInboxClient as aj, type PalbaseInboxListOptions as ak, type PalbaseInboxListResult as al, type PalbaseInboxMessage as am, type PalbaseInboxSendParams as an, type PalbaseInboxSendResponse as ao, type PalbaseInitialLink as ap, type PalbaseInvokeOptions as aq, type PalbaseLink as ar, type PalbaseLinkAnalytics as as, type PalbaseLinkDetails as at, type PalbaseLinksClient as au, type PalbaseListLinksOptions as av, type PalbaseListLinksResult as aw, type PalbaseListOptions as ax, type PalbaseMatchParams as ay, type PalbaseMultiChannelResponse as az, type PalbaseDocsClient as b, type PalbaseWhereOperator as b0, TooManyRequests as b1, type TxClient as b2, Unauthorized as b3, defineMiddleware as b4, type PalbaseFlagsClient as c, type PalbaseNotificationsClient as d, type PalbaseRealtimeClient as e, type PalbaseStorageClient as f, type AuthConfig as g, type ClientInfo as h, Conflict as i, type DBOps as j, type ErrorMap as k, type ErrorThrowers as l, Forbidden as m, type HttpMethod as n, type MiddlewareContext as o, type MiddlewareHandler as p, PalError as q, type PalbaseAnalyticsClient as r, type PalbaseAnalyticsManagementNamespace as s, type PalbaseAnalyticsProperties as t, type PalbaseAnalyticsQueryNamespace as u, type PalbaseAttestAndroidParams as v, type PalbaseAttestAndroidResult as w, type PalbaseAttestiOSParams as x, type PalbaseAttestiOSResult as y, type PalbaseAuthClient as z };
1601
+ export { type PalbaseDeviceTokenView as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseBatchOverrideOperation as G, HttpError as H, type PalbaseBatchSetOverridesResult as I, type PalbaseBindDeviceParams as J, type PalbaseBucketClient as K, type Logger as L, type Middleware as M, NotFound as N, type PalbaseClearAllOverridesResult as O, type PBRequest as P, type QueueClient as Q, type RateLimitConfig as R, type PalbaseClearOverrideResult as S, type PalbaseCohortQueryInput as T, type User as U, type PalbaseCohortResult as V, type PalbaseCollectionRef as W, type PalbaseCountQueryInput as X, type PalbaseCountResult as Y, type PalbaseCreateLinkParams as Z, type PalbaseDeviceInfo as _, type PalbaseModuleClients as a, type PalbaseVerifyRequestSignatureParams as a$, type PalbaseDocumentRef as a0, type PalbaseDocumentSnapshot as a1, type PalbaseEmailClient as a2, type PalbaseEmailSendParams as a3, type PalbaseEmailSendResponse as a4, type PalbaseEventNamesResult as a5, type PalbaseEventsQueryInput as a6, type PalbaseEventsResult as a7, type PalbaseFileObject as a8, type PalbaseFlag as a9, type PalbaseOverviewResult as aA, type PalbasePreferences as aB, type PalbasePreferencesClient as aC, type PalbasePublicUrlResponse as aD, type PalbasePushClient as aE, type PalbasePushSendParams as aF, type PalbasePushSendResponse as aG, type PalbaseQrCodeOptions as aH, type PalbaseQuerySnapshot as aI, type PalbaseRegisterDeviceParams as aJ, type PalbaseResult as aK, type PalbaseRetentionQueryInput as aL, type PalbaseRetentionResult as aM, type PalbaseSession as aN, type PalbaseSetOverrideResult as aO, type PalbaseSetOverridesResult as aP, type PalbaseSignedUrlResponse as aQ, type PalbaseSmsClient as aR, type PalbaseSmsSendParams as aS, type PalbaseSmsSendResponse as aT, type PalbaseTransformOptions as aU, type PalbaseUpdateLinkParams as aV, type PalbaseUploadOptions as aW, type PalbaseUser as aX, type PalbaseUserDetailResult as aY, type PalbaseUsersQueryInput as aZ, type PalbaseUsersResult as a_, type PalbaseFlagContext as aa, type PalbaseFlagSource as ab, type PalbaseFlagValue as ac, type PalbaseFlagVariant as ad, type PalbaseFlagsServiceClient as ae, type PalbaseFunctionsClient as af, type PalbaseFunnelQueryInput as ag, type PalbaseFunnelResult as ah, type PalbaseIdentifyTraits as ai, type PalbaseInboxClient as aj, type PalbaseInboxListOptions as ak, type PalbaseInboxListResult as al, type PalbaseInboxMessage as am, type PalbaseInboxSendParams as an, type PalbaseInboxSendResponse as ao, type PalbaseInitialLink as ap, type PalbaseInvokeOptions as aq, type PalbaseLink as ar, type PalbaseLinkAnalytics as as, type PalbaseLinkDetails as at, type PalbaseLinksClient as au, type PalbaseListLinksOptions as av, type PalbaseListLinksResult as aw, type PalbaseListOptions as ax, type PalbaseMatchParams as ay, type PalbaseMultiChannelResponse as az, type PalbaseDocsClient as b, type PalbaseWhereOperator as b0, TooManyRequests as b1, type TxClient as b2, Unauthorized as b3, type VerifiedDevice as b4, defineMiddleware as b5, type PalbaseFlagsClient as c, type PalbaseNotificationsClient as d, type PalbaseRealtimeClient as e, type PalbaseStorageClient as f, type AuthConfig as g, type ClientInfo as h, Conflict as i, type DBOps as j, type ErrorMap as k, type ErrorThrowers as l, Forbidden as m, type HttpMethod as n, type MiddlewareContext as o, type MiddlewareHandler as p, PalError as q, type PalbaseAnalyticsClient as r, type PalbaseAnalyticsManagementNamespace as s, type PalbaseAnalyticsProperties as t, type PalbaseAnalyticsQueryNamespace as u, type PalbaseAttestAndroidParams as v, type PalbaseAttestAndroidResult as w, type PalbaseAttestiOSParams as x, type PalbaseAttestiOSResult as y, type PalbaseAuthClient as z };
@@ -2,6 +2,21 @@ import { ZodSchema, z } from 'zod';
2
2
 
3
3
  /** Supported HTTP methods for endpoints. */
4
4
  type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
5
+ /**
6
+ * Verified device claim, minted at the platform attestation boundary (App
7
+ * Attest / Play Integrity). Server-owned and immutable: it is populated ONLY
8
+ * from a successful, request-bound verification — never from a raw client
9
+ * header or from user/JWT metadata.
10
+ */
11
+ interface VerifiedDevice {
12
+ /** Server-minted `auth.installations` anchor (`ins_…`); may be "" until the installation binding is wired at the verify boundary. */
13
+ installationId: string;
14
+ /** Palauth device record (`dev_…`) proven by the App Attest assertion. Absent on the Android integrity path. */
15
+ authDeviceId?: string;
16
+ platform: "ios" | "android" | "web";
17
+ /** Proven verification tier — never a string-matched or header-asserted value. */
18
+ assurance: "attested" | "app_integrity" | "registered";
19
+ }
5
20
  /** Authenticated user attached to the request context. */
6
21
  interface User {
7
22
  id: string;
@@ -9,6 +24,12 @@ interface User {
9
24
  email?: string;
10
25
  role: string;
11
26
  metadata: Record<string, unknown>;
27
+ /**
28
+ * Reserved, server-owned verified device claim. `null` on an authenticated
29
+ * request with no verified device. The context assembler is the sole writer;
30
+ * user/JWT metadata can never populate it.
31
+ */
32
+ device: VerifiedDevice | null;
12
33
  }
13
34
  /** Authentication configuration for an endpoint. */
14
35
  interface AuthConfig {
@@ -29,7 +50,6 @@ interface MiddlewareContext extends PalbaseModuleClients {
29
50
  log: Logger;
30
51
  cache: CacheClient;
31
52
  requestId: string;
32
- projectId: string;
33
53
  environmentId: string;
34
54
  }
35
55
  /** Middleware function signature — receives context and next function. */
@@ -513,8 +533,8 @@ interface PalbaseRegisterDeviceParams {
513
533
  /** Email template view (camelCase). */
514
534
  interface PalbaseEmailTemplate {
515
535
  id: string;
516
- projectId: string;
517
536
  slug: string;
537
+ locale: string;
518
538
  subject: string;
519
539
  htmlBody: string;
520
540
  textBody?: string;
@@ -526,6 +546,7 @@ interface PalbaseEmailTemplate {
526
546
  /** Payload for templates.email.create. */
527
547
  interface PalbaseCreateEmailTemplateInput {
528
548
  slug: string;
549
+ locale?: string;
529
550
  subject: string;
530
551
  htmlBody: string;
531
552
  textBody?: string;
@@ -541,8 +562,8 @@ interface PalbaseUpdateEmailTemplateInput {
541
562
  /** SMS template view (camelCase). No subject / html / text distinction. */
542
563
  interface PalbaseSMSTemplate {
543
564
  id: string;
544
- projectId: string;
545
565
  slug: string;
566
+ locale: string;
546
567
  body: string;
547
568
  variables: string[];
548
569
  isDefault: boolean;
@@ -552,6 +573,7 @@ interface PalbaseSMSTemplate {
552
573
  /** Payload for templates.sms.create. */
553
574
  interface PalbaseCreateSMSTemplateInput {
554
575
  slug: string;
576
+ locale?: string;
555
577
  body: string;
556
578
  variables?: string[];
557
579
  }
@@ -1576,4 +1598,4 @@ type Middleware = (ctx: MiddlewareContext, next: () => Promise<void>) => Promise
1576
1598
  */
1577
1599
  type AuthSpec = boolean | Partial<AuthConfig>;
1578
1600
 
1579
- export { type PalbaseDeviceTokenView as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseBatchOverrideOperation as G, HttpError as H, type PalbaseBatchSetOverridesResult as I, type PalbaseBindDeviceParams as J, type PalbaseBucketClient as K, type Logger as L, type Middleware as M, NotFound as N, type PalbaseClearAllOverridesResult as O, type PBRequest as P, type QueueClient as Q, type RateLimitConfig as R, type PalbaseClearOverrideResult as S, type PalbaseCohortQueryInput as T, type User as U, type PalbaseCohortResult as V, type PalbaseCollectionRef as W, type PalbaseCountQueryInput as X, type PalbaseCountResult as Y, type PalbaseCreateLinkParams as Z, type PalbaseDeviceInfo as _, type PalbaseModuleClients as a, type PalbaseVerifyRequestSignatureParams as a$, type PalbaseDocumentRef as a0, type PalbaseDocumentSnapshot as a1, type PalbaseEmailClient as a2, type PalbaseEmailSendParams as a3, type PalbaseEmailSendResponse as a4, type PalbaseEventNamesResult as a5, type PalbaseEventsQueryInput as a6, type PalbaseEventsResult as a7, type PalbaseFileObject as a8, type PalbaseFlag as a9, type PalbaseOverviewResult as aA, type PalbasePreferences as aB, type PalbasePreferencesClient as aC, type PalbasePublicUrlResponse as aD, type PalbasePushClient as aE, type PalbasePushSendParams as aF, type PalbasePushSendResponse as aG, type PalbaseQrCodeOptions as aH, type PalbaseQuerySnapshot as aI, type PalbaseRegisterDeviceParams as aJ, type PalbaseResult as aK, type PalbaseRetentionQueryInput as aL, type PalbaseRetentionResult as aM, type PalbaseSession as aN, type PalbaseSetOverrideResult as aO, type PalbaseSetOverridesResult as aP, type PalbaseSignedUrlResponse as aQ, type PalbaseSmsClient as aR, type PalbaseSmsSendParams as aS, type PalbaseSmsSendResponse as aT, type PalbaseTransformOptions as aU, type PalbaseUpdateLinkParams as aV, type PalbaseUploadOptions as aW, type PalbaseUser as aX, type PalbaseUserDetailResult as aY, type PalbaseUsersQueryInput as aZ, type PalbaseUsersResult as a_, type PalbaseFlagContext as aa, type PalbaseFlagSource as ab, type PalbaseFlagValue as ac, type PalbaseFlagVariant as ad, type PalbaseFlagsServiceClient as ae, type PalbaseFunctionsClient as af, type PalbaseFunnelQueryInput as ag, type PalbaseFunnelResult as ah, type PalbaseIdentifyTraits as ai, type PalbaseInboxClient as aj, type PalbaseInboxListOptions as ak, type PalbaseInboxListResult as al, type PalbaseInboxMessage as am, type PalbaseInboxSendParams as an, type PalbaseInboxSendResponse as ao, type PalbaseInitialLink as ap, type PalbaseInvokeOptions as aq, type PalbaseLink as ar, type PalbaseLinkAnalytics as as, type PalbaseLinkDetails as at, type PalbaseLinksClient as au, type PalbaseListLinksOptions as av, type PalbaseListLinksResult as aw, type PalbaseListOptions as ax, type PalbaseMatchParams as ay, type PalbaseMultiChannelResponse as az, type PalbaseDocsClient as b, type PalbaseWhereOperator as b0, TooManyRequests as b1, type TxClient as b2, Unauthorized as b3, defineMiddleware as b4, type PalbaseFlagsClient as c, type PalbaseNotificationsClient as d, type PalbaseRealtimeClient as e, type PalbaseStorageClient as f, type AuthConfig as g, type ClientInfo as h, Conflict as i, type DBOps as j, type ErrorMap as k, type ErrorThrowers as l, Forbidden as m, type HttpMethod as n, type MiddlewareContext as o, type MiddlewareHandler as p, PalError as q, type PalbaseAnalyticsClient as r, type PalbaseAnalyticsManagementNamespace as s, type PalbaseAnalyticsProperties as t, type PalbaseAnalyticsQueryNamespace as u, type PalbaseAttestAndroidParams as v, type PalbaseAttestAndroidResult as w, type PalbaseAttestiOSParams as x, type PalbaseAttestiOSResult as y, type PalbaseAuthClient as z };
1601
+ export { type PalbaseDeviceTokenView as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseBatchOverrideOperation as G, HttpError as H, type PalbaseBatchSetOverridesResult as I, type PalbaseBindDeviceParams as J, type PalbaseBucketClient as K, type Logger as L, type Middleware as M, NotFound as N, type PalbaseClearAllOverridesResult as O, type PBRequest as P, type QueueClient as Q, type RateLimitConfig as R, type PalbaseClearOverrideResult as S, type PalbaseCohortQueryInput as T, type User as U, type PalbaseCohortResult as V, type PalbaseCollectionRef as W, type PalbaseCountQueryInput as X, type PalbaseCountResult as Y, type PalbaseCreateLinkParams as Z, type PalbaseDeviceInfo as _, type PalbaseModuleClients as a, type PalbaseVerifyRequestSignatureParams as a$, type PalbaseDocumentRef as a0, type PalbaseDocumentSnapshot as a1, type PalbaseEmailClient as a2, type PalbaseEmailSendParams as a3, type PalbaseEmailSendResponse as a4, type PalbaseEventNamesResult as a5, type PalbaseEventsQueryInput as a6, type PalbaseEventsResult as a7, type PalbaseFileObject as a8, type PalbaseFlag as a9, type PalbaseOverviewResult as aA, type PalbasePreferences as aB, type PalbasePreferencesClient as aC, type PalbasePublicUrlResponse as aD, type PalbasePushClient as aE, type PalbasePushSendParams as aF, type PalbasePushSendResponse as aG, type PalbaseQrCodeOptions as aH, type PalbaseQuerySnapshot as aI, type PalbaseRegisterDeviceParams as aJ, type PalbaseResult as aK, type PalbaseRetentionQueryInput as aL, type PalbaseRetentionResult as aM, type PalbaseSession as aN, type PalbaseSetOverrideResult as aO, type PalbaseSetOverridesResult as aP, type PalbaseSignedUrlResponse as aQ, type PalbaseSmsClient as aR, type PalbaseSmsSendParams as aS, type PalbaseSmsSendResponse as aT, type PalbaseTransformOptions as aU, type PalbaseUpdateLinkParams as aV, type PalbaseUploadOptions as aW, type PalbaseUser as aX, type PalbaseUserDetailResult as aY, type PalbaseUsersQueryInput as aZ, type PalbaseUsersResult as a_, type PalbaseFlagContext as aa, type PalbaseFlagSource as ab, type PalbaseFlagValue as ac, type PalbaseFlagVariant as ad, type PalbaseFlagsServiceClient as ae, type PalbaseFunctionsClient as af, type PalbaseFunnelQueryInput as ag, type PalbaseFunnelResult as ah, type PalbaseIdentifyTraits as ai, type PalbaseInboxClient as aj, type PalbaseInboxListOptions as ak, type PalbaseInboxListResult as al, type PalbaseInboxMessage as am, type PalbaseInboxSendParams as an, type PalbaseInboxSendResponse as ao, type PalbaseInitialLink as ap, type PalbaseInvokeOptions as aq, type PalbaseLink as ar, type PalbaseLinkAnalytics as as, type PalbaseLinkDetails as at, type PalbaseLinksClient as au, type PalbaseListLinksOptions as av, type PalbaseListLinksResult as aw, type PalbaseListOptions as ax, type PalbaseMatchParams as ay, type PalbaseMultiChannelResponse as az, type PalbaseDocsClient as b, type PalbaseWhereOperator as b0, TooManyRequests as b1, type TxClient as b2, Unauthorized as b3, type VerifiedDevice as b4, defineMiddleware as b5, type PalbaseFlagsClient as c, type PalbaseNotificationsClient as d, type PalbaseRealtimeClient as e, type PalbaseStorageClient as f, type AuthConfig as g, type ClientInfo as h, Conflict as i, type DBOps as j, type ErrorMap as k, type ErrorThrowers as l, Forbidden as m, type HttpMethod as n, type MiddlewareContext as o, type MiddlewareHandler as p, PalError as q, type PalbaseAnalyticsClient as r, type PalbaseAnalyticsManagementNamespace as s, type PalbaseAnalyticsProperties as t, type PalbaseAnalyticsQueryNamespace as u, type PalbaseAttestAndroidParams as v, type PalbaseAttestAndroidResult as w, type PalbaseAttestiOSParams as x, type PalbaseAttestiOSResult as y, type PalbaseAuthClient as z };
@@ -1,8 +1,17 @@
1
1
  import { Tables, TableTypes } from './db/env.cjs';
2
- import { D as DBClient } from './endpoint-CGI5cZMg.cjs';
2
+ import { D as DBClient } from './endpoint-Cn3ICGTf.cjs';
3
3
 
4
4
  /** On delete action for foreign key references. */
5
5
  type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
6
+ /**
7
+ * The ON DELETE actions permitted on a foreign key to the built-in auth users
8
+ * (`auth.users`). Both let a user's rows be removed (`cascade`) or detached
9
+ * (`set null`) when the account is erased; `restrict` / `no action` would BLOCK
10
+ * erasure and are therefore excluded. This is the CLIENT-SIDE mirror of the
11
+ * server's auth-FK deletion policy — the server (validateAuthUserFK) is the real
12
+ * boundary, this narrows the type so the common mistake is caught at compile time.
13
+ */
14
+ type AuthUserOnDelete = Extract<OnDeleteAction, 'cascade' | 'set null'>;
6
15
  /** Column type identifiers. */
7
16
  type ColumnType = 'uuid' | 'text' | 'integer' | 'bigint' | 'numeric' | 'boolean' | 'timestamp' | 'jsonb' | 'enum';
8
17
  /** Base column definition shared by all column types. */
@@ -73,11 +82,37 @@ declare class ColumnBuilder<K extends ColumnType = ColumnType, N extends boolean
73
82
  * `auth.users` lives in the SAME tenant database (palauth-owned), so this is
74
83
  * a genuine cross-schema integrity constraint scoped to THIS tenant's users.
75
84
  * The referenced `auth.users.id` is `text` (palauth ids are `usr_<uuid>`), so
76
- * the referencing column must be `text()` too. Combine with `.onDelete(...)`
77
- * for cascade behaviour, e.g. a `user_id` column defined as
78
- * `text().notNull().referencesAuthUser().onDelete("cascade")`.
85
+ * the referencing column must be `text()` too.
86
+ *
87
+ * ON DELETE is REQUIRED here and may only be `cascade` or `set null`: an
88
+ * account-erasure request must never be blocked by a lingering FK, so
89
+ * `restrict` / `no action` are not accepted (they don't type-check). Example:
90
+ * `text().notNull().referencesAuthUser("cascade")`, or
91
+ * `text().nullable().referencesAuthUser("set null")`. The server
92
+ * (validateAuthUserFK) enforces this — and the remaining rules the type can't
93
+ * express (referencing column is text, `set null` needs a nullable column) —
94
+ * as the real boundary; this signature is the compile-time DX mirror.
95
+ */
96
+ referencesAuthUser(onDelete: AuthUserOnDelete): ColumnBuilder<K, N, D, E, P>;
97
+ /**
98
+ * Add a real DB-level foreign key to the canonical, server-minted installation
99
+ * anchor (`REFERENCES auth.installations(id)`) — the app-scoped verified-device
100
+ * root (`ins_...`). Sugar for `.references("auth.installations", "id")`.
101
+ *
102
+ * An installation is an APP INSTALL, not a user: this FK is NOT user ownership.
103
+ * A user-owned row STILL needs its own `.referencesAuthUser(...)` FK so account
104
+ * erasure removes it — an installation reference alone does not tie a row to a
105
+ * user's deletion. Use this only for install-scoped state (device prefs, push
106
+ * routing, …), alongside a separate auth-user FK where the row is user-owned.
107
+ *
108
+ * `auth.installations` lives in the SAME tenant DB (palauth-owned); its `id` is
109
+ * `text` (`ins_<uuid>`), so the referencing column must be `text()` too. ON
110
+ * DELETE is REQUIRED and may only be `cascade` or `set null` (same allowed set
111
+ * as an auth-user FK): an installation revoke / orphan cleanup must never be
112
+ * blocked by a lingering FK. The server (validateAuthAnchorFK) is the real
113
+ * boundary; this signature is the compile-time DX mirror.
79
114
  */
80
- referencesAuthUser(): ColumnBuilder<K, N, D, E, P>;
115
+ referencesInstallation(onDelete: AuthUserOnDelete): ColumnBuilder<K, N, D, E, P>;
81
116
  /** Set the ON DELETE action for a foreign key reference. */
82
117
  onDelete(action: OnDeleteAction): ColumnBuilder<K, N, D, E, P>;
83
118
  /** Add a single-column UNIQUE constraint. */
@@ -1,8 +1,17 @@
1
1
  import { Tables, TableTypes } from './db/env.js';
2
- import { D as DBClient } from './endpoint-CGI5cZMg.js';
2
+ import { D as DBClient } from './endpoint-Cn3ICGTf.js';
3
3
 
4
4
  /** On delete action for foreign key references. */
5
5
  type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
6
+ /**
7
+ * The ON DELETE actions permitted on a foreign key to the built-in auth users
8
+ * (`auth.users`). Both let a user's rows be removed (`cascade`) or detached
9
+ * (`set null`) when the account is erased; `restrict` / `no action` would BLOCK
10
+ * erasure and are therefore excluded. This is the CLIENT-SIDE mirror of the
11
+ * server's auth-FK deletion policy — the server (validateAuthUserFK) is the real
12
+ * boundary, this narrows the type so the common mistake is caught at compile time.
13
+ */
14
+ type AuthUserOnDelete = Extract<OnDeleteAction, 'cascade' | 'set null'>;
6
15
  /** Column type identifiers. */
7
16
  type ColumnType = 'uuid' | 'text' | 'integer' | 'bigint' | 'numeric' | 'boolean' | 'timestamp' | 'jsonb' | 'enum';
8
17
  /** Base column definition shared by all column types. */
@@ -73,11 +82,37 @@ declare class ColumnBuilder<K extends ColumnType = ColumnType, N extends boolean
73
82
  * `auth.users` lives in the SAME tenant database (palauth-owned), so this is
74
83
  * a genuine cross-schema integrity constraint scoped to THIS tenant's users.
75
84
  * The referenced `auth.users.id` is `text` (palauth ids are `usr_<uuid>`), so
76
- * the referencing column must be `text()` too. Combine with `.onDelete(...)`
77
- * for cascade behaviour, e.g. a `user_id` column defined as
78
- * `text().notNull().referencesAuthUser().onDelete("cascade")`.
85
+ * the referencing column must be `text()` too.
86
+ *
87
+ * ON DELETE is REQUIRED here and may only be `cascade` or `set null`: an
88
+ * account-erasure request must never be blocked by a lingering FK, so
89
+ * `restrict` / `no action` are not accepted (they don't type-check). Example:
90
+ * `text().notNull().referencesAuthUser("cascade")`, or
91
+ * `text().nullable().referencesAuthUser("set null")`. The server
92
+ * (validateAuthUserFK) enforces this — and the remaining rules the type can't
93
+ * express (referencing column is text, `set null` needs a nullable column) —
94
+ * as the real boundary; this signature is the compile-time DX mirror.
95
+ */
96
+ referencesAuthUser(onDelete: AuthUserOnDelete): ColumnBuilder<K, N, D, E, P>;
97
+ /**
98
+ * Add a real DB-level foreign key to the canonical, server-minted installation
99
+ * anchor (`REFERENCES auth.installations(id)`) — the app-scoped verified-device
100
+ * root (`ins_...`). Sugar for `.references("auth.installations", "id")`.
101
+ *
102
+ * An installation is an APP INSTALL, not a user: this FK is NOT user ownership.
103
+ * A user-owned row STILL needs its own `.referencesAuthUser(...)` FK so account
104
+ * erasure removes it — an installation reference alone does not tie a row to a
105
+ * user's deletion. Use this only for install-scoped state (device prefs, push
106
+ * routing, …), alongside a separate auth-user FK where the row is user-owned.
107
+ *
108
+ * `auth.installations` lives in the SAME tenant DB (palauth-owned); its `id` is
109
+ * `text` (`ins_<uuid>`), so the referencing column must be `text()` too. ON
110
+ * DELETE is REQUIRED and may only be `cascade` or `set null` (same allowed set
111
+ * as an auth-user FK): an installation revoke / orphan cleanup must never be
112
+ * blocked by a lingering FK. The server (validateAuthAnchorFK) is the real
113
+ * boundary; this signature is the compile-time DX mirror.
79
114
  */
80
- referencesAuthUser(): ColumnBuilder<K, N, D, E, P>;
115
+ referencesInstallation(onDelete: AuthUserOnDelete): ColumnBuilder<K, N, D, E, P>;
81
116
  /** Set the ON DELETE action for a foreign key reference. */
82
117
  onDelete(action: OnDeleteAction): ColumnBuilder<K, N, D, E, P>;
83
118
  /** Add a single-column UNIQUE constraint. */