@pylonsync/sdk 0.3.29 → 0.3.30

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +14 -0
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.29",
6
+ "version": "0.3.30",
7
7
  "type": "module",
8
8
  "main": "src/index.ts",
9
9
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -510,6 +510,18 @@ export type AuthConfig = {
510
510
  expose?: string[];
511
511
  /** Additional fields stripped (combined with default `passwordHash` + `_*`). */
512
512
  hide?: string[];
513
+ /**
514
+ * Field on the User row that, when truthy, lifts the session's
515
+ * `auth.is_admin = true`. Examples: `"isAdmin"` (bool column),
516
+ * `"role"` (string equal to "admin"), `"roles"` (array containing
517
+ * "admin"). Default unset — only `PYLON_ADMIN_TOKEN` grants admin.
518
+ *
519
+ * Set this when you want platform admins to sign in with their
520
+ * regular account (Studio gates on `is_admin`, dashboards can
521
+ * branch on it, etc.). The env-token path keeps working as the
522
+ * bootstrap / CI escape hatch.
523
+ */
524
+ adminField?: string;
513
525
  };
514
526
  session?: {
515
527
  /** New session lifetime in seconds. Default 30 days. */
@@ -532,6 +544,7 @@ export type ManifestAuthConfig = {
532
544
  entity: string;
533
545
  expose: string[];
534
546
  hide: string[];
547
+ admin_field?: string;
535
548
  };
536
549
  session: {
537
550
  expires_in: number;
@@ -557,6 +570,7 @@ export function auth(cfg: AuthConfig = {}): ManifestAuthConfig {
557
570
  entity: cfg.user?.entity ?? "User",
558
571
  expose: cfg.user?.expose ?? [],
559
572
  hide: cfg.user?.hide ?? [],
573
+ ...(cfg.user?.adminField ? { admin_field: cfg.user.adminField } : {}),
560
574
  },
561
575
  session: {
562
576
  expires_in: cfg.session?.expiresIn ?? 30 * 24 * 60 * 60,