From a42369a130b9c2b1eb1b65f70da5f0e24596bb9b Mon Sep 17 00:00:00 2001 From: juliet Date: Thu, 25 Jun 2026 23:24:32 -0400 Subject: [PATCH] Add EMAIL_ADDRESS scalar to @roostorg/coop-types (v2.4.0) (#841) Adds a dedicated EMAIL_ADDRESS entry to the ScalarTypes enum and maps it to `string` in ScalarTypeRuntimeTypeMapping. Mirrors the IP_ADDRESS addition from #559. Lets Coop tag a schema field as an email address so integrations (NCMEC today; potentially others later) can pull it via schema-field role metadata instead of accepting any STRING-typed field. Format validation lives at the field-value level, not in this type. Required before #840 can switch the `email` field role from STRING to EMAIL_ADDRESS. Co-authored-by: Claude Opus 4.7 (1M context) --- types/index.ts | 6 ++++++ types/package-lock.json | 4 ++-- types/package.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/types/index.ts b/types/index.ts index 55b4f4c..e98fbb3 100644 --- a/types/index.ts +++ b/types/index.ts @@ -34,6 +34,11 @@ export const ScalarTypes = makeEnumLike([ // schema field as an IP address so it can be surfaced as an identifier in // moderation flows (e.g., via schema-field role metadata). 'IP_ADDRESS', + // Stored as a string at runtime. The dedicated scalar lets Coop tag a + // schema field as an email address so integrations (e.g., NCMEC) can + // pull it via schema-field role metadata. Format validation happens at + // the field-value level, not here. + 'EMAIL_ADDRESS', // Polymorphic media: holds a URL plus the resolved kind (AUDIO/IMAGE/VIDEO), // detected from the URL extension at ingestion time. Lets an adopter declare // a single field (or container of fields) that mixes media kinds without @@ -65,6 +70,7 @@ type ScalarTypeRuntimeTypeMapping = Satisfies< [ScalarTypes.RELATED_ITEM]: RelatedItem; [ScalarTypes.POLICY_ID]: string; [ScalarTypes.IP_ADDRESS]: string; + [ScalarTypes.EMAIL_ADDRESS]: string; [ScalarTypes.MEDIA]: { url: string; // The resolved kind, derived from the URL extension. `null` when the diff --git a/types/package-lock.json b/types/package-lock.json index c894037..457f166 100644 --- a/types/package-lock.json +++ b/types/package-lock.json @@ -1,12 +1,12 @@ { "name": "@roostorg/coop-types", - "version": "2.3.0", + "version": "2.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@roostorg/coop-types", - "version": "2.3.0", + "version": "2.4.0", "license": "ISC", "dependencies": { "date-fns": "^2.29.3", diff --git a/types/package.json b/types/package.json index 80aedce..946bfc1 100644 --- a/types/package.json +++ b/types/package.json @@ -1,7 +1,7 @@ { "name": "@roostorg/coop-types", "type": "module", - "version": "2.3.0", + "version": "2.4.0", "description": "Shared TypeScript types for Coop: schema primitives, signal data maps, and integration contracts.", "module": "transpiled/index.js", "typings": "./transpiled/index.d.ts", -- 2.51.2