Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat(api): add dpaRestricted org flag (#4629)
firecrawl-spring[bot]f747e157ce30
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.tsindex 421c469c1..78281cdf2 100644--- a/apps/api/src/controllers/v1/types.ts+++ b/apps/api/src/controllers/v1/types.ts@@ -1360,6 +1360,9 @@ export type TeamFlags = {labsSearch?: boolean;exchangeRetrieve?: boolean;professionalProfileCompanyDataBeta?: boolean;+ // The org's DPA (or partner amendment) restricts how its data may be+ // handled. Informational only: the API does not change behavior on it.+ dpaRestricted?: boolean;organizationDataSourceAccess?: Record<string,{diff --git a/apps/api/src/controllers/v2/types.ts b/apps/api/src/controllers/v2/types.tsindex a1e9d421e..29e0b4b37 100644--- a/apps/api/src/controllers/v2/types.ts+++ b/apps/api/src/controllers/v2/types.ts@@ -1916,6 +1916,9 @@ export type TeamFlags = {menuBeta?: boolean;enrichBeta?: boolean;professionalProfileCompanyDataBeta?: boolean;+ // The org's DPA (or partner amendment) restricts how its data may be+ // handled. Informational only: the API does not change behavior on it.+ dpaRestricted?: boolean;organizationDataSourceAccess?: Record<string,{diff --git a/apps/api/src/lib/zdr-helpers.test.ts b/apps/api/src/lib/zdr-helpers.test.tsnew file mode 100644index 000000000..a4509d728--- /dev/null+++ b/apps/api/src/lib/zdr-helpers.test.ts@@ -0,0 +1,20 @@+import { isDpaRestricted } from "./zdr-helpers";++describe("isDpaRestricted", () => {+ it("is false when flags are missing", () => {+ expect(isDpaRestricted(undefined)).toBe(false);+ expect(isDpaRestricted(null)).toBe(false);+ });++ it("is false when the flag is absent or not strictly true", () => {+ expect(isDpaRestricted({})).toBe(false);+ expect(isDpaRestricted({ dpaRestricted: false })).toBe(false);+ expect(+ isDpaRestricted({ dpaRestricted: "true" as unknown as boolean }),+ ).toBe(false);+ });++ it("is true when the flag is set", () => {+ expect(isDpaRestricted({ dpaRestricted: true })).toBe(true);+ });+});diff --git a/apps/api/src/lib/zdr-helpers.ts b/apps/api/src/lib/zdr-helpers.tsindex 578940dfd..9aa9b9375 100644--- a/apps/api/src/lib/zdr-helpers.ts+++ b/apps/api/src/lib/zdr-helpers.ts@@ -87,3 +87,11 @@ export function getCustomRobotsAgent(if (flags?.customRobotsAgent === "allowed") return "allowed";return "disabled";}++/**+ * Whether the org's DPA (or partner amendment) restricts how its data may be+ * handled. Absent or any non-`true` value reads as unrestricted.+ */+export function isDpaRestricted(flags: TeamFlags | undefined): boolean {+ return flags?.dpaRestricted === true;+}