Skip to content

The open alternative to Salesforce, designed for AI.

Partners app: profile picture (additive file field), derived region & deployment, scope cleanup (0.5.4) (#21709)

Rashad Karanouha7760c04ab1b
diff --git a/packages/twenty-apps/internal/twenty-partners/package.json b/packages/twenty-apps/internal/twenty-partners/package.json
index e62aee36578..2041bbfc6d3 100644
--- a/packages/twenty-apps/internal/twenty-partners/package.json
+++ b/packages/twenty-apps/internal/twenty-partners/package.json
@@ -1,6 +1,6 @@
{
"name": "twenty-partners",
- "version": "0.5.2",
+ "version": "0.5.4",
"license": "MIT",
"engines": {
"node": "^24.5.0",
@@ -20,12 +20,6 @@
"seed:prod": "ENV_FILE=.env.prod tsx src/scripts/seed.ts",
"purge": "tsx src/scripts/purge-soft-deleted.ts",
"purge:prod": "ENV_FILE=.env.prod tsx src/scripts/purge-soft-deleted.ts",
- "import:dryrun": "tsx src/scripts/import-from-tft.ts",
- "import:dryrun:prod": "ENV_FILE=.env.prod tsx src/scripts/import-from-tft.ts",
- "import:apply": "IMPORT_APPLY=1 tsx src/scripts/import-from-tft.ts",
- "import:apply:prod": "ENV_FILE=.env.prod IMPORT_APPLY=1 tsx src/scripts/import-from-tft.ts",
- "migrate:partner-scope": "tsx src/scripts/migrate-partner-scope.ts",
- "migrate:partner-scope:prod": "ENV_FILE=.env.prod tsx src/scripts/migrate-partner-scope.ts",
"rls:configure": "tsx src/scripts/configure-partner-rls.ts",
"rls:configure:prod": "ENV_FILE=.env.prod tsx src/scripts/configure-partner-rls.ts"
},
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-deployment-expertise.test.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-deployment-expertise.test.ts
new file mode 100644
index 00000000000..9fb708a7cc5
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-deployment-expertise.test.ts
@@ -0,0 +1,16 @@
+import { describe, expect, it } from 'vitest';
+
+import { deriveDeploymentExpertise } from './derive-deployment-expertise';
+
+describe('deriveDeploymentExpertise', () => {
+ it('defaults to CLOUD for everyone', () => {
+ expect(deriveDeploymentExpertise(undefined)).toEqual(['CLOUD']);
+ expect(deriveDeploymentExpertise([])).toEqual(['CLOUD']);
+ expect(deriveDeploymentExpertise(['ADVISORY', 'SUPPORT'])).toEqual(['CLOUD']);
+ });
+
+ it('adds SELF_HOST when the partner covers HOSTING', () => {
+ expect(deriveDeploymentExpertise(['HOSTING'])).toEqual(['CLOUD', 'SELF_HOST']);
+ expect(deriveDeploymentExpertise(['DEVELOPMENT', 'HOSTING'])).toEqual(['CLOUD', 'SELF_HOST']);
+ });
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-deployment-expertise.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-deployment-expertise.ts
new file mode 100644
index 00000000000..9ee892867de
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-deployment-expertise.ts
@@ -0,0 +1,11 @@
+// Everyone uses the cloud by default; covering Hosting & Infrastructure also
+// signals self-host capability. Derived server-side on application creation.
+export type PartnerDeployment = 'CLOUD' | 'SELF_HOST';
+
+export function deriveDeploymentExpertise(
+ partnerScope: ReadonlyArray<string> | undefined | null,
+): PartnerDeployment[] {
+ const result: PartnerDeployment[] = ['CLOUD'];
+ if (partnerScope?.includes('HOSTING')) result.push('SELF_HOST');
+ return result;
+}
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-region.test.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-region.test.ts
new file mode 100644
index 00000000000..cd270155499
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-region.test.ts
@@ -0,0 +1,29 @@
+import { describe, expect, it } from 'vitest';
+
+import { PARTNER_COUNTRY_VALUES } from './submit-partner-application.logic-function';
+import { COUNTRY_TO_REGION, deriveRegion } from './derive-region';
+
+describe('deriveRegion', () => {
+ it('maps representative countries to the right region', () => {
+ expect(deriveRegion('FRANCE')).toBe('EUROPE');
+ expect(deriveRegion('UNITED_STATES')).toBe('US');
+ expect(deriveRegion('CANADA')).toBe('US');
+ expect(deriveRegion('BRAZIL')).toBe('LATAM');
+ expect(deriveRegion('SAUDI_ARABIA')).toBe('MENA');
+ expect(deriveRegion('JAPAN')).toBe('APAC');
+ expect(deriveRegion('NIGERIA')).toBe('AFRICA');
+ });
+
+ it('returns null for missing / unknown country', () => {
+ expect(deriveRegion(undefined)).toBeNull();
+ expect(deriveRegion(null)).toBeNull();
+ expect(deriveRegion('ATLANTIS')).toBeNull();
+ });
+
+ it('covers every accepted country exactly once', () => {
+ for (const country of PARTNER_COUNTRY_VALUES) {
+ expect(COUNTRY_TO_REGION[country], `missing region for ${country}`).toBeDefined();
+ }
+ expect(Object.keys(COUNTRY_TO_REGION).length).toBe(PARTNER_COUNTRY_VALUES.length);
+ });
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-region.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-region.ts
new file mode 100644
index 00000000000..fa6bf077616
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/derive-region.ts
@@ -0,0 +1,23 @@
+// Static country → region lookup. Six regions match the Partner.region options.
+// Applied once when an application record is created; admins can override in CRM.
+export type PartnerRegion = 'EUROPE' | 'US' | 'LATAM' | 'MENA' | 'APAC' | 'AFRICA';
+
+const REGION_COUNTRIES: Record<PartnerRegion, readonly string[]> = {
+ EUROPE: ['ALBANIA','ANDORRA','ARMENIA','AUSTRIA','AZERBAIJAN','BELARUS','BELGIUM','BOSNIA_AND_HERZEGOVINA','BULGARIA','CROATIA','CYPRUS','CZECH_REPUBLIC','DENMARK','ESTONIA','FINLAND','FRANCE','GEORGIA','GERMANY','GREECE','HUNGARY','ICELAND','IRELAND','ITALY','KOSOVO','LATVIA','LIECHTENSTEIN','LITHUANIA','LUXEMBOURG','MALTA','MOLDOVA','MONACO','MONTENEGRO','NETHERLANDS','NORTH_MACEDONIA','NORWAY','POLAND','PORTUGAL','ROMANIA','RUSSIA','SAN_MARINO','SERBIA','SLOVAKIA','SLOVENIA','SPAIN','SWEDEN','SWITZERLAND','UKRAINE','UNITED_KINGDOM','VATICAN'],
+ US: ['CANADA','UNITED_STATES'],
+ LATAM: ['ANTIGUA_AND_BARBUDA','ARGENTINA','BAHAMAS','BARBADOS','BELIZE','BOLIVIA','BRAZIL','CHILE','COLOMBIA','COSTA_RICA','CUBA','DOMINICA','DOMINICAN_REPUBLIC','ECUADOR','EL_SALVADOR','GRENADA','GUATEMALA','GUYANA','HAITI','HONDURAS','JAMAICA','MEXICO','NICARAGUA','PANAMA','PARAGUAY','PERU','SAINT_KITTS_AND_NEVIS','SAINT_LUCIA','SAINT_VINCENT','SURINAME','TRINIDAD_AND_TOBAGO','URUGUAY','VENEZUELA'],
+ MENA: ['ALGERIA','BAHRAIN','EGYPT','IRAN','IRAQ','ISRAEL','JORDAN','KUWAIT','LEBANON','LIBYA','MAURITANIA','MOROCCO','OMAN','PALESTINE','QATAR','SAUDI_ARABIA','SUDAN','SYRIA','TUNISIA','TURKEY','UNITED_ARAB_EMIRATES','YEMEN'],
+ APAC: ['AFGHANISTAN','AUSTRALIA','BANGLADESH','BHUTAN','BRUNEI','CAMBODIA','CHINA','FIJI','INDIA','INDONESIA','JAPAN','KAZAKHSTAN','KIRIBATI','KYRGYZSTAN','LAOS','MALAYSIA','MALDIVES','MARSHALL_ISLANDS','MICRONESIA','MONGOLIA','MYANMAR','NAURU','NEPAL','NEW_ZEALAND','NORTH_KOREA','PAKISTAN','PALAU','PAPUA_NEW_GUINEA','PHILIPPINES','SAMOA','SINGAPORE','SOLOMON_ISLANDS','SOUTH_KOREA','SRI_LANKA','TAIWAN','TAJIKISTAN','THAILAND','TIMOR_LESTE','TONGA','TURKMENISTAN','TUVALU','UZBEKISTAN','VANUATU','VIETNAM'],
+ AFRICA: ['ANGOLA','BENIN','BOTSWANA','BURKINA_FASO','BURUNDI','CAMEROON','CAPE_VERDE','CENTRAL_AFRICAN_REPUBLIC','CHAD','COMOROS','CONGO','DR_CONGO','DJIBOUTI','EQUATORIAL_GUINEA','ERITREA','ESWATINI','ETHIOPIA','GABON','GAMBIA','GHANA','GUINEA','GUINEA_BISSAU','IVORY_COAST','KENYA','LESOTHO','LIBERIA','MADAGASCAR','MALAWI','MALI','MAURITIUS','MOZAMBIQUE','NAMIBIA','NIGER','NIGERIA','RWANDA','SAO_TOME_AND_PRINCIPE','SENEGAL','SEYCHELLES','SIERRA_LEONE','SOMALIA','SOUTH_AFRICA','SOUTH_SUDAN','TANZANIA','TOGO','UGANDA','ZAMBIA','ZIMBABWE'],
+};
+
+export const COUNTRY_TO_REGION: Record<string, PartnerRegion> = Object.fromEntries(
+ (Object.entries(REGION_COUNTRIES) as [PartnerRegion, readonly string[]][]).flatMap(
+ ([region, countries]) => countries.map((country) => [country, region]),
+ ),
+);
+
+export function deriveRegion(country: string | undefined | null): PartnerRegion | null {
+ if (!country) return null;
+ return COUNTRY_TO_REGION[country] ?? null;
+}
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/get-partner-by-slug.logic-function.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/get-partner-by-slug.logic-function.ts
index b45eab374b4..b2d7a904126 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/get-partner-by-slug.logic-function.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/get-partner-by-slug.logic-function.ts
@@ -1,29 +1,56 @@
import { CoreApiClient } from 'twenty-client-sdk/core';
import { defineLogicFunction } from 'twenty-sdk/define';
+import { resolvePartnerPictureUrl } from './profile-picture';
+
export const GET_PARTNER_BY_SLUG_LOGIC_FUNCTION_ID =
'5e3e7b88-2cf2-4f56-9a4a-46c4c1d6b0bb';
-type CurrencyValue = { amountMicros: number; currencyCode: string } | null;
-type LinkValue = { primaryLinkUrl: string | null } | null;
+// CoreApiClient is codegenerated from the synced workspace schema, so the
+// selection is strictly typed and the response shape derives from it.
+const queryPartnerBySlug = (client: CoreApiClient, slug: string) =>
+ client.query({
+ partners: {
+ __args: {
+ filter: {
+ slug: { eq: slug },
+ validationStage: { eq: 'VALIDATED' },
+ availability: { eq: 'AVAILABLE' },
+ },
+ first: 1,
+ },
+ edges: {
+ node: {
+ id: true,
+ name: true,
+ slug: true,
+ introduction: true,
+ languagesSpoken: true,
+ deploymentExpertise: true,
+ partnerScope: true,
+ region: true,
+ calendarLink: { primaryLinkUrl: true },
+ hourlyRate: { amountMicros: true, currencyCode: true },
+ projectBudgetMin: { amountMicros: true, currencyCode: true },
+ linkedin: { primaryLinkUrl: true },
+ // profilePicture is the legacy LINKS url; profilePictureFile is the
+ // new FILES upload (its items expose `url`). Display prefers the file.
+ profilePicture: { primaryLinkUrl: true },
+ profilePictureFile: { url: true },
+ skills: true,
+ city: true,
+ country: true,
+ },
+ },
+ },
+ });
+
+type PartnerRaw = NonNullable<
+ Awaited<ReturnType<typeof queryPartnerBySlug>>['partners']
+>['edges'][number]['node'];
-type Partner = {
- id: string;
- name: string | null;
- slug: string | null;
- introduction: string | null;
- languagesSpoken: string[] | null;
- deploymentExpertise: string[] | null;
- partnerScope: string[] | null;
- region: string[] | null;
- calendarLink: LinkValue;
- hourlyRate: CurrencyValue;
- projectBudgetMin: CurrencyValue;
- linkedin: LinkValue;
- profilePicture: LinkValue;
- skills: string[] | null;
- city: string | null;
- country: string | null;
+type Partner = Omit<PartnerRaw, 'profilePicture' | 'profilePictureFile'> & {
+ profilePicture: { primaryLinkUrl: string | null };
};
type GetPartnerBySlugResult =
@@ -40,47 +67,24 @@ const handler = async (input: {
try {
const client = new CoreApiClient();
+ const result = await queryPartnerBySlug(client, slug);
+ const rawNode = result.partners?.edges?.[0]?.node;
- const result = await client.query({
- partners: {
- __args: {
- filter: {
- slug: { eq: slug },
- validationStage: { eq: 'VALIDATED' },
- availability: { eq: 'AVAILABLE' },
- },
- first: 1,
- },
- edges: {
- node: {
- id: true,
- name: true,
- slug: true,
- introduction: true,
- languagesSpoken: true,
- deploymentExpertise: true,
- partnerScope: true,
- region: true,
- calendarLink: { primaryLinkUrl: true },
- hourlyRate: { amountMicros: true, currencyCode: true },
- projectBudgetMin: { amountMicros: true, currencyCode: true },
- linkedin: { primaryLinkUrl: true },
- profilePicture: { primaryLinkUrl: true },
- skills: true,
- city: true,
- country: true,
- },
- },
- },
- } as any);
-
- const edges = (result?.partners?.edges ?? []) as Array<{ node: Partner }>;
- const partner = edges[0]?.node;
-
- if (!partner) {
+ if (!rawNode) {
return { ok: false, reason: 'NOT_FOUND' };
}
+ const { profilePictureFile, ...rest } = rawNode;
+ const partner: Partner = {
+ ...rest,
+ profilePicture: {
+ primaryLinkUrl: resolvePartnerPictureUrl(
+ profilePictureFile,
+ rawNode.profilePicture?.primaryLinkUrl,
+ ),
+ },
+ };
+
return { ok: true, partner };
} catch (err) {
return {
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/list-available-partners.logic-function.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/list-available-partners.logic-function.ts
index 54df2c53db2..8062de9121f 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/list-available-partners.logic-function.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/list-available-partners.logic-function.ts
@@ -1,6 +1,8 @@
import { CoreApiClient } from 'twenty-client-sdk/core';
import { defineLogicFunction } from 'twenty-sdk/define';
+import { resolvePartnerPictureUrl } from './profile-picture';
+
export const LIST_AVAILABLE_PARTNERS_LOGIC_FUNCTION_ID =
'0f91164f-f492-41e8-9bb0-481be5a3d5b9';
@@ -34,7 +36,10 @@ const queryAvailablePartners = (client: CoreApiClient) =>
hourlyRate: { amountMicros: true, currencyCode: true },
projectBudgetMin: { amountMicros: true, currencyCode: true },
linkedin: { primaryLinkUrl: true },
+ // profilePicture is the legacy LINKS url; profilePictureFile is the
+ // new FILES upload (its items expose `url`). Display prefers the file.
profilePicture: { primaryLinkUrl: true },
+ profilePictureFile: { url: true },
skills: true,
city: true,
country: true,
@@ -43,10 +48,17 @@ const queryAvailablePartners = (client: CoreApiClient) =>
},
});
-type AvailablePartner = NonNullable<
+type AvailablePartnerRaw = NonNullable<
Awaited<ReturnType<typeof queryAvailablePartners>>['partners']
>['edges'][number]['node'];
+type AvailablePartner = Omit<
+ AvailablePartnerRaw,
+ 'profilePicture' | 'profilePictureFile'
+> & {
+ profilePicture: { primaryLinkUrl: string | null };
+};
+
type ListAvailablePartnersResult =
| { ok: true; count: number; partners: AvailablePartner[] }
| { ok: false; reason: string };
@@ -55,7 +67,20 @@ const handler = async (): Promise<ListAvailablePartnersResult> => {
try {
const client = new CoreApiClient();
const result = await queryAvailablePartners(client);
- const partners = (result.partners?.edges ?? []).map((edge) => edge.node);
+ const partners: AvailablePartner[] = (result.partners?.edges ?? []).map(
+ ({ node }) => {
+ const { profilePictureFile, ...rest } = node;
+ return {
+ ...rest,
+ profilePicture: {
+ primaryLinkUrl: resolvePartnerPictureUrl(
+ profilePictureFile,
+ node.profilePicture?.primaryLinkUrl,
+ ),
+ },
+ };
+ },
+ );
return { ok: true, count: partners.length, partners };
} catch (err) {
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/profile-picture.test.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/profile-picture.test.ts
new file mode 100644
index 00000000000..23bb24f7445
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/profile-picture.test.ts
@@ -0,0 +1,38 @@
+import { describe, expect, it } from 'vitest';
+
+import { firstFileUrl, resolvePartnerPictureUrl } from './profile-picture';
+
+describe('firstFileUrl', () => {
+ it('returns the first file url', () => {
+ expect(firstFileUrl([{ url: 'https://x/a.png' }, { url: 'https://x/b.png' }])).toBe('https://x/a.png');
+ });
+ it('skips entries without a url', () => {
+ expect(firstFileUrl([{ url: null }, { url: 'https://x/b.png' }])).toBe('https://x/b.png');
+ });
+ it('returns null for empty / nullish input', () => {
+ expect(firstFileUrl(null)).toBeNull();
+ expect(firstFileUrl(undefined)).toBeNull();
+ expect(firstFileUrl([])).toBeNull();
+ expect(firstFileUrl([null])).toBeNull();
+ });
+});
+
+describe('resolvePartnerPictureUrl', () => {
+ it('prefers the uploaded file url over the legacy link', () => {
+ expect(
+ resolvePartnerPictureUrl([{ url: 'https://x/file.png' }], 'https://x/legacy.png'),
+ ).toBe('https://x/file.png');
+ });
+ it('falls back to the legacy link when there is no file', () => {
+ expect(resolvePartnerPictureUrl(null, 'https://x/legacy.png')).toBe('https://x/legacy.png');
+ expect(resolvePartnerPictureUrl([], 'https://x/legacy.png')).toBe('https://x/legacy.png');
+ expect(resolvePartnerPictureUrl([{ url: null }], 'https://x/legacy.png')).toBe(
+ 'https://x/legacy.png',
+ );
+ });
+ it('returns null when neither source has a url', () => {
+ expect(resolvePartnerPictureUrl(null, null)).toBeNull();
+ expect(resolvePartnerPictureUrl(undefined, undefined)).toBeNull();
+ expect(resolvePartnerPictureUrl([], null)).toBeNull();
+ });
+});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/profile-picture.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/profile-picture.ts
new file mode 100644
index 00000000000..80423370c81
--- /dev/null
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/profile-picture.ts
@@ -0,0 +1,20 @@
+// A FILES field reads back as an array of file items, each exposing a signed
+// `url`. We surface the first file's url, mapped into the legacy { primaryLinkUrl }
+// shape the website partner directory already consumes.
+type FileItemRead = { url?: string | null } | null | undefined;
+
+export function firstFileUrl(
+ files: ReadonlyArray<FileItemRead> | null | undefined,
+): string | null {
+ return files?.find((file) => file?.url)?.url ?? null;
+}
+
+// Picture has two sources: the new uploaded file (profilePictureFile, FILES) and
+// the legacy URL (profilePicture, LINKS) that pre-FILES partners still carry.
+// Prefer an uploaded file, fall back to the legacy URL.
+export function resolvePartnerPictureUrl(
+ files: ReadonlyArray<FileItemRead> | null | undefined,
+ legacyLinkUrl: string | null | undefined,
+): string | null {
+ return firstFileUrl(files) ?? legacyLinkUrl ?? null;
+}
diff --git a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/submit-partner-application.logic-function.ts b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/submit-partner-application.logic-function.ts
index f43e15f5b64..f3c7eddc179 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/logic-functions/submit-partner-application.logic-function.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/logic-functions/submit-partner-application.logic-function.ts
@@ -3,11 +3,13 @@ import { defineLogicFunction } from 'twenty-sdk/define';
import { z } from 'zod';
import { slugify } from '../scripts/slugify';
+import { deriveDeploymentExpertise } from './derive-deployment-expertise';
+import { deriveRegion } from './derive-region';
export const SUBMIT_PARTNER_APPLICATION_LOGIC_FUNCTION_ID =
'7b1e2c5f-3a14-4f7d-8e91-0b5e2a3c4d76';
-const PARTNER_COUNTRY_VALUES = [
+export const PARTNER_COUNTRY_VALUES = [
'AFGHANISTAN','ALBANIA','ALGERIA','ANDORRA','ANGOLA','ANTIGUA_AND_BARBUDA','ARGENTINA','ARMENIA','AUSTRALIA','AUSTRIA','AZERBAIJAN','BAHAMAS','BAHRAIN','BANGLADESH','BARBADOS','BELARUS','BELGIUM','BELIZE','BENIN','BHUTAN','BOLIVIA','BOSNIA_AND_HERZEGOVINA','BOTSWANA','BRAZIL','BRUNEI','BULGARIA','BURKINA_FASO','BURUNDI','CAMBODIA','CAMEROON','CANADA','CAPE_VERDE','CENTRAL_AFRICAN_REPUBLIC','CHAD','CHILE','CHINA','COLOMBIA','COMOROS','CONGO','DR_CONGO','COSTA_RICA','CROATIA','CUBA','CYPRUS','CZECH_REPUBLIC','DENMARK','DJIBOUTI','DOMINICA','DOMINICAN_REPUBLIC','ECUADOR','EGYPT','EL_SALVADOR','EQUATORIAL_GUINEA','ERITREA','ESTONIA','ESWATINI','ETHIOPIA','FIJI','FINLAND','FRANCE','GABON','GAMBIA','GEORGIA','GERMANY','GHANA','GREECE','GRENADA','GUATEMALA','GUINEA','GUINEA_BISSAU','GUYANA','HAITI','HONDURAS','HUNGARY','ICELAND','INDIA','INDONESIA','IRAN','IRAQ','IRELAND','ISRAEL','ITALY','IVORY_COAST','JAMAICA','JAPAN','JORDAN','KAZAKHSTAN','KENYA','KIRIBATI','KOSOVO','KUWAIT','KYRGYZSTAN','LAOS','LATVIA','LEBANON','LESOTHO','LIBERIA','LIBYA','LIECHTENSTEIN','LITHUANIA','LUXEMBOURG','MADAGASCAR','MALAWI','MALAYSIA','MALDIVES','MALI','MALTA','MARSHALL_ISLANDS','MAURITANIA','MAURITIUS','MEXICO','MICRONESIA','MOLDOVA','MONACO','MONGOLIA','MONTENEGRO','MOROCCO','MOZAMBIQUE','MYANMAR','NAMIBIA','NAURU','NEPAL','NETHERLANDS','NEW_ZEALAND','NICARAGUA','NIGER','NIGERIA','NORTH_KOREA','NORTH_MACEDONIA','NORWAY','OMAN','PAKISTAN','PALAU','PALESTINE','PANAMA','PAPUA_NEW_GUINEA','PARAGUAY','PERU','PHILIPPINES','POLAND','PORTUGAL','QATAR','ROMANIA','RUSSIA','RWANDA','SAINT_KITTS_AND_NEVIS','SAINT_LUCIA','SAINT_VINCENT','SAMOA','SAN_MARINO','SAO_TOME_AND_PRINCIPE','SAUDI_ARABIA','SENEGAL','SERBIA','SEYCHELLES','SIERRA_LEONE','SINGAPORE','SLOVAKIA','SLOVENIA','SOLOMON_ISLANDS','SOMALIA','SOUTH_AFRICA','SOUTH_KOREA','SOUTH_SUDAN','SPAIN','SRI_LANKA','SUDAN','SURINAME','SWEDEN','SWITZERLAND','SYRIA','TAIWAN','TAJIKISTAN','TANZANIA','THAILAND','TIMOR_LESTE','TOGO','TONGA','TRINIDAD_AND_TOBAGO','TUNISIA','TURKEY','TURKMENISTAN','TUVALU','UGANDA','UKRAINE','UNITED_ARAB_EMIRATES','UNITED_KINGDOM','UNITED_STATES','URUGUAY','UZBEKISTAN','VANUATU','VATICAN','VENEZUELA','VIETNAM','YEMEN','ZAMBIA','ZIMBABWE',
] as const;
@@ -69,6 +71,7 @@ function buildApplicationNotes(input: SubmitPartnerApplicationInput): string | n
type PartnerFieldsForUpsert = {
name: string;
linkedin?: { primaryLinkUrl: string };
+ website?: { primaryLinkUrl: string };
city?: string;
country?: CoreSchema.PartnerCountryEnum;
languagesSpoken?: CoreSchema.PartnerLanguagesSpokenEnum[];
@@ -86,6 +89,7 @@ function buildPartnerFields(input: SubmitPartnerApplicationInput): PartnerFields
name: input.companyName.trim(),
};
if (isNonEmptyString(input.linkedin)) fields.linkedin = { primaryLinkUrl: input.linkedin.trim() };
+ if (isNonEmptyString(input.domainName)) fields.website = { primaryLinkUrl: input.domainName.trim() };
if (isNonEmptyString(input.city)) fields.city = input.city.trim();
// validate() has already checked these against the allowed value sets, so
// narrowing the validated strings to their enum types here is sound.
@@ -260,6 +264,7 @@ export const handler = async (
const companyId = await findOrCreateCompanyId(client, input);
+ const region = deriveRegion(input.country);
const partnerResult = await client.mutation({
createPartner: {
__args: {
@@ -270,6 +275,8 @@ export const handler = async (
reviewed: false,
partnerTier: 'NEW',
companyId,
+ deploymentExpertise: deriveDeploymentExpertise(input.partnerScope) as CoreSchema.PartnerDeploymentExpertiseEnum[],
+ ...(region ? { region: [region] as CoreSchema.PartnerRegionEnum[] } : {}),
},
},
id: true,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/objects/partner.object.ts b/packages/twenty-apps/internal/twenty-partners/src/objects/partner.object.ts
index fd37f741ab1..3b170b8aadf 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/objects/partner.object.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/objects/partner.object.ts
@@ -88,16 +88,11 @@ export default defineObject({
icon: 'IconListCheck',
isNullable: true,
options: [
- { id: '00f05e1c-0fd9-4214-a461-554b7c9e7eb5', value: 'APPS', label: 'Apps', position: 0, color: 'blue' },
- { id: 'e0f789d5-a3bc-4ecb-8bc2-5aa018468d83', value: 'DATA_MODEL', label: 'Data model', position: 1, color: 'green' },
- { id: 'c88bf189-8be4-4431-aa03-85928f8b2a52', value: 'DATA_MIGRATION', label: 'Data migration', position: 2, color: 'turquoise' },
- { id: 'a7fd9429-c26f-49ab-bf52-4d591f5ca7a0', value: 'HOSTING_ENVIRONMENT', label: 'Hosting environment', position: 3, color: 'purple' },
- { id: '9e416a39-05c6-4c80-9f36-99b5b60c26ec', value: 'WORKFLOWS', label: 'Workflows', position: 4, color: 'orange' },
- { id: 'b1000001-0000-4000-8000-0000000000a1', value: 'ADVISORY', label: 'Advisory & Discovery', position: 5, color: 'blue' },
- { id: 'b1000002-0000-4000-8000-0000000000a2', value: 'SOLUTIONING', label: 'Solutioning', position: 6, color: 'green' },
- { id: 'b1000003-0000-4000-8000-0000000000a3', value: 'DEVELOPMENT', label: 'Custom Development', position: 7, color: 'turquoise' },
- { id: 'b1000004-0000-4000-8000-0000000000a4', value: 'HOSTING', label: 'Hosting & Infrastructure', position: 8, color: 'purple' },
- { id: 'b1000005-0000-4000-8000-0000000000a5', value: 'SUPPORT', label: 'Training & Adoption', position: 9, color: 'pink' },
+ { id: 'b1000001-0000-4000-8000-0000000000a1', value: 'ADVISORY', label: 'Advisory & Discovery', position: 0, color: 'blue' },
+ { id: 'b1000002-0000-4000-8000-0000000000a2', value: 'SOLUTIONING', label: 'Solutioning', position: 1, color: 'green' },
+ { id: 'b1000003-0000-4000-8000-0000000000a3', value: 'DEVELOPMENT', label: 'Custom Development', position: 2, color: 'turquoise' },
+ { id: 'b1000004-0000-4000-8000-0000000000a4', value: 'HOSTING', label: 'Hosting & Infrastructure', position: 3, color: 'purple' },
+ { id: 'b1000005-0000-4000-8000-0000000000a5', value: 'SUPPORT', label: 'Training & Adoption', position: 4, color: 'pink' },
],
},
{
@@ -453,6 +448,10 @@ export default defineObject({
isNullable: true,
},
{
+ // Legacy URL picture, kept as LINKS. Twenty treats field type as
+ // immutable, so we cannot flip this to FILES in place on an installed
+ // workspace — the change is silently ignored on upgrade. Existing
+ // partners keep their URL here; new uploads go to profilePictureFile.
universalIdentifier: '40d730e3-2785-45c8-aa5f-cc724b1b08e0',
type: FieldType.LINKS,
name: 'profilePicture',
@@ -460,6 +459,15 @@ export default defineObject({
icon: 'IconPhoto',
isNullable: true,
},
+ {
+ universalIdentifier: '076b81f2-2398-4ece-a352-d7a6f6a89cae',
+ type: FieldType.FILES,
+ name: 'profilePictureFile',
+ label: 'Profile Picture File',
+ icon: 'IconPhoto',
+ isNullable: true,
+ universalSettings: { maxNumberOfValues: 1 },
+ },
{
universalIdentifier: 'a0000008-0000-4000-8000-000000000008',
type: FieldType.LINKS,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/scripts/__tests__/migrate-partner-scope.test.ts b/packages/twenty-apps/internal/twenty-partners/src/scripts/__tests__/migrate-partner-scope.test.ts
deleted file mode 100644
index 9895ce86d4d..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/scripts/__tests__/migrate-partner-scope.test.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { describe, expect, it } from 'vitest';
-
-import { mapLegacyScope } from '../partner-scope-map';
-
-describe('mapLegacyScope', () => {
- it('maps each legacy value to its new category', () => {
- expect(mapLegacyScope(['APPS'])).toEqual(['DEVELOPMENT']);
- expect(mapLegacyScope(['DATA_MODEL'])).toEqual(['SOLUTIONING']);
- expect(mapLegacyScope(['DATA_MIGRATION'])).toEqual(['SOLUTIONING']);
- expect(mapLegacyScope(['WORKFLOWS'])).toEqual(['SOLUTIONING']);
- expect(mapLegacyScope(['HOSTING_ENVIRONMENT'])).toEqual(['HOSTING']);
- });
-
- it('de-duplicates collapsed values', () => {
- expect(mapLegacyScope(['DATA_MODEL', 'DATA_MIGRATION', 'WORKFLOWS'])).toEqual([
- 'SOLUTIONING',
- ]);
- });
-
- it('passes through already-migrated values unchanged', () => {
- expect(mapLegacyScope(['ADVISORY', 'HOSTING'])).toEqual(['ADVISORY', 'HOSTING']);
- });
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/scripts/import-from-tft.ts b/packages/twenty-apps/internal/twenty-partners/src/scripts/import-from-tft.ts
deleted file mode 100644
index 4f84e35a046..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/scripts/import-from-tft.ts
+++ /dev/null
@@ -1,515 +0,0 @@
-// Import partners, opportunities and partner quotes FROM the TFT workspace INTO
-// this (local) workspace. Idempotent: re-running upserts by natural key
-// (partner=slug, opportunity=tftOpportunityId, quote=name).
-//
-// TFT (source) is read over RAW GraphQL fetch: its custom fields/filters are not
-// in the SDK's generated (local) genql schema, so CoreApiClient cannot build
-// queries for them. The local (target) workspace is written via CoreApiClient,
-// exactly like seed.ts. Two separate credential sets, no collision:
-// TFT -> TFT_API_URL / TFT_API_KEY (raw fetch)
-// local-> TWENTY_PARTNERS_API_URL / TWENTY_PARTNERS_API_KEY (CoreApiClient)
-//
-// The local server rate-limits API calls (~100 / 60s), so existence checks are
-// batched into one `in` query per object (like seed.ts) and writes are paced.
-//
-// DRY-RUN BY DEFAULT: reads everything, writes nothing, and reports both what it
-// WOULD upsert and the distinct TFT SELECT values it saw (flagging any value not
-// covered by a local field option, which would otherwise fail a real write).
-// Set IMPORT_APPLY=1 to actually write to the local workspace.
-//
-// TFT_API_URL=https://twentyfortwenty.twenty.com TFT_API_KEY=<tft key> \
-// TWENTY_PARTNERS_API_URL=http://localhost:2020 TWENTY_PARTNERS_API_KEY=<local key> \
-// [IMPORT_APPLY=1] \
-// tsx src/scripts/import-from-tft.ts
-
-import { config } from 'dotenv';
-config({ path: process.env.ENV_FILE ?? '.env.local' });
-
-import { CoreApiClient } from 'twenty-client-sdk/core';
-
-import { mapLegacyScope } from './partner-scope-map';
-import { slugify } from './slugify';
-
-const requireEnv = (name: string): string => {
- const value = process.env[name];
- if (!value) throw new Error(`Missing ${name} env var`);
- return value;
-};
-
-const APPLY = process.env.IMPORT_APPLY === '1';
-
-// Raw GraphQL against TFT. The generated CoreApiClient is bound to the LOCAL
-// schema and cannot serialise TFT's custom fields/filters, so read TFT untyped.
-const tftQuery = async (query: string): Promise<any> => {
- const url = `${requireEnv('TFT_API_URL').replace(/\/$/, '')}/graphql`;
- const response = await fetch(url, {
- method: 'POST',
- headers: {
- Authorization: `Bearer ${requireEnv('TFT_API_KEY')}`,
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ query }),
- });
- const json: any = await response.json();
- if (json.errors?.length) {
- throw new Error(`TFT query failed: ${JSON.stringify(json.errors)}`);
- }
- return json.data;
-};
-
-// TFT opportunity.stage -> our matchStatus (the 4 early stages collapse to TO_BE_MATCHED)
-const STAGE_TO_MATCH_STATUS: Record<string, string> = {
- INTRODUCED_TO_A_PARTNER: 'INTRODUCED_TO_A_PARTNER',
- WORKING_WITH_A_PARTNER: 'WORKING_WITH_A_PARTNER',
- WON: 'WON',
- LOST: 'LOST',
- RECONNECT_LATER: 'RECONNECT_LATER',
- IDENTIFIED: 'TO_BE_MATCHED',
- MET: 'TO_BE_MATCHED',
- SOLUTIONING: 'TO_BE_MATCHED',
- ADVANCED: 'TO_BE_MATCHED',
-};
-
-// TFT person.partnerStage -> our Partner.validationStage
-const PARTNER_STAGE_TO_VALIDATION: Record<string, string> = {
- APPLICATION: 'APPLICATION',
- POTENTIAL_PARTNER: 'POTENTIAL',
- PARTNER: 'VALIDATED',
- FORMER_PARTNER: 'FORMER',
- REJECTED: 'REJECTED',
-};
-
-// TFT person.partnerTimezone -> our Partner.region (MULTI_SELECT). TFT's value is a
-// coarse timezone band, not a geography, so each maps to every region it plausibly
-// covers. OTHER carries no signal -> no region. Region stays empty if unmapped.
-const TIMEZONE_TO_REGION: Record<string, string[]> = {
- AMERICAS: ['US', 'LATAM'],
- EMEA: ['EUROPE', 'MENA', 'AFRICA'],
- WEST_ASIA: ['MENA', 'APAC'],
- EAST_ASIA_OCEANIA: ['APAC'],
- OTHER: [],
-};
-
-// Local SELECT option sets, for preflight coverage checks (a TFT value not in
-// these would fail a real write). Keep in sync with src/objects + src/fields.
-const LOCAL_OPTIONS: Record<string, Set<string>> = {
- partnerTier: new Set(['NEW', 'INTERMEDIATE', 'ADVANCED']),
- partnerScope: new Set(['APPS', 'DATA_MODEL', 'DATA_MIGRATION', 'HOSTING_ENVIRONMENT', 'WORKFLOWS']),
- typeOfTeam: new Set(['SOLO', 'AGENCY']),
- hostingType: new Set(['CLOUD', 'SELF_HOSTING']),
- subscriptionType: new Set(['PRO', 'ORG', 'ENT']),
- subscriptionFrequency: new Set(['MONTHLY', 'ANNUAL']),
- quoteStatus: new Set(['WIP', 'INTERVIEW_SCHEDULED', 'UNDER_CUSTOMER_PARTNER_REVIEW', 'APPROVED', 'REJECTED']),
-};
-
-const edges = (result: any, key: string): any[] =>
- (result?.[key]?.edges ?? []).map((e: any) => e.node);
-
-const uniq = (values: (string | undefined | null)[]): string[] =>
- [...new Set(values.filter((v): v is string => !!v))];
-
-// Normalize a domain for dedup. Twenty's company domain is a unique key but is
-// stored with an https:// prefix, while TFT values vary, so compare on a canonical
-// form (no protocol, no www, no trailing slash, lowercased).
-const normDomain = (d?: string | null): string | undefined =>
- d
- ? d.trim().toLowerCase().replace(/^https?:\/\//, '').replace(/^www\./, '').replace(/\/+$/, '') || undefined
- : undefined;
-
-// Distinct non-empty values across rows, for the preflight report. Flattens array
-// fields (e.g. partnerScope, typeCustom) and stringifies, so scalar and
-// multi-select fields share one path. Derived from the already-fetched source
-// rows — no per-loop bookkeeping needed.
-const distinct = <TRow>(rows: TRow[], pick: (row: TRow) => unknown): string[] =>
- [
- ...new Set(
- rows.flatMap((row) => {
- const value = pick(row);
- return Array.isArray(value) ? value : value != null ? [value] : [];
- }),
- ),
- ]
- .map(String)
- .sort();
-
-async function main() {
- console.log(`[import] mode: ${APPLY ? 'APPLY (writing to local)' : 'DRY-RUN (no writes)'}`);
- const local = new CoreApiClient({
- url: `${requireEnv('TWENTY_PARTNERS_API_URL').replace(/\/$/, '')}/graphql`,
- headers: { Authorization: `Bearer ${requireEnv('TWENTY_PARTNERS_API_KEY')}` },
- });
-
- // Pace writes to stay under the local server's ~100 req/60s limit.
- let writes = 0;
- const pace = async () => {
- if (APPLY && writes++ > 0) await new Promise((r) => setTimeout(r, 750));
- };
-
- // ---------------------------------------------------------------------
- // 1. Read all three TFT datasets (raw fetch; not rate-limited by local).
- // ---------------------------------------------------------------------
- console.log('[import] fetching TFT people...');
- const tftPeople = edges(
- await tftQuery(`query {
- people(first: 500, filter: { partnerStage: { in: ["APPLICATION","POTENTIAL_PARTNER","PARTNER","FORMER_PARTNER","REJECTED"] } }) {
- edges { node {
- id
- name { firstName lastName }
- emails { primaryEmail }
- city jobTitle
- linkedinLink { primaryLinkUrl }
- partnerStage partnerTier partnerScope partnerTypeOfTeam partnerTimezone partnerIsAvailable partnerSkills
- partnerBudgetMinimum { amountMicros currencyCode }
- company { id name domainName { primaryLinkUrl } }
- } }
- }
- }`),
- 'people',
- );
- console.log('[import] fetching TFT opportunities...');
- const tftOppsAll = edges(
- await tftQuery(`query {
- opportunities(first: 500) {
- edges { node {
- id name numberOfSeats useCase hostingType subscriptionType subscriptionFrequence lostReason stage
- amount { amountMicros currencyCode }
- closeDate
- company { id name domainName { primaryLinkUrl } }
- partner { id }
- } }
- }
- }`),
- 'opportunities',
- );
- // Only import opportunities linked to a partner. The rest is TFT's general sales
- // pipeline (mostly LOST/IDENTIFIED) — noise for a partners app. Every partner
- // stage (INTRODUCED/WORKING) only ever appears on partner-linked opps anyway.
- const tftOpps = tftOppsAll.filter((o: any) => o.partner?.id);
- console.log(`[import] opportunities: ${tftOpps.length} partner-linked of ${tftOppsAll.length} total (skipping ${tftOppsAll.length - tftOpps.length} unlinked)`);
- console.log('[import] fetching TFT partner content...');
- const tftContent = edges(
- await tftQuery(`query {
- customerContents(first: 500) {
- edges { node {
- id name status approvalDate typeCustom
- interview { primaryLinkUrl }
- partnerPerson { id }
- customerCompany { id name domainName { primaryLinkUrl } }
- customerPerson { id }
- } }
- }
- }`),
- 'customerContents',
- );
- // Import all content TYPES (quotes, case studies, logos) but only records that
- // involve a partner. Customer-only content (no partnerPerson) is noise for the
- // partners app; a partner-linked case study/quote should show on the partner.
- const contentRecords = tftContent.filter((c: any) => c.partnerPerson?.id);
- console.log(`[import] TFT: ${tftPeople.length} partner-people, ${tftOpps.length} opportunities, ${tftContent.length} content records`);
- console.log(`[import] partner content: ${contentRecords.length} partner-linked of ${tftContent.length} total (skipping ${tftContent.length - contentRecords.length} customer-only)`);
-
- const personSlug = (p: any): string =>
- slugify([p.name?.firstName, p.name?.lastName].filter(Boolean).join(' ').trim() || 'Unknown partner') || p.id;
-
- // ---------------------------------------------------------------------
- // 2. Batched existence lookups against local (one `in` query per object).
- // ---------------------------------------------------------------------
- console.log('[import] checking existing records in target workspace...');
- const partnerSlugs = uniq(tftPeople.map(personSlug));
- const partnerIdBySlug = new Map<string, string>(
- partnerSlugs.length
- ? edges(
- await local.query({
- partners: { __args: { filter: { slug: { in: partnerSlugs } }, first: 500 }, edges: { node: { id: true, slug: true } } },
- } as any),
- 'partners',
- ).map((n: any) => [n.slug, n.id])
- : [],
- );
-
- // Fetch existing companies and index by BOTH name and normalized domain. Twenty
- // enforces uniqueness on domain, so dedup must be domain-aware: the same company
- // can arrive under different names (e.g. "Acme" vs "acme.com") across TFT people,
- // opps and content, and creating a second one collides on the domain constraint.
- // Page through ALL companies (not just the first 500): these dedupe maps must
- // be complete, or upsertCompany would create domain-colliding duplicates for
- // companies that live beyond the first page in a larger workspace.
- const existingCompanies: any[] = [];
- let companiesCursor: string | undefined;
- for (;;) {
- const page: any = await local.query({
- companies: {
- __args: { filter: {}, first: 200, ...(companiesCursor ? { after: companiesCursor } : {}) },
- edges: { node: { id: true, name: true, domainName: { primaryLinkUrl: true } } },
- pageInfo: { hasNextPage: true, endCursor: true },
- },
- } as any);
- existingCompanies.push(...edges(page, 'companies'));
- if (!page?.companies?.pageInfo?.hasNextPage) break;
- companiesCursor = page.companies.pageInfo.endCursor;
- }
- const companyIdByName = new Map<string, string>(existingCompanies.map((n: any) => [n.name, n.id]));
- const companyIdByDomain = new Map<string, string>();
- for (const c of existingCompanies) {
- const nd = normDomain(c.domainName?.primaryLinkUrl);
- if (nd && !companyIdByDomain.has(nd)) companyIdByDomain.set(nd, c.id);
- }
-
- const oppTftIds = uniq(tftOpps.filter((o: any) => o.name).map((o: any) => o.id));
- const oppIdByTftId = new Map<string, string>(
- oppTftIds.length
- ? edges(
- await local.query({
- opportunities: { __args: { filter: { tftOpportunityId: { in: oppTftIds } }, first: 500 }, edges: { node: { id: true, tftOpportunityId: true } } },
- } as any),
- 'opportunities',
- ).map((n: any) => [n.tftOpportunityId, n.id])
- : [],
- );
-
- // Unnamed content upserts by name, so a constant fallback would make every
- // unnamed record collide on one key (collapsing them on re-run). Key the
- // fallback on the TFT id so each unnamed record stays distinct.
- const contentName = (c: any): string => c.name || `Partner content ${c.id}`;
- const contentNames = uniq(contentRecords.map(contentName));
- const contentIdByName = new Map<string, string>(
- contentNames.length
- ? edges(
- await local.query({
- partnerContents: { __args: { filter: { name: { in: contentNames } }, first: 500 }, edges: { node: { id: true, name: true } } },
- } as any),
- 'partnerContents',
- ).map((n: any) => [n.name, n.id])
- : [],
- );
-
- // ---------------------------------------------------------------------
- // 3. Upsert. Writes are APPLY-gated and paced; in dry-run we resolve new
- // ids to synthetic placeholders so relation mapping still exercises.
- // ---------------------------------------------------------------------
- const upsertCompany = async (name?: string, domain?: string): Promise<string | undefined> => {
- if (!name) return undefined;
- if (companyIdByName.has(name)) return companyIdByName.get(name);
- const nd = normDomain(domain);
- // Same company under a different name but same domain — reuse it.
- if (nd && companyIdByDomain.has(nd)) {
- const existingId = companyIdByDomain.get(nd) as string;
- companyIdByName.set(name, existingId);
- return existingId;
- }
- let id = `dry:company:${name}`;
- if (APPLY) {
- await pace();
- try {
- const created: any = await local.mutation({
- createCompany: {
- __args: { data: { name, ...(domain ? { domainName: { primaryLinkUrl: domain } } : {}) } },
- id: true,
- },
- } as any);
- id = created.createCompany.id;
- } catch (err) {
- // Fallback: createCompany failed, almost certainly because the domain
- // already exists (Twenty enforces a unique domain) on a company we
- // didn't index. Re-find it and reuse instead of failing the import.
- // `ilike` is a substring match — and the stored value carries an
- // https:// prefix so we can't `eq` the normalized form — so it can
- // return the wrong company ("acme.com" also matches "notacme.com" or
- // "acme.com.br"). Confirm an exact normalized-domain match before reuse.
- if (!nd) throw err;
- await pace();
- const candidates = edges(
- await local.query({
- companies: { __args: { filter: { domainName: { primaryLinkUrl: { ilike: `%${nd}%` } } }, first: 20 }, edges: { node: { id: true, domainName: { primaryLinkUrl: true } } } },
- } as any),
- 'companies',
- );
- const match = candidates.find((c: any) => normDomain(c.domainName?.primaryLinkUrl) === nd);
- if (!match?.id) throw err;
- id = match.id;
- console.log(`[import] company "${name}" reused existing by domain ${nd}`);
- }
- }
- companyIdByName.set(name, id);
- if (nd) companyIdByDomain.set(nd, id);
- return id;
- };
-
- const budgetCurrency = (amount: any) =>
- amount?.amountMicros != null ? { amountMicros: amount.amountMicros, currencyCode: amount.currencyCode ?? 'USD' } : undefined;
-
- // Generic create/update dispatch shared by partners, opportunities and content.
- // Owns pacing + APPLY-gating + the create-vs-update branch, so each loop below
- // only builds its `data`. genql keys a mutation by the object name, so the
- // create<Object>/update<Object> names are derived from one argument. Companies
- // keep their own upsert (above) because of the domain-collision fallback.
- // Returns the row id: the real id on APPLY, a synthetic dry id otherwise so the
- // relation mapping in dry-run still resolves to a stable placeholder.
- const upsert = async (
- object: 'Partner' | 'Opportunity' | 'PartnerContent',
- existingId: string | undefined,
- data: Record<string, unknown>,
- dryKey: string,
- ): Promise<string> => {
- if (!APPLY) return existingId ?? `dry:${object}:${dryKey}`;
- await pace();
- if (existingId) {
- await local.mutation({ [`update${object}`]: { __args: { id: existingId, data }, id: true } } as any);
- return existingId;
- }
- const created: any = await local.mutation({ [`create${object}`]: { __args: { data }, id: true } } as any);
- return created[`create${object}`].id;
- };
-
- // -- Partners (upsert by slug) --
- console.log(`[import] upserting ${tftPeople.length} partners...`);
- const localPartnerIdByTftPersonId = new Map<string, string>();
- let partnersCreated = 0;
- let partnersUpdated = 0;
- let partnersDone = 0;
- for (const p of tftPeople) {
- const slug = personSlug(p);
- const companyId = await upsertCompany(p.company?.name, p.company?.domainName?.primaryLinkUrl);
- // Timezone band -> geographic region(s). Unmapped/OTHER -> no region.
- const region = TIMEZONE_TO_REGION[p.partnerTimezone] ?? [];
- // A partner scoped for hosting is, by definition, a self-host expert.
- const rawScope = Array.isArray(p.partnerScope) ? p.partnerScope : [];
- // Map legacy TFT categories to the validated set so the import never
- // re-introduces retired values.
- const scope = mapLegacyScope(rawScope);
- const deploymentExpertise = rawScope.includes('HOSTING_ENVIRONMENT') ? ['SELF_HOST'] : [];
- const data: Record<string, unknown> = {
- name: [p.name?.firstName, p.name?.lastName].filter(Boolean).join(' ').trim() || 'Unknown partner',
- slug,
- validationStage: PARTNER_STAGE_TO_VALIDATION[p.partnerStage] ?? 'APPLICATION',
- availability: p.partnerIsAvailable ? 'AVAILABLE' : 'UNAVAILABLE',
- // TFT has no language data; default everyone to English.
- languagesSpoken: ['ENGLISH'],
- ...(p.partnerTier ? { partnerTier: p.partnerTier } : {}),
- ...(scope.length ? { partnerScope: scope } : {}),
- ...(region.length ? { region } : {}),
- ...(deploymentExpertise.length ? { deploymentExpertise } : {}),
- ...(p.partnerTypeOfTeam ? { typeOfTeam: p.partnerTypeOfTeam } : {}),
- ...(Array.isArray(p.partnerSkills) && p.partnerSkills.length ? { skills: p.partnerSkills } : {}),
- ...(p.city ? { city: p.city } : {}),
- ...(budgetCurrency(p.partnerBudgetMinimum) ? { projectBudgetMin: budgetCurrency(p.partnerBudgetMinimum) } : {}),
- ...(p.linkedinLink?.primaryLinkUrl ? { linkedin: { primaryLinkUrl: p.linkedinLink.primaryLinkUrl } } : {}),
- ...(companyId && APPLY ? { companyId } : {}),
- };
-
- const existingId = partnerIdBySlug.get(slug);
- const partnerId = await upsert('Partner', existingId, data, slug);
- if (existingId) {
- partnersUpdated++;
- } else {
- partnerIdBySlug.set(slug, partnerId);
- partnersCreated++;
- }
- localPartnerIdByTftPersonId.set(p.id, partnerId);
- partnersDone++;
- if (partnersDone % 10 === 0 || partnersDone === tftPeople.length)
- console.log(`[import] partners ${partnersDone}/${tftPeople.length} (created=${partnersCreated} updated=${partnersUpdated})`);
- }
- console.log(`[import] partners done: created=${partnersCreated} updated=${partnersUpdated}`);
-
- // -- Opportunities (upsert by tftOpportunityId) --
- console.log(`[import] upserting ${tftOpps.length} opportunities...`);
- let oppsCreated = 0;
- let oppsUpdated = 0;
- let oppsPartnerLinked = 0;
- let oppsDone = 0;
- for (const o of tftOpps) {
- if (!o.name) continue;
- const companyId = await upsertCompany(o.company?.name, o.company?.domainName?.primaryLinkUrl);
- const partnerId = o.partner?.id ? localPartnerIdByTftPersonId.get(o.partner.id) : undefined;
- if (partnerId) oppsPartnerLinked++;
-
- const data: Record<string, unknown> = {
- name: o.name,
- tftOpportunityId: o.id,
- matchStatus: STAGE_TO_MATCH_STATUS[o.stage] ?? 'TO_BE_MATCHED',
- ...(o.numberOfSeats != null ? { numberOfSeats: o.numberOfSeats } : {}),
- ...(o.useCase ? { useCase: o.useCase } : {}),
- ...(o.hostingType ? { hostingType: o.hostingType } : {}),
- ...(o.subscriptionType ? { subscriptionType: o.subscriptionType } : {}),
- ...(o.subscriptionFrequence ? { subscriptionFrequency: o.subscriptionFrequence } : {}),
- ...(o.lostReason ? { lostReason: o.lostReason } : {}),
- ...(o.amount?.amountMicros != null ? { amount: { amountMicros: o.amount.amountMicros, currencyCode: o.amount.currencyCode ?? 'USD' } } : {}),
- ...(o.closeDate ? { closeDate: o.closeDate } : {}),
- ...(companyId && APPLY ? { companyId } : {}),
- ...(partnerId && APPLY ? { partnerId } : {}),
- };
-
- const existingId = oppIdByTftId.get(o.id);
- await upsert('Opportunity', existingId, data, o.id);
- if (existingId) oppsUpdated++;
- else oppsCreated++;
- oppsDone++;
- if (oppsDone % 20 === 0 || oppsDone === tftOpps.length)
- console.log(`[import] opportunities ${oppsDone}/${tftOpps.length} (created=${oppsCreated} updated=${oppsUpdated})`);
- }
- console.log(`[import] opportunities done: created=${oppsCreated} updated=${oppsUpdated} (partner-linked=${oppsPartnerLinked})`);
-
- // -- Partner content (upsert by name) --
- console.log(`[import] upserting ${contentRecords.length} content records...`);
- let contentCreated = 0;
- let contentUpdated = 0;
- for (const c of contentRecords) {
- const name = contentName(c);
- const partnerId = c.partnerPerson?.id ? localPartnerIdByTftPersonId.get(c.partnerPerson.id) : undefined;
- const customerCompanyId = await upsertCompany(c.customerCompany?.name, c.customerCompany?.domainName?.primaryLinkUrl);
- const data: Record<string, unknown> = {
- name,
- ...(Array.isArray(c.typeCustom) && c.typeCustom.length ? { contentType: c.typeCustom } : {}),
- ...(c.status ? { status: c.status } : {}),
- ...(c.approvalDate ? { approvalDate: c.approvalDate } : {}),
- ...(c.interview?.primaryLinkUrl ? { interview: { primaryLinkUrl: c.interview.primaryLinkUrl } } : {}),
- ...(partnerId && APPLY ? { partnerId } : {}),
- ...(customerCompanyId && APPLY ? { customerCompanyId } : {}),
- };
- const existingId = contentIdByName.get(name);
- await upsert('PartnerContent', existingId, data, name);
- if (existingId) contentUpdated++;
- else contentCreated++;
- }
- console.log(`[import] partner content created=${contentCreated} updated=${contentUpdated}`);
-
- // ---------------------------------------------------------------------
- // 4. Preflight: distinct TFT values vs local option coverage. Derived
- // directly from the fetched source rows (no per-loop bookkeeping).
- // ---------------------------------------------------------------------
- const report = (label: string, values: string[], optionKey?: string) => {
- const allowed = optionKey ? LOCAL_OPTIONS[optionKey] : undefined;
- const uncovered = allowed ? values.filter((v) => !allowed.has(v)) : [];
- console.log(
- `[preflight] ${label}: ${values.join(', ') || '(none)'}` +
- (uncovered.length ? ` ⚠️ NOT IN LOCAL OPTIONS: ${uncovered.join(', ')}` : ''),
- );
- };
- const partnerStages = distinct(tftPeople, (p: any) => p.partnerStage);
- const oppStages = distinct(tftOpps, (o: any) => o.stage);
- const timezones = distinct(tftPeople, (p: any) => p.partnerTimezone);
- console.log('--- preflight: distinct TFT values seen ---');
- report('partnerStage (-> validationStage map)', partnerStages);
- report('partnerTier', distinct(tftPeople, (p: any) => p.partnerTier), 'partnerTier');
- report('partnerScope', distinct(tftPeople, (p: any) => p.partnerScope), 'partnerScope');
- report('typeOfTeam', distinct(tftPeople, (p: any) => p.partnerTypeOfTeam), 'typeOfTeam');
- report('partnerTimezone (-> region map)', timezones);
- report('opp stage (-> matchStatus map)', oppStages);
- report('hostingType', distinct(tftOpps, (o: any) => o.hostingType), 'hostingType');
- report('subscriptionType', distinct(tftOpps, (o: any) => o.subscriptionType), 'subscriptionType');
- report('subscriptionFrequency', distinct(tftOpps, (o: any) => o.subscriptionFrequence), 'subscriptionFrequency');
- report('quote status', distinct(contentRecords, (c: any) => c.status), 'quoteStatus');
- report('customerContent typeCustom', distinct(contentRecords, (c: any) => c.typeCustom));
- const unmappedStages = partnerStages.filter((s) => !(s in PARTNER_STAGE_TO_VALIDATION));
- const unmappedOpps = oppStages.filter((s) => !(s in STAGE_TO_MATCH_STATUS));
- const unmappedTz = timezones.filter((t) => !(t in TIMEZONE_TO_REGION));
- if (unmappedStages.length) console.log(`[preflight] ⚠️ partnerStage not mapped: ${unmappedStages.join(', ')}`);
- if (unmappedOpps.length) console.log(`[preflight] ⚠️ opp stage not mapped: ${unmappedOpps.join(', ')}`);
- if (unmappedTz.length) console.log(`[preflight] ⚠️ partnerTimezone not mapped: ${unmappedTz.join(', ')}`);
-}
-
-main().catch((err) => {
- console.error(err);
- process.exit(1);
-});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/scripts/migrate-partner-scope.ts b/packages/twenty-apps/internal/twenty-partners/src/scripts/migrate-partner-scope.ts
deleted file mode 100644
index 88ab6518241..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/scripts/migrate-partner-scope.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-// Remap legacy partnerScope values to the validated categories.
-//
-// yarn migrate:partner-scope # dry-run against .env.local
-// MIGRATE_APPLY=1 yarn migrate:partner-scope
-// yarn migrate:partner-scope:prod # dry-run against .env.prod
-//
-// Adding the new options is done in partner.object.ts (additive). This script
-// rewrites existing records old→new so the old options can later be removed.
-import { config } from 'dotenv';
-config({ path: process.env.ENV_FILE ?? '.env.local' });
-
-import { CoreApiClient } from 'twenty-client-sdk/core';
-import { fileURLToPath } from 'url';
-
-import { mapLegacyScope } from './partner-scope-map';
-
-const requireEnv = (name: string): string => {
- const value = process.env[name];
- if (!value) throw new Error(`Missing ${name} env var`);
- return value;
-};
-
-async function main() {
- const apply = process.env.MIGRATE_APPLY === '1';
- const url = `${requireEnv('TWENTY_PARTNERS_API_URL').replace(/\/$/, '')}/graphql`;
- const client = new CoreApiClient({
- url,
- headers: { Authorization: `Bearer ${requireEnv('TWENTY_PARTNERS_API_KEY')}` },
- });
- console.log(`[migrate-scope] target: ${url} — ${apply ? 'APPLY' : 'dry-run'}`);
-
- // Pass 1: page through ALL partners read-only and collect those that need remapping.
- type Pending = { id: string; current: string[]; next: string[] };
- const pending: Pending[] = [];
- let after: string | null = null;
- // eslint-disable-next-line no-constant-condition
- while (true) {
- const data: any = await client.query({
- partners: {
- __args: after ? { first: 50, after } : { first: 50 },
- edges: { node: { id: true, partnerScope: true }, cursor: true },
- pageInfo: { hasNextPage: true, endCursor: true },
- },
- } as any);
- const edges = data.partners?.edges ?? [];
- for (const edge of edges) {
- const id = edge.node.id as string;
- const current = (edge.node.partnerScope ?? []) as string[];
- const next = mapLegacyScope(current);
- const isChanged =
- next.length !== current.length || next.some((v, i) => v !== current[i]);
- if (!isChanged) continue;
- pending.push({ id, current, next });
- console.log(`[migrate-scope] ${id}: ${JSON.stringify(current)} -> ${JSON.stringify(next)}`);
- }
- if (!data.partners?.pageInfo?.hasNextPage) break;
- after = data.partners.pageInfo.endCursor;
- }
-
- // Pass 2: apply the remapping mutations (only when MIGRATE_APPLY=1).
- if (apply) {
- for (const { id, next } of pending) {
- await client.mutation({
- updatePartner: { __args: { id, data: { partnerScope: next } }, id: true },
- } as any);
- }
- }
-
- console.log(`[migrate-scope] ${apply ? 'updated' : 'would update'} ${pending.length} partner(s)`);
- if (!apply) console.log('[migrate-scope] re-run with MIGRATE_APPLY=1 to apply');
-}
-
-// Only run when invoked directly (so unit tests can import mapLegacyScope safely).
-if (process.argv[1] === fileURLToPath(import.meta.url)) {
- main().catch((err) => {
- console.error(err);
- process.exit(1);
- });
-}
diff --git a/packages/twenty-apps/internal/twenty-partners/src/scripts/partner-scope-map.ts b/packages/twenty-apps/internal/twenty-partners/src/scripts/partner-scope-map.ts
deleted file mode 100644
index c7f265cb0a2..00000000000
--- a/packages/twenty-apps/internal/twenty-partners/src/scripts/partner-scope-map.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-// Legacy -> validated partnerScope category mapping. Single source of truth,
-// shared by the migration script (rewrites existing records) and the TFT import
-// (so it never writes retired legacy values back in).
-export const LEGACY_SCOPE_MAP: Record<string, string> = {
- APPS: 'DEVELOPMENT',
- DATA_MODEL: 'SOLUTIONING',
- DATA_MIGRATION: 'SOLUTIONING',
- WORKFLOWS: 'SOLUTIONING',
- HOSTING_ENVIRONMENT: 'HOSTING',
-};
-
-export function mapLegacyScope(values: ReadonlyArray<string>): string[] {
- const out: string[] = [];
- for (const value of values) {
- const mapped = LEGACY_SCOPE_MAP[value] ?? value;
- if (!out.includes(mapped)) out.push(mapped);
- }
- return out;
-}
diff --git a/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts b/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts
index 03f5625571a..48f5ad7ca68 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts
@@ -26,8 +26,6 @@ const usd = (dollars: number) => ({
amountMicros: dollars * 1_000_000,
currencyCode: 'USD',
});
-// Deterministic placeholder avatars; pravatar returns a stable image per `u` seed.
-const avatar = (slug: string) => `https://i.pravatar.cc/300?u=${slug}`;
const linkedin = (slug: string) =>
`https://www.linkedin.com/company/${slug}`;
@@ -52,16 +50,16 @@ type Partner = {
};
const PARTNERS: Partner[] = [
- { slug: 'nine-dots-ventures', name: 'Nine Dots Ventures', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Boutique CRM implementer for real-estate workflows and WhatsApp automation. Nine Dots runs end-to-end Twenty rollouts for property managers and brokerages across Europe and MENA, with deep multi-language data models and AI-assisted lead intake.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['EUROPE', 'MENA'], languagesSpoken: ['ENGLISH', 'FRENCH', 'ARABIC'], partnerTier: 'ADVANCED', partnerScope: ['DATA_MODEL', 'WORKFLOWS', 'APPS'], typeOfTeam: 'AGENCY', country: 'FRANCE', city: 'Paris', hourlyRateUsd: 250, projectBudgetMinUsd: 15000, skills: ['Real estate', 'WhatsApp', 'Multi-language', 'Workflows', 'Integrations', 'AI'] },
- { slug: 'elevate-consulting', name: 'Elevate Consulting', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Revenue-operations partner for B2B SaaS teams scaling seed to Series C. Elevate moves teams off legacy CRMs onto Twenty with a four-week migration playbook, pipeline rebuilds, and analytics handoff.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['US', 'LATAM'], languagesSpoken: ['ENGLISH', 'SPANISH'], partnerTier: 'INTERMEDIATE', partnerScope: ['DATA_MIGRATION', 'DATA_MODEL'], typeOfTeam: 'AGENCY', country: 'UNITED_STATES', city: 'Austin', hourlyRateUsd: 200, projectBudgetMinUsd: 20000, skills: ['RevOps', 'B2B SaaS', 'Data migration', 'Pipelines', 'Salesforce migration', 'HubSpot migration'] },
- { slug: 'w3villa-technologies', name: 'W3Villa Technologies', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Engineering-heavy partner running large self-hosted Twenty deployments. Specializes in hardened Kubernetes hosting, custom integrations, and 24/7 support contracts for regulated industries across APAC and the Gulf.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['APAC', 'MENA'], languagesSpoken: ['ENGLISH', 'HINDI'], partnerTier: 'ADVANCED', partnerScope: ['HOSTING_ENVIRONMENT', 'APPS', 'WORKFLOWS'], typeOfTeam: 'AGENCY', country: 'INDIA', city: 'Bangalore', hourlyRateUsd: 120, projectBudgetMinUsd: 10000, skills: ['Self-hosting', 'Kubernetes', 'DevOps', 'Integrations', 'Workflows', 'Enterprise support'] },
- { slug: 'act-education', name: 'Act Education', validationStage: 'VALIDATED', availability: 'UNAVAILABLE', introduction: 'CRM partner for European education providers; compliance-first self-hosting on EU infrastructure with full GDPR data residency and student-record workflows.', calendarLink: CAL, deploymentExpertise: ['SELF_HOST'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'GERMAN'], partnerTier: 'NEW', partnerScope: ['HOSTING_ENVIRONMENT', 'DATA_MODEL'], typeOfTeam: 'SOLO', country: 'GERMANY', city: 'Berlin', hourlyRateUsd: 180, projectBudgetMinUsd: 8000, skills: ['Education', 'Compliance', 'Self-hosting', 'GDPR', 'Data privacy'] },
- { slug: 'netzero-systems', name: 'NetZero Systems', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'LATAM go-to-market partner for climate-tech and renewable-energy companies. Builds bilingual sales pipelines, ESG reporting, and grant-management workflows on top of Twenty.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['LATAM', 'US'], languagesSpoken: ['ENGLISH', 'SPANISH', 'PORTUGUESE'], partnerTier: 'INTERMEDIATE', partnerScope: ['DATA_MODEL'], typeOfTeam: 'AGENCY', country: 'BRAZIL', city: 'São Paulo', hourlyRateUsd: 150, projectBudgetMinUsd: 12000, skills: ['Climate tech', 'Renewable energy', 'ESG reporting', 'Bilingual pipelines', 'LATAM go-to-market'] },
- { slug: 'meridian-craft', name: 'Meridian Craft', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'APAC implementation studio for fintech and logistics. Senior team of ex-bank engineers building high-throughput Twenty deployments across Singapore, Hong Kong, and Kuala Lumpur.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['APAC', 'AFRICA'], languagesSpoken: ['ENGLISH', 'CHINESE', 'MALAY'], partnerTier: 'ADVANCED', partnerScope: ['APPS', 'WORKFLOWS'], typeOfTeam: 'AGENCY', country: 'SINGAPORE', city: 'Singapore', hourlyRateUsd: 300, projectBudgetMinUsd: 25000, skills: ['Fintech', 'Logistics', 'APAC', 'High throughput', 'Custom apps', 'Performance tuning'] },
- { slug: 'applicant-studio', name: 'Applicant Studio', validationStage: 'APPLICATION', availability: 'UNAVAILABLE', introduction: 'New applicant; awaiting first review.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'FRENCH'], partnerTier: 'NEW', partnerScope: ['DATA_MODEL'], typeOfTeam: 'SOLO', country: 'FRANCE', city: 'Lyon', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['Boutique', 'Design'] },
- { slug: 'rising-crm', name: 'Rising CRM', validationStage: 'POTENTIAL', availability: 'AVAILABLE', introduction: 'Promising applicant in evaluation.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['US'], languagesSpoken: ['ENGLISH'], partnerTier: 'NEW', partnerScope: ['WORKFLOWS', 'APPS'], typeOfTeam: 'AGENCY', country: 'UNITED_STATES', city: 'New York', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['SMB', 'Quick setup'] },
- { slug: 'legacy-partners', name: 'Legacy Partners', validationStage: 'FORMER', availability: 'UNAVAILABLE', introduction: 'Former partner; no longer active in the program.', calendarLink: CAL, deploymentExpertise: ['SELF_HOST'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'GERMAN'], partnerTier: 'INTERMEDIATE', partnerScope: ['HOSTING_ENVIRONMENT'], typeOfTeam: 'AGENCY', country: 'UNITED_KINGDOM', city: 'London', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['Enterprise', 'Self-hosting'] },
- { slug: 'declined-co', name: 'Declined Co', validationStage: 'REJECTED', availability: 'UNAVAILABLE', introduction: 'Application rejected after review.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['MENA'], languagesSpoken: ['ENGLISH', 'ARABIC'], partnerTier: 'NEW', partnerScope: ['APPS'], typeOfTeam: 'SOLO', country: 'UNITED_ARAB_EMIRATES', city: 'Dubai', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['MENA', 'Arabic'] },
+ { slug: 'nine-dots-ventures', name: 'Nine Dots Ventures', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Boutique CRM implementer for real-estate workflows and WhatsApp automation. Nine Dots runs end-to-end Twenty rollouts for property managers and brokerages across Europe and MENA, with deep multi-language data models and AI-assisted lead intake.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['EUROPE', 'MENA'], languagesSpoken: ['ENGLISH', 'FRENCH', 'ARABIC'], partnerTier: 'ADVANCED', partnerScope: ['SOLUTIONING', 'DEVELOPMENT'], typeOfTeam: 'AGENCY', country: 'FRANCE', city: 'Paris', hourlyRateUsd: 250, projectBudgetMinUsd: 15000, skills: ['Real estate', 'WhatsApp', 'Multi-language', 'Workflows', 'Integrations', 'AI'] },
+ { slug: 'elevate-consulting', name: 'Elevate Consulting', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Revenue-operations partner for B2B SaaS teams scaling seed to Series C. Elevate moves teams off legacy CRMs onto Twenty with a four-week migration playbook, pipeline rebuilds, and analytics handoff.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['US', 'LATAM'], languagesSpoken: ['ENGLISH', 'SPANISH'], partnerTier: 'INTERMEDIATE', partnerScope: ['SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'UNITED_STATES', city: 'Austin', hourlyRateUsd: 200, projectBudgetMinUsd: 20000, skills: ['RevOps', 'B2B SaaS', 'Data migration', 'Pipelines', 'Salesforce migration', 'HubSpot migration'] },
+ { slug: 'w3villa-technologies', name: 'W3Villa Technologies', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Engineering-heavy partner running large self-hosted Twenty deployments. Specializes in hardened Kubernetes hosting, custom integrations, and 24/7 support contracts for regulated industries across APAC and the Gulf.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['APAC', 'MENA'], languagesSpoken: ['ENGLISH', 'HINDI'], partnerTier: 'ADVANCED', partnerScope: ['HOSTING', 'DEVELOPMENT', 'SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'INDIA', city: 'Bangalore', hourlyRateUsd: 120, projectBudgetMinUsd: 10000, skills: ['Self-hosting', 'Kubernetes', 'DevOps', 'Integrations', 'Workflows', 'Enterprise support'] },
+ { slug: 'act-education', name: 'Act Education', validationStage: 'VALIDATED', availability: 'UNAVAILABLE', introduction: 'CRM partner for European education providers; compliance-first self-hosting on EU infrastructure with full GDPR data residency and student-record workflows.', calendarLink: CAL, deploymentExpertise: ['SELF_HOST'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'GERMAN'], partnerTier: 'NEW', partnerScope: ['HOSTING', 'SOLUTIONING'], typeOfTeam: 'SOLO', country: 'GERMANY', city: 'Berlin', hourlyRateUsd: 180, projectBudgetMinUsd: 8000, skills: ['Education', 'Compliance', 'Self-hosting', 'GDPR', 'Data privacy'] },
+ { slug: 'netzero-systems', name: 'NetZero Systems', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'LATAM go-to-market partner for climate-tech and renewable-energy companies. Builds bilingual sales pipelines, ESG reporting, and grant-management workflows on top of Twenty.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['LATAM', 'US'], languagesSpoken: ['ENGLISH', 'SPANISH', 'PORTUGUESE'], partnerTier: 'INTERMEDIATE', partnerScope: ['SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'BRAZIL', city: 'São Paulo', hourlyRateUsd: 150, projectBudgetMinUsd: 12000, skills: ['Climate tech', 'Renewable energy', 'ESG reporting', 'Bilingual pipelines', 'LATAM go-to-market'] },
+ { slug: 'meridian-craft', name: 'Meridian Craft', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'APAC implementation studio for fintech and logistics. Senior team of ex-bank engineers building high-throughput Twenty deployments across Singapore, Hong Kong, and Kuala Lumpur.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['APAC', 'AFRICA'], languagesSpoken: ['ENGLISH', 'CHINESE', 'MALAY'], partnerTier: 'ADVANCED', partnerScope: ['DEVELOPMENT', 'SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'SINGAPORE', city: 'Singapore', hourlyRateUsd: 300, projectBudgetMinUsd: 25000, skills: ['Fintech', 'Logistics', 'APAC', 'High throughput', 'Custom apps', 'Performance tuning'] },
+ { slug: 'applicant-studio', name: 'Applicant Studio', validationStage: 'APPLICATION', availability: 'UNAVAILABLE', introduction: 'New applicant; awaiting first review.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'FRENCH'], partnerTier: 'NEW', partnerScope: ['SOLUTIONING'], typeOfTeam: 'SOLO', country: 'FRANCE', city: 'Lyon', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['Boutique', 'Design'] },
+ { slug: 'rising-crm', name: 'Rising CRM', validationStage: 'POTENTIAL', availability: 'AVAILABLE', introduction: 'Promising applicant in evaluation.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['US'], languagesSpoken: ['ENGLISH'], partnerTier: 'NEW', partnerScope: ['SOLUTIONING', 'DEVELOPMENT'], typeOfTeam: 'AGENCY', country: 'UNITED_STATES', city: 'New York', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['SMB', 'Quick setup'] },
+ { slug: 'legacy-partners', name: 'Legacy Partners', validationStage: 'FORMER', availability: 'UNAVAILABLE', introduction: 'Former partner; no longer active in the program.', calendarLink: CAL, deploymentExpertise: ['SELF_HOST'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'GERMAN'], partnerTier: 'INTERMEDIATE', partnerScope: ['HOSTING'], typeOfTeam: 'AGENCY', country: 'UNITED_KINGDOM', city: 'London', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['Enterprise', 'Self-hosting'] },
+ { slug: 'declined-co', name: 'Declined Co', validationStage: 'REJECTED', availability: 'UNAVAILABLE', introduction: 'Application rejected after review.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['MENA'], languagesSpoken: ['ENGLISH', 'ARABIC'], partnerTier: 'NEW', partnerScope: ['DEVELOPMENT'], typeOfTeam: 'SOLO', country: 'UNITED_ARAB_EMIRATES', city: 'Dubai', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['MENA', 'Arabic'] },
];
const COMPANIES = [
@@ -133,7 +131,6 @@ async function main() {
country: p.country, city: p.city,
skills: p.skills,
linkedin: { primaryLinkUrl: linkedin(p.slug) },
- profilePicture: { primaryLinkUrl: avatar(p.slug) },
...(p.hourlyRateUsd != null ? { hourlyRate: usd(p.hourlyRateUsd) } : {}),
...(p.projectBudgetMinUsd != null ? { projectBudgetMin: usd(p.projectBudgetMinUsd) } : {}),
};