The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
chore(people-data-labs): remove the workflow seeding that never ran (#26262)
Thomas Trompette52a3e4d2931e
diff --git a/packages/twenty-apps/public/people-data-labs/package.json b/packages/twenty-apps/public/people-data-labs/package.jsonindex d9f446d12a2..85e6417c1aa 100644--- a/packages/twenty-apps/public/people-data-labs/package.json+++ b/packages/twenty-apps/public/people-data-labs/package.json@@ -1,6 +1,6 @@{"name": "@twentyhq/people-data-labs",- "version": "1.0.10",+ "version": "1.0.11","description": "People Data Labs enrichment app for Twenty","license": "MIT","engines": {diff --git a/packages/twenty-apps/public/people-data-labs/src/constants/enrichment-workflow-seeds.ts b/packages/twenty-apps/public/people-data-labs/src/constants/enrichment-workflow-seeds.tsdeleted file mode 100644index 397d52144a2..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/constants/enrichment-workflow-seeds.ts+++ /dev/null@@ -1,27 +0,0 @@-import { PDL_LOGIC_FUNCTION_CONSTANTS } from 'src/constants/universal-identifiers';-import { type EnrichmentWorkflowSeed } from 'src/types/enrichment-workflow-seed';--const ENRICHMENT_ICON = 'IconSparkles';--export const ENRICHMENT_WORKFLOW_SEEDS: EnrichmentWorkflowSeed[] = [- {- objectNameSingular: 'company',- workflowName: 'Enrich companies with People Data Labs',- triggerName: 'When companies are selected',- icon: ENRICHMENT_ICON,- stepName: 'Enrich Companies',- logicFunctionUniversalIdentifier:- PDL_LOGIC_FUNCTION_CONSTANTS.enrichCompanies.universalIdentifier,- logicFunctionInput: { records: '{{trigger.companies}}' },- },- {- objectNameSingular: 'person',- workflowName: 'Enrich people with People Data Labs',- triggerName: 'When people are selected',- icon: ENRICHMENT_ICON,- stepName: 'Enrich People',- logicFunctionUniversalIdentifier:- PDL_LOGIC_FUNCTION_CONSTANTS.enrichPeople.universalIdentifier,- logicFunctionInput: { records: '{{trigger.people}}' },- },-];diff --git a/packages/twenty-apps/public/people-data-labs/src/constants/universal-identifiers.ts b/packages/twenty-apps/public/people-data-labs/src/constants/universal-identifiers.tsindex b3a8ba4f2ae..2073f60fa2f 100644--- a/packages/twenty-apps/public/people-data-labs/src/constants/universal-identifiers.ts+++ b/packages/twenty-apps/public/people-data-labs/src/constants/universal-identifiers.ts@@ -9,7 +9,6 @@ export const PDL_LOGIC_FUNCTION_CONSTANTS = {enrichPerson: { universalIdentifier:'864ad69b-ff9f-4635-9aed-16fd0c2ad210', path: '/people-data-labs/enrich-person' },enrichCompanies: { universalIdentifier:'c769fb49-d495-469f-a58f-1a69ab90ec24', path: '/people-data-labs/enrich-companies' },enrichCompany: { universalIdentifier:'560bbfd9-1107-4f7f-8398-ea835e7e5bbe', path: '/people-data-labs/enrich-company' },- postInstall: { universalIdentifier:'9de46f15-05ec-4314-84c1-b9919b545269'},} as const;export const PDL_FIELD_UNIVERSAL_IDENTIFIERS = {diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/handlers/__tests__/post-install.test.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/handlers/__tests__/post-install.test.tsdeleted file mode 100644index ac8788574bb..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/handlers/__tests__/post-install.test.ts+++ /dev/null@@ -1,153 +0,0 @@-import { type MetadataApiClient } from 'twenty-client-sdk/metadata';-import { describe, expect, it, vi } from 'vitest';--import { PDL_LOGIC_FUNCTION_CONSTANTS } from 'src/constants/universal-identifiers';-import { createCoreApiClientMock } from 'src/logic-functions/__mocks__/create-core-api-client-mock';-import { postInstallCore } from 'src/logic-functions/handlers/post-install';--type AnyRequest = Record<string, unknown>;--const buildMetadataClient = (- logicFunctions: { id: string; universalIdentifier: string }[],-): MetadataApiClient =>- ({- query: vi.fn(() =>- Promise.resolve({ findManyLogicFunctions: logicFunctions }),- ),- }) as unknown as MetadataApiClient;--const buildCoreClient = () =>- createCoreApiClientMock({- queryResult: (request: unknown) => {- const req = request as AnyRequest;- if ('workflows' in req) {- return { workflows: { edges: [] } };- }- if ('workflowVersions' in req) {- return {- workflowVersions: {- edges: [{ node: { id: 'version-1', status: 'DRAFT' } }],- },- };- }- return {};- },- mutationResult: (request: unknown) =>- 'createWorkflow' in (request as AnyRequest)- ? { createWorkflow: { id: 'workflow-new' } }- : {},- });--describe('postInstallCore', () => {- it('seeds a workflow for each resolvable enrich function', async () => {- const metadataClient = buildMetadataClient([- {- id: 'company-fn',- universalIdentifier:- PDL_LOGIC_FUNCTION_CONSTANTS.enrichCompanies.universalIdentifier,- },- {- id: 'person-fn',- universalIdentifier:- PDL_LOGIC_FUNCTION_CONSTANTS.enrichPeople.universalIdentifier,- },- ]);-- const result = await postInstallCore({- coreClient: buildCoreClient(),- metadataClient,- });-- expect(result.seededWorkflows.map((workflow) => workflow.objectNameSingular)).toEqual([- 'company',- 'person',- ]);- expect(- result.seededWorkflows.every((workflow) => workflow.status === 'created'),- ).toBe(true);- });-- it('skips a workflow when its logic function is not installed', async () => {- const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});-- const metadataClient = buildMetadataClient([- {- id: 'company-fn',- universalIdentifier:- PDL_LOGIC_FUNCTION_CONSTANTS.enrichCompanies.universalIdentifier,- },- ]);-- const result = await postInstallCore({- coreClient: buildCoreClient(),- metadataClient,- });-- expect(result.seededWorkflows).toHaveLength(1);- expect(result.seededWorkflows[0]?.objectNameSingular).toBe('company');- expect(warnSpy).toHaveBeenCalledTimes(1);-- warnSpy.mockRestore();- });-- it('continues seeding remaining workflows when one seed fails', async () => {- const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});-- const metadataClient = buildMetadataClient([- {- id: 'company-fn',- universalIdentifier:- PDL_LOGIC_FUNCTION_CONSTANTS.enrichCompanies.universalIdentifier,- },- {- id: 'person-fn',- universalIdentifier:- PDL_LOGIC_FUNCTION_CONSTANTS.enrichPeople.universalIdentifier,- },- ]);-- const coreClient = createCoreApiClientMock({- queryResult: (request: unknown) => {- const req = request as AnyRequest;- if ('workflows' in req) {- return { workflows: { edges: [] } };- }- if ('workflowVersions' in req) {- return {- workflowVersions: {- edges: [{ node: { id: 'version-1', status: 'DRAFT' } }],- },- };- }- return {};- },- mutationResult: (request: unknown) => {- const req = request as AnyRequest;- if ('createWorkflow' in req) {- const args = (req.createWorkflow as AnyRequest)?.__args as AnyRequest;- const workflowName = (args?.data as AnyRequest)?.name;- return workflowName === 'Enrich companies with People Data Labs'- ? { createWorkflow: {} }- : { createWorkflow: { id: 'workflow-person' } };- }- return {};- },- });-- const result = await postInstallCore({ coreClient, metadataClient });-- expect(result.seededWorkflows).toHaveLength(2);- expect(result.seededWorkflows[0]).toMatchObject({- objectNameSingular: 'company',- status: 'failed',- });- expect(result.seededWorkflows[0]?.error).toBeDefined();- expect(result.seededWorkflows[1]).toMatchObject({- objectNameSingular: 'person',- status: 'created',- });- expect(warnSpy).toHaveBeenCalledTimes(1);-- warnSpy.mockRestore();- });-});diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/handlers/post-install.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/handlers/post-install.tsdeleted file mode 100644index 6fd5f3dff2b..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/handlers/post-install.ts+++ /dev/null@@ -1,69 +0,0 @@-import { CoreApiClient } from 'twenty-client-sdk/core';-import { MetadataApiClient } from 'twenty-client-sdk/metadata';--import { ENRICHMENT_WORKFLOW_SEEDS } from 'src/constants/enrichment-workflow-seeds';-import { resolveLogicFunctionId } from 'src/logic-functions/utils/resolve-logic-function-id';-import { seedEnrichmentWorkflow } from 'src/logic-functions/utils/seed-enrichment-workflow';-import { type PostInstallResult } from 'src/types/post-install-result';-import { type SeedEnrichmentWorkflowResult } from 'src/types/seed-enrichment-workflow-result';-import { isDefined } from 'src/utils/is-defined';--export const postInstallCore = async ({- coreClient = new CoreApiClient(),- metadataClient = new MetadataApiClient(),-}: {- coreClient?: CoreApiClient;- metadataClient?: MetadataApiClient;-} = {}): Promise<PostInstallResult> => {- const { findManyLogicFunctions: logicFunctions } = await metadataClient.query(- {- findManyLogicFunctions: {- id: true,- universalIdentifier: true,- },- },- );-- const seededWorkflows: SeedEnrichmentWorkflowResult[] = [];-- for (const seed of ENRICHMENT_WORKFLOW_SEEDS) {- const logicFunctionId = resolveLogicFunctionId({- logicFunctions,- universalIdentifier: seed.logicFunctionUniversalIdentifier,- });-- if (!isDefined(logicFunctionId)) {- console.warn(- `[people-data-labs] Skipping "${seed.workflowName}": logic function ${seed.logicFunctionUniversalIdentifier} is not installed.`,- );- continue;- }-- try {- const result = await seedEnrichmentWorkflow({- client: coreClient,- logicFunctionId,- seed,- });-- seededWorkflows.push(result);- } catch (error) {- const errorMessage =- error instanceof Error ? error.message : String(error);-- console.warn(- `[people-data-labs] Failed to seed "${seed.workflowName}": ${errorMessage}`,- error,- );-- seededWorkflows.push({- objectNameSingular: seed.objectNameSingular,- workflowName: seed.workflowName,- status: 'failed',- error: errorMessage,- });- }- }-- return { seededWorkflows };-};diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/post-install.function.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/post-install.function.tsdeleted file mode 100644index 5cc6c73f011..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/post-install.function.ts+++ /dev/null@@ -1,17 +0,0 @@-import { definePostInstallLogicFunction } from 'twenty-sdk/define';--import { PDL_LOGIC_FUNCTION_CONSTANTS } from 'src/constants/universal-identifiers';--const handler = async () => {- return { seededWorkflows: [] };-};--export default definePostInstallLogicFunction({- universalIdentifier: PDL_LOGIC_FUNCTION_CONSTANTS.postInstall.universalIdentifier,- name: 'post-install',- description:- 'Post-install hook for the People Data Labs app (workflow seeding is not currently wired up).',- timeoutSeconds: 30,- handler,- shouldRunSynchronously: true,-});diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/build-bulk-records-trigger.test.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/build-bulk-records-trigger.test.tsdeleted file mode 100644index e5234d8e056..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/build-bulk-records-trigger.test.ts+++ /dev/null@@ -1,26 +0,0 @@-import { describe, expect, it } from 'vitest';--import { buildBulkRecordsTrigger } from 'src/logic-functions/utils/build-bulk-records-trigger';--describe('buildBulkRecordsTrigger', () => {- it('builds a bulk-records manual trigger with no next step wired', () => {- const trigger = buildBulkRecordsTrigger({- objectNameSingular: 'person',- name: 'When people are selected',- icon: 'IconSparkles',- });-- expect(trigger).toEqual({- name: 'When people are selected',- type: 'MANUAL',- settings: {- objectType: 'person',- availability: { type: 'BULK_RECORDS', objectNameSingular: 'person' },- outputSchema: {},- icon: 'IconSparkles',- isPinned: false,- },- nextStepIds: [],- });- });-});diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/build-logic-function-step.test.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/build-logic-function-step.test.tsdeleted file mode 100644index 4835f7ea8e6..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/build-logic-function-step.test.ts+++ /dev/null@@ -1,33 +0,0 @@-import { describe, expect, it } from 'vitest';--import { buildLogicFunctionStep } from 'src/logic-functions/utils/build-logic-function-step';--describe('buildLogicFunctionStep', () => {- it('builds a logic-function step carrying the resolved id and input', () => {- const step = buildLogicFunctionStep({- id: 'step-1',- name: 'Enrich with People Data Labs',- logicFunctionId: 'logic-function-1',- logicFunctionInput: { records: '{{trigger.companies}}' },- });-- expect(step).toEqual({- id: 'step-1',- name: 'Enrich with People Data Labs',- type: 'LOGIC_FUNCTION',- valid: true,- settings: {- input: {- logicFunctionId: 'logic-function-1',- logicFunctionInput: { records: '{{trigger.companies}}' },- },- outputSchema: {},- errorHandlingOptions: {- retryOnFailure: { value: 0 },- continueOnFailure: { value: false },- },- },- nextStepIds: [],- });- });-});diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/find-existing-workflow-id.test.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/find-existing-workflow-id.test.tsdeleted file mode 100644index 0aa9b268701..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/find-existing-workflow-id.test.ts+++ /dev/null@@ -1,26 +0,0 @@-import { describe, expect, it } from 'vitest';--import { createCoreApiClientMock } from 'src/logic-functions/__mocks__/create-core-api-client-mock';-import { findExistingWorkflowId } from 'src/logic-functions/utils/find-existing-workflow-id';--describe('findExistingWorkflowId', () => {- it('returns the id of the first matching workflow', async () => {- const client = createCoreApiClientMock({- queryResult: { workflows: { edges: [{ node: { id: 'workflow-1' } }] } },- });-- await expect(- findExistingWorkflowId({ client, name: 'Enrich company' }),- ).resolves.toBe('workflow-1');- });-- it('returns undefined when no workflow matches', async () => {- const client = createCoreApiClientMock({- queryResult: { workflows: { edges: [] } },- });-- await expect(- findExistingWorkflowId({ client, name: 'Enrich company' }),- ).resolves.toBeUndefined();- });-});diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/resolve-logic-function-id.test.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/resolve-logic-function-id.test.tsdeleted file mode 100644index 0c6f4ce8d62..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/resolve-logic-function-id.test.ts+++ /dev/null@@ -1,25 +0,0 @@-import { describe, expect, it } from 'vitest';--import { resolveLogicFunctionId } from 'src/logic-functions/utils/resolve-logic-function-id';--describe('resolveLogicFunctionId', () => {- const logicFunctions = [- { id: 'id-a', universalIdentifier: 'uid-a' },- { id: 'id-b', universalIdentifier: 'uid-b' },- ];-- it('returns the id matching the universal identifier', () => {- expect(- resolveLogicFunctionId({ logicFunctions, universalIdentifier: 'uid-b' }),- ).toBe('id-b');- });-- it('returns undefined when no logic function matches', () => {- expect(- resolveLogicFunctionId({- logicFunctions,- universalIdentifier: 'uid-missing',- }),- ).toBeUndefined();- });-});diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/seed-enrichment-workflow.test.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/seed-enrichment-workflow.test.tsdeleted file mode 100644index 4f6624d926c..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/__tests__/seed-enrichment-workflow.test.ts+++ /dev/null@@ -1,136 +0,0 @@-import { describe, expect, it } from 'vitest';--import { createCoreApiClientMock } from 'src/logic-functions/__mocks__/create-core-api-client-mock';-import { seedEnrichmentWorkflow } from 'src/logic-functions/utils/seed-enrichment-workflow';-import { type EnrichmentWorkflowSeed } from 'src/types/enrichment-workflow-seed';--const SEED: EnrichmentWorkflowSeed = {- objectNameSingular: 'company',- workflowName: 'Enrich companies with People Data Labs',- triggerName: 'When companies are selected',- icon: 'IconSparkles',- stepName: 'Enrich with People Data Labs',- logicFunctionUniversalIdentifier: 'lf-universal-id',- logicFunctionInput: { records: '{{trigger.companies}}' },-};--type AnyRequest = Record<string, any>;--describe('seedEnrichmentWorkflow', () => {- it('creates, configures and activates a new workflow', async () => {- const mutations: AnyRequest[] = [];-- const client = createCoreApiClientMock({- queryResult: (request: unknown) => {- const req = request as AnyRequest;- if ('workflows' in req) {- return { workflows: { edges: [] } };- }- if ('workflowVersions' in req) {- return {- workflowVersions: {- edges: [{ node: { id: 'version-1', status: 'DRAFT' } }],- },- };- }- return {};- },- mutationResult: (request: unknown) =>- 'createWorkflow' in (request as AnyRequest)- ? { createWorkflow: { id: 'workflow-1' } }- : {},- onMutation: (request) => mutations.push(request as AnyRequest),- });-- const result = await seedEnrichmentWorkflow({- client,- logicFunctionId: 'logic-function-1',- seed: SEED,- });-- expect(result).toEqual({- objectNameSingular: 'company',- workflowName: SEED.workflowName,- status: 'created',- workflowId: 'workflow-1',- });-- const createRequest = mutations.find(- (request) => 'createWorkflow' in request,- );- expect(createRequest?.createWorkflow.__args.data).toEqual({- name: SEED.workflowName,- });-- const updateRequest = mutations.find(- (request) => 'updateWorkflowVersion' in request,- );- const { id, data } = updateRequest?.updateWorkflowVersion.__args ?? {};- expect(id).toBe('version-1');-- expect(data.trigger.type).toBe('MANUAL');- expect(data.trigger.settings.availability).toEqual({- type: 'BULK_RECORDS',- objectNameSingular: 'company',- });- expect(data.trigger.settings.objectType).toBe('company');- expect(data.trigger.nextStepIds).toEqual([]);- expect(data.steps).toBeUndefined();-- const createStepRequest = mutations.find(- (request) => 'createWorkflowVersionStep' in request,- );- const createStepInput =- createStepRequest?.createWorkflowVersionStep.__args.input;- expect(createStepInput.workflowVersionId).toBe('version-1');- expect(createStepInput.stepType).toBe('LOGIC_FUNCTION');- expect(createStepInput.parentStepId).toBe('trigger');- expect(createStepInput.defaultSettings.input.logicFunctionId).toBe(- 'logic-function-1',- );-- const updateStepRequest = mutations.find(- (request) => 'updateWorkflowVersionStep' in request,- );- const updateStepInput =- updateStepRequest?.updateWorkflowVersionStep.__args.input;- expect(updateStepInput.workflowVersionId).toBe('version-1');- expect(updateStepInput.step.id).toBe(createStepInput.id);- expect(updateStepInput.step.type).toBe('LOGIC_FUNCTION');- expect(updateStepInput.step.settings.input.logicFunctionId).toBe(- 'logic-function-1',- );- expect(updateStepInput.step.settings.input.logicFunctionInput).toEqual({- records: '{{trigger.companies}}',- });-- const activateRequest = mutations.find(- (request) => 'activateWorkflowVersion' in request,- );- expect(- activateRequest?.activateWorkflowVersion.__args.workflowVersionId,- ).toBe('version-1');- });-- it('skips creation when a workflow with the same name already exists', async () => {- const mutations: AnyRequest[] = [];-- const client = createCoreApiClientMock({- queryResult: (request: unknown) =>- 'workflows' in (request as AnyRequest)- ? { workflows: { edges: [{ node: { id: 'existing-1' } }] } }- : {},- onMutation: (request) => mutations.push(request as AnyRequest),- });-- const result = await seedEnrichmentWorkflow({- client,- logicFunctionId: 'logic-function-1',- seed: SEED,- });-- expect(result.status).toBe('skipped');- expect(result.workflowId).toBe('existing-1');- expect(mutations).toHaveLength(0);- });-});diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/build-bulk-records-trigger.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/build-bulk-records-trigger.tsdeleted file mode 100644index a8309ddcd8a..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/build-bulk-records-trigger.ts+++ /dev/null@@ -1,25 +0,0 @@-import { type WorkflowBulkRecordsTrigger } from 'src/types/workflow-bulk-records-trigger';--export const buildBulkRecordsTrigger = ({- objectNameSingular,- name,- icon,-}: {- objectNameSingular: string;- name: string;- icon: string;-}): WorkflowBulkRecordsTrigger => ({- name,- type: 'MANUAL',- settings: {- objectType: objectNameSingular,- availability: {- type: 'BULK_RECORDS',- objectNameSingular,- },- outputSchema: {},- icon,- isPinned: false,- },- nextStepIds: [],-});diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/build-logic-function-step.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/build-logic-function-step.tsdeleted file mode 100644index b0686deab2b..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/build-logic-function-step.ts+++ /dev/null@@ -1,30 +0,0 @@-import { type WorkflowLogicFunctionStep } from 'src/types/workflow-logic-function-step';--export const buildLogicFunctionStep = ({- id,- name,- logicFunctionId,- logicFunctionInput,-}: {- id: string;- name: string;- logicFunctionId: string;- logicFunctionInput: Record<string, unknown>;-}): WorkflowLogicFunctionStep => ({- id,- name,- type: 'LOGIC_FUNCTION',- valid: true,- settings: {- input: {- logicFunctionId,- logicFunctionInput,- },- outputSchema: {},- errorHandlingOptions: {- retryOnFailure: { value: 0 },- continueOnFailure: { value: false },- },- },- nextStepIds: [],-});diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/find-existing-workflow-id.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/find-existing-workflow-id.tsdeleted file mode 100644index 43e333751f6..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/find-existing-workflow-id.ts+++ /dev/null@@ -1,18 +0,0 @@-import { type CoreApiClient } from 'twenty-client-sdk/core';--export const findExistingWorkflowId = async ({- client,- name,-}: {- client: CoreApiClient;- name: string;-}): Promise<string | undefined> => {- const result = (await client.query({- workflows: {- __args: { filter: { name: { eq: name } } },- edges: { node: { id: true } },- },- })) as { workflows?: { edges?: { node?: { id?: string } }[] } };-- return result.workflows?.edges?.[0]?.node?.id;-};diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/resolve-logic-function-id.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/resolve-logic-function-id.tsdeleted file mode 100644index b527a230fec..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/resolve-logic-function-id.ts+++ /dev/null@@ -1,11 +0,0 @@-export const resolveLogicFunctionId = ({- logicFunctions,- universalIdentifier,-}: {- logicFunctions: { id: string; universalIdentifier?: string | null }[];- universalIdentifier: string;-}): string | undefined =>- logicFunctions.find(- (logicFunction) =>- logicFunction.universalIdentifier === universalIdentifier,- )?.id;diff --git a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/seed-enrichment-workflow.ts b/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/seed-enrichment-workflow.tsdeleted file mode 100644index c71fcaddd7b..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/seed-enrichment-workflow.ts+++ /dev/null@@ -1,131 +0,0 @@-import { type CoreApiClient } from 'twenty-client-sdk/core';--import { PdlOperationError } from 'src/logic-functions/errors/pdl-operation-error';-import { buildBulkRecordsTrigger } from 'src/logic-functions/utils/build-bulk-records-trigger';-import { buildLogicFunctionStep } from 'src/logic-functions/utils/build-logic-function-step';-import { findExistingWorkflowId } from 'src/logic-functions/utils/find-existing-workflow-id';-import { type EnrichmentWorkflowSeed } from 'src/types/enrichment-workflow-seed';-import { type SeedEnrichmentWorkflowResult } from 'src/types/seed-enrichment-workflow-result';-import { isDefined } from 'src/utils/is-defined';--const TRIGGER_STEP_ID = 'trigger';--export const seedEnrichmentWorkflow = async ({- client,- logicFunctionId,- seed,-}: {- client: CoreApiClient;- logicFunctionId: string;- seed: EnrichmentWorkflowSeed;-}): Promise<SeedEnrichmentWorkflowResult> => {- const existingWorkflowId = await findExistingWorkflowId({- client,- name: seed.workflowName,- });-- if (isDefined(existingWorkflowId)) {- return {- objectNameSingular: seed.objectNameSingular,- workflowName: seed.workflowName,- status: 'skipped',- workflowId: existingWorkflowId,- };- }-- const createResult = (await client.mutation({- createWorkflow: {- __args: { data: { name: seed.workflowName } },- id: true,- },- })) as { createWorkflow?: { id?: string } };-- const workflowId = createResult.createWorkflow?.id;-- if (!isDefined(workflowId)) {- throw new PdlOperationError(- `Failed to create workflow "${seed.workflowName}": no id returned.`,- );- }-- const versionsResult = (await client.query({- workflowVersions: {- __args: { filter: { workflowId: { eq: workflowId } } },- edges: { node: { id: true, status: true } },- },- })) as {- workflowVersions?: { edges?: { node?: { id?: string; status?: string } }[] };- };-- const draftVersionId = versionsResult.workflowVersions?.edges?.find(- (edge) => edge.node?.status === 'DRAFT',- )?.node?.id;-- if (!isDefined(draftVersionId)) {- throw new PdlOperationError(- `No draft version found for workflow "${seed.workflowName}".`,- );- }-- const stepId = crypto.randomUUID();-- const trigger = buildBulkRecordsTrigger({- objectNameSingular: seed.objectNameSingular,- name: seed.triggerName,- icon: seed.icon,- });-- await client.mutation({- updateWorkflowVersion: {- __args: { id: draftVersionId, data: { trigger } },- id: true,- },- });-- const callMutationNotYetInClientSchema = (- request: unknown,- ): Promise<unknown> => client.mutation(request as never);-- await callMutationNotYetInClientSchema({- createWorkflowVersionStep: {- __args: {- input: {- workflowVersionId: draftVersionId,- stepType: 'LOGIC_FUNCTION',- parentStepId: TRIGGER_STEP_ID,- id: stepId,- defaultSettings: { input: { logicFunctionId } },- },- },- triggerDiff: true,- stepsDiff: true,- },- });-- const step = buildLogicFunctionStep({- id: stepId,- name: seed.stepName,- logicFunctionId,- logicFunctionInput: seed.logicFunctionInput,- });-- await callMutationNotYetInClientSchema({- updateWorkflowVersionStep: {- __args: { input: { workflowVersionId: draftVersionId, step } },- id: true,- },- });-- await callMutationNotYetInClientSchema({- activateWorkflowVersion: {- __args: { workflowVersionId: draftVersionId },- },- });-- return {- objectNameSingular: seed.objectNameSingular,- workflowName: seed.workflowName,- status: 'created',- workflowId,- };-};diff --git a/packages/twenty-apps/public/people-data-labs/src/types/enrichment-workflow-seed.ts b/packages/twenty-apps/public/people-data-labs/src/types/enrichment-workflow-seed.tsdeleted file mode 100644index f0cbd0b0492..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/types/enrichment-workflow-seed.ts+++ /dev/null@@ -1,9 +0,0 @@-export type EnrichmentWorkflowSeed = {- objectNameSingular: string;- workflowName: string;- triggerName: string;- icon: string;- stepName: string;- logicFunctionUniversalIdentifier: string;- logicFunctionInput: Record<string, unknown>;-};diff --git a/packages/twenty-apps/public/people-data-labs/src/types/post-install-result.ts b/packages/twenty-apps/public/people-data-labs/src/types/post-install-result.tsdeleted file mode 100644index c2aaeb8ef42..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/types/post-install-result.ts+++ /dev/null@@ -1,5 +0,0 @@-import { type SeedEnrichmentWorkflowResult } from 'src/types/seed-enrichment-workflow-result';--export type PostInstallResult = {- seededWorkflows: SeedEnrichmentWorkflowResult[];-};diff --git a/packages/twenty-apps/public/people-data-labs/src/types/seed-enrichment-workflow-result.ts b/packages/twenty-apps/public/people-data-labs/src/types/seed-enrichment-workflow-result.tsdeleted file mode 100644index d1368e0fbff..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/types/seed-enrichment-workflow-result.ts+++ /dev/null@@ -1,7 +0,0 @@-export type SeedEnrichmentWorkflowResult = {- objectNameSingular: string;- workflowName: string;- status: 'created' | 'skipped' | 'failed';- workflowId?: string;- error?: string;-};diff --git a/packages/twenty-apps/public/people-data-labs/src/types/workflow-bulk-records-trigger.ts b/packages/twenty-apps/public/people-data-labs/src/types/workflow-bulk-records-trigger.tsdeleted file mode 100644index fb7e5ffa050..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/types/workflow-bulk-records-trigger.ts+++ /dev/null@@ -1,15 +0,0 @@-export type WorkflowBulkRecordsTrigger = {- name: string;- type: 'MANUAL';- settings: {- objectType: string;- availability: {- type: 'BULK_RECORDS';- objectNameSingular: string;- };- outputSchema: Record<string, never>;- icon: string;- isPinned: boolean;- };- nextStepIds: string[];-};diff --git a/packages/twenty-apps/public/people-data-labs/src/types/workflow-logic-function-step.ts b/packages/twenty-apps/public/people-data-labs/src/types/workflow-logic-function-step.tsdeleted file mode 100644index 82cf555848a..00000000000--- a/packages/twenty-apps/public/people-data-labs/src/types/workflow-logic-function-step.ts+++ /dev/null@@ -1,18 +0,0 @@-export type WorkflowLogicFunctionStep = {- id: string;- name: string;- type: 'LOGIC_FUNCTION';- valid: boolean;- settings: {- input: {- logicFunctionId: string;- logicFunctionInput: Record<string, unknown>;- };- outputSchema: Record<string, never>;- errorHandlingOptions: {- retryOnFailure: { value: number };- continueOnFailure: { value: boolean };- };- };- nextStepIds: string[];-};