@pylonsync/sdk 0.3.74 → 0.3.75

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 +40 -0
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.74",
6
+ "version": "0.3.75",
7
7
  "type": "module",
8
8
  "main": "src/index.ts",
9
9
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -562,6 +562,34 @@ export type AuthConfig = {
562
562
  claims?: string[];
563
563
  };
564
564
  };
565
+ /**
566
+ * Org / OrgMember / OrgInvite entity configuration. Apps that use
567
+ * the framework's `/api/auth/orgs/*` surface declare these entities
568
+ * in their schema with the framework's required fields. Add custom
569
+ * fields freely (logo, industry, billingEmail, etc.) — the framework
570
+ * reads / writes only the fields it manages.
571
+ *
572
+ * Defaults to entities named `Org`, `OrgMember`, `OrgInvite`. Rename
573
+ * via the three string fields if your codebase uses different names
574
+ * (e.g. `Organization` / `Membership`). Set `disabled: true` to opt
575
+ * out of the framework's routes entirely — useful when the app has
576
+ * its own org flow in TS and doesn't want the framework's parallel
577
+ * write paths.
578
+ */
579
+ org?: {
580
+ /** Entity name for the org table. Default `"Org"`. */
581
+ entity?: string;
582
+ /** Entity name for membership rows. Default `"OrgMember"`. */
583
+ memberEntity?: string;
584
+ /** Entity name for invite rows. Default `"OrgInvite"`. */
585
+ inviteEntity?: string;
586
+ /**
587
+ * Disable the framework's `/api/auth/orgs/*` routes. Endpoints
588
+ * return `501 ORG_NOT_CONFIGURED`. Use when you implement org
589
+ * management entirely in your own TypeScript functions.
590
+ */
591
+ disabled?: boolean;
592
+ };
565
593
  /** Per-app trusted origins for OAuth `?callback=` validation. Merged with `PYLON_TRUSTED_ORIGINS` env. */
566
594
  trustedOrigins?: string[];
567
595
  };
@@ -581,6 +609,12 @@ export type ManifestAuthConfig = {
581
609
  claims: string[];
582
610
  };
583
611
  };
612
+ org: {
613
+ entity: string;
614
+ member_entity: string;
615
+ invite_entity: string;
616
+ disabled: boolean;
617
+ };
584
618
  trusted_origins: string[];
585
619
  };
586
620
 
@@ -607,6 +641,12 @@ export function auth(cfg: AuthConfig = {}): ManifestAuthConfig {
607
641
  claims: cfg.session?.cookieCache?.claims ?? ["is_admin", "tenant_id"],
608
642
  },
609
643
  },
644
+ org: {
645
+ entity: cfg.org?.entity ?? "Org",
646
+ member_entity: cfg.org?.memberEntity ?? "OrgMember",
647
+ invite_entity: cfg.org?.inviteEntity ?? "OrgInvite",
648
+ disabled: cfg.org?.disabled ?? false,
649
+ },
610
650
  trusted_origins: cfg.trustedOrigins ?? [],
611
651
  };
612
652
  }