snapshot of https://github.com/twentyhq/twenty.git (main, 2026-09-17; blobs > 131072B omitted)
Some checks failed
App Prod-Parity E2E Dispatch / dispatch (push) Failing after 10s
CD Storybook UI / build (push) Failing after 3m25s
CD Storybook UI / dispatch (push) Has been skipped
CD deploy main / website-changed-files (push) Successful in 18m8s
CI Agent Skills / changed-files-check (push) Successful in 18m9s
CI Create App E2E minimal / changed-files-check (push) Successful in 24s
CI Create App / changed-files-check (push) Successful in 26s
CI Docs / changed-files-check (push) Successful in 26s
CI Emails / changed-files-check (push) Successful in 28s
CI Example App Hello World / changed-files-check (push) Successful in 23s
CI Front / changed-files-check (push) Has been skipped
CI Example App Postcard / changed-files-check (push) Successful in 27s
CI UI / changed-files-check (push) Has been skipped
CI Utils Test / changed-files-check (push) Successful in 45s
CI Twenty Apps / discover (push) Successful in 1m3s
CD deploy main / deploy-main (push) Failing after 3s
CI Agent Skills / agent-skills-validate (push) Has been skipped
CI Create App / create-app-test (lint) (push) Has been skipped
CI Emails / emails-test (push) Has been skipped
CI Front / front-task (lingui:compile) (push) Has been skipped
CI Front / front-task (lint) (push) Has been skipped
CI Example App Postcard / example-app-postcard (push) Has been skipped
CI UI / ui-task (lint) (push) Has been skipped
CI UI / ui-task (pack-size) (push) Has been skipped
CI UI / ui-task (size) (push) Has been skipped
CI UI / ui-task (test) (push) Has been skipped
CI UI / ui-task (typecheck) (push) Has been skipped
CI Utils Test / utils-test (push) Has been skipped
CI Twenty Apps / ${{ matrix.app.name }} (push) Has been skipped
CI Emails / ci-emails-status-check (push) Successful in 2s
CI Example App Hello World / ci-example-app-hello-world-status-check (push) Successful in 2s
CI Example App Postcard / ci-example-app-postcard-status-check (push) Successful in 3s
CI UI / ui-sb-test (push) Has been skipped
CI Utils Test / ci-utils-test-status-check (push) Successful in 2s
CI Twenty Apps / ci-twenty-apps-status-check (push) Successful in 2s
CI UI / ci-ui-status-check (push) Successful in 2s
CI Desktop / desktop (push) Failing after 1m8s
Push docs to Crowdin / Push documentation to Crowdin (push) Failing after 55s
Push translations to Crowdin / Extract and upload translations (push) Failing after 5s
Push website translations to Crowdin / Extract and upload website translations (push) Failing after 5s
CI Create App / create-app-test (test) (push) Has been skipped
CI Create App / create-app-test (typecheck) (push) Has been skipped
CI Docs / docs-lint (push) Has been skipped
CI Example App Hello World / example-app-hello-world (push) Has been skipped
CI Front / front-task (lingui:extract) (push) Has been skipped
CI Front / front-task (test) (push) Has been skipped
CI Front / front-task (typecheck) (push) Has been skipped
CI UI / ui-sb-build (push) Failing after 1m32s
CI Twenty Apps / ${{ matrix.app.name }} (${{ matrix.server-source }}) (push) Has been skipped
CI Agent Skills / agent-skills-publish (push) Has been skipped
CI Create App / ci-create-app-status-check (push) Successful in 2s
CI Agent Skills / agent-skills-remote-source (push) Has been skipped
CI Create App E2E minimal / create-app-e2e-minimal (push) Has been cancelled
CI E2E Main / e2e-test (push) Has been cancelled
CI Front / front-sb-build (push) Has been cancelled
CI Front / front-build (push) Has been cancelled
CI Create App E2E minimal / ci-create-app-e2e-minimal-status-check (push) Has been cancelled
CI E2E Main / ci-e2e-main-status-check (push) Has been cancelled
CI E2E Main / notify-main-ci-failure (push) Has been cancelled
CI E2E Main / qa-scout-comment (push) Has been cancelled
CI Front / front-sb-test (push) Has been cancelled
CI Front / front-sb-screenshots (push) Has been cancelled
CI Front / ci-front-status-check (push) Has been cancelled
DPA Sub-Processor Sync / sync-subprocessors (push) Failing after 3s
AI Catalog Sync / sync-catalog (push) Failing after 2s

This commit is contained in:
upstream-mirror
2026-09-17 23:28:13 +05:00
commit e7da97194a
32688 changed files with 4208681 additions and 0 deletions

View File

@@ -0,0 +1,316 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Logic function creation via manifest sync should fail for path traversal when builtHandlerPath contains backslash path traversal 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Resource path must not contain backslashes",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for path traversal when builtHandlerPath contains path traversal 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Resource path must not contain path traversal (..)",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for path traversal when builtHandlerPath has a completely unrelated extension (.pdf) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Invalid file extension. Allowed extensions: .mjs",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for path traversal when builtHandlerPath has an invalid extension (.js instead of .mjs) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Invalid file extension. Allowed extensions: .mjs",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for path traversal when builtHandlerPath is a folder path without extension (bare UUID) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Filename must have an extension",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for path traversal when builtHandlerPath is an absolute path 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Resource path must be relative, not absolute",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for path traversal when sourceHandlerPath contains path traversal 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Resource path must not contain path traversal (..)",
"userFriendlyMessage": "Source handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Source handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for path traversal when sourceHandlerPath has an invalid extension (.mjs instead of .ts/.tsx) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Invalid file extension. Allowed extensions: .ts, .tsx, .json",
"userFriendlyMessage": "Source handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Source handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for path traversal when sourceHandlerPath is a folder path without extension 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Filename must have an extension",
"userFriendlyMessage": "Source handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Source handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;

View File

@@ -0,0 +1,141 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Logic function creation via manifest sync should fail for invalid handlerName when handlerName contains an invalid identifier character 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "handlerName must be a valid JavaScript identifier or dotted path",
"userFriendlyMessage": "Handler name is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Handler name is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for invalid handlerName when handlerName injects a statement via semicolon 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "handlerName must be a valid JavaScript identifier or dotted path",
"userFriendlyMessage": "Handler name is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Handler name is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for invalid handlerName when handlerName is a malformed dotted path (consecutive dots) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "handlerName must be a valid JavaScript identifier or dotted path",
"userFriendlyMessage": "Handler name is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Handler name is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function creation via manifest sync should fail for invalid handlerName when handlerName is empty 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "handlerName must be a valid JavaScript identifier or dotted path",
"userFriendlyMessage": "Handler name is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "create",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Handler name is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;

View File

@@ -0,0 +1,316 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Logic function update via manifest sync should fail for path traversal when builtHandlerPath is a folder path without extension (bare UUID) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Filename must have an extension",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "update",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function update via manifest sync should fail for path traversal when builtHandlerPath is updated with a completely unrelated extension (.pdf) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Invalid file extension. Allowed extensions: .mjs",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "update",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function update via manifest sync should fail for path traversal when builtHandlerPath is updated with absolute path via manifest sync 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Resource path must be relative, not absolute",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "update",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function update via manifest sync should fail for path traversal when builtHandlerPath is updated with backslash path via manifest sync 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Resource path must not contain backslashes",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "update",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function update via manifest sync should fail for path traversal when builtHandlerPath is updated with invalid extension (.js instead of .mjs) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Invalid file extension. Allowed extensions: .mjs",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "update",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function update via manifest sync should fail for path traversal when builtHandlerPath is updated with path traversal via manifest sync 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Resource path must not contain path traversal (..)",
"userFriendlyMessage": "Built handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "update",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Built handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function update via manifest sync should fail for path traversal when sourceHandlerPath is a folder path without extension 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Filename must have an extension",
"userFriendlyMessage": "Source handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "update",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Source handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function update via manifest sync should fail for path traversal when sourceHandlerPath is updated with invalid extension (.mjs instead of .ts/.tsx) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Invalid file extension. Allowed extensions: .ts, .tsx, .json",
"userFriendlyMessage": "Source handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "update",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Source handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;
exports[`Logic function update via manifest sync should fail for path traversal when sourceHandlerPath is updated with path traversal via manifest sync 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
"errors": {
"logicFunction": [
{
"errors": [
{
"code": "INVALID_LOGIC_FUNCTION_INPUT",
"message": "Resource path must not contain path traversal (..)",
"userFriendlyMessage": "Source handler path is invalid",
},
],
"flatEntityMinimalInformation": {
"universalIdentifier": Any<String>,
},
"metadataName": "logicFunction",
"status": "fail",
"type": "update",
},
],
},
"message": "Validation failed for 1 logicFunction",
"summary": {
"logicFunction": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "Source handler path is invalid",
},
"message": "Validation errors occurred while syncing application manifest metadata",
"name": "GraphQLError",
}
`;

View File

@@ -0,0 +1,170 @@
import { expectOneNotInternalServerErrorSnapshot } from 'test/integration/graphql/utils/expect-one-not-internal-server-error-snapshot.util';
import { buildBaseManifest } from 'test/integration/metadata/suites/application/utils/build-base-manifest.util';
import { cleanupApplicationAndAppRegistration } from 'test/integration/metadata/suites/application/utils/cleanup-application-and-app-registration.util';
import { setupApplicationForSync } from 'test/integration/metadata/suites/application/utils/setup-application-for-sync.util';
import { syncApplication } from 'test/integration/metadata/suites/application/utils/sync-application.util';
import { uploadApplicationFile } from 'test/integration/metadata/suites/application/utils/upload-application-file.util';
import {
type LogicFunctionManifest,
type Manifest,
} from 'twenty-shared/application';
import {
type EachTestingContext,
eachTestingContextFilter,
} from 'twenty-shared/testing';
import { v4 as uuidv4 } from 'uuid';
const TEST_APP_ID = uuidv4();
const TEST_ROLE_ID = uuidv4();
const VALID_BUILT_PATH = 'src/logic-functions/handler.mjs';
const buildLogicFunction = (
overrides: Partial<LogicFunctionManifest> = {},
): LogicFunctionManifest => ({
universalIdentifier: uuidv4(),
name: 'TestLogicFunction',
description: 'A test logic function',
sourceHandlerPath: 'src/logic-functions/handler.ts',
builtHandlerPath: VALID_BUILT_PATH,
builtHandlerChecksum: 'valid-checksum',
handlerName: 'handler',
...overrides,
});
const buildManifest = (
logicFunctionOverrides: Partial<LogicFunctionManifest> = {},
): Manifest =>
buildBaseManifest({
appId: TEST_APP_ID,
roleId: TEST_ROLE_ID,
overrides: {
logicFunctions: [buildLogicFunction(logicFunctionOverrides)],
},
});
type TestContext = {
manifest: Manifest;
};
const FAILING_CREATION_TEST_CASES: EachTestingContext<TestContext>[] = [
{
title: 'when builtHandlerPath contains path traversal',
context: {
manifest: buildManifest({
builtHandlerPath:
'../../../other-workspace/other-app/built-logic-function/stolen.mjs',
}),
},
},
{
title: 'when sourceHandlerPath contains path traversal',
context: {
manifest: buildManifest({
sourceHandlerPath: '../../etc/passwd',
}),
},
},
{
title: 'when builtHandlerPath is an absolute path',
context: {
manifest: buildManifest({
builtHandlerPath: '/etc/passwd',
}),
},
},
{
title: 'when builtHandlerPath contains backslash path traversal',
context: {
manifest: buildManifest({
builtHandlerPath: '..\\..\\..\\etc\\passwd',
}),
},
},
{
title: 'when builtHandlerPath is a folder path without extension (bare UUID)',
context: {
manifest: buildManifest({
builtHandlerPath: '8b2df3cc-23ad-4e1b-87fd-f880d4cefd58',
}),
},
},
{
title: 'when sourceHandlerPath is a folder path without extension',
context: {
manifest: buildManifest({
sourceHandlerPath: 'src/logic-functions/my-handler',
}),
},
},
{
title:
'when builtHandlerPath has an invalid extension (.js instead of .mjs)',
context: {
manifest: buildManifest({
builtHandlerPath: 'src/logic-functions/handler.js',
}),
},
},
{
title:
'when sourceHandlerPath has an invalid extension (.mjs instead of .ts/.tsx)',
context: {
manifest: buildManifest({
sourceHandlerPath: 'src/logic-functions/handler.mjs',
}),
},
},
{
title: 'when builtHandlerPath has a completely unrelated extension (.pdf)',
context: {
manifest: buildManifest({
builtHandlerPath: 'src/logic-functions/handler.pdf',
}),
},
},
];
describe('Logic function creation via manifest sync should fail for path traversal', () => {
beforeAll(async () => {
await setupApplicationForSync({
applicationUniversalIdentifier: TEST_APP_ID,
name: 'Test Path Traversal Logic App',
description: 'App for testing path traversal validation on creation',
sourcePath: 'test-path-traversal-logic',
});
jest.useRealTimers();
await uploadApplicationFile({
applicationUniversalIdentifier: TEST_APP_ID,
fileFolder: 'BuiltLogicFunction',
filePath: VALID_BUILT_PATH,
fileBuffer: Buffer.from('dummy built handler content'),
filename: 'handler.mjs',
contentType: 'application/javascript',
expectToFail: false,
});
jest.useFakeTimers();
}, 60000);
afterAll(async () => {
await cleanupApplicationAndAppRegistration({
applicationUniversalIdentifier: TEST_APP_ID,
});
});
it.each(eachTestingContextFilter(FAILING_CREATION_TEST_CASES))(
'$title',
async ({ context }) => {
const { errors } = await syncApplication({
manifest: context.manifest,
expectToFail: true,
});
expectOneNotInternalServerErrorSnapshot({ errors });
},
60000,
);
});

View File

@@ -0,0 +1,127 @@
import { expectOneNotInternalServerErrorSnapshot } from 'test/integration/graphql/utils/expect-one-not-internal-server-error-snapshot.util';
import { buildBaseManifest } from 'test/integration/metadata/suites/application/utils/build-base-manifest.util';
import { cleanupApplicationAndAppRegistration } from 'test/integration/metadata/suites/application/utils/cleanup-application-and-app-registration.util';
import { setupApplicationForSync } from 'test/integration/metadata/suites/application/utils/setup-application-for-sync.util';
import { syncApplication } from 'test/integration/metadata/suites/application/utils/sync-application.util';
import { uploadApplicationFile } from 'test/integration/metadata/suites/application/utils/upload-application-file.util';
import {
type LogicFunctionManifest,
type Manifest,
} from 'twenty-shared/application';
import {
type EachTestingContext,
eachTestingContextFilter,
} from 'twenty-shared/testing';
import { v4 as uuidv4 } from 'uuid';
const TEST_APP_ID = uuidv4();
const TEST_ROLE_ID = uuidv4();
const VALID_BUILT_PATH = 'src/logic-functions/handler.mjs';
const buildLogicFunction = (
overrides: Partial<LogicFunctionManifest> = {},
): LogicFunctionManifest => ({
universalIdentifier: uuidv4(),
name: 'TestLogicFunction',
description: 'A test logic function',
sourceHandlerPath: 'src/logic-functions/handler.ts',
builtHandlerPath: VALID_BUILT_PATH,
builtHandlerChecksum: 'valid-checksum',
handlerName: 'handler',
...overrides,
});
const buildManifest = (
logicFunctionOverrides: Partial<LogicFunctionManifest> = {},
): Manifest =>
buildBaseManifest({
appId: TEST_APP_ID,
roleId: TEST_ROLE_ID,
overrides: {
logicFunctions: [buildLogicFunction(logicFunctionOverrides)],
},
});
type TestContext = {
manifest: Manifest;
};
const FAILING_HANDLER_NAME_TEST_CASES: EachTestingContext<TestContext>[] = [
{
title: 'when handlerName injects a statement via semicolon',
context: {
manifest: buildManifest({
handlerName: 'handler; process.exit(1)',
}),
},
},
{
title: 'when handlerName contains an invalid identifier character',
context: {
manifest: buildManifest({
handlerName: 'my-handler',
}),
},
},
{
title: 'when handlerName is a malformed dotted path (consecutive dots)',
context: {
manifest: buildManifest({
handlerName: 'default..handler',
}),
},
},
{
title: 'when handlerName is empty',
context: {
manifest: buildManifest({
handlerName: '',
}),
},
},
];
describe('Logic function creation via manifest sync should fail for invalid handlerName', () => {
beforeAll(async () => {
await setupApplicationForSync({
applicationUniversalIdentifier: TEST_APP_ID,
name: 'Test Handler Name Logic App',
description: 'App for testing handlerName validation on creation',
sourcePath: 'test-handler-name-logic',
});
jest.useRealTimers();
await uploadApplicationFile({
applicationUniversalIdentifier: TEST_APP_ID,
fileFolder: 'BuiltLogicFunction',
filePath: VALID_BUILT_PATH,
fileBuffer: Buffer.from('dummy built handler content'),
filename: 'handler.mjs',
contentType: 'application/javascript',
expectToFail: false,
});
jest.useFakeTimers();
}, 60000);
afterAll(async () => {
await cleanupApplicationAndAppRegistration({
applicationUniversalIdentifier: TEST_APP_ID,
});
});
it.each(eachTestingContextFilter(FAILING_HANDLER_NAME_TEST_CASES))(
'$title',
async ({ context }) => {
const { errors } = await syncApplication({
manifest: context.manifest,
expectToFail: true,
});
expectOneNotInternalServerErrorSnapshot({ errors });
},
60000,
);
});

View File

@@ -0,0 +1,186 @@
import { expectOneNotInternalServerErrorSnapshot } from 'test/integration/graphql/utils/expect-one-not-internal-server-error-snapshot.util';
import { buildBaseManifest } from 'test/integration/metadata/suites/application/utils/build-base-manifest.util';
import { cleanupApplicationAndAppRegistration } from 'test/integration/metadata/suites/application/utils/cleanup-application-and-app-registration.util';
import { setupApplicationForSync } from 'test/integration/metadata/suites/application/utils/setup-application-for-sync.util';
import { syncApplication } from 'test/integration/metadata/suites/application/utils/sync-application.util';
import { uploadApplicationFile } from 'test/integration/metadata/suites/application/utils/upload-application-file.util';
import {
type LogicFunctionManifest,
type Manifest,
} from 'twenty-shared/application';
import {
type EachTestingContext,
eachTestingContextFilter,
} from 'twenty-shared/testing';
import { v4 as uuidv4 } from 'uuid';
const TEST_APP_ID = uuidv4();
const TEST_ROLE_ID = uuidv4();
const LOGIC_FUNCTION_ID = uuidv4();
const VALID_BUILT_PATH = 'src/logic-functions/handler.mjs';
const buildValidLogicFunction = (): LogicFunctionManifest => ({
universalIdentifier: LOGIC_FUNCTION_ID,
name: 'TestLogicFunction',
description: 'A test logic function',
sourceHandlerPath: 'src/logic-functions/handler.ts',
builtHandlerPath: VALID_BUILT_PATH,
builtHandlerChecksum: 'valid-checksum',
handlerName: 'handler',
});
const buildManifest = (
logicFunctionOverrides: Partial<LogicFunctionManifest> = {},
): Manifest =>
buildBaseManifest({
appId: TEST_APP_ID,
roleId: TEST_ROLE_ID,
overrides: {
logicFunctions: [
{
...buildValidLogicFunction(),
...logicFunctionOverrides,
},
],
},
});
type TestContext = {
manifest: Manifest;
};
const FAILING_UPDATE_TEST_CASES: EachTestingContext<TestContext>[] = [
{
title:
'when builtHandlerPath is updated with path traversal via manifest sync',
context: {
manifest: buildManifest({
builtHandlerPath:
'../../../other-workspace/other-app/built-logic-function/stolen.mjs',
}),
},
},
{
title:
'when sourceHandlerPath is updated with path traversal via manifest sync',
context: {
manifest: buildManifest({
sourceHandlerPath: '../../etc/passwd',
}),
},
},
{
title:
'when builtHandlerPath is updated with absolute path via manifest sync',
context: {
manifest: buildManifest({
builtHandlerPath: '/etc/passwd',
}),
},
},
{
title:
'when builtHandlerPath is updated with backslash path via manifest sync',
context: {
manifest: buildManifest({
builtHandlerPath: '..\\..\\..\\etc\\passwd',
}),
},
},
{
title:
'when builtHandlerPath is a folder path without extension (bare UUID)',
context: {
manifest: buildManifest({
builtHandlerPath: '8b2df3cc-23ad-4e1b-87fd-f880d4cefd58',
}),
},
},
{
title:
'when sourceHandlerPath is a folder path without extension',
context: {
manifest: buildManifest({
sourceHandlerPath: 'src/logic-functions/my-handler',
}),
},
},
{
title:
'when builtHandlerPath is updated with invalid extension (.js instead of .mjs)',
context: {
manifest: buildManifest({
builtHandlerPath: 'src/logic-functions/handler.js',
}),
},
},
{
title:
'when sourceHandlerPath is updated with invalid extension (.mjs instead of .ts/.tsx)',
context: {
manifest: buildManifest({
sourceHandlerPath: 'src/logic-functions/handler.mjs',
}),
},
},
{
title:
'when builtHandlerPath is updated with a completely unrelated extension (.pdf)',
context: {
manifest: buildManifest({
builtHandlerPath: 'src/logic-functions/handler.pdf',
}),
},
},
];
describe('Logic function update via manifest sync should fail for path traversal', () => {
beforeAll(async () => {
await setupApplicationForSync({
applicationUniversalIdentifier: TEST_APP_ID,
name: 'Test Path Traversal Logic App',
description:
'App for testing path traversal validation on logic function update',
sourcePath: 'test-path-traversal-logic',
});
jest.useRealTimers();
await uploadApplicationFile({
applicationUniversalIdentifier: TEST_APP_ID,
fileFolder: 'BuiltLogicFunction',
filePath: VALID_BUILT_PATH,
fileBuffer: Buffer.from('dummy built handler content'),
filename: 'handler.mjs',
contentType: 'application/javascript',
expectToFail: false,
});
jest.useFakeTimers();
await syncApplication({
manifest: buildManifest(),
expectToFail: false,
});
}, 60000);
afterAll(async () => {
await cleanupApplicationAndAppRegistration({
applicationUniversalIdentifier: TEST_APP_ID,
});
});
it.each(eachTestingContextFilter(FAILING_UPDATE_TEST_CASES))(
'$title',
async ({ context }) => {
const { errors } = await syncApplication({
manifest: context.manifest,
expectToFail: true,
});
expectOneNotInternalServerErrorSnapshot({ errors });
},
60000,
);
});

View File

@@ -0,0 +1,286 @@
import { createOneLogicFunction } from 'test/integration/metadata/suites/logic-function/utils/create-logic-function.util';
import { deleteLogicFunction } from 'test/integration/metadata/suites/logic-function/utils/delete-logic-function.util';
import { executeLogicFunction } from 'test/integration/metadata/suites/logic-function/utils/execute-logic-function.util';
import { updateLogicFunctionSource } from 'test/integration/metadata/suites/logic-function/utils/update-logic-function-source.util';
import { LogicFunctionExecutionStatus } from 'src/engine/metadata-modules/logic-function/dtos/logic-function-execution-result.dto';
import { LogicFunctionExecutionMode } from 'src/engine/metadata-modules/logic-function/logic-function.entity';
const DEFAULT_TEMPLATE_FUNCTION_CODE = `export const main = async (params: { a: string; b: number }): Promise<object> => {
return { message: \`Toto: \${params.a} and \${params.b}\` };
};`;
const EXTERNAL_PACKAGES_FUNCTION_CODE = `import groupBy from 'lodash.groupby';
export const main = async (params: { items: Array<{ category: string; name: string }> }): Promise<object> => {
const grouped = groupBy(params.items, 'category');
return {
grouped,
categories: Object.keys(grouped),
};
};`;
const ERROR_FUNCTION_CODE = `export const main = async (params: { shouldFail: boolean }): Promise<object> => {
if (params.shouldFail) {
throw new Error('Intentional test error');
}
return { success: true };
};`;
describe('Logic Function Execution', () => {
const createdFunctionIds: string[] = [];
afterAll(async () => {
for (const functionId of createdFunctionIds) {
try {
await deleteLogicFunction({
input: { id: functionId },
expectToFail: false,
});
} catch {
// Ignore cleanup errors
}
}
});
it('should execute the default logic function template', async () => {
const { data: createData } = await createOneLogicFunction({
input: {
name: 'Test Default Function',
},
expectToFail: false,
});
const functionId = createData?.createOneLogicFunction?.id;
expect(functionId).toBeDefined();
expect(createData?.createOneLogicFunction?.executionMode).toBe(
LogicFunctionExecutionMode.LIVE,
);
createdFunctionIds.push(functionId);
await updateLogicFunctionSource({
input: {
id: createData.createOneLogicFunction.id,
update: {
sourceHandlerCode: DEFAULT_TEMPLATE_FUNCTION_CODE,
},
},
expectToFail: false,
});
// Execute with the default template's expected params: { a: string, b: number }
const { data: executeData } = await executeLogicFunction({
input: {
id: functionId,
payload: { a: 'hello', b: 42 },
},
expectToFail: false,
});
const result = executeData?.executeOneLogicFunction;
if (result?.status !== LogicFunctionExecutionStatus.SUCCESS) {
throw new Error(JSON.stringify(result?.error, null, 2));
}
expect(result?.status).toBe(LogicFunctionExecutionStatus.SUCCESS);
expect(result?.data).toMatchObject({
message: 'Toto: hello and 42',
});
expect(result?.duration).toBeGreaterThan(0);
});
it('should execute a function with external packages (lodash.groupby)', async () => {
const { data: createData } = await createOneLogicFunction({
input: {
name: 'External Packages Test',
},
expectToFail: false,
});
const functionId = createData?.createOneLogicFunction?.id;
expect(functionId).toBeDefined();
createdFunctionIds.push(functionId);
await updateLogicFunctionSource({
input: {
id: createData.createOneLogicFunction.id,
update: {
sourceHandlerCode: EXTERNAL_PACKAGES_FUNCTION_CODE,
},
},
expectToFail: false,
});
const { data: executeData } = await executeLogicFunction({
input: {
id: functionId,
payload: {
items: [
{ category: 'fruit', name: 'apple' },
{ category: 'vegetable', name: 'carrot' },
{ category: 'fruit', name: 'banana' },
],
},
},
expectToFail: false,
});
const result = executeData?.executeOneLogicFunction;
if (result?.status !== LogicFunctionExecutionStatus.SUCCESS) {
throw new Error(JSON.stringify(result?.error, null, 2));
}
expect(result?.status).toBe(LogicFunctionExecutionStatus.SUCCESS);
const data = result?.data as unknown as {
grouped: Record<string, Array<{ category: string; name: string }>>;
categories: string[];
};
expect(data?.grouped).toMatchObject({
fruit: [
{ category: 'fruit', name: 'apple' },
{ category: 'fruit', name: 'banana' },
],
vegetable: [{ category: 'vegetable', name: 'carrot' }],
});
expect(data?.categories).toEqual(
expect.arrayContaining(['fruit', 'vegetable']),
);
});
it('should create logic function without source', async () => {
const { data: createData } = await createOneLogicFunction({
input: {
name: 'Test Default Function',
},
expectToFail: false,
});
const functionId = createData?.createOneLogicFunction?.id;
expect(functionId).toBeDefined();
createdFunctionIds.push(functionId);
// Execute with the default template's expected params: { a: string, b: number }
const { data: executeData } = await executeLogicFunction({
input: {
id: functionId,
payload: { a: 'hello', b: 42 },
},
expectToFail: false,
});
const result = executeData?.executeOneLogicFunction;
if (result?.status !== LogicFunctionExecutionStatus.SUCCESS) {
throw new Error(JSON.stringify(result?.error, null, 2));
}
expect(result?.status).toBe(LogicFunctionExecutionStatus.SUCCESS);
expect(result?.data).toMatchObject({
message: 'Hello, input: hello and 42',
});
expect(result?.duration).toBeGreaterThan(0);
});
it('should create logic function with source', async () => {
const { data: createData } = await createOneLogicFunction({
input: {
name: 'Test Default Function',
source: {
sourceHandlerCode: DEFAULT_TEMPLATE_FUNCTION_CODE,
handlerName: 'main',
},
},
expectToFail: false,
});
const functionId = createData?.createOneLogicFunction?.id;
expect(functionId).toBeDefined();
createdFunctionIds.push(functionId);
// Execute with the default template's expected params: { a: string, b: number }
const { data: executeData } = await executeLogicFunction({
input: {
id: functionId,
payload: { a: 'hello', b: 42 },
},
expectToFail: false,
});
const result = executeData?.executeOneLogicFunction;
if (result?.status !== LogicFunctionExecutionStatus.SUCCESS) {
throw new Error(JSON.stringify(result?.error, null, 2));
}
expect(result?.status).toBe(LogicFunctionExecutionStatus.SUCCESS);
expect(result?.data).toMatchObject({
message: 'Toto: hello and 42',
});
expect(result?.duration).toBeGreaterThan(0);
});
it('should handle errors thrown by logic functions', async () => {
const { data: createData } = await createOneLogicFunction({
input: {
name: 'Error Test Function',
},
expectToFail: false,
});
const functionId = createData?.createOneLogicFunction?.id;
expect(functionId).toBeDefined();
createdFunctionIds.push(functionId);
await updateLogicFunctionSource({
input: {
id: createData.createOneLogicFunction.id,
update: {
sourceHandlerCode: ERROR_FUNCTION_CODE,
},
},
expectToFail: false,
});
const { data: successData } = await executeLogicFunction({
input: {
id: functionId,
payload: { shouldFail: false },
},
expectToFail: false,
});
expect(successData?.executeOneLogicFunction?.status).toBe(
LogicFunctionExecutionStatus.SUCCESS,
);
expect(successData?.executeOneLogicFunction?.data).toMatchObject({
success: true,
});
const { data: errorData } = await executeLogicFunction({
input: {
id: functionId,
payload: { shouldFail: true },
},
expectToFail: false, // The GraphQL call succeeds, but the function execution fails
});
const errorResult = errorData?.executeOneLogicFunction;
expect(errorResult?.status).toBe(LogicFunctionExecutionStatus.ERROR);
expect(errorResult?.error).toMatchObject({
errorType: 'Error',
errorMessage: expect.stringContaining('Intentional test error'),
});
expect(errorResult?.data).toBeNull();
});
});

View File

@@ -0,0 +1,119 @@
import { buildBaseManifest } from 'test/integration/metadata/suites/application/utils/build-base-manifest.util';
import { cleanupApplicationAndAppRegistration } from 'test/integration/metadata/suites/application/utils/cleanup-application-and-app-registration.util';
import { setupApplicationForSync } from 'test/integration/metadata/suites/application/utils/setup-application-for-sync.util';
import { syncApplication } from 'test/integration/metadata/suites/application/utils/sync-application.util';
import { uploadApplicationFile } from 'test/integration/metadata/suites/application/utils/upload-application-file.util';
import {
type LogicFunctionManifest,
type Manifest,
} from 'twenty-shared/application';
import {
type EachTestingContext,
eachTestingContextFilter,
} from 'twenty-shared/testing';
import { v4 as uuidv4 } from 'uuid';
const TEST_APP_ID = uuidv4();
const TEST_ROLE_ID = uuidv4();
const VALID_BUILT_PATH = 'src/logic-functions/handler.mjs';
const buildLogicFunction = (
overrides: Partial<LogicFunctionManifest> = {},
): LogicFunctionManifest => ({
universalIdentifier: uuidv4(),
name: 'TestLogicFunction',
description: 'A test logic function',
sourceHandlerPath: 'src/logic-functions/handler.ts',
builtHandlerPath: VALID_BUILT_PATH,
builtHandlerChecksum: 'valid-checksum',
handlerName: 'handler',
...overrides,
});
const buildManifest = (
logicFunctionOverrides: Partial<LogicFunctionManifest> = {},
): Manifest =>
buildBaseManifest({
appId: TEST_APP_ID,
roleId: TEST_ROLE_ID,
overrides: {
logicFunctions: [buildLogicFunction(logicFunctionOverrides)],
},
});
type TestContext = {
manifest: Manifest;
};
const SUCCESSFUL_HANDLER_NAME_TEST_CASES: EachTestingContext<TestContext>[] = [
{
title: 'when handlerName is a simple identifier',
context: {
manifest: buildManifest({
handlerName: 'main',
}),
},
},
{
title: 'when handlerName is the SDK-emitted dotted path',
context: {
manifest: buildManifest({
handlerName: 'default.config.handler',
}),
},
},
{
title: 'when handlerName uses identifier-legal symbols ($ and _)',
context: {
manifest: buildManifest({
handlerName: '$run_handler2',
}),
},
},
];
describe('Logic function creation via manifest sync should succeed for valid handlerName', () => {
beforeAll(async () => {
await setupApplicationForSync({
applicationUniversalIdentifier: TEST_APP_ID,
name: 'Test Valid Handler Name Logic App',
description: 'App for testing valid handlerName values on creation',
sourcePath: 'test-valid-handler-name-logic',
});
jest.useRealTimers();
await uploadApplicationFile({
applicationUniversalIdentifier: TEST_APP_ID,
fileFolder: 'BuiltLogicFunction',
filePath: VALID_BUILT_PATH,
fileBuffer: Buffer.from('dummy built handler content'),
filename: 'handler.mjs',
contentType: 'application/javascript',
expectToFail: false,
});
jest.useFakeTimers();
}, 60000);
afterAll(async () => {
await cleanupApplicationAndAppRegistration({
applicationUniversalIdentifier: TEST_APP_ID,
});
});
it.each(eachTestingContextFilter(SUCCESSFUL_HANDLER_NAME_TEST_CASES))(
'$title',
async ({ context }) => {
const { data, errors } = await syncApplication({
manifest: context.manifest,
expectToFail: false,
});
expect(errors).toBeUndefined();
expect(data?.syncApplication).toBeDefined();
},
60000,
);
});

View File

@@ -0,0 +1,33 @@
import gql from 'graphql-tag';
import { type PerformMetadataQueryParams } from 'test/integration/metadata/types/perform-metadata-query.type';
import { type CreateLogicFunctionFromSourceInput } from 'src/engine/metadata-modules/logic-function/dtos/create-logic-function-from-source.input';
export type CreateLogicFunctionFactoryInput =
CreateLogicFunctionFromSourceInput;
const LOGIC_FUNCTION_GQL_FIELDS = `
id
name
description
runtime
executionMode
createdAt
updatedAt
`;
export const createOneLogicFunctionQueryFactory = ({
input,
gqlFields = LOGIC_FUNCTION_GQL_FIELDS,
}: PerformMetadataQueryParams<CreateLogicFunctionFactoryInput>) => ({
query: gql`
mutation CreateOneLogicFunction($input: CreateLogicFunctionFromSourceInput!) {
createOneLogicFunction(input: $input) {
${gqlFields}
}
}
`,
variables: {
input,
},
});

View File

@@ -0,0 +1,41 @@
import { createOneLogicFunctionQueryFactory } from 'test/integration/metadata/suites/logic-function/utils/create-logic-function-query-factory.util';
import { makeMetadataAPIRequest } from 'test/integration/metadata/suites/utils/make-metadata-api-request.util';
import { type CommonResponseBody } from 'test/integration/metadata/types/common-response-body.type';
import { type PerformMetadataQueryParams } from 'test/integration/metadata/types/perform-metadata-query.type';
import { warnIfErrorButNotExpectedToFail } from 'test/integration/metadata/utils/warn-if-error-but-not-expected-to-fail.util';
import { warnIfNoErrorButExpectedToFail } from 'test/integration/metadata/utils/warn-if-no-error-but-expected-to-fail.util';
import { type LogicFunctionDTO } from 'src/engine/metadata-modules/logic-function/dtos/logic-function.dto';
import { type CreateLogicFunctionFromSourceInput } from 'src/engine/metadata-modules/logic-function/dtos/create-logic-function-from-source.input';
export const createOneLogicFunction = async ({
input,
gqlFields,
expectToFail = false,
token,
}: PerformMetadataQueryParams<CreateLogicFunctionFromSourceInput>): CommonResponseBody<{
createOneLogicFunction: LogicFunctionDTO;
}> => {
const graphqlOperation = createOneLogicFunctionQueryFactory({
input,
gqlFields,
});
const response = await makeMetadataAPIRequest(graphqlOperation, token);
if (expectToFail === true) {
warnIfNoErrorButExpectedToFail({
response,
errorMessage: 'Logic Function creation should have failed but did not',
});
}
if (expectToFail === false) {
warnIfErrorButNotExpectedToFail({
response,
errorMessage: 'Logic Function creation has failed but should not',
});
}
return { data: response.body.data, errors: response.body.errors };
};

View File

@@ -0,0 +1,22 @@
import gql from 'graphql-tag';
export type DeleteLogicFunctionFactoryInput = {
id: string;
};
export const deleteLogicFunctionQueryFactory = ({
input,
}: {
input: DeleteLogicFunctionFactoryInput;
}) => ({
query: gql`
mutation DeleteOneLogicFunction($input: LogicFunctionIdInput!) {
deleteOneLogicFunction(input: $input) {
id
}
}
`,
variables: {
input,
},
});

View File

@@ -0,0 +1,42 @@
import {
type DeleteLogicFunctionFactoryInput,
deleteLogicFunctionQueryFactory,
} from 'test/integration/metadata/suites/logic-function/utils/delete-logic-function-query-factory.util';
import { makeMetadataAPIRequest } from 'test/integration/metadata/suites/utils/make-metadata-api-request.util';
import { type CommonResponseBody } from 'test/integration/metadata/types/common-response-body.type';
import { warnIfErrorButNotExpectedToFail } from 'test/integration/metadata/utils/warn-if-error-but-not-expected-to-fail.util';
import { warnIfNoErrorButExpectedToFail } from 'test/integration/metadata/utils/warn-if-no-error-but-expected-to-fail.util';
export const deleteLogicFunction = async ({
input,
expectToFail = false,
token,
}: {
input: DeleteLogicFunctionFactoryInput;
expectToFail?: boolean;
token?: string;
}): CommonResponseBody<{
deleteOneLogicFunction: { id: string };
}> => {
const graphqlOperation = deleteLogicFunctionQueryFactory({
input,
});
const response = await makeMetadataAPIRequest(graphqlOperation, token);
if (expectToFail === true) {
warnIfNoErrorButExpectedToFail({
response,
errorMessage: 'Logic Function deletion should have failed but did not',
});
}
if (expectToFail === false) {
warnIfErrorButNotExpectedToFail({
response,
errorMessage: 'Logic Function deletion has failed but should not',
});
}
return { data: response.body.data, errors: response.body.errors };
};

View File

@@ -0,0 +1,37 @@
import gql from 'graphql-tag';
import { type ExecuteOneLogicFunctionInput } from 'src/engine/metadata-modules/logic-function/dtos/execute-logic-function.input';
export type ExecuteLogicFunctionFactoryInput = Omit<
ExecuteOneLogicFunctionInput,
'payload'
> & {
payload: Record<string, unknown>;
};
const DEFAULT_EXECUTION_RESULT_GQL_FIELDS = `
data
logs
duration
status
error
`;
export const executeLogicFunctionQueryFactory = ({
input,
gqlFields = DEFAULT_EXECUTION_RESULT_GQL_FIELDS,
}: {
input: ExecuteLogicFunctionFactoryInput;
gqlFields?: string;
}) => ({
query: gql`
mutation ExecuteOneLogicFunction($input: ExecuteOneLogicFunctionInput!) {
executeOneLogicFunction(input: $input) {
${gqlFields}
}
}
`,
variables: {
input,
},
});

View File

@@ -0,0 +1,47 @@
import {
type ExecuteLogicFunctionFactoryInput,
executeLogicFunctionQueryFactory,
} from 'test/integration/metadata/suites/logic-function/utils/execute-logic-function-query-factory.util';
import { makeMetadataAPIRequest } from 'test/integration/metadata/suites/utils/make-metadata-api-request.util';
import { type CommonResponseBody } from 'test/integration/metadata/types/common-response-body.type';
import { warnIfErrorButNotExpectedToFail } from 'test/integration/metadata/utils/warn-if-error-but-not-expected-to-fail.util';
import { warnIfNoErrorButExpectedToFail } from 'test/integration/metadata/utils/warn-if-no-error-but-expected-to-fail.util';
import { type LogicFunctionExecutionResultDTO } from 'src/engine/metadata-modules/logic-function/dtos/logic-function-execution-result.dto';
export const executeLogicFunction = async ({
input,
gqlFields,
expectToFail = false,
token,
}: {
input: ExecuteLogicFunctionFactoryInput;
gqlFields?: string;
expectToFail?: boolean;
token?: string;
}): CommonResponseBody<{
executeOneLogicFunction: LogicFunctionExecutionResultDTO;
}> => {
const graphqlOperation = executeLogicFunctionQueryFactory({
input,
gqlFields,
});
const response = await makeMetadataAPIRequest(graphqlOperation, token);
if (expectToFail === true) {
warnIfNoErrorButExpectedToFail({
response,
errorMessage: 'Logic Function execution should have failed but did not',
});
}
if (expectToFail === false) {
warnIfErrorButNotExpectedToFail({
response,
errorMessage: 'Logic Function execution has failed but should not',
});
}
return { data: response.body.data, errors: response.body.errors };
};

View File

@@ -0,0 +1,22 @@
import gql from 'graphql-tag';
import { type PerformMetadataQueryParams } from 'test/integration/metadata/types/perform-metadata-query.type';
import { type UpdateLogicFunctionFromSourceInput } from 'src/engine/metadata-modules/logic-function/dtos/update-logic-function-from-source.input';
export type UpdateLogicFunctionFromSourceFactoryInput =
UpdateLogicFunctionFromSourceInput;
export const updateLogicFunctionFromSourceQueryFactory = ({
input,
}: PerformMetadataQueryParams<UpdateLogicFunctionFromSourceFactoryInput>) => ({
query: gql`
mutation UpdateOneLogicFunction(
$input: UpdateLogicFunctionFromSourceInput!
) {
updateOneLogicFunction(input: $input)
}
`,
variables: {
input,
},
});

View File

@@ -0,0 +1,43 @@
import { makeMetadataAPIRequest } from 'test/integration/metadata/suites/utils/make-metadata-api-request.util';
import { type CommonResponseBody } from 'test/integration/metadata/types/common-response-body.type';
import { type PerformMetadataQueryParams } from 'test/integration/metadata/types/perform-metadata-query.type';
import { warnIfErrorButNotExpectedToFail } from 'test/integration/metadata/utils/warn-if-error-but-not-expected-to-fail.util';
import { warnIfNoErrorButExpectedToFail } from 'test/integration/metadata/utils/warn-if-no-error-but-expected-to-fail.util';
import {
type UpdateLogicFunctionFromSourceFactoryInput,
updateLogicFunctionFromSourceQueryFactory,
} from 'test/integration/metadata/suites/logic-function/utils/update-logic-function-source-query-factory.util';
import { type LogicFunctionDTO } from 'src/engine/metadata-modules/logic-function/dtos/logic-function.dto';
export const updateLogicFunctionSource = async ({
input,
gqlFields,
expectToFail = false,
token,
}: PerformMetadataQueryParams<UpdateLogicFunctionFromSourceFactoryInput>): CommonResponseBody<{
updateOneLogicFunction: LogicFunctionDTO;
}> => {
const graphqlOperation = updateLogicFunctionFromSourceQueryFactory({
input,
gqlFields,
});
const response = await makeMetadataAPIRequest(graphqlOperation, token);
if (expectToFail === true) {
warnIfNoErrorButExpectedToFail({
response,
errorMessage: 'Logic Function creation should have failed but did not',
});
}
if (expectToFail === false) {
warnIfErrorButNotExpectedToFail({
response,
errorMessage: 'Logic Function creation has failed but should not',
});
}
return { data: response.body.data, errors: response.body.errors };
};