twenty-sdk 2.50.0 → 2.51.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/descriptor.json +1 -1
- package/dist/{build-snapshot-DlB2VyNd.mjs → build-snapshot--GXJr4vI.mjs} +2 -2
- package/dist/{build-snapshot-C-NQg7fn.js → build-snapshot-D38u-ntr.js} +1 -1
- package/dist/build.cjs +1 -1
- package/dist/build.mjs +2 -2
- package/dist/{catalog-sync-C6jv_xoa.mjs → catalog-sync-BMUVC4nI.mjs} +1 -1
- package/dist/{catalog-sync-DxcdSEBJ.js → catalog-sync-D5e5_2jo.js} +1 -1
- package/dist/cli/utilities/build/common/front-component-build/css-injection-plugin.d.ts +1 -2
- package/dist/cli/utilities/build/common/front-component-build/utils/unwrap-define-front-component-to-direct-export.d.ts +1 -1
- package/dist/cli.cjs +11 -11
- package/dist/cli.mjs +113 -113
- package/dist/{compile-application-BFhqkVqO.js → compile-application-BPxjs2Co.js} +5 -5
- package/dist/{compile-application-B2LfsDBX.mjs → compile-application-CU3rJlps.mjs} +1380 -1376
- package/dist/define/index.cjs +15 -12
- package/dist/define/index.cjs.map +1 -1
- package/dist/define/index.d.ts +22 -5
- package/dist/define/index.mjs +5555 -5128
- package/dist/define/index.mjs.map +1 -1
- package/dist/front-component/index.cjs +1 -1
- package/dist/front-component/index.cjs.map +1 -1
- package/dist/front-component/index.d.ts +6 -1
- package/dist/front-component/index.mjs +26 -15
- package/dist/front-component/index.mjs.map +1 -1
- package/dist/front-component-renderer/build.cjs +1 -1
- package/dist/front-component-renderer/build.mjs +1 -1
- package/dist/get-front-component-build-plugins-B0LNjbg4.js +883 -0
- package/dist/{get-front-component-build-plugins-QXeU8MwC.mjs → get-front-component-build-plugins-CnwC-jU8.mjs} +7178 -6721
- package/dist/logic-function/index.cjs.map +1 -1
- package/dist/logic-function/index.mjs.map +1 -1
- package/dist/{login-_eABINVq.mjs → login-B-j7rN0L.mjs} +466 -466
- package/dist/{login-DkjpI4jn.js → login-CLfFxyR3.js} +9 -9
- package/dist/operations.cjs +1 -1
- package/dist/operations.mjs +2 -2
- package/dist/{package-DftRfrG7.mjs → package-Blg6y0Gq.mjs} +6 -1
- package/dist/package-sw5GnVdj.js +1 -0
- package/dist/{typecheck-application-DIe_vwjU.mjs → typecheck-application-aR7mCSHB.mjs} +1 -1
- package/package.json +8 -3
- package/dist/get-front-component-build-plugins-BcUjFnki.js +0 -880
- package/dist/package-vtLsH5RS.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["t","i","a","t","e","o","s","e","t"],"sources":["../../../twenty-shared/dist/is-record-object-schema-CwzshFdt.mjs","../../../twenty-shared/dist/logic-function.mjs","../../src/sdk/logic-function/connections/errors/app-connection-auth-failed.error.ts","../../../twenty-shared/dist/application-runtime.mjs","../../src/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util.ts","../../src/sdk/utils/get-application-access-token.ts","../../src/sdk/logic-function/utils/post-graphql-request.util.ts","../../src/sdk/logic-function/connections/get-connection.ts","../../../twenty-shared/dist/capitalize-eyqNaLFT.mjs","../../src/sdk/logic-function/connections/list-connections.ts","../../src/sdk/logic-function/connections/find-connection-for-request.ts","../../src/sdk/logic-function/connections/report-connection-auth-failure.ts","../../src/sdk/logic-function/messaging/message-channel-fields.constant.ts","../../src/sdk/logic-function/messaging/create-message-channel.ts","../../src/sdk/logic-function/messaging/list-message-channels.ts","../../src/sdk/logic-function/messaging/update-message-channel.ts","../../src/sdk/logic-function/messaging/delete-message-channel.ts","../../src/sdk/logic-function/messaging/ingest-messages.ts","../../src/sdk/logic-function/agents/run-agent.ts","../../src/sdk/logic-function/inbox/send-inbox-message.ts","../../src/sdk/logic-function/jobs/enqueue-job.ts","../../src/sdk/logic-function/jobs/enqueue-jobs.ts","../../src/sdk/logic-function/jobs/get-jobs.ts","../../src/sdk/logic-function/timeline/create-timeline-activity.ts","../../src/sdk/logic-function/key-value/kv.ts","../../src/sdk/logic-function/response.ts"],"sourcesContent":["import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/logic-function/is-record-object-schema.ts\nvar t = (t) => (t?.type === \"record\" || t?.type === \"object\") && e(t.objectUniversalIdentifier);\n//#endregion\nexport { t };\n","import { t as e } from \"./isDefined-Dtu5EYqP.mjs\";\nimport { t } from \"./is-record-object-schema-CwzshFdt.mjs\";\nimport { isNonEmptyString as n, isObject as r } from \"@sniptt/guards\";\n//#region src/logic-function/build-tool-input-json-schema.ts\nvar i = (e, t) => {\n\tlet r = n(e) ? t?.(e) : void 0;\n\treturn `Id of the ${n(r) ? r : \"linked\"} record`;\n}, a = (n, o) => {\n\tif (t(n)) return {\n\t\ttype: \"string\",\n\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t};\n\tif (n.type === \"records\") return {\n\t\ttype: \"array\",\n\t\titems: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t\t}\n\t};\n\tlet { objectUniversalIdentifier: s, multiline: c, label: l, items: u, properties: d, additionalProperties: f, ...p } = n, m = { ...p };\n\treturn e(u) && (m.items = a(u, o)), e(d) && (m.properties = Object.fromEntries(Object.entries(d).map(([e, t]) => [e, a(t, o)]))), e(f) && (m.additionalProperties = r(f) ? a(f, o) : f), m;\n}, o = {\n\ttype: \"object\",\n\tproperties: {}\n}, s = (e) => {\n\tlet t = { type: \"unknown\" };\n\tswitch (e.type) {\n\t\tcase \"string\":\n\t\t\tt.type = \"string\";\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\tcase \"integer\":\n\t\t\tt.type = \"number\";\n\t\t\tbreak;\n\t\tcase \"boolean\":\n\t\t\tt.type = \"boolean\";\n\t\t\tbreak;\n\t\tcase \"array\":\n\t\t\tt.type = \"array\", e.items && (t.items = s(e.items));\n\t\t\tbreak;\n\t\tcase \"object\":\n\t\t\tt.type = \"object\", e.properties && (t.properties = Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, s(t)])));\n\t\t\tbreak;\n\t\tcase \"record\":\n\t\t\tt.type = \"record\";\n\t\t\tbreak;\n\t\tcase \"records\":\n\t\t\tt.type = \"records\";\n\t\t\tbreak;\n\t\tdefault: t.type = \"unknown\";\n\t}\n\treturn Array.isArray(e.enum) && (t.enum = e.enum.filter((e) => typeof e == \"string\")), e.multiline === !0 && (t.multiline = !0), n(e.label) && (t.label = e.label), n(e.objectUniversalIdentifier) && (t.objectUniversalIdentifier = e.objectUniversalIdentifier), t;\n}, c = (e) => [s(e)], l = { inputSchema: c({\n\ttype: \"object\",\n\tproperties: {\n\t\ta: { type: \"string\" },\n\t\tb: { type: \"number\" }\n\t}\n}) }, u = async (t) => {\n\tlet { getFunctionInputSchema: n } = await import(\"./get-function-input-schema-GNk3NRLJ.mjs\"), r = n(t)[0];\n\treturn r?.type === \"object\" && e(r.properties) ? {\n\t\ttype: \"object\",\n\t\tproperties: r.properties\n\t} : o;\n}, d = (t) => !e(t) || t === null ? \"unknown\" : typeof t == \"string\" ? \"string\" : typeof t == \"number\" ? \"number\" : typeof t == \"boolean\" ? \"boolean\" : Array.isArray(t) ? \"array\" : \"unknown\", f = (e) => e ? Object.entries(e).reduce((e, [t, n]) => (r(n) && !Array.isArray(n) ? e[t] = {\n\tisLeaf: !1,\n\ttype: \"object\",\n\tlabel: t,\n\tvalue: f(n)\n} : e[t] = {\n\tisLeaf: !0,\n\tvalue: n,\n\ttype: d(n),\n\tlabel: t\n}, e), {}) : {}, p = (e, t) => e ? `${e}.${t}` : t, m = (t, n, r = \"\") => {\n\tlet i = [];\n\tfor (let [a, o] of Object.entries(n)) {\n\t\tlet n = p(r, a), s = t[a];\n\t\tif (!e(s)) {\n\t\t\ti.push(`Missing key \"${n}\" in declared output schema.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (o.isLeaf !== s.isLeaf) {\n\t\t\ti.push(`Type mismatch at \"${n}\": expected ${o.isLeaf ? o.type : \"object\"} but declared ${s.isLeaf ? s.type : \"object\"}.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!o.isLeaf && !s.isLeaf) {\n\t\t\ti.push(...m(s.value, o.value, n));\n\t\t\tcontinue;\n\t\t}\n\t\to.isLeaf && s.isLeaf && o.type !== \"unknown\" && s.type !== \"unknown\" && o.type !== s.type && i.push(`Type mismatch at \"${n}\": expected ${o.type} but declared ${s.type}.`);\n\t}\n\treturn i;\n}, h = [\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"array\",\n\t\"unknown\"\n], g = (e) => h.includes(e), _ = (e, t) => {\n\tlet n = t.label ?? e;\n\treturn t.type === \"record\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"string\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"records\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"array\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"object\" ? {\n\t\tisLeaf: !1,\n\t\ttype: \"object\",\n\t\tlabel: n,\n\t\tvalue: r(t.properties) ? v(t.properties) : {}\n\t} : {\n\t\tisLeaf: !0,\n\t\ttype: g(t.type) ? t.type : \"unknown\",\n\t\tlabel: n,\n\t\tvalue: null\n\t};\n}, v = (e) => Object.entries(e).reduce((e, [t, n]) => (e[t] = _(t, n), e), {}), y = (e) => {\n\tlet t = e[0];\n\treturn t?.type !== \"object\" || !r(t.properties) ? {} : v(t.properties);\n}, b = (e) => e?.type === \"records\" && n(e.objectUniversalIdentifier) || e?.type === \"array\" && t(e?.items), x = \"RetryableLogicFunctionError\", S = class extends Error {\n\tconstructor(e) {\n\t\tsuper(e), this.name = x;\n\t}\n};\n//#endregion\nexport { o as DEFAULT_TOOL_INPUT_SCHEMA, x as RETRYABLE_LOGIC_FUNCTION_ERROR_NAME, S as RetryableLogicFunctionError, l as SEED_WORKFLOW_ACTION_TRIGGER_SETTINGS, a as buildToolInputJsonSchema, u as getInputSchemaFromSourceCode, f as getOutputSchemaFromValue, m as getOutputSchemaMismatchIssues, y as inputSchemaToOutputSchema, b as isRecordArraySchema, t as isRecordObjectSchema, c as jsonSchemaToInputSchema };\n","// Thrown when the platform asks the SDK to operate on a connection whose\n// OAuth refresh failed permanently (`authFailedAt` is set). The end user\n// must reconnect from the app's settings tab — the app cannot recover on\n// its own.\n//\n// `listConnections` filters these out by default (the user can't act on\n// them anyway). `getConnection` throws this when the looked-up connection\n// is in this state, so a stored connection id can be safely retried until\n// it works again.\nexport class AppConnectionAuthFailedError extends Error {\n readonly connectionId: string;\n\n constructor(connectionId: string) {\n super(\n `App connection ${connectionId} requires the user to reconnect ` +\n `(authFailedAt is set). Surface a \"Reconnect\" prompt in your UI.`,\n );\n this.name = 'AppConnectionAuthFailedError';\n this.connectionId = connectionId;\n }\n}\n","//#region src/application-runtime/constants/ConnectionScopeByLegacyVisibility.ts\nvar e = {\n\tuser: \"USER\",\n\tworkspace: \"WORKSPACE\"\n}, t = \"TWENTY_API_KEY\", n = \"TWENTY_API_URL\", r = \"TWENTY_APP_ACCESS_TOKEN\", i = \"TWENTY_APP_APPLICATION_ACCESS_TOKEN\", a = \"TWENTY_FUNCTIONS_URL\", o = {\n\tUSER: \"user\",\n\tWORKSPACE: \"workspace\"\n}, s = [\n\t\"workspace-suspended\",\n\t\"no-subscription\",\n\t\"no-credits\"\n];\n//#endregion\nexport { e as CONNECTION_SCOPE_BY_LEGACY_VISIBILITY, s as CREDIT_UNAVAILABLE_REASONS, t as DEFAULT_API_KEY_NAME, n as DEFAULT_API_URL_NAME, r as DEFAULT_APP_ACCESS_TOKEN_NAME, i as DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME, a as DEFAULT_FUNCTIONS_URL_NAME, o as LEGACY_CONNECTION_VISIBILITY_BY_SCOPE };\n","import { LEGACY_CONNECTION_VISIBILITY_BY_SCOPE } from 'twenty-shared/application-runtime';\n\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const withLegacyConnectionVisibility = (\n connection: Omit<AppConnection, 'visibility'>,\n): AppConnection => ({\n ...connection,\n visibility: LEGACY_CONNECTION_VISIBILITY_BY_SCOPE[connection.scope],\n});\n","import {\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application-runtime';\n\n// These reach the application's own resources, so prefer the application token when the runtime injects one\nexport const getApplicationAccessToken = (): string | undefined =>\n process.env[DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME] ??\n process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application-runtime';\n\nimport { getApplicationAccessToken } from '@/sdk/utils/get-application-access-token';\n\nexport const postGraphqlRequest = async <TVariables, TData>({\n query,\n variables,\n caller,\n}: {\n query: string;\n variables: TVariables;\n caller: string;\n}): Promise<TData> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const accessToken = getApplicationAccessToken();\n\n if (!apiUrl || !accessToken) {\n throw new Error(\n `${caller}() requires the app runtime env vars ` +\n `${DEFAULT_API_URL_NAME} and ${DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME}.`,\n );\n }\n\n const response = await fetch(`${apiUrl}/metadata`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({ query, variables }),\n });\n\n if (!response.ok) {\n throw new Error(\n `${caller}() failed: HTTP ${response.status} ${response.statusText}`,\n );\n }\n\n const body = (await response.json()) as {\n data?: TData;\n errors?: { message: string }[];\n };\n\n if (body.errors && body.errors.length > 0) {\n throw new Error(\n `${caller}() failed: ${body.errors.map((error) => error.message).join(', ')}`,\n );\n }\n\n if (!body.data) {\n throw new Error(`${caller}() failed: response contained no data.`);\n }\n\n return body.data;\n};\n","import { AppConnectionAuthFailedError } from '@/sdk/logic-function/connections/errors/app-connection-auth-failed.error';\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { withLegacyConnectionVisibility } from '@/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_CONNECTION_QUERY = `\n query GetAppConnection($id: ID!) {\n appConnection(id: $id) {\n id\n providerName\n name\n handle\n externalAccountId\n scope\n userWorkspaceId\n workspaceMemberId\n accessToken\n scopes\n authFailedAt\n authFailedReason\n }\n }\n`;\n\nexport const getConnection = async (id: string): Promise<AppConnection> => {\n const { appConnection } = await postGraphqlRequest<\n { id: string },\n { appConnection: Omit<AppConnection, 'visibility'> }\n >({\n query: GET_APP_CONNECTION_QUERY,\n variables: { id },\n caller: 'getConnection',\n });\n\n if (appConnection.authFailedAt !== null) {\n throw new AppConnectionAuthFailedError(appConnection.id);\n }\n\n return withLegacyConnectionVisibility(appConnection);\n};\n","import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/utils/strings/capitalize.ts\nvar t = (t) => e(t) ? t.charAt(0).toUpperCase() + t.slice(1) : \"\";\n//#endregion\nexport { t };\n","import { CONNECTION_SCOPE_BY_LEGACY_VISIBILITY } from 'twenty-shared/application-runtime';\nimport { isDefined } from 'twenty-shared/utils';\n\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { withLegacyConnectionVisibility } from '@/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_CONNECTIONS_QUERY = `\n query ListAppConnections($filter: ListAppConnectionsInput) {\n appConnections(filter: $filter) {\n id\n providerName\n name\n handle\n externalAccountId\n scope\n userWorkspaceId\n workspaceMemberId\n accessToken\n scopes\n authFailedAt\n authFailedReason\n }\n }\n`;\n\nexport type ListConnectionsFilter = {\n providerName?: string;\n userWorkspaceId?: string;\n scope?: AppConnection['scope'];\n /** @deprecated Use `scope` instead. */\n visibility?: AppConnection['visibility'];\n};\n\nexport const listConnections = async ({\n visibility,\n ...filter\n}: ListConnectionsFilter = {}): Promise<AppConnection[]> => {\n const { appConnections } = await postGraphqlRequest<\n { filter: Omit<ListConnectionsFilter, 'visibility'> },\n { appConnections: Omit<AppConnection, 'visibility'>[] }\n >({\n query: LIST_APP_CONNECTIONS_QUERY,\n variables: {\n filter: {\n ...filter,\n scope:\n filter.scope ??\n (isDefined(visibility)\n ? CONNECTION_SCOPE_BY_LEGACY_VISIBILITY[visibility]\n : undefined),\n },\n },\n caller: 'listConnections',\n });\n\n return appConnections.map(withLegacyConnectionVisibility);\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const findConnectionForRequest = (\n connections: AppConnection[],\n event: { userWorkspaceId: string | null },\n): AppConnection | null => {\n if (event.userWorkspaceId !== null) {\n const personal = connections.find(\n (connection) =>\n connection.scope === 'USER' &&\n connection.userWorkspaceId === event.userWorkspaceId,\n );\n\n if (personal) {\n return personal;\n }\n }\n\n const workspaceShared = connections.find(\n (connection) => connection.scope === 'WORKSPACE',\n );\n\n return workspaceShared ?? null;\n};\n","import { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst REPORT_APP_CONNECTION_AUTH_FAILURE_MUTATION = `\n mutation ReportAppConnectionAuthFailure($input: ReportAppConnectionAuthFailureInput!) {\n reportAppConnectionAuthFailure(input: $input)\n }\n`;\n\nexport const reportConnectionAuthFailure = async ({\n connectionId,\n reason,\n}: {\n connectionId: string;\n reason?: string;\n}): Promise<void> => {\n await postGraphqlRequest<\n { input: { id: string; reason?: string } },\n { reportAppConnectionAuthFailure: boolean }\n >({\n query: REPORT_APP_CONNECTION_AUTH_FAILURE_MUTATION,\n variables: { input: { id: connectionId, reason } },\n caller: 'reportConnectionAuthFailure',\n });\n};\n","// Shared by every helper, so channels returned by any of them are interchangeable\nexport const APP_MESSAGE_CHANNEL_SELECTION = `\n id\n handle\n displayName\n visibility\n connectedAccountId\n isSyncEnabled\n`;\n","import { type MessageChannelVisibility } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst CREATE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation CreateAppMessageChannel($input: CreateAppMessageChannelInput!) {\n createAppMessageChannel(input: $input) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type CreateMessageChannelInput = {\n // An app connection id (from getConnection/listConnections); the channel speaks through it and inherits who may see it\n connectedAccountId: string;\n // The account's provider identity; inbound participants matching it are treated as the account itself\n handle: string;\n displayName?: string;\n // Required: decides whether one member's conversations are readable by the whole workspace, and only the app\n // knows how private its messages are ('METADATA' for personal inboxes, 'SHARE_EVERYTHING' for shared ones)\n visibility: MessageChannelVisibility;\n};\n\nexport const createMessageChannel = async (\n input: CreateMessageChannelInput,\n): Promise<AppMessageChannel> => {\n const { createAppMessageChannel } = await postGraphqlRequest<\n { input: CreateMessageChannelInput },\n { createAppMessageChannel: AppMessageChannel }\n >({\n query: CREATE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { input },\n caller: 'createMessageChannel',\n });\n\n return createAppMessageChannel;\n};\n","import { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_MESSAGE_CHANNELS_QUERY = `\n query ListAppMessageChannels($filter: ListAppMessageChannelsInput) {\n appMessageChannels(filter: $filter) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type ListMessageChannelsFilter = {\n connectedAccountId?: string;\n};\n\nexport const listMessageChannels = async (\n filter: ListMessageChannelsFilter = {},\n): Promise<AppMessageChannel[]> => {\n const { appMessageChannels } = await postGraphqlRequest<\n { filter: ListMessageChannelsFilter },\n { appMessageChannels: AppMessageChannel[] }\n >({\n query: LIST_APP_MESSAGE_CHANNELS_QUERY,\n variables: { filter },\n caller: 'listMessageChannels',\n });\n\n return appMessageChannels;\n};\n","import { type MessageChannelVisibility } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst UPDATE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation UpdateAppMessageChannel($input: UpdateAppMessageChannelInput!) {\n updateAppMessageChannel(input: $input) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type UpdateMessageChannelInput = {\n id: string;\n // Omitted leaves the current label untouched; null clears it.\n displayName?: string | null;\n // Changes who can read every message already ingested, not just the ones that follow\n visibility?: MessageChannelVisibility;\n // False pauses ingestion (further ingests are rejected) without deleting the history\n isSyncEnabled?: boolean;\n};\n\nexport const updateMessageChannel = async (\n input: UpdateMessageChannelInput,\n): Promise<AppMessageChannel> => {\n const { updateAppMessageChannel } = await postGraphqlRequest<\n { input: UpdateMessageChannelInput },\n { updateAppMessageChannel: AppMessageChannel }\n >({\n query: UPDATE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { input },\n caller: 'updateMessageChannel',\n });\n\n return updateAppMessageChannel;\n};\n","import { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst DELETE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation DeleteAppMessageChannel($id: UUID!) {\n deleteAppMessageChannel(id: $id) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\n// Also deletes the channel's ingested messages and emptied threads; call from onDisconnect to retire a channel with its credential.\n// To stop ingesting but keep the history, set `isSyncEnabled` to false instead.\nexport const deleteMessageChannel = async (\n id: string,\n): Promise<AppMessageChannel> => {\n const { deleteAppMessageChannel } = await postGraphqlRequest<\n { id: string },\n { deleteAppMessageChannel: AppMessageChannel }\n >({\n query: DELETE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { id },\n caller: 'deleteMessageChannel',\n });\n\n return deleteAppMessageChannel;\n};\n","import {\n type IngestMessage,\n type IngestedMessage,\n} from '@/sdk/logic-function/messaging/types/ingest-message.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst INGEST_APP_MESSAGES_MUTATION = `\n mutation IngestAppMessages($input: IngestAppMessagesInput!) {\n ingestAppMessages(input: $input) {\n messages {\n externalId\n messageId\n messageThreadId\n }\n }\n }\n`;\n\n// Threading, dedup and privacy are handled server-side. At most 100 messages per call (one transaction\n// within one logic-function timeout), so page provider backfills\nexport const ingestMessages = async ({\n messageChannelId,\n messages,\n}: {\n messageChannelId: string;\n messages: IngestMessage[];\n}): Promise<IngestedMessage[]> => {\n const { ingestAppMessages } = await postGraphqlRequest<\n { input: { messageChannelId: string; messages: IngestMessage[] } },\n { ingestAppMessages: { messages: IngestedMessage[] } }\n >({\n query: INGEST_APP_MESSAGES_MUTATION,\n variables: { input: { messageChannelId, messages } },\n caller: 'ingestMessages',\n });\n\n return ingestAppMessages.messages;\n};\n","import {\n type RunAgentInput,\n type RunAgentResult,\n} from 'twenty-shared/application';\nimport { isDefined } from 'twenty-shared/utils';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst RUN_AGENT_MUTATION = `\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n threadId\n status\n result\n error\n success\n }\n }\n`;\n\nexport const runAgent = async ({\n input,\n ...rest\n}: RunAgentInput): Promise<RunAgentResult> => {\n const variables = {\n input: isDefined(input)\n ? {\n ...rest,\n input:\n typeof input === 'string'\n ? [{ role: 'user', content: input }]\n : input,\n }\n : rest,\n };\n\n const { runAgent: result } = await postGraphqlRequest<\n typeof variables,\n { runAgent: RunAgentResult }\n >({\n query: RUN_AGENT_MUTATION,\n variables,\n caller: 'runAgent',\n });\n\n return result;\n};\n","import { type SendInboxMessageResult } from 'twenty-shared/application';\n\nimport { type SendInboxMessageInput } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst SEND_INBOX_MESSAGE_MUTATION = `\n mutation SendInboxMessage($input: SendInboxMessageInput!) {\n sendInboxMessage(input: $input) {\n threadId\n }\n }\n`;\n\nexport const sendInboxMessage = async (\n input: SendInboxMessageInput,\n): Promise<SendInboxMessageResult> => {\n const { sendInboxMessage: result } = await postGraphqlRequest<\n { input: SendInboxMessageInput },\n { sendInboxMessage: SendInboxMessageResult }\n >({\n query: SEND_INBOX_MESSAGE_MUTATION,\n variables: { input },\n caller: 'sendInboxMessage',\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport {\n type EnqueueJobInput,\n type EnqueueJobResult,\n} from 'twenty-shared/application';\n\n/**\n * @deprecated Use `enqueueJobs` instead.\n */\nexport const enqueueJob = async (\n input: EnqueueJobInput,\n): Promise<EnqueueJobResult> => {\n const client = new MetadataApiClient();\n\n const { enqueueJob: result } = await client.mutation({\n enqueueJob: {\n __args: { input },\n enqueued: true,\n logicFunctionUniversalIdentifier: true,\n jobId: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport {\n type EnqueueJobsInput,\n type EnqueueJobsResult,\n} from 'twenty-shared/application';\n\nexport const enqueueJobs = async (\n input: EnqueueJobsInput,\n): Promise<EnqueueJobsResult> => {\n const client = new MetadataApiClient();\n\n const { enqueueJobs: result } = await client.mutation({\n enqueueJobs: {\n __args: { input },\n enqueued: true,\n logicFunctionUniversalIdentifier: true,\n enqueuedJobsCount: true,\n jobIds: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport { type JobStatusResult } from 'twenty-shared/application';\n\nexport const getJobs = async (jobIds: string[]): Promise<JobStatusResult[]> => {\n const client = new MetadataApiClient();\n\n const { getJobs: result } = await client.query({\n getJobs: {\n __args: { jobIds },\n jobId: true,\n state: true,\n attemptsMade: true,\n failedReason: true,\n enqueuedAt: true,\n startedAt: true,\n finishedAt: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport { RestApiClient } from 'twenty-client-sdk/rest';\nimport { capitalize, isDefined } from 'twenty-shared/utils';\nimport { type TimelineActivityTypeSnapshot } from 'twenty-shared/timeline';\n\ntype CreateTimelineActivityBaseInput = {\n timelineActivityTypeUniversalIdentifier: string;\n targetObjectUniversalIdentifier: string;\n targetRecordId: string;\n happensAt?: string;\n properties?: Record<string, unknown>;\n};\n\ntype CreateTimelineActivityLinkedRecordInput =\n | {\n linkedRecordId: string;\n linkedObjectMetadataUniversalIdentifier: string;\n }\n | {\n linkedRecordId?: never;\n linkedObjectMetadataUniversalIdentifier?: never;\n };\n\nexport type CreateTimelineActivityInput = CreateTimelineActivityBaseInput &\n CreateTimelineActivityLinkedRecordInput;\n\nexport type CreatedTimelineActivity = {\n id: string;\n timelineActivityTypeId: string;\n timelineActivityTypeSnapshot: TimelineActivityTypeSnapshot;\n};\n\nconst getObjectMetadataSelection = (universalIdentifiers: string[]) => ({\n __args: {\n paging: {\n first: universalIdentifiers.length,\n },\n filter: {\n universalIdentifier: {\n in: universalIdentifiers,\n },\n },\n },\n edges: {\n node: {\n id: true,\n universalIdentifier: true,\n nameSingular: true,\n },\n },\n});\n\n// Apps address manifest entities by universal identifier; the row stores the installation-specific metadata id\nexport const createTimelineActivity = async ({\n timelineActivityTypeUniversalIdentifier,\n targetObjectUniversalIdentifier,\n linkedObjectMetadataUniversalIdentifier,\n targetRecordId,\n ...input\n}: CreateTimelineActivityInput): Promise<CreatedTimelineActivity> => {\n const requiredObjectUniversalIdentifiers = [\n ...new Set(\n [\n targetObjectUniversalIdentifier,\n linkedObjectMetadataUniversalIdentifier,\n ].filter(isDefined),\n ),\n ];\n const metadataClient = new MetadataApiClient();\n const { timelineActivityTypes, objects } = await metadataClient.query({\n timelineActivityTypes: {\n id: true,\n universalIdentifier: true,\n isActive: true,\n },\n objects: getObjectMetadataSelection(requiredObjectUniversalIdentifiers),\n });\n\n const timelineActivityType = timelineActivityTypes.find(\n ({ universalIdentifier }) =>\n universalIdentifier === timelineActivityTypeUniversalIdentifier,\n );\n\n if (!isDefined(timelineActivityType)) {\n throw new Error(\n `Timeline activity type ${timelineActivityTypeUniversalIdentifier} is not installed`,\n );\n }\n\n if (!timelineActivityType.isActive) {\n throw new Error(\n `Timeline activity type ${timelineActivityTypeUniversalIdentifier} is inactive`,\n );\n }\n\n const objectMetadataByUniversalIdentifier = new Map(\n objects.edges.map(({ node }) => [node.universalIdentifier, node]),\n );\n\n const targetObject = objectMetadataByUniversalIdentifier.get(\n targetObjectUniversalIdentifier,\n );\n\n if (!isDefined(targetObject)) {\n throw new Error(\n `Timeline activity target object ${targetObjectUniversalIdentifier} is not installed`,\n );\n }\n\n const targetFieldName = `target${capitalize(targetObject.nameSingular)}Id`;\n const linkedObject = isDefined(linkedObjectMetadataUniversalIdentifier)\n ? objectMetadataByUniversalIdentifier.get(\n linkedObjectMetadataUniversalIdentifier,\n )\n : undefined;\n\n if (\n isDefined(linkedObjectMetadataUniversalIdentifier) &&\n !isDefined(linkedObject)\n ) {\n throw new Error(\n `Timeline activity linked object ${linkedObjectMetadataUniversalIdentifier} is not installed`,\n );\n }\n\n const response = await new RestApiClient().post<{\n data: { createTimelineActivity: CreatedTimelineActivity };\n }>('/rest/timelineActivities', {\n ...input,\n timelineActivityTypeId: timelineActivityType.id,\n linkedObjectMetadataId: linkedObject?.id,\n [targetFieldName]: targetRecordId,\n });\n\n return response.data.createTimelineActivity;\n};\n","import {\n type AppKeyValue,\n type AppKeyValueScope,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_KEY_VALUE_QUERY = `\n query GetAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n appKeyValue(key: $key, scope: $scope) {\n key\n value\n scope\n }\n }\n`;\n\nconst SET_APP_KEY_VALUE_MUTATION = `\n mutation SetAppKeyValue($input: SetAppKeyValueInput!) {\n setAppKeyValue(input: $input) {\n key\n value\n scope\n }\n }\n`;\n\nconst DELETE_APP_KEY_VALUE_MUTATION = `\n mutation DeleteAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n deleteAppKeyValue(key: $key, scope: $scope)\n }\n`;\n\nconst DEFAULT_APP_KEY_VALUE_SCOPE: AppKeyValueScope = 'WORKSPACE';\n\ntype KvOptions = {\n scope?: AppKeyValueScope;\n};\n\nexport const kv = {\n async get<TValue = unknown>(\n key: string,\n options?: KvOptions,\n ): Promise<TValue | null> {\n const { appKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { appKeyValue: AppKeyValue | null }\n >({\n query: GET_APP_KEY_VALUE_QUERY,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.get',\n });\n\n return (appKeyValue?.value ?? null) as TValue | null;\n },\n\n async set<TValue>(\n key: string,\n value: TValue,\n options?: KvOptions,\n ): Promise<void> {\n await postGraphqlRequest<\n {\n input: { key: string; value: TValue; scope: AppKeyValueScope };\n },\n { setAppKeyValue: AppKeyValue }\n >({\n query: SET_APP_KEY_VALUE_MUTATION,\n variables: {\n input: {\n key,\n value,\n scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE,\n },\n },\n caller: 'kv.set',\n });\n },\n\n async delete(key: string, options?: KvOptions): Promise<boolean> {\n const { deleteAppKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { deleteAppKeyValue: boolean }\n >({\n query: DELETE_APP_KEY_VALUE_MUTATION,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.delete',\n });\n\n return deleteAppKeyValue;\n },\n};\n","import { type LogicFunctionHttpResponse } from 'twenty-shared/types';\n\nexport type ResponseInit = {\n status?: number;\n headers?: Record<string, string>;\n};\n\nexport class Response implements LogicFunctionHttpResponse {\n readonly __twentyHttpResponse = true as const;\n readonly body: unknown;\n readonly status?: number;\n readonly headers?: Record<string, string>;\n\n constructor(body: unknown, init?: ResponseInit) {\n this.body = body;\n this.status = init?.status;\n this.headers = init?.headers;\n }\n}\n"],"mappings":"mOAEA,IAAIA,EAAK,IAAO,GAAG,OAAS,UAAY,GAAG,OAAS,YAAA,EAAA,EAAA,kBAAe,EAAE,yBAAyB,ECE1FC,GAAK,EAAG,IAAM,CACjB,IAAI,GAAA,EAAA,EAAA,kBAAM,CAAC,EAAI,IAAI,CAAC,EAAI,IAAK,GAC7B,MAAO,cAAA,EAAA,EAAA,kBAAe,CAAC,EAAI,EAAI,SAAS,QACzC,EAAGC,GAAK,EAAG,IAAM,CAChB,GAAIC,EAAE,CAAC,EAAG,MAAO,CAChB,KAAM,SACN,YAAaF,EAAE,EAAE,0BAA2B,CAAC,CAC9C,EACA,GAAI,EAAE,OAAS,UAAW,MAAO,CAChC,KAAM,QACN,MAAO,CACN,KAAM,SACN,YAAaA,EAAE,EAAE,0BAA2B,CAAC,CAC9C,CACD,EACA,GAAI,CAAE,0BAA2B,EAAG,UAAW,EAAG,MAAO,EAAG,MAAO,EAAG,WAAY,EAAG,qBAAsB,EAAG,GAAG,GAAM,EAAG,EAAI,CAAE,GAAG,CAAE,EACrI,OAAOG,EAAAA,EAAE,CAAC,IAAM,EAAE,MAAQF,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AAoC,IAClC,CACF,EACA,IAAA,GAEJ,GACE,EAAA,EAAU,CAAuC,GACjD,CAAC,EAAA,EAAU,CAAY,EAEvB,MAAU,MACR,mCAAmC,EAAwC,kBAC7E,EAYF,OAAO,MATgB,IAAI,EAAA,cAAc,EAAE,KAExC,2BAA4B,CAC7B,GAAG,EACH,uBAAwB,EAAqB,GAC7C,uBAAwB,GAAc,IACrC,GAAkB,CACrB,CAAC,GAEe,KAAK,sBACvB,EChIM,GAA0B;;;;;;;;EAU1B,GAA6B;;;;;;;;EAU7B,GAAgC;;;;EAMhC,EAAgD,YAMzC,GAAK,CAChB,MAAM,IACJ,EACA,EACwB,CACxB,GAAM,CAAE,eAAgB,MAAM,EAG5B,CACA,MAAO,GACP,UAAW,CAAE,MAAK,MAAO,GAAS,OAAS,CAA4B,EACvE,OAAQ,QACV,CAAC,EAED,OAAQ,GAAa,OAAS,IAChC,EAEA,MAAM,IACJ,EACA,EACA,EACe,CACf,MAAM,EAKJ,CACA,MAAO,GACP,UAAW,CACT,MAAO,CACL,MACA,QACA,MAAO,GAAS,OAAS,CAC3B,CACF,EACA,OAAQ,QACV,CAAC,CACH,EAEA,MAAM,OAAO,EAAa,EAAuC,CAC/D,GAAM,CAAE,qBAAsB,MAAM,EAGlC,CACA,MAAO,GACP,UAAW,CAAE,MAAK,MAAO,GAAS,OAAS,CAA4B,EACvE,OAAQ,WACV,CAAC,EAED,OAAO,CACT,CACF,ECpFa,GAAb,KAA2D,CAMzD,YAAY,EAAe,EAAqB,2BALhB,GAM9B,KAAK,KAAO,EACZ,KAAK,OAAS,GAAM,OACpB,KAAK,QAAU,GAAM,OACvB,CACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["t","i","a","t","e","o","s","e","t","n"],"sources":["../../../twenty-shared/dist/is-record-object-schema-CwzshFdt.mjs","../../../twenty-shared/dist/logic-function.mjs","../../src/sdk/logic-function/connections/errors/app-connection-auth-failed.error.ts","../../../twenty-shared/dist/application-runtime.mjs","../../src/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util.ts","../../src/sdk/utils/get-application-access-token.ts","../../src/sdk/logic-function/utils/post-graphql-request.util.ts","../../src/sdk/logic-function/connections/get-connection.ts","../../../twenty-shared/dist/capitalize-DFPVt1IM.mjs","../../src/sdk/logic-function/connections/list-connections.ts","../../src/sdk/logic-function/connections/find-connection-for-request.ts","../../src/sdk/logic-function/connections/report-connection-auth-failure.ts","../../src/sdk/logic-function/messaging/message-channel-fields.constant.ts","../../src/sdk/logic-function/messaging/create-message-channel.ts","../../src/sdk/logic-function/messaging/list-message-channels.ts","../../src/sdk/logic-function/messaging/update-message-channel.ts","../../src/sdk/logic-function/messaging/delete-message-channel.ts","../../src/sdk/logic-function/messaging/ingest-messages.ts","../../src/sdk/logic-function/agents/run-agent.ts","../../src/sdk/logic-function/inbox/send-inbox-message.ts","../../src/sdk/logic-function/jobs/enqueue-job.ts","../../src/sdk/logic-function/jobs/enqueue-jobs.ts","../../src/sdk/logic-function/jobs/get-jobs.ts","../../src/sdk/logic-function/timeline/create-timeline-activity.ts","../../src/sdk/logic-function/key-value/kv.ts","../../src/sdk/logic-function/response.ts"],"sourcesContent":["import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/logic-function/is-record-object-schema.ts\nvar t = (t) => (t?.type === \"record\" || t?.type === \"object\") && e(t.objectUniversalIdentifier);\n//#endregion\nexport { t };\n","import { t as e } from \"./isDefined-Dtu5EYqP.mjs\";\nimport { t } from \"./is-record-object-schema-CwzshFdt.mjs\";\nimport { isNonEmptyString as n, isObject as r } from \"@sniptt/guards\";\n//#region src/logic-function/build-tool-input-json-schema.ts\nvar i = (e, t) => {\n\tlet r = n(e) ? t?.(e) : void 0;\n\treturn `Id of the ${n(r) ? r : \"linked\"} record`;\n}, a = (n, o) => {\n\tif (t(n)) return {\n\t\ttype: \"string\",\n\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t};\n\tif (n.type === \"records\") return {\n\t\ttype: \"array\",\n\t\titems: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t\t}\n\t};\n\tlet { objectUniversalIdentifier: s, multiline: c, label: l, items: u, properties: d, additionalProperties: f, ...p } = n, m = { ...p };\n\treturn e(u) && (m.items = a(u, o)), e(d) && (m.properties = Object.fromEntries(Object.entries(d).map(([e, t]) => [e, a(t, o)]))), e(f) && (m.additionalProperties = r(f) ? a(f, o) : f), m;\n}, o = {\n\ttype: \"object\",\n\tproperties: {}\n}, s = (e) => {\n\tlet t = { type: \"unknown\" };\n\tswitch (e.type) {\n\t\tcase \"string\":\n\t\t\tt.type = \"string\";\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\tcase \"integer\":\n\t\t\tt.type = \"number\";\n\t\t\tbreak;\n\t\tcase \"boolean\":\n\t\t\tt.type = \"boolean\";\n\t\t\tbreak;\n\t\tcase \"array\":\n\t\t\tt.type = \"array\", e.items && (t.items = s(e.items));\n\t\t\tbreak;\n\t\tcase \"object\":\n\t\t\tt.type = \"object\", e.properties && (t.properties = Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, s(t)])));\n\t\t\tbreak;\n\t\tcase \"record\":\n\t\t\tt.type = \"record\";\n\t\t\tbreak;\n\t\tcase \"records\":\n\t\t\tt.type = \"records\";\n\t\t\tbreak;\n\t\tdefault: t.type = \"unknown\";\n\t}\n\treturn Array.isArray(e.enum) && (t.enum = e.enum.filter((e) => typeof e == \"string\")), e.multiline === !0 && (t.multiline = !0), n(e.label) && (t.label = e.label), n(e.objectUniversalIdentifier) && (t.objectUniversalIdentifier = e.objectUniversalIdentifier), t;\n}, c = (e) => [s(e)], l = { inputSchema: c({\n\ttype: \"object\",\n\tproperties: {\n\t\ta: { type: \"string\" },\n\t\tb: { type: \"number\" }\n\t}\n}) }, u = async (t) => {\n\tlet { getFunctionInputSchema: n } = await import(\"./get-function-input-schema-GNk3NRLJ.mjs\"), r = n(t)[0];\n\treturn r?.type === \"object\" && e(r.properties) ? {\n\t\ttype: \"object\",\n\t\tproperties: r.properties\n\t} : o;\n}, d = (t) => !e(t) || t === null ? \"unknown\" : typeof t == \"string\" ? \"string\" : typeof t == \"number\" ? \"number\" : typeof t == \"boolean\" ? \"boolean\" : Array.isArray(t) ? \"array\" : \"unknown\", f = (e) => e ? Object.entries(e).reduce((e, [t, n]) => (r(n) && !Array.isArray(n) ? e[t] = {\n\tisLeaf: !1,\n\ttype: \"object\",\n\tlabel: t,\n\tvalue: f(n)\n} : e[t] = {\n\tisLeaf: !0,\n\tvalue: n,\n\ttype: d(n),\n\tlabel: t\n}, e), {}) : {}, p = (e, t) => e ? `${e}.${t}` : t, m = (t, n, r = \"\") => {\n\tlet i = [];\n\tfor (let [a, o] of Object.entries(n)) {\n\t\tlet n = p(r, a), s = t[a];\n\t\tif (!e(s)) {\n\t\t\ti.push(`Missing key \"${n}\" in declared output schema.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (o.isLeaf !== s.isLeaf) {\n\t\t\ti.push(`Type mismatch at \"${n}\": expected ${o.isLeaf ? o.type : \"object\"} but declared ${s.isLeaf ? s.type : \"object\"}.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!o.isLeaf && !s.isLeaf) {\n\t\t\ti.push(...m(s.value, o.value, n));\n\t\t\tcontinue;\n\t\t}\n\t\to.isLeaf && s.isLeaf && o.type !== \"unknown\" && s.type !== \"unknown\" && o.type !== s.type && i.push(`Type mismatch at \"${n}\": expected ${o.type} but declared ${s.type}.`);\n\t}\n\treturn i;\n}, h = [\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"array\",\n\t\"unknown\"\n], g = (e) => h.includes(e), _ = (e, t) => {\n\tlet n = t.label ?? e;\n\treturn t.type === \"record\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"string\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"records\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"array\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"object\" ? {\n\t\tisLeaf: !1,\n\t\ttype: \"object\",\n\t\tlabel: n,\n\t\tvalue: r(t.properties) ? v(t.properties) : {}\n\t} : {\n\t\tisLeaf: !0,\n\t\ttype: g(t.type) ? t.type : \"unknown\",\n\t\tlabel: n,\n\t\tvalue: null\n\t};\n}, v = (e) => Object.entries(e).reduce((e, [t, n]) => (e[t] = _(t, n), e), {}), y = (e) => {\n\tlet t = e[0];\n\treturn t?.type !== \"object\" || !r(t.properties) ? {} : v(t.properties);\n}, b = (e) => e?.type === \"records\" && n(e.objectUniversalIdentifier) || e?.type === \"array\" && t(e?.items), x = \"RetryableLogicFunctionError\", S = class extends Error {\n\tconstructor(e) {\n\t\tsuper(e), this.name = x;\n\t}\n};\n//#endregion\nexport { o as DEFAULT_TOOL_INPUT_SCHEMA, x as RETRYABLE_LOGIC_FUNCTION_ERROR_NAME, S as RetryableLogicFunctionError, l as SEED_WORKFLOW_ACTION_TRIGGER_SETTINGS, a as buildToolInputJsonSchema, u as getInputSchemaFromSourceCode, f as getOutputSchemaFromValue, m as getOutputSchemaMismatchIssues, y as inputSchemaToOutputSchema, b as isRecordArraySchema, t as isRecordObjectSchema, c as jsonSchemaToInputSchema };\n","// Thrown when the platform asks the SDK to operate on a connection whose\n// OAuth refresh failed permanently (`authFailedAt` is set). The end user\n// must reconnect from the app's settings tab — the app cannot recover on\n// its own.\n//\n// `listConnections` filters these out by default (the user can't act on\n// them anyway). `getConnection` throws this when the looked-up connection\n// is in this state, so a stored connection id can be safely retried until\n// it works again.\nexport class AppConnectionAuthFailedError extends Error {\n readonly connectionId: string;\n\n constructor(connectionId: string) {\n super(\n `App connection ${connectionId} requires the user to reconnect ` +\n `(authFailedAt is set). Surface a \"Reconnect\" prompt in your UI.`,\n );\n this.name = 'AppConnectionAuthFailedError';\n this.connectionId = connectionId;\n }\n}\n","//#region src/application-runtime/constants/ConnectionScopeByLegacyVisibility.ts\nvar e = {\n\tuser: \"USER\",\n\tworkspace: \"WORKSPACE\"\n}, t = \"TWENTY_API_KEY\", n = \"TWENTY_API_URL\", r = \"TWENTY_APP_ACCESS_TOKEN\", i = \"TWENTY_APP_APPLICATION_ACCESS_TOKEN\", a = \"TWENTY_FUNCTIONS_URL\", o = {\n\tUSER: \"user\",\n\tWORKSPACE: \"workspace\"\n}, s = [\n\t\"workspace-suspended\",\n\t\"no-subscription\",\n\t\"no-credits\"\n];\n//#endregion\nexport { e as CONNECTION_SCOPE_BY_LEGACY_VISIBILITY, s as CREDIT_UNAVAILABLE_REASONS, t as DEFAULT_API_KEY_NAME, n as DEFAULT_API_URL_NAME, r as DEFAULT_APP_ACCESS_TOKEN_NAME, i as DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME, a as DEFAULT_FUNCTIONS_URL_NAME, o as LEGACY_CONNECTION_VISIBILITY_BY_SCOPE };\n","import { LEGACY_CONNECTION_VISIBILITY_BY_SCOPE } from 'twenty-shared/application-runtime';\n\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const withLegacyConnectionVisibility = (\n connection: Omit<AppConnection, 'visibility'>,\n): AppConnection => ({\n ...connection,\n visibility: LEGACY_CONNECTION_VISIBILITY_BY_SCOPE[connection.scope],\n});\n","import {\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application-runtime';\n\n// These reach the application's own resources, so prefer the application token when the runtime injects one\nexport const getApplicationAccessToken = (): string | undefined =>\n process.env[DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME] ??\n process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application-runtime';\n\nimport { getApplicationAccessToken } from '@/sdk/utils/get-application-access-token';\n\nexport const postGraphqlRequest = async <TVariables, TData>({\n query,\n variables,\n caller,\n}: {\n query: string;\n variables: TVariables;\n caller: string;\n}): Promise<TData> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const accessToken = getApplicationAccessToken();\n\n if (!apiUrl || !accessToken) {\n throw new Error(\n `${caller}() requires the app runtime env vars ` +\n `${DEFAULT_API_URL_NAME} and ${DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME}.`,\n );\n }\n\n const response = await fetch(`${apiUrl}/metadata`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({ query, variables }),\n });\n\n if (!response.ok) {\n throw new Error(\n `${caller}() failed: HTTP ${response.status} ${response.statusText}`,\n );\n }\n\n const body = (await response.json()) as {\n data?: TData;\n errors?: { message: string }[];\n };\n\n if (body.errors && body.errors.length > 0) {\n throw new Error(\n `${caller}() failed: ${body.errors.map((error) => error.message).join(', ')}`,\n );\n }\n\n if (!body.data) {\n throw new Error(`${caller}() failed: response contained no data.`);\n }\n\n return body.data;\n};\n","import { AppConnectionAuthFailedError } from '@/sdk/logic-function/connections/errors/app-connection-auth-failed.error';\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { withLegacyConnectionVisibility } from '@/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_CONNECTION_QUERY = `\n query GetAppConnection($id: ID!) {\n appConnection(id: $id) {\n id\n providerName\n name\n handle\n externalAccountId\n scope\n userWorkspaceId\n workspaceMemberId\n accessToken\n scopes\n authFailedAt\n authFailedReason\n }\n }\n`;\n\nexport const getConnection = async (id: string): Promise<AppConnection> => {\n const { appConnection } = await postGraphqlRequest<\n { id: string },\n { appConnection: Omit<AppConnection, 'visibility'> }\n >({\n query: GET_APP_CONNECTION_QUERY,\n variables: { id },\n caller: 'getConnection',\n });\n\n if (appConnection.authFailedAt !== null) {\n throw new AppConnectionAuthFailedError(appConnection.id);\n }\n\n return withLegacyConnectionVisibility(appConnection);\n};\n","import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/i18n/do-not-translate.ts\nvar t = (e) => e, n = (t) => e(t) ? t.charAt(0).toUpperCase() + t.slice(1) : \"\";\n//#endregion\nexport { t as n, n as t };\n","import { CONNECTION_SCOPE_BY_LEGACY_VISIBILITY } from 'twenty-shared/application-runtime';\nimport { isDefined } from 'twenty-shared/utils';\n\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { withLegacyConnectionVisibility } from '@/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_CONNECTIONS_QUERY = `\n query ListAppConnections($filter: ListAppConnectionsInput) {\n appConnections(filter: $filter) {\n id\n providerName\n name\n handle\n externalAccountId\n scope\n userWorkspaceId\n workspaceMemberId\n accessToken\n scopes\n authFailedAt\n authFailedReason\n }\n }\n`;\n\nexport type ListConnectionsFilter = {\n providerName?: string;\n userWorkspaceId?: string;\n scope?: AppConnection['scope'];\n /** @deprecated Use `scope` instead. */\n visibility?: AppConnection['visibility'];\n};\n\nexport const listConnections = async ({\n visibility,\n ...filter\n}: ListConnectionsFilter = {}): Promise<AppConnection[]> => {\n const { appConnections } = await postGraphqlRequest<\n { filter: Omit<ListConnectionsFilter, 'visibility'> },\n { appConnections: Omit<AppConnection, 'visibility'>[] }\n >({\n query: LIST_APP_CONNECTIONS_QUERY,\n variables: {\n filter: {\n ...filter,\n scope:\n filter.scope ??\n (isDefined(visibility)\n ? CONNECTION_SCOPE_BY_LEGACY_VISIBILITY[visibility]\n : undefined),\n },\n },\n caller: 'listConnections',\n });\n\n return appConnections.map(withLegacyConnectionVisibility);\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const findConnectionForRequest = (\n connections: AppConnection[],\n event: { userWorkspaceId: string | null },\n): AppConnection | null => {\n if (event.userWorkspaceId !== null) {\n const personal = connections.find(\n (connection) =>\n connection.scope === 'USER' &&\n connection.userWorkspaceId === event.userWorkspaceId,\n );\n\n if (personal) {\n return personal;\n }\n }\n\n const workspaceShared = connections.find(\n (connection) => connection.scope === 'WORKSPACE',\n );\n\n return workspaceShared ?? null;\n};\n","import { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst REPORT_APP_CONNECTION_AUTH_FAILURE_MUTATION = `\n mutation ReportAppConnectionAuthFailure($input: ReportAppConnectionAuthFailureInput!) {\n reportAppConnectionAuthFailure(input: $input)\n }\n`;\n\nexport const reportConnectionAuthFailure = async ({\n connectionId,\n reason,\n}: {\n connectionId: string;\n reason?: string;\n}): Promise<void> => {\n await postGraphqlRequest<\n { input: { id: string; reason?: string } },\n { reportAppConnectionAuthFailure: boolean }\n >({\n query: REPORT_APP_CONNECTION_AUTH_FAILURE_MUTATION,\n variables: { input: { id: connectionId, reason } },\n caller: 'reportConnectionAuthFailure',\n });\n};\n","// Shared by every helper, so channels returned by any of them are interchangeable\nexport const APP_MESSAGE_CHANNEL_SELECTION = `\n id\n handle\n displayName\n visibility\n connectedAccountId\n isSyncEnabled\n`;\n","import { type MessageChannelVisibility } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst CREATE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation CreateAppMessageChannel($input: CreateAppMessageChannelInput!) {\n createAppMessageChannel(input: $input) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type CreateMessageChannelInput = {\n // An app connection id (from getConnection/listConnections); the channel speaks through it and inherits who may see it\n connectedAccountId: string;\n // The account's provider identity; inbound participants matching it are treated as the account itself\n handle: string;\n displayName?: string;\n // Required: decides whether one member's conversations are readable by the whole workspace, and only the app\n // knows how private its messages are ('METADATA' for personal inboxes, 'SHARE_EVERYTHING' for shared ones)\n visibility: MessageChannelVisibility;\n};\n\nexport const createMessageChannel = async (\n input: CreateMessageChannelInput,\n): Promise<AppMessageChannel> => {\n const { createAppMessageChannel } = await postGraphqlRequest<\n { input: CreateMessageChannelInput },\n { createAppMessageChannel: AppMessageChannel }\n >({\n query: CREATE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { input },\n caller: 'createMessageChannel',\n });\n\n return createAppMessageChannel;\n};\n","import { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_MESSAGE_CHANNELS_QUERY = `\n query ListAppMessageChannels($filter: ListAppMessageChannelsInput) {\n appMessageChannels(filter: $filter) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type ListMessageChannelsFilter = {\n connectedAccountId?: string;\n};\n\nexport const listMessageChannels = async (\n filter: ListMessageChannelsFilter = {},\n): Promise<AppMessageChannel[]> => {\n const { appMessageChannels } = await postGraphqlRequest<\n { filter: ListMessageChannelsFilter },\n { appMessageChannels: AppMessageChannel[] }\n >({\n query: LIST_APP_MESSAGE_CHANNELS_QUERY,\n variables: { filter },\n caller: 'listMessageChannels',\n });\n\n return appMessageChannels;\n};\n","import { type MessageChannelVisibility } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst UPDATE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation UpdateAppMessageChannel($input: UpdateAppMessageChannelInput!) {\n updateAppMessageChannel(input: $input) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type UpdateMessageChannelInput = {\n id: string;\n // Omitted leaves the current label untouched; null clears it.\n displayName?: string | null;\n // Changes who can read every message already ingested, not just the ones that follow\n visibility?: MessageChannelVisibility;\n // False pauses ingestion (further ingests are rejected) without deleting the history\n isSyncEnabled?: boolean;\n};\n\nexport const updateMessageChannel = async (\n input: UpdateMessageChannelInput,\n): Promise<AppMessageChannel> => {\n const { updateAppMessageChannel } = await postGraphqlRequest<\n { input: UpdateMessageChannelInput },\n { updateAppMessageChannel: AppMessageChannel }\n >({\n query: UPDATE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { input },\n caller: 'updateMessageChannel',\n });\n\n return updateAppMessageChannel;\n};\n","import { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst DELETE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation DeleteAppMessageChannel($id: UUID!) {\n deleteAppMessageChannel(id: $id) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\n// Also deletes the channel's ingested messages and emptied threads; call from onDisconnect to retire a channel with its credential.\n// To stop ingesting but keep the history, set `isSyncEnabled` to false instead.\nexport const deleteMessageChannel = async (\n id: string,\n): Promise<AppMessageChannel> => {\n const { deleteAppMessageChannel } = await postGraphqlRequest<\n { id: string },\n { deleteAppMessageChannel: AppMessageChannel }\n >({\n query: DELETE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { id },\n caller: 'deleteMessageChannel',\n });\n\n return deleteAppMessageChannel;\n};\n","import {\n type IngestMessage,\n type IngestedMessage,\n} from '@/sdk/logic-function/messaging/types/ingest-message.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst INGEST_APP_MESSAGES_MUTATION = `\n mutation IngestAppMessages($input: IngestAppMessagesInput!) {\n ingestAppMessages(input: $input) {\n messages {\n externalId\n messageId\n messageThreadId\n }\n }\n }\n`;\n\n// Threading, dedup and privacy are handled server-side. At most 100 messages per call (one transaction\n// within one logic-function timeout), so page provider backfills\nexport const ingestMessages = async ({\n messageChannelId,\n messages,\n}: {\n messageChannelId: string;\n messages: IngestMessage[];\n}): Promise<IngestedMessage[]> => {\n const { ingestAppMessages } = await postGraphqlRequest<\n { input: { messageChannelId: string; messages: IngestMessage[] } },\n { ingestAppMessages: { messages: IngestedMessage[] } }\n >({\n query: INGEST_APP_MESSAGES_MUTATION,\n variables: { input: { messageChannelId, messages } },\n caller: 'ingestMessages',\n });\n\n return ingestAppMessages.messages;\n};\n","import {\n type RunAgentInput,\n type RunAgentResult,\n} from 'twenty-shared/application';\nimport { isDefined } from 'twenty-shared/utils';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst RUN_AGENT_MUTATION = `\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n threadId\n status\n result\n error\n success\n }\n }\n`;\n\nexport const runAgent = async ({\n input,\n ...rest\n}: RunAgentInput): Promise<RunAgentResult> => {\n const variables = {\n input: isDefined(input)\n ? {\n ...rest,\n input:\n typeof input === 'string'\n ? [{ role: 'user', content: input }]\n : input,\n }\n : rest,\n };\n\n const { runAgent: result } = await postGraphqlRequest<\n typeof variables,\n { runAgent: RunAgentResult }\n >({\n query: RUN_AGENT_MUTATION,\n variables,\n caller: 'runAgent',\n });\n\n return result;\n};\n","import { type SendInboxMessageResult } from 'twenty-shared/application';\n\nimport { type SendInboxMessageInput } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst SEND_INBOX_MESSAGE_MUTATION = `\n mutation SendInboxMessage($input: SendInboxMessageInput!) {\n sendInboxMessage(input: $input) {\n threadId\n }\n }\n`;\n\nexport const sendInboxMessage = async (\n input: SendInboxMessageInput,\n): Promise<SendInboxMessageResult> => {\n const { sendInboxMessage: result } = await postGraphqlRequest<\n { input: SendInboxMessageInput },\n { sendInboxMessage: SendInboxMessageResult }\n >({\n query: SEND_INBOX_MESSAGE_MUTATION,\n variables: { input },\n caller: 'sendInboxMessage',\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport {\n type EnqueueJobInput,\n type EnqueueJobResult,\n} from 'twenty-shared/application';\n\n/**\n * @deprecated Use `enqueueJobs` instead.\n */\nexport const enqueueJob = async (\n input: EnqueueJobInput,\n): Promise<EnqueueJobResult> => {\n const client = new MetadataApiClient();\n\n const { enqueueJob: result } = await client.mutation({\n enqueueJob: {\n __args: { input },\n enqueued: true,\n logicFunctionUniversalIdentifier: true,\n jobId: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport {\n type EnqueueJobsInput,\n type EnqueueJobsResult,\n} from 'twenty-shared/application';\n\nexport const enqueueJobs = async (\n input: EnqueueJobsInput,\n): Promise<EnqueueJobsResult> => {\n const client = new MetadataApiClient();\n\n const { enqueueJobs: result } = await client.mutation({\n enqueueJobs: {\n __args: { input },\n enqueued: true,\n logicFunctionUniversalIdentifier: true,\n enqueuedJobsCount: true,\n jobIds: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport { type JobStatusResult } from 'twenty-shared/application';\n\nexport const getJobs = async (jobIds: string[]): Promise<JobStatusResult[]> => {\n const client = new MetadataApiClient();\n\n const { getJobs: result } = await client.query({\n getJobs: {\n __args: { jobIds },\n jobId: true,\n state: true,\n attemptsMade: true,\n failedReason: true,\n enqueuedAt: true,\n startedAt: true,\n finishedAt: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport { RestApiClient } from 'twenty-client-sdk/rest';\nimport { capitalize, isDefined } from 'twenty-shared/utils';\nimport { type TimelineActivityTypeSnapshot } from 'twenty-shared/timeline';\n\ntype CreateTimelineActivityBaseInput = {\n timelineActivityTypeUniversalIdentifier: string;\n targetObjectUniversalIdentifier: string;\n targetRecordId: string;\n happensAt?: string;\n properties?: Record<string, unknown>;\n};\n\ntype CreateTimelineActivityLinkedRecordInput =\n | {\n linkedRecordId: string;\n linkedObjectMetadataUniversalIdentifier: string;\n }\n | {\n linkedRecordId?: never;\n linkedObjectMetadataUniversalIdentifier?: never;\n };\n\nexport type CreateTimelineActivityInput = CreateTimelineActivityBaseInput &\n CreateTimelineActivityLinkedRecordInput;\n\nexport type CreatedTimelineActivity = {\n id: string;\n timelineActivityTypeId: string;\n timelineActivityTypeSnapshot: TimelineActivityTypeSnapshot;\n};\n\nconst getObjectMetadataSelection = (universalIdentifiers: string[]) => ({\n __args: {\n paging: {\n first: universalIdentifiers.length,\n },\n filter: {\n universalIdentifier: {\n in: universalIdentifiers,\n },\n },\n },\n edges: {\n node: {\n id: true,\n universalIdentifier: true,\n nameSingular: true,\n },\n },\n});\n\n// Apps address manifest entities by universal identifier; the row stores the installation-specific metadata id\nexport const createTimelineActivity = async ({\n timelineActivityTypeUniversalIdentifier,\n targetObjectUniversalIdentifier,\n linkedObjectMetadataUniversalIdentifier,\n targetRecordId,\n ...input\n}: CreateTimelineActivityInput): Promise<CreatedTimelineActivity> => {\n const requiredObjectUniversalIdentifiers = [\n ...new Set(\n [\n targetObjectUniversalIdentifier,\n linkedObjectMetadataUniversalIdentifier,\n ].filter(isDefined),\n ),\n ];\n const metadataClient = new MetadataApiClient();\n const { timelineActivityTypes, objects } = await metadataClient.query({\n timelineActivityTypes: {\n id: true,\n universalIdentifier: true,\n isActive: true,\n },\n objects: getObjectMetadataSelection(requiredObjectUniversalIdentifiers),\n });\n\n const timelineActivityType = timelineActivityTypes.find(\n ({ universalIdentifier }) =>\n universalIdentifier === timelineActivityTypeUniversalIdentifier,\n );\n\n if (!isDefined(timelineActivityType)) {\n throw new Error(\n `Timeline activity type ${timelineActivityTypeUniversalIdentifier} is not installed`,\n );\n }\n\n if (!timelineActivityType.isActive) {\n throw new Error(\n `Timeline activity type ${timelineActivityTypeUniversalIdentifier} is inactive`,\n );\n }\n\n const objectMetadataByUniversalIdentifier = new Map(\n objects.edges.map(({ node }) => [node.universalIdentifier, node]),\n );\n\n const targetObject = objectMetadataByUniversalIdentifier.get(\n targetObjectUniversalIdentifier,\n );\n\n if (!isDefined(targetObject)) {\n throw new Error(\n `Timeline activity target object ${targetObjectUniversalIdentifier} is not installed`,\n );\n }\n\n const targetFieldName = `target${capitalize(targetObject.nameSingular)}Id`;\n const linkedObject = isDefined(linkedObjectMetadataUniversalIdentifier)\n ? objectMetadataByUniversalIdentifier.get(\n linkedObjectMetadataUniversalIdentifier,\n )\n : undefined;\n\n if (\n isDefined(linkedObjectMetadataUniversalIdentifier) &&\n !isDefined(linkedObject)\n ) {\n throw new Error(\n `Timeline activity linked object ${linkedObjectMetadataUniversalIdentifier} is not installed`,\n );\n }\n\n const response = await new RestApiClient().post<{\n data: { createTimelineActivity: CreatedTimelineActivity };\n }>('/rest/timelineActivities', {\n ...input,\n timelineActivityTypeId: timelineActivityType.id,\n linkedObjectMetadataId: linkedObject?.id,\n [targetFieldName]: targetRecordId,\n });\n\n return response.data.createTimelineActivity;\n};\n","import {\n type AppKeyValue,\n type AppKeyValueScope,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_KEY_VALUE_QUERY = `\n query GetAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n appKeyValue(key: $key, scope: $scope) {\n key\n value\n scope\n }\n }\n`;\n\nconst SET_APP_KEY_VALUE_MUTATION = `\n mutation SetAppKeyValue($input: SetAppKeyValueInput!) {\n setAppKeyValue(input: $input) {\n key\n value\n scope\n }\n }\n`;\n\nconst DELETE_APP_KEY_VALUE_MUTATION = `\n mutation DeleteAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n deleteAppKeyValue(key: $key, scope: $scope)\n }\n`;\n\nconst DEFAULT_APP_KEY_VALUE_SCOPE: AppKeyValueScope = 'WORKSPACE';\n\ntype KvOptions = {\n scope?: AppKeyValueScope;\n};\n\nexport const kv = {\n async get<TValue = unknown>(\n key: string,\n options?: KvOptions,\n ): Promise<TValue | null> {\n const { appKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { appKeyValue: AppKeyValue | null }\n >({\n query: GET_APP_KEY_VALUE_QUERY,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.get',\n });\n\n return (appKeyValue?.value ?? null) as TValue | null;\n },\n\n async set<TValue>(\n key: string,\n value: TValue,\n options?: KvOptions,\n ): Promise<void> {\n await postGraphqlRequest<\n {\n input: { key: string; value: TValue; scope: AppKeyValueScope };\n },\n { setAppKeyValue: AppKeyValue }\n >({\n query: SET_APP_KEY_VALUE_MUTATION,\n variables: {\n input: {\n key,\n value,\n scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE,\n },\n },\n caller: 'kv.set',\n });\n },\n\n async delete(key: string, options?: KvOptions): Promise<boolean> {\n const { deleteAppKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { deleteAppKeyValue: boolean }\n >({\n query: DELETE_APP_KEY_VALUE_MUTATION,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.delete',\n });\n\n return deleteAppKeyValue;\n },\n};\n","import { type LogicFunctionHttpResponse } from 'twenty-shared/types';\n\nexport type ResponseInit = {\n status?: number;\n headers?: Record<string, string>;\n};\n\nexport class Response implements LogicFunctionHttpResponse {\n readonly __twentyHttpResponse = true as const;\n readonly body: unknown;\n readonly status?: number;\n readonly headers?: Record<string, string>;\n\n constructor(body: unknown, init?: ResponseInit) {\n this.body = body;\n this.status = init?.status;\n this.headers = init?.headers;\n }\n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AC,EAED,OAAQ,GAAa,OAAS,IAChC,EAEA,MAAM,IACJ,EACA,EACA,EACe,CACf,MAAM,EAKJ,CACA,MAAO,GACP,UAAW,CACT,MAAO,CACL,MACA,QACA,MAAO,GAAS,OAAS,CAC3B,CACF,EACA,OAAQ,QACV,CAAC,CACH,EAEA,MAAM,OAAO,EAAa,EAAuC,CAC/D,GAAM,CAAE,qBAAsB,MAAM,EAGlC,CACA,MAAO,GACP,UAAW,CAAE,MAAK,MAAO,GAAS,OAAS,CAA4B,EACvE,OAAQ,WACV,CAAC,EAED,OAAO,CACT,CACF,ECpFa,GAAb,KAA2D,CAMzD,YAAY,EAAe,EAAqB,2BALhB,GAM9B,KAAK,KAAO,EACZ,KAAK,OAAS,GAAM,OACpB,KAAK,QAAU,GAAM,OACvB,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["t","e","i","n","a","t","e","r","o","s","t","e"],"sources":["../../../twenty-shared/dist/is-record-object-schema-CwzshFdt.mjs","../../../twenty-shared/dist/logic-function.mjs","../../src/sdk/logic-function/connections/errors/app-connection-auth-failed.error.ts","../../../twenty-shared/dist/application-runtime.mjs","../../src/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util.ts","../../src/sdk/utils/get-application-access-token.ts","../../src/sdk/logic-function/utils/post-graphql-request.util.ts","../../src/sdk/logic-function/connections/get-connection.ts","../../../twenty-shared/dist/capitalize-eyqNaLFT.mjs","../../src/sdk/logic-function/connections/list-connections.ts","../../src/sdk/logic-function/connections/find-connection-for-request.ts","../../src/sdk/logic-function/connections/report-connection-auth-failure.ts","../../src/sdk/logic-function/messaging/message-channel-fields.constant.ts","../../src/sdk/logic-function/messaging/create-message-channel.ts","../../src/sdk/logic-function/messaging/list-message-channels.ts","../../src/sdk/logic-function/messaging/update-message-channel.ts","../../src/sdk/logic-function/messaging/delete-message-channel.ts","../../src/sdk/logic-function/messaging/ingest-messages.ts","../../src/sdk/logic-function/agents/run-agent.ts","../../src/sdk/logic-function/inbox/send-inbox-message.ts","../../src/sdk/logic-function/jobs/enqueue-job.ts","../../src/sdk/logic-function/jobs/enqueue-jobs.ts","../../src/sdk/logic-function/jobs/get-jobs.ts","../../src/sdk/logic-function/timeline/create-timeline-activity.ts","../../src/sdk/logic-function/key-value/kv.ts","../../src/sdk/logic-function/response.ts"],"sourcesContent":["import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/logic-function/is-record-object-schema.ts\nvar t = (t) => (t?.type === \"record\" || t?.type === \"object\") && e(t.objectUniversalIdentifier);\n//#endregion\nexport { t };\n","import { t as e } from \"./isDefined-Dtu5EYqP.mjs\";\nimport { t } from \"./is-record-object-schema-CwzshFdt.mjs\";\nimport { isNonEmptyString as n, isObject as r } from \"@sniptt/guards\";\n//#region src/logic-function/build-tool-input-json-schema.ts\nvar i = (e, t) => {\n\tlet r = n(e) ? t?.(e) : void 0;\n\treturn `Id of the ${n(r) ? r : \"linked\"} record`;\n}, a = (n, o) => {\n\tif (t(n)) return {\n\t\ttype: \"string\",\n\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t};\n\tif (n.type === \"records\") return {\n\t\ttype: \"array\",\n\t\titems: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t\t}\n\t};\n\tlet { objectUniversalIdentifier: s, multiline: c, label: l, items: u, properties: d, additionalProperties: f, ...p } = n, m = { ...p };\n\treturn e(u) && (m.items = a(u, o)), e(d) && (m.properties = Object.fromEntries(Object.entries(d).map(([e, t]) => [e, a(t, o)]))), e(f) && (m.additionalProperties = r(f) ? a(f, o) : f), m;\n}, o = {\n\ttype: \"object\",\n\tproperties: {}\n}, s = (e) => {\n\tlet t = { type: \"unknown\" };\n\tswitch (e.type) {\n\t\tcase \"string\":\n\t\t\tt.type = \"string\";\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\tcase \"integer\":\n\t\t\tt.type = \"number\";\n\t\t\tbreak;\n\t\tcase \"boolean\":\n\t\t\tt.type = \"boolean\";\n\t\t\tbreak;\n\t\tcase \"array\":\n\t\t\tt.type = \"array\", e.items && (t.items = s(e.items));\n\t\t\tbreak;\n\t\tcase \"object\":\n\t\t\tt.type = \"object\", e.properties && (t.properties = Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, s(t)])));\n\t\t\tbreak;\n\t\tcase \"record\":\n\t\t\tt.type = \"record\";\n\t\t\tbreak;\n\t\tcase \"records\":\n\t\t\tt.type = \"records\";\n\t\t\tbreak;\n\t\tdefault: t.type = \"unknown\";\n\t}\n\treturn Array.isArray(e.enum) && (t.enum = e.enum.filter((e) => typeof e == \"string\")), e.multiline === !0 && (t.multiline = !0), n(e.label) && (t.label = e.label), n(e.objectUniversalIdentifier) && (t.objectUniversalIdentifier = e.objectUniversalIdentifier), t;\n}, c = (e) => [s(e)], l = { inputSchema: c({\n\ttype: \"object\",\n\tproperties: {\n\t\ta: { type: \"string\" },\n\t\tb: { type: \"number\" }\n\t}\n}) }, u = async (t) => {\n\tlet { getFunctionInputSchema: n } = await import(\"./get-function-input-schema-GNk3NRLJ.mjs\"), r = n(t)[0];\n\treturn r?.type === \"object\" && e(r.properties) ? {\n\t\ttype: \"object\",\n\t\tproperties: r.properties\n\t} : o;\n}, d = (t) => !e(t) || t === null ? \"unknown\" : typeof t == \"string\" ? \"string\" : typeof t == \"number\" ? \"number\" : typeof t == \"boolean\" ? \"boolean\" : Array.isArray(t) ? \"array\" : \"unknown\", f = (e) => e ? Object.entries(e).reduce((e, [t, n]) => (r(n) && !Array.isArray(n) ? e[t] = {\n\tisLeaf: !1,\n\ttype: \"object\",\n\tlabel: t,\n\tvalue: f(n)\n} : e[t] = {\n\tisLeaf: !0,\n\tvalue: n,\n\ttype: d(n),\n\tlabel: t\n}, e), {}) : {}, p = (e, t) => e ? `${e}.${t}` : t, m = (t, n, r = \"\") => {\n\tlet i = [];\n\tfor (let [a, o] of Object.entries(n)) {\n\t\tlet n = p(r, a), s = t[a];\n\t\tif (!e(s)) {\n\t\t\ti.push(`Missing key \"${n}\" in declared output schema.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (o.isLeaf !== s.isLeaf) {\n\t\t\ti.push(`Type mismatch at \"${n}\": expected ${o.isLeaf ? o.type : \"object\"} but declared ${s.isLeaf ? s.type : \"object\"}.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!o.isLeaf && !s.isLeaf) {\n\t\t\ti.push(...m(s.value, o.value, n));\n\t\t\tcontinue;\n\t\t}\n\t\to.isLeaf && s.isLeaf && o.type !== \"unknown\" && s.type !== \"unknown\" && o.type !== s.type && i.push(`Type mismatch at \"${n}\": expected ${o.type} but declared ${s.type}.`);\n\t}\n\treturn i;\n}, h = [\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"array\",\n\t\"unknown\"\n], g = (e) => h.includes(e), _ = (e, t) => {\n\tlet n = t.label ?? e;\n\treturn t.type === \"record\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"string\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"records\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"array\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"object\" ? {\n\t\tisLeaf: !1,\n\t\ttype: \"object\",\n\t\tlabel: n,\n\t\tvalue: r(t.properties) ? v(t.properties) : {}\n\t} : {\n\t\tisLeaf: !0,\n\t\ttype: g(t.type) ? t.type : \"unknown\",\n\t\tlabel: n,\n\t\tvalue: null\n\t};\n}, v = (e) => Object.entries(e).reduce((e, [t, n]) => (e[t] = _(t, n), e), {}), y = (e) => {\n\tlet t = e[0];\n\treturn t?.type !== \"object\" || !r(t.properties) ? {} : v(t.properties);\n}, b = (e) => e?.type === \"records\" && n(e.objectUniversalIdentifier) || e?.type === \"array\" && t(e?.items), x = \"RetryableLogicFunctionError\", S = class extends Error {\n\tconstructor(e) {\n\t\tsuper(e), this.name = x;\n\t}\n};\n//#endregion\nexport { o as DEFAULT_TOOL_INPUT_SCHEMA, x as RETRYABLE_LOGIC_FUNCTION_ERROR_NAME, S as RetryableLogicFunctionError, l as SEED_WORKFLOW_ACTION_TRIGGER_SETTINGS, a as buildToolInputJsonSchema, u as getInputSchemaFromSourceCode, f as getOutputSchemaFromValue, m as getOutputSchemaMismatchIssues, y as inputSchemaToOutputSchema, b as isRecordArraySchema, t as isRecordObjectSchema, c as jsonSchemaToInputSchema };\n","// Thrown when the platform asks the SDK to operate on a connection whose\n// OAuth refresh failed permanently (`authFailedAt` is set). The end user\n// must reconnect from the app's settings tab — the app cannot recover on\n// its own.\n//\n// `listConnections` filters these out by default (the user can't act on\n// them anyway). `getConnection` throws this when the looked-up connection\n// is in this state, so a stored connection id can be safely retried until\n// it works again.\nexport class AppConnectionAuthFailedError extends Error {\n readonly connectionId: string;\n\n constructor(connectionId: string) {\n super(\n `App connection ${connectionId} requires the user to reconnect ` +\n `(authFailedAt is set). Surface a \"Reconnect\" prompt in your UI.`,\n );\n this.name = 'AppConnectionAuthFailedError';\n this.connectionId = connectionId;\n }\n}\n","//#region src/application-runtime/constants/ConnectionScopeByLegacyVisibility.ts\nvar e = {\n\tuser: \"USER\",\n\tworkspace: \"WORKSPACE\"\n}, t = \"TWENTY_API_KEY\", n = \"TWENTY_API_URL\", r = \"TWENTY_APP_ACCESS_TOKEN\", i = \"TWENTY_APP_APPLICATION_ACCESS_TOKEN\", a = \"TWENTY_FUNCTIONS_URL\", o = {\n\tUSER: \"user\",\n\tWORKSPACE: \"workspace\"\n}, s = [\n\t\"workspace-suspended\",\n\t\"no-subscription\",\n\t\"no-credits\"\n];\n//#endregion\nexport { e as CONNECTION_SCOPE_BY_LEGACY_VISIBILITY, s as CREDIT_UNAVAILABLE_REASONS, t as DEFAULT_API_KEY_NAME, n as DEFAULT_API_URL_NAME, r as DEFAULT_APP_ACCESS_TOKEN_NAME, i as DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME, a as DEFAULT_FUNCTIONS_URL_NAME, o as LEGACY_CONNECTION_VISIBILITY_BY_SCOPE };\n","import { LEGACY_CONNECTION_VISIBILITY_BY_SCOPE } from 'twenty-shared/application-runtime';\n\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const withLegacyConnectionVisibility = (\n connection: Omit<AppConnection, 'visibility'>,\n): AppConnection => ({\n ...connection,\n visibility: LEGACY_CONNECTION_VISIBILITY_BY_SCOPE[connection.scope],\n});\n","import {\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application-runtime';\n\n// These reach the application's own resources, so prefer the application token when the runtime injects one\nexport const getApplicationAccessToken = (): string | undefined =>\n process.env[DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME] ??\n process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application-runtime';\n\nimport { getApplicationAccessToken } from '@/sdk/utils/get-application-access-token';\n\nexport const postGraphqlRequest = async <TVariables, TData>({\n query,\n variables,\n caller,\n}: {\n query: string;\n variables: TVariables;\n caller: string;\n}): Promise<TData> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const accessToken = getApplicationAccessToken();\n\n if (!apiUrl || !accessToken) {\n throw new Error(\n `${caller}() requires the app runtime env vars ` +\n `${DEFAULT_API_URL_NAME} and ${DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME}.`,\n );\n }\n\n const response = await fetch(`${apiUrl}/metadata`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({ query, variables }),\n });\n\n if (!response.ok) {\n throw new Error(\n `${caller}() failed: HTTP ${response.status} ${response.statusText}`,\n );\n }\n\n const body = (await response.json()) as {\n data?: TData;\n errors?: { message: string }[];\n };\n\n if (body.errors && body.errors.length > 0) {\n throw new Error(\n `${caller}() failed: ${body.errors.map((error) => error.message).join(', ')}`,\n );\n }\n\n if (!body.data) {\n throw new Error(`${caller}() failed: response contained no data.`);\n }\n\n return body.data;\n};\n","import { AppConnectionAuthFailedError } from '@/sdk/logic-function/connections/errors/app-connection-auth-failed.error';\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { withLegacyConnectionVisibility } from '@/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_CONNECTION_QUERY = `\n query GetAppConnection($id: ID!) {\n appConnection(id: $id) {\n id\n providerName\n name\n handle\n externalAccountId\n scope\n userWorkspaceId\n workspaceMemberId\n accessToken\n scopes\n authFailedAt\n authFailedReason\n }\n }\n`;\n\nexport const getConnection = async (id: string): Promise<AppConnection> => {\n const { appConnection } = await postGraphqlRequest<\n { id: string },\n { appConnection: Omit<AppConnection, 'visibility'> }\n >({\n query: GET_APP_CONNECTION_QUERY,\n variables: { id },\n caller: 'getConnection',\n });\n\n if (appConnection.authFailedAt !== null) {\n throw new AppConnectionAuthFailedError(appConnection.id);\n }\n\n return withLegacyConnectionVisibility(appConnection);\n};\n","import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/utils/strings/capitalize.ts\nvar t = (t) => e(t) ? t.charAt(0).toUpperCase() + t.slice(1) : \"\";\n//#endregion\nexport { t };\n","import { CONNECTION_SCOPE_BY_LEGACY_VISIBILITY } from 'twenty-shared/application-runtime';\nimport { isDefined } from 'twenty-shared/utils';\n\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { withLegacyConnectionVisibility } from '@/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_CONNECTIONS_QUERY = `\n query ListAppConnections($filter: ListAppConnectionsInput) {\n appConnections(filter: $filter) {\n id\n providerName\n name\n handle\n externalAccountId\n scope\n userWorkspaceId\n workspaceMemberId\n accessToken\n scopes\n authFailedAt\n authFailedReason\n }\n }\n`;\n\nexport type ListConnectionsFilter = {\n providerName?: string;\n userWorkspaceId?: string;\n scope?: AppConnection['scope'];\n /** @deprecated Use `scope` instead. */\n visibility?: AppConnection['visibility'];\n};\n\nexport const listConnections = async ({\n visibility,\n ...filter\n}: ListConnectionsFilter = {}): Promise<AppConnection[]> => {\n const { appConnections } = await postGraphqlRequest<\n { filter: Omit<ListConnectionsFilter, 'visibility'> },\n { appConnections: Omit<AppConnection, 'visibility'>[] }\n >({\n query: LIST_APP_CONNECTIONS_QUERY,\n variables: {\n filter: {\n ...filter,\n scope:\n filter.scope ??\n (isDefined(visibility)\n ? CONNECTION_SCOPE_BY_LEGACY_VISIBILITY[visibility]\n : undefined),\n },\n },\n caller: 'listConnections',\n });\n\n return appConnections.map(withLegacyConnectionVisibility);\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const findConnectionForRequest = (\n connections: AppConnection[],\n event: { userWorkspaceId: string | null },\n): AppConnection | null => {\n if (event.userWorkspaceId !== null) {\n const personal = connections.find(\n (connection) =>\n connection.scope === 'USER' &&\n connection.userWorkspaceId === event.userWorkspaceId,\n );\n\n if (personal) {\n return personal;\n }\n }\n\n const workspaceShared = connections.find(\n (connection) => connection.scope === 'WORKSPACE',\n );\n\n return workspaceShared ?? null;\n};\n","import { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst REPORT_APP_CONNECTION_AUTH_FAILURE_MUTATION = `\n mutation ReportAppConnectionAuthFailure($input: ReportAppConnectionAuthFailureInput!) {\n reportAppConnectionAuthFailure(input: $input)\n }\n`;\n\nexport const reportConnectionAuthFailure = async ({\n connectionId,\n reason,\n}: {\n connectionId: string;\n reason?: string;\n}): Promise<void> => {\n await postGraphqlRequest<\n { input: { id: string; reason?: string } },\n { reportAppConnectionAuthFailure: boolean }\n >({\n query: REPORT_APP_CONNECTION_AUTH_FAILURE_MUTATION,\n variables: { input: { id: connectionId, reason } },\n caller: 'reportConnectionAuthFailure',\n });\n};\n","// Shared by every helper, so channels returned by any of them are interchangeable\nexport const APP_MESSAGE_CHANNEL_SELECTION = `\n id\n handle\n displayName\n visibility\n connectedAccountId\n isSyncEnabled\n`;\n","import { type MessageChannelVisibility } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst CREATE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation CreateAppMessageChannel($input: CreateAppMessageChannelInput!) {\n createAppMessageChannel(input: $input) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type CreateMessageChannelInput = {\n // An app connection id (from getConnection/listConnections); the channel speaks through it and inherits who may see it\n connectedAccountId: string;\n // The account's provider identity; inbound participants matching it are treated as the account itself\n handle: string;\n displayName?: string;\n // Required: decides whether one member's conversations are readable by the whole workspace, and only the app\n // knows how private its messages are ('METADATA' for personal inboxes, 'SHARE_EVERYTHING' for shared ones)\n visibility: MessageChannelVisibility;\n};\n\nexport const createMessageChannel = async (\n input: CreateMessageChannelInput,\n): Promise<AppMessageChannel> => {\n const { createAppMessageChannel } = await postGraphqlRequest<\n { input: CreateMessageChannelInput },\n { createAppMessageChannel: AppMessageChannel }\n >({\n query: CREATE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { input },\n caller: 'createMessageChannel',\n });\n\n return createAppMessageChannel;\n};\n","import { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_MESSAGE_CHANNELS_QUERY = `\n query ListAppMessageChannels($filter: ListAppMessageChannelsInput) {\n appMessageChannels(filter: $filter) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type ListMessageChannelsFilter = {\n connectedAccountId?: string;\n};\n\nexport const listMessageChannels = async (\n filter: ListMessageChannelsFilter = {},\n): Promise<AppMessageChannel[]> => {\n const { appMessageChannels } = await postGraphqlRequest<\n { filter: ListMessageChannelsFilter },\n { appMessageChannels: AppMessageChannel[] }\n >({\n query: LIST_APP_MESSAGE_CHANNELS_QUERY,\n variables: { filter },\n caller: 'listMessageChannels',\n });\n\n return appMessageChannels;\n};\n","import { type MessageChannelVisibility } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst UPDATE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation UpdateAppMessageChannel($input: UpdateAppMessageChannelInput!) {\n updateAppMessageChannel(input: $input) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type UpdateMessageChannelInput = {\n id: string;\n // Omitted leaves the current label untouched; null clears it.\n displayName?: string | null;\n // Changes who can read every message already ingested, not just the ones that follow\n visibility?: MessageChannelVisibility;\n // False pauses ingestion (further ingests are rejected) without deleting the history\n isSyncEnabled?: boolean;\n};\n\nexport const updateMessageChannel = async (\n input: UpdateMessageChannelInput,\n): Promise<AppMessageChannel> => {\n const { updateAppMessageChannel } = await postGraphqlRequest<\n { input: UpdateMessageChannelInput },\n { updateAppMessageChannel: AppMessageChannel }\n >({\n query: UPDATE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { input },\n caller: 'updateMessageChannel',\n });\n\n return updateAppMessageChannel;\n};\n","import { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst DELETE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation DeleteAppMessageChannel($id: UUID!) {\n deleteAppMessageChannel(id: $id) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\n// Also deletes the channel's ingested messages and emptied threads; call from onDisconnect to retire a channel with its credential.\n// To stop ingesting but keep the history, set `isSyncEnabled` to false instead.\nexport const deleteMessageChannel = async (\n id: string,\n): Promise<AppMessageChannel> => {\n const { deleteAppMessageChannel } = await postGraphqlRequest<\n { id: string },\n { deleteAppMessageChannel: AppMessageChannel }\n >({\n query: DELETE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { id },\n caller: 'deleteMessageChannel',\n });\n\n return deleteAppMessageChannel;\n};\n","import {\n type IngestMessage,\n type IngestedMessage,\n} from '@/sdk/logic-function/messaging/types/ingest-message.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst INGEST_APP_MESSAGES_MUTATION = `\n mutation IngestAppMessages($input: IngestAppMessagesInput!) {\n ingestAppMessages(input: $input) {\n messages {\n externalId\n messageId\n messageThreadId\n }\n }\n }\n`;\n\n// Threading, dedup and privacy are handled server-side. At most 100 messages per call (one transaction\n// within one logic-function timeout), so page provider backfills\nexport const ingestMessages = async ({\n messageChannelId,\n messages,\n}: {\n messageChannelId: string;\n messages: IngestMessage[];\n}): Promise<IngestedMessage[]> => {\n const { ingestAppMessages } = await postGraphqlRequest<\n { input: { messageChannelId: string; messages: IngestMessage[] } },\n { ingestAppMessages: { messages: IngestedMessage[] } }\n >({\n query: INGEST_APP_MESSAGES_MUTATION,\n variables: { input: { messageChannelId, messages } },\n caller: 'ingestMessages',\n });\n\n return ingestAppMessages.messages;\n};\n","import {\n type RunAgentInput,\n type RunAgentResult,\n} from 'twenty-shared/application';\nimport { isDefined } from 'twenty-shared/utils';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst RUN_AGENT_MUTATION = `\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n threadId\n status\n result\n error\n success\n }\n }\n`;\n\nexport const runAgent = async ({\n input,\n ...rest\n}: RunAgentInput): Promise<RunAgentResult> => {\n const variables = {\n input: isDefined(input)\n ? {\n ...rest,\n input:\n typeof input === 'string'\n ? [{ role: 'user', content: input }]\n : input,\n }\n : rest,\n };\n\n const { runAgent: result } = await postGraphqlRequest<\n typeof variables,\n { runAgent: RunAgentResult }\n >({\n query: RUN_AGENT_MUTATION,\n variables,\n caller: 'runAgent',\n });\n\n return result;\n};\n","import { type SendInboxMessageResult } from 'twenty-shared/application';\n\nimport { type SendInboxMessageInput } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst SEND_INBOX_MESSAGE_MUTATION = `\n mutation SendInboxMessage($input: SendInboxMessageInput!) {\n sendInboxMessage(input: $input) {\n threadId\n }\n }\n`;\n\nexport const sendInboxMessage = async (\n input: SendInboxMessageInput,\n): Promise<SendInboxMessageResult> => {\n const { sendInboxMessage: result } = await postGraphqlRequest<\n { input: SendInboxMessageInput },\n { sendInboxMessage: SendInboxMessageResult }\n >({\n query: SEND_INBOX_MESSAGE_MUTATION,\n variables: { input },\n caller: 'sendInboxMessage',\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport {\n type EnqueueJobInput,\n type EnqueueJobResult,\n} from 'twenty-shared/application';\n\n/**\n * @deprecated Use `enqueueJobs` instead.\n */\nexport const enqueueJob = async (\n input: EnqueueJobInput,\n): Promise<EnqueueJobResult> => {\n const client = new MetadataApiClient();\n\n const { enqueueJob: result } = await client.mutation({\n enqueueJob: {\n __args: { input },\n enqueued: true,\n logicFunctionUniversalIdentifier: true,\n jobId: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport {\n type EnqueueJobsInput,\n type EnqueueJobsResult,\n} from 'twenty-shared/application';\n\nexport const enqueueJobs = async (\n input: EnqueueJobsInput,\n): Promise<EnqueueJobsResult> => {\n const client = new MetadataApiClient();\n\n const { enqueueJobs: result } = await client.mutation({\n enqueueJobs: {\n __args: { input },\n enqueued: true,\n logicFunctionUniversalIdentifier: true,\n enqueuedJobsCount: true,\n jobIds: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport { type JobStatusResult } from 'twenty-shared/application';\n\nexport const getJobs = async (jobIds: string[]): Promise<JobStatusResult[]> => {\n const client = new MetadataApiClient();\n\n const { getJobs: result } = await client.query({\n getJobs: {\n __args: { jobIds },\n jobId: true,\n state: true,\n attemptsMade: true,\n failedReason: true,\n enqueuedAt: true,\n startedAt: true,\n finishedAt: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport { RestApiClient } from 'twenty-client-sdk/rest';\nimport { capitalize, isDefined } from 'twenty-shared/utils';\nimport { type TimelineActivityTypeSnapshot } from 'twenty-shared/timeline';\n\ntype CreateTimelineActivityBaseInput = {\n timelineActivityTypeUniversalIdentifier: string;\n targetObjectUniversalIdentifier: string;\n targetRecordId: string;\n happensAt?: string;\n properties?: Record<string, unknown>;\n};\n\ntype CreateTimelineActivityLinkedRecordInput =\n | {\n linkedRecordId: string;\n linkedObjectMetadataUniversalIdentifier: string;\n }\n | {\n linkedRecordId?: never;\n linkedObjectMetadataUniversalIdentifier?: never;\n };\n\nexport type CreateTimelineActivityInput = CreateTimelineActivityBaseInput &\n CreateTimelineActivityLinkedRecordInput;\n\nexport type CreatedTimelineActivity = {\n id: string;\n timelineActivityTypeId: string;\n timelineActivityTypeSnapshot: TimelineActivityTypeSnapshot;\n};\n\nconst getObjectMetadataSelection = (universalIdentifiers: string[]) => ({\n __args: {\n paging: {\n first: universalIdentifiers.length,\n },\n filter: {\n universalIdentifier: {\n in: universalIdentifiers,\n },\n },\n },\n edges: {\n node: {\n id: true,\n universalIdentifier: true,\n nameSingular: true,\n },\n },\n});\n\n// Apps address manifest entities by universal identifier; the row stores the installation-specific metadata id\nexport const createTimelineActivity = async ({\n timelineActivityTypeUniversalIdentifier,\n targetObjectUniversalIdentifier,\n linkedObjectMetadataUniversalIdentifier,\n targetRecordId,\n ...input\n}: CreateTimelineActivityInput): Promise<CreatedTimelineActivity> => {\n const requiredObjectUniversalIdentifiers = [\n ...new Set(\n [\n targetObjectUniversalIdentifier,\n linkedObjectMetadataUniversalIdentifier,\n ].filter(isDefined),\n ),\n ];\n const metadataClient = new MetadataApiClient();\n const { timelineActivityTypes, objects } = await metadataClient.query({\n timelineActivityTypes: {\n id: true,\n universalIdentifier: true,\n isActive: true,\n },\n objects: getObjectMetadataSelection(requiredObjectUniversalIdentifiers),\n });\n\n const timelineActivityType = timelineActivityTypes.find(\n ({ universalIdentifier }) =>\n universalIdentifier === timelineActivityTypeUniversalIdentifier,\n );\n\n if (!isDefined(timelineActivityType)) {\n throw new Error(\n `Timeline activity type ${timelineActivityTypeUniversalIdentifier} is not installed`,\n );\n }\n\n if (!timelineActivityType.isActive) {\n throw new Error(\n `Timeline activity type ${timelineActivityTypeUniversalIdentifier} is inactive`,\n );\n }\n\n const objectMetadataByUniversalIdentifier = new Map(\n objects.edges.map(({ node }) => [node.universalIdentifier, node]),\n );\n\n const targetObject = objectMetadataByUniversalIdentifier.get(\n targetObjectUniversalIdentifier,\n );\n\n if (!isDefined(targetObject)) {\n throw new Error(\n `Timeline activity target object ${targetObjectUniversalIdentifier} is not installed`,\n );\n }\n\n const targetFieldName = `target${capitalize(targetObject.nameSingular)}Id`;\n const linkedObject = isDefined(linkedObjectMetadataUniversalIdentifier)\n ? objectMetadataByUniversalIdentifier.get(\n linkedObjectMetadataUniversalIdentifier,\n )\n : undefined;\n\n if (\n isDefined(linkedObjectMetadataUniversalIdentifier) &&\n !isDefined(linkedObject)\n ) {\n throw new Error(\n `Timeline activity linked object ${linkedObjectMetadataUniversalIdentifier} is not installed`,\n );\n }\n\n const response = await new RestApiClient().post<{\n data: { createTimelineActivity: CreatedTimelineActivity };\n }>('/rest/timelineActivities', {\n ...input,\n timelineActivityTypeId: timelineActivityType.id,\n linkedObjectMetadataId: linkedObject?.id,\n [targetFieldName]: targetRecordId,\n });\n\n return response.data.createTimelineActivity;\n};\n","import {\n type AppKeyValue,\n type AppKeyValueScope,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_KEY_VALUE_QUERY = `\n query GetAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n appKeyValue(key: $key, scope: $scope) {\n key\n value\n scope\n }\n }\n`;\n\nconst SET_APP_KEY_VALUE_MUTATION = `\n mutation SetAppKeyValue($input: SetAppKeyValueInput!) {\n setAppKeyValue(input: $input) {\n key\n value\n scope\n }\n }\n`;\n\nconst DELETE_APP_KEY_VALUE_MUTATION = `\n mutation DeleteAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n deleteAppKeyValue(key: $key, scope: $scope)\n }\n`;\n\nconst DEFAULT_APP_KEY_VALUE_SCOPE: AppKeyValueScope = 'WORKSPACE';\n\ntype KvOptions = {\n scope?: AppKeyValueScope;\n};\n\nexport const kv = {\n async get<TValue = unknown>(\n key: string,\n options?: KvOptions,\n ): Promise<TValue | null> {\n const { appKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { appKeyValue: AppKeyValue | null }\n >({\n query: GET_APP_KEY_VALUE_QUERY,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.get',\n });\n\n return (appKeyValue?.value ?? null) as TValue | null;\n },\n\n async set<TValue>(\n key: string,\n value: TValue,\n options?: KvOptions,\n ): Promise<void> {\n await postGraphqlRequest<\n {\n input: { key: string; value: TValue; scope: AppKeyValueScope };\n },\n { setAppKeyValue: AppKeyValue }\n >({\n query: SET_APP_KEY_VALUE_MUTATION,\n variables: {\n input: {\n key,\n value,\n scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE,\n },\n },\n caller: 'kv.set',\n });\n },\n\n async delete(key: string, options?: KvOptions): Promise<boolean> {\n const { deleteAppKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { deleteAppKeyValue: boolean }\n >({\n query: DELETE_APP_KEY_VALUE_MUTATION,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.delete',\n });\n\n return deleteAppKeyValue;\n },\n};\n","import { type LogicFunctionHttpResponse } from 'twenty-shared/types';\n\nexport type ResponseInit = {\n status?: number;\n headers?: Record<string, string>;\n};\n\nexport class Response implements LogicFunctionHttpResponse {\n readonly __twentyHttpResponse = true as const;\n readonly body: unknown;\n readonly status?: number;\n readonly headers?: Record<string, string>;\n\n constructor(body: unknown, init?: ResponseInit) {\n this.body = body;\n this.status = init?.status;\n this.headers = init?.headers;\n }\n}\n"],"mappings":";;;;;AAEA,IAAIA,KAAK,OAAO,GAAG,SAAS,YAAY,GAAG,SAAS,aAAaC,EAAE,EAAE,yBAAyB,GCE1FC,KAAK,GAAG,MAAM;CACjB,IAAI,IAAIC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK;CAC7B,OAAO,aAAaA,EAAE,CAAC,IAAI,IAAI,SAAS;AACzC,GAAGC,KAAK,GAAG,MAAM;CAChB,IAAIC,EAAE,CAAC,GAAG,OAAO;EAChB,MAAM;EACN,aAAaH,EAAE,EAAE,2BAA2B,CAAC;CAC9C;CACA,IAAI,EAAE,SAAS,WAAW,OAAO;EAChC,MAAM;EACN,OAAO;GACN,MAAM;GACN,aAAaA,EAAE,EAAE,2BAA2B,CAAC;EAC9C;CACD;CACA,IAAI,EAAE,2BAA2B,GAAG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EvB,MAAU,MACR,mCAAmC,EAAwC,kBAC7E;CAYF,QAAO,MATgB,IAAI,EAAc,EAAE,KAExC,4BAA4B;EAC7B,GAAG;EACH,wBAAwB,EAAqB;EAC7C,wBAAwB,GAAc;GACrC,IAAkB;CACrB,CAAC,GAEe,KAAK;AACvB,GChIM,KAA0B,uKAU1B,KAA6B,uJAU7B,KAAgC,qIAMhC,IAAgD,aAMzC,KAAK;CAChB,MAAM,IACJ,GACA,GACwB;EACxB,IAAM,EAAE,mBAAgB,MAAM,EAG5B;GACA,OAAO;GACP,WAAW;IAAE;IAAK,OAAO,GAAS,SAAS;GAA4B;GACvE,QAAQ;EACV,CAAC;EAED,OAAQ,GAAa,SAAS;CAChC;CAEA,MAAM,IACJ,GACA,GACA,GACe;EACf,MAAM,EAKJ;GACA,OAAO;GACP,WAAW,EACT,OAAO;IACL;IACA;IACA,OAAO,GAAS,SAAS;GAC3B,EACF;GACA,QAAQ;EACV,CAAC;CACH;CAEA,MAAM,OAAO,GAAa,GAAuC;EAC/D,IAAM,EAAE,yBAAsB,MAAM,EAGlC;GACA,OAAO;GACP,WAAW;IAAE;IAAK,OAAO,GAAS,SAAS;GAA4B;GACvE,QAAQ;EACV,CAAC;EAED,OAAO;CACT;AACF,GCpFa,KAAb,MAA2D;CAMzD,YAAY,GAAe,GAAqB;EAG9C,4BAR8B,IAM9B,KAAK,OAAO,GACZ,KAAK,SAAS,GAAM,QACpB,KAAK,UAAU,GAAM;CACvB;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["t","e","i","n","a","t","e","r","o","s","t","n","e"],"sources":["../../../twenty-shared/dist/is-record-object-schema-CwzshFdt.mjs","../../../twenty-shared/dist/logic-function.mjs","../../src/sdk/logic-function/connections/errors/app-connection-auth-failed.error.ts","../../../twenty-shared/dist/application-runtime.mjs","../../src/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util.ts","../../src/sdk/utils/get-application-access-token.ts","../../src/sdk/logic-function/utils/post-graphql-request.util.ts","../../src/sdk/logic-function/connections/get-connection.ts","../../../twenty-shared/dist/capitalize-DFPVt1IM.mjs","../../src/sdk/logic-function/connections/list-connections.ts","../../src/sdk/logic-function/connections/find-connection-for-request.ts","../../src/sdk/logic-function/connections/report-connection-auth-failure.ts","../../src/sdk/logic-function/messaging/message-channel-fields.constant.ts","../../src/sdk/logic-function/messaging/create-message-channel.ts","../../src/sdk/logic-function/messaging/list-message-channels.ts","../../src/sdk/logic-function/messaging/update-message-channel.ts","../../src/sdk/logic-function/messaging/delete-message-channel.ts","../../src/sdk/logic-function/messaging/ingest-messages.ts","../../src/sdk/logic-function/agents/run-agent.ts","../../src/sdk/logic-function/inbox/send-inbox-message.ts","../../src/sdk/logic-function/jobs/enqueue-job.ts","../../src/sdk/logic-function/jobs/enqueue-jobs.ts","../../src/sdk/logic-function/jobs/get-jobs.ts","../../src/sdk/logic-function/timeline/create-timeline-activity.ts","../../src/sdk/logic-function/key-value/kv.ts","../../src/sdk/logic-function/response.ts"],"sourcesContent":["import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/logic-function/is-record-object-schema.ts\nvar t = (t) => (t?.type === \"record\" || t?.type === \"object\") && e(t.objectUniversalIdentifier);\n//#endregion\nexport { t };\n","import { t as e } from \"./isDefined-Dtu5EYqP.mjs\";\nimport { t } from \"./is-record-object-schema-CwzshFdt.mjs\";\nimport { isNonEmptyString as n, isObject as r } from \"@sniptt/guards\";\n//#region src/logic-function/build-tool-input-json-schema.ts\nvar i = (e, t) => {\n\tlet r = n(e) ? t?.(e) : void 0;\n\treturn `Id of the ${n(r) ? r : \"linked\"} record`;\n}, a = (n, o) => {\n\tif (t(n)) return {\n\t\ttype: \"string\",\n\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t};\n\tif (n.type === \"records\") return {\n\t\ttype: \"array\",\n\t\titems: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t\t}\n\t};\n\tlet { objectUniversalIdentifier: s, multiline: c, label: l, items: u, properties: d, additionalProperties: f, ...p } = n, m = { ...p };\n\treturn e(u) && (m.items = a(u, o)), e(d) && (m.properties = Object.fromEntries(Object.entries(d).map(([e, t]) => [e, a(t, o)]))), e(f) && (m.additionalProperties = r(f) ? a(f, o) : f), m;\n}, o = {\n\ttype: \"object\",\n\tproperties: {}\n}, s = (e) => {\n\tlet t = { type: \"unknown\" };\n\tswitch (e.type) {\n\t\tcase \"string\":\n\t\t\tt.type = \"string\";\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\tcase \"integer\":\n\t\t\tt.type = \"number\";\n\t\t\tbreak;\n\t\tcase \"boolean\":\n\t\t\tt.type = \"boolean\";\n\t\t\tbreak;\n\t\tcase \"array\":\n\t\t\tt.type = \"array\", e.items && (t.items = s(e.items));\n\t\t\tbreak;\n\t\tcase \"object\":\n\t\t\tt.type = \"object\", e.properties && (t.properties = Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, s(t)])));\n\t\t\tbreak;\n\t\tcase \"record\":\n\t\t\tt.type = \"record\";\n\t\t\tbreak;\n\t\tcase \"records\":\n\t\t\tt.type = \"records\";\n\t\t\tbreak;\n\t\tdefault: t.type = \"unknown\";\n\t}\n\treturn Array.isArray(e.enum) && (t.enum = e.enum.filter((e) => typeof e == \"string\")), e.multiline === !0 && (t.multiline = !0), n(e.label) && (t.label = e.label), n(e.objectUniversalIdentifier) && (t.objectUniversalIdentifier = e.objectUniversalIdentifier), t;\n}, c = (e) => [s(e)], l = { inputSchema: c({\n\ttype: \"object\",\n\tproperties: {\n\t\ta: { type: \"string\" },\n\t\tb: { type: \"number\" }\n\t}\n}) }, u = async (t) => {\n\tlet { getFunctionInputSchema: n } = await import(\"./get-function-input-schema-GNk3NRLJ.mjs\"), r = n(t)[0];\n\treturn r?.type === \"object\" && e(r.properties) ? {\n\t\ttype: \"object\",\n\t\tproperties: r.properties\n\t} : o;\n}, d = (t) => !e(t) || t === null ? \"unknown\" : typeof t == \"string\" ? \"string\" : typeof t == \"number\" ? \"number\" : typeof t == \"boolean\" ? \"boolean\" : Array.isArray(t) ? \"array\" : \"unknown\", f = (e) => e ? Object.entries(e).reduce((e, [t, n]) => (r(n) && !Array.isArray(n) ? e[t] = {\n\tisLeaf: !1,\n\ttype: \"object\",\n\tlabel: t,\n\tvalue: f(n)\n} : e[t] = {\n\tisLeaf: !0,\n\tvalue: n,\n\ttype: d(n),\n\tlabel: t\n}, e), {}) : {}, p = (e, t) => e ? `${e}.${t}` : t, m = (t, n, r = \"\") => {\n\tlet i = [];\n\tfor (let [a, o] of Object.entries(n)) {\n\t\tlet n = p(r, a), s = t[a];\n\t\tif (!e(s)) {\n\t\t\ti.push(`Missing key \"${n}\" in declared output schema.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (o.isLeaf !== s.isLeaf) {\n\t\t\ti.push(`Type mismatch at \"${n}\": expected ${o.isLeaf ? o.type : \"object\"} but declared ${s.isLeaf ? s.type : \"object\"}.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!o.isLeaf && !s.isLeaf) {\n\t\t\ti.push(...m(s.value, o.value, n));\n\t\t\tcontinue;\n\t\t}\n\t\to.isLeaf && s.isLeaf && o.type !== \"unknown\" && s.type !== \"unknown\" && o.type !== s.type && i.push(`Type mismatch at \"${n}\": expected ${o.type} but declared ${s.type}.`);\n\t}\n\treturn i;\n}, h = [\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"array\",\n\t\"unknown\"\n], g = (e) => h.includes(e), _ = (e, t) => {\n\tlet n = t.label ?? e;\n\treturn t.type === \"record\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"string\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"records\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"array\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"object\" ? {\n\t\tisLeaf: !1,\n\t\ttype: \"object\",\n\t\tlabel: n,\n\t\tvalue: r(t.properties) ? v(t.properties) : {}\n\t} : {\n\t\tisLeaf: !0,\n\t\ttype: g(t.type) ? t.type : \"unknown\",\n\t\tlabel: n,\n\t\tvalue: null\n\t};\n}, v = (e) => Object.entries(e).reduce((e, [t, n]) => (e[t] = _(t, n), e), {}), y = (e) => {\n\tlet t = e[0];\n\treturn t?.type !== \"object\" || !r(t.properties) ? {} : v(t.properties);\n}, b = (e) => e?.type === \"records\" && n(e.objectUniversalIdentifier) || e?.type === \"array\" && t(e?.items), x = \"RetryableLogicFunctionError\", S = class extends Error {\n\tconstructor(e) {\n\t\tsuper(e), this.name = x;\n\t}\n};\n//#endregion\nexport { o as DEFAULT_TOOL_INPUT_SCHEMA, x as RETRYABLE_LOGIC_FUNCTION_ERROR_NAME, S as RetryableLogicFunctionError, l as SEED_WORKFLOW_ACTION_TRIGGER_SETTINGS, a as buildToolInputJsonSchema, u as getInputSchemaFromSourceCode, f as getOutputSchemaFromValue, m as getOutputSchemaMismatchIssues, y as inputSchemaToOutputSchema, b as isRecordArraySchema, t as isRecordObjectSchema, c as jsonSchemaToInputSchema };\n","// Thrown when the platform asks the SDK to operate on a connection whose\n// OAuth refresh failed permanently (`authFailedAt` is set). The end user\n// must reconnect from the app's settings tab — the app cannot recover on\n// its own.\n//\n// `listConnections` filters these out by default (the user can't act on\n// them anyway). `getConnection` throws this when the looked-up connection\n// is in this state, so a stored connection id can be safely retried until\n// it works again.\nexport class AppConnectionAuthFailedError extends Error {\n readonly connectionId: string;\n\n constructor(connectionId: string) {\n super(\n `App connection ${connectionId} requires the user to reconnect ` +\n `(authFailedAt is set). Surface a \"Reconnect\" prompt in your UI.`,\n );\n this.name = 'AppConnectionAuthFailedError';\n this.connectionId = connectionId;\n }\n}\n","//#region src/application-runtime/constants/ConnectionScopeByLegacyVisibility.ts\nvar e = {\n\tuser: \"USER\",\n\tworkspace: \"WORKSPACE\"\n}, t = \"TWENTY_API_KEY\", n = \"TWENTY_API_URL\", r = \"TWENTY_APP_ACCESS_TOKEN\", i = \"TWENTY_APP_APPLICATION_ACCESS_TOKEN\", a = \"TWENTY_FUNCTIONS_URL\", o = {\n\tUSER: \"user\",\n\tWORKSPACE: \"workspace\"\n}, s = [\n\t\"workspace-suspended\",\n\t\"no-subscription\",\n\t\"no-credits\"\n];\n//#endregion\nexport { e as CONNECTION_SCOPE_BY_LEGACY_VISIBILITY, s as CREDIT_UNAVAILABLE_REASONS, t as DEFAULT_API_KEY_NAME, n as DEFAULT_API_URL_NAME, r as DEFAULT_APP_ACCESS_TOKEN_NAME, i as DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME, a as DEFAULT_FUNCTIONS_URL_NAME, o as LEGACY_CONNECTION_VISIBILITY_BY_SCOPE };\n","import { LEGACY_CONNECTION_VISIBILITY_BY_SCOPE } from 'twenty-shared/application-runtime';\n\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const withLegacyConnectionVisibility = (\n connection: Omit<AppConnection, 'visibility'>,\n): AppConnection => ({\n ...connection,\n visibility: LEGACY_CONNECTION_VISIBILITY_BY_SCOPE[connection.scope],\n});\n","import {\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application-runtime';\n\n// These reach the application's own resources, so prefer the application token when the runtime injects one\nexport const getApplicationAccessToken = (): string | undefined =>\n process.env[DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME] ??\n process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application-runtime';\n\nimport { getApplicationAccessToken } from '@/sdk/utils/get-application-access-token';\n\nexport const postGraphqlRequest = async <TVariables, TData>({\n query,\n variables,\n caller,\n}: {\n query: string;\n variables: TVariables;\n caller: string;\n}): Promise<TData> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const accessToken = getApplicationAccessToken();\n\n if (!apiUrl || !accessToken) {\n throw new Error(\n `${caller}() requires the app runtime env vars ` +\n `${DEFAULT_API_URL_NAME} and ${DEFAULT_APP_APPLICATION_ACCESS_TOKEN_NAME}.`,\n );\n }\n\n const response = await fetch(`${apiUrl}/metadata`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({ query, variables }),\n });\n\n if (!response.ok) {\n throw new Error(\n `${caller}() failed: HTTP ${response.status} ${response.statusText}`,\n );\n }\n\n const body = (await response.json()) as {\n data?: TData;\n errors?: { message: string }[];\n };\n\n if (body.errors && body.errors.length > 0) {\n throw new Error(\n `${caller}() failed: ${body.errors.map((error) => error.message).join(', ')}`,\n );\n }\n\n if (!body.data) {\n throw new Error(`${caller}() failed: response contained no data.`);\n }\n\n return body.data;\n};\n","import { AppConnectionAuthFailedError } from '@/sdk/logic-function/connections/errors/app-connection-auth-failed.error';\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { withLegacyConnectionVisibility } from '@/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_CONNECTION_QUERY = `\n query GetAppConnection($id: ID!) {\n appConnection(id: $id) {\n id\n providerName\n name\n handle\n externalAccountId\n scope\n userWorkspaceId\n workspaceMemberId\n accessToken\n scopes\n authFailedAt\n authFailedReason\n }\n }\n`;\n\nexport const getConnection = async (id: string): Promise<AppConnection> => {\n const { appConnection } = await postGraphqlRequest<\n { id: string },\n { appConnection: Omit<AppConnection, 'visibility'> }\n >({\n query: GET_APP_CONNECTION_QUERY,\n variables: { id },\n caller: 'getConnection',\n });\n\n if (appConnection.authFailedAt !== null) {\n throw new AppConnectionAuthFailedError(appConnection.id);\n }\n\n return withLegacyConnectionVisibility(appConnection);\n};\n","import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/i18n/do-not-translate.ts\nvar t = (e) => e, n = (t) => e(t) ? t.charAt(0).toUpperCase() + t.slice(1) : \"\";\n//#endregion\nexport { t as n, n as t };\n","import { CONNECTION_SCOPE_BY_LEGACY_VISIBILITY } from 'twenty-shared/application-runtime';\nimport { isDefined } from 'twenty-shared/utils';\n\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { withLegacyConnectionVisibility } from '@/sdk/logic-function/connections/utils/with-legacy-connection-visibility.util';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_CONNECTIONS_QUERY = `\n query ListAppConnections($filter: ListAppConnectionsInput) {\n appConnections(filter: $filter) {\n id\n providerName\n name\n handle\n externalAccountId\n scope\n userWorkspaceId\n workspaceMemberId\n accessToken\n scopes\n authFailedAt\n authFailedReason\n }\n }\n`;\n\nexport type ListConnectionsFilter = {\n providerName?: string;\n userWorkspaceId?: string;\n scope?: AppConnection['scope'];\n /** @deprecated Use `scope` instead. */\n visibility?: AppConnection['visibility'];\n};\n\nexport const listConnections = async ({\n visibility,\n ...filter\n}: ListConnectionsFilter = {}): Promise<AppConnection[]> => {\n const { appConnections } = await postGraphqlRequest<\n { filter: Omit<ListConnectionsFilter, 'visibility'> },\n { appConnections: Omit<AppConnection, 'visibility'>[] }\n >({\n query: LIST_APP_CONNECTIONS_QUERY,\n variables: {\n filter: {\n ...filter,\n scope:\n filter.scope ??\n (isDefined(visibility)\n ? CONNECTION_SCOPE_BY_LEGACY_VISIBILITY[visibility]\n : undefined),\n },\n },\n caller: 'listConnections',\n });\n\n return appConnections.map(withLegacyConnectionVisibility);\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const findConnectionForRequest = (\n connections: AppConnection[],\n event: { userWorkspaceId: string | null },\n): AppConnection | null => {\n if (event.userWorkspaceId !== null) {\n const personal = connections.find(\n (connection) =>\n connection.scope === 'USER' &&\n connection.userWorkspaceId === event.userWorkspaceId,\n );\n\n if (personal) {\n return personal;\n }\n }\n\n const workspaceShared = connections.find(\n (connection) => connection.scope === 'WORKSPACE',\n );\n\n return workspaceShared ?? null;\n};\n","import { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst REPORT_APP_CONNECTION_AUTH_FAILURE_MUTATION = `\n mutation ReportAppConnectionAuthFailure($input: ReportAppConnectionAuthFailureInput!) {\n reportAppConnectionAuthFailure(input: $input)\n }\n`;\n\nexport const reportConnectionAuthFailure = async ({\n connectionId,\n reason,\n}: {\n connectionId: string;\n reason?: string;\n}): Promise<void> => {\n await postGraphqlRequest<\n { input: { id: string; reason?: string } },\n { reportAppConnectionAuthFailure: boolean }\n >({\n query: REPORT_APP_CONNECTION_AUTH_FAILURE_MUTATION,\n variables: { input: { id: connectionId, reason } },\n caller: 'reportConnectionAuthFailure',\n });\n};\n","// Shared by every helper, so channels returned by any of them are interchangeable\nexport const APP_MESSAGE_CHANNEL_SELECTION = `\n id\n handle\n displayName\n visibility\n connectedAccountId\n isSyncEnabled\n`;\n","import { type MessageChannelVisibility } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst CREATE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation CreateAppMessageChannel($input: CreateAppMessageChannelInput!) {\n createAppMessageChannel(input: $input) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type CreateMessageChannelInput = {\n // An app connection id (from getConnection/listConnections); the channel speaks through it and inherits who may see it\n connectedAccountId: string;\n // The account's provider identity; inbound participants matching it are treated as the account itself\n handle: string;\n displayName?: string;\n // Required: decides whether one member's conversations are readable by the whole workspace, and only the app\n // knows how private its messages are ('METADATA' for personal inboxes, 'SHARE_EVERYTHING' for shared ones)\n visibility: MessageChannelVisibility;\n};\n\nexport const createMessageChannel = async (\n input: CreateMessageChannelInput,\n): Promise<AppMessageChannel> => {\n const { createAppMessageChannel } = await postGraphqlRequest<\n { input: CreateMessageChannelInput },\n { createAppMessageChannel: AppMessageChannel }\n >({\n query: CREATE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { input },\n caller: 'createMessageChannel',\n });\n\n return createAppMessageChannel;\n};\n","import { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_MESSAGE_CHANNELS_QUERY = `\n query ListAppMessageChannels($filter: ListAppMessageChannelsInput) {\n appMessageChannels(filter: $filter) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type ListMessageChannelsFilter = {\n connectedAccountId?: string;\n};\n\nexport const listMessageChannels = async (\n filter: ListMessageChannelsFilter = {},\n): Promise<AppMessageChannel[]> => {\n const { appMessageChannels } = await postGraphqlRequest<\n { filter: ListMessageChannelsFilter },\n { appMessageChannels: AppMessageChannel[] }\n >({\n query: LIST_APP_MESSAGE_CHANNELS_QUERY,\n variables: { filter },\n caller: 'listMessageChannels',\n });\n\n return appMessageChannels;\n};\n","import { type MessageChannelVisibility } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst UPDATE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation UpdateAppMessageChannel($input: UpdateAppMessageChannelInput!) {\n updateAppMessageChannel(input: $input) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\nexport type UpdateMessageChannelInput = {\n id: string;\n // Omitted leaves the current label untouched; null clears it.\n displayName?: string | null;\n // Changes who can read every message already ingested, not just the ones that follow\n visibility?: MessageChannelVisibility;\n // False pauses ingestion (further ingests are rejected) without deleting the history\n isSyncEnabled?: boolean;\n};\n\nexport const updateMessageChannel = async (\n input: UpdateMessageChannelInput,\n): Promise<AppMessageChannel> => {\n const { updateAppMessageChannel } = await postGraphqlRequest<\n { input: UpdateMessageChannelInput },\n { updateAppMessageChannel: AppMessageChannel }\n >({\n query: UPDATE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { input },\n caller: 'updateMessageChannel',\n });\n\n return updateAppMessageChannel;\n};\n","import { APP_MESSAGE_CHANNEL_SELECTION } from '@/sdk/logic-function/messaging/message-channel-fields.constant';\nimport { type AppMessageChannel } from '@/sdk/logic-function/messaging/types/app-message-channel.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst DELETE_APP_MESSAGE_CHANNEL_MUTATION = `\n mutation DeleteAppMessageChannel($id: UUID!) {\n deleteAppMessageChannel(id: $id) {\n ${APP_MESSAGE_CHANNEL_SELECTION}\n }\n }\n`;\n\n// Also deletes the channel's ingested messages and emptied threads; call from onDisconnect to retire a channel with its credential.\n// To stop ingesting but keep the history, set `isSyncEnabled` to false instead.\nexport const deleteMessageChannel = async (\n id: string,\n): Promise<AppMessageChannel> => {\n const { deleteAppMessageChannel } = await postGraphqlRequest<\n { id: string },\n { deleteAppMessageChannel: AppMessageChannel }\n >({\n query: DELETE_APP_MESSAGE_CHANNEL_MUTATION,\n variables: { id },\n caller: 'deleteMessageChannel',\n });\n\n return deleteAppMessageChannel;\n};\n","import {\n type IngestMessage,\n type IngestedMessage,\n} from '@/sdk/logic-function/messaging/types/ingest-message.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst INGEST_APP_MESSAGES_MUTATION = `\n mutation IngestAppMessages($input: IngestAppMessagesInput!) {\n ingestAppMessages(input: $input) {\n messages {\n externalId\n messageId\n messageThreadId\n }\n }\n }\n`;\n\n// Threading, dedup and privacy are handled server-side. At most 100 messages per call (one transaction\n// within one logic-function timeout), so page provider backfills\nexport const ingestMessages = async ({\n messageChannelId,\n messages,\n}: {\n messageChannelId: string;\n messages: IngestMessage[];\n}): Promise<IngestedMessage[]> => {\n const { ingestAppMessages } = await postGraphqlRequest<\n { input: { messageChannelId: string; messages: IngestMessage[] } },\n { ingestAppMessages: { messages: IngestedMessage[] } }\n >({\n query: INGEST_APP_MESSAGES_MUTATION,\n variables: { input: { messageChannelId, messages } },\n caller: 'ingestMessages',\n });\n\n return ingestAppMessages.messages;\n};\n","import {\n type RunAgentInput,\n type RunAgentResult,\n} from 'twenty-shared/application';\nimport { isDefined } from 'twenty-shared/utils';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst RUN_AGENT_MUTATION = `\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n threadId\n status\n result\n error\n success\n }\n }\n`;\n\nexport const runAgent = async ({\n input,\n ...rest\n}: RunAgentInput): Promise<RunAgentResult> => {\n const variables = {\n input: isDefined(input)\n ? {\n ...rest,\n input:\n typeof input === 'string'\n ? [{ role: 'user', content: input }]\n : input,\n }\n : rest,\n };\n\n const { runAgent: result } = await postGraphqlRequest<\n typeof variables,\n { runAgent: RunAgentResult }\n >({\n query: RUN_AGENT_MUTATION,\n variables,\n caller: 'runAgent',\n });\n\n return result;\n};\n","import { type SendInboxMessageResult } from 'twenty-shared/application';\n\nimport { type SendInboxMessageInput } from '@/sdk/define/common/types/loose-shared-types.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst SEND_INBOX_MESSAGE_MUTATION = `\n mutation SendInboxMessage($input: SendInboxMessageInput!) {\n sendInboxMessage(input: $input) {\n threadId\n }\n }\n`;\n\nexport const sendInboxMessage = async (\n input: SendInboxMessageInput,\n): Promise<SendInboxMessageResult> => {\n const { sendInboxMessage: result } = await postGraphqlRequest<\n { input: SendInboxMessageInput },\n { sendInboxMessage: SendInboxMessageResult }\n >({\n query: SEND_INBOX_MESSAGE_MUTATION,\n variables: { input },\n caller: 'sendInboxMessage',\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport {\n type EnqueueJobInput,\n type EnqueueJobResult,\n} from 'twenty-shared/application';\n\n/**\n * @deprecated Use `enqueueJobs` instead.\n */\nexport const enqueueJob = async (\n input: EnqueueJobInput,\n): Promise<EnqueueJobResult> => {\n const client = new MetadataApiClient();\n\n const { enqueueJob: result } = await client.mutation({\n enqueueJob: {\n __args: { input },\n enqueued: true,\n logicFunctionUniversalIdentifier: true,\n jobId: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport {\n type EnqueueJobsInput,\n type EnqueueJobsResult,\n} from 'twenty-shared/application';\n\nexport const enqueueJobs = async (\n input: EnqueueJobsInput,\n): Promise<EnqueueJobsResult> => {\n const client = new MetadataApiClient();\n\n const { enqueueJobs: result } = await client.mutation({\n enqueueJobs: {\n __args: { input },\n enqueued: true,\n logicFunctionUniversalIdentifier: true,\n enqueuedJobsCount: true,\n jobIds: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport { type JobStatusResult } from 'twenty-shared/application';\n\nexport const getJobs = async (jobIds: string[]): Promise<JobStatusResult[]> => {\n const client = new MetadataApiClient();\n\n const { getJobs: result } = await client.query({\n getJobs: {\n __args: { jobIds },\n jobId: true,\n state: true,\n attemptsMade: true,\n failedReason: true,\n enqueuedAt: true,\n startedAt: true,\n finishedAt: true,\n },\n });\n\n return result;\n};\n","import { MetadataApiClient } from 'twenty-client-sdk/metadata';\nimport { RestApiClient } from 'twenty-client-sdk/rest';\nimport { capitalize, isDefined } from 'twenty-shared/utils';\nimport { type TimelineActivityTypeSnapshot } from 'twenty-shared/timeline';\n\ntype CreateTimelineActivityBaseInput = {\n timelineActivityTypeUniversalIdentifier: string;\n targetObjectUniversalIdentifier: string;\n targetRecordId: string;\n happensAt?: string;\n properties?: Record<string, unknown>;\n};\n\ntype CreateTimelineActivityLinkedRecordInput =\n | {\n linkedRecordId: string;\n linkedObjectMetadataUniversalIdentifier: string;\n }\n | {\n linkedRecordId?: never;\n linkedObjectMetadataUniversalIdentifier?: never;\n };\n\nexport type CreateTimelineActivityInput = CreateTimelineActivityBaseInput &\n CreateTimelineActivityLinkedRecordInput;\n\nexport type CreatedTimelineActivity = {\n id: string;\n timelineActivityTypeId: string;\n timelineActivityTypeSnapshot: TimelineActivityTypeSnapshot;\n};\n\nconst getObjectMetadataSelection = (universalIdentifiers: string[]) => ({\n __args: {\n paging: {\n first: universalIdentifiers.length,\n },\n filter: {\n universalIdentifier: {\n in: universalIdentifiers,\n },\n },\n },\n edges: {\n node: {\n id: true,\n universalIdentifier: true,\n nameSingular: true,\n },\n },\n});\n\n// Apps address manifest entities by universal identifier; the row stores the installation-specific metadata id\nexport const createTimelineActivity = async ({\n timelineActivityTypeUniversalIdentifier,\n targetObjectUniversalIdentifier,\n linkedObjectMetadataUniversalIdentifier,\n targetRecordId,\n ...input\n}: CreateTimelineActivityInput): Promise<CreatedTimelineActivity> => {\n const requiredObjectUniversalIdentifiers = [\n ...new Set(\n [\n targetObjectUniversalIdentifier,\n linkedObjectMetadataUniversalIdentifier,\n ].filter(isDefined),\n ),\n ];\n const metadataClient = new MetadataApiClient();\n const { timelineActivityTypes, objects } = await metadataClient.query({\n timelineActivityTypes: {\n id: true,\n universalIdentifier: true,\n isActive: true,\n },\n objects: getObjectMetadataSelection(requiredObjectUniversalIdentifiers),\n });\n\n const timelineActivityType = timelineActivityTypes.find(\n ({ universalIdentifier }) =>\n universalIdentifier === timelineActivityTypeUniversalIdentifier,\n );\n\n if (!isDefined(timelineActivityType)) {\n throw new Error(\n `Timeline activity type ${timelineActivityTypeUniversalIdentifier} is not installed`,\n );\n }\n\n if (!timelineActivityType.isActive) {\n throw new Error(\n `Timeline activity type ${timelineActivityTypeUniversalIdentifier} is inactive`,\n );\n }\n\n const objectMetadataByUniversalIdentifier = new Map(\n objects.edges.map(({ node }) => [node.universalIdentifier, node]),\n );\n\n const targetObject = objectMetadataByUniversalIdentifier.get(\n targetObjectUniversalIdentifier,\n );\n\n if (!isDefined(targetObject)) {\n throw new Error(\n `Timeline activity target object ${targetObjectUniversalIdentifier} is not installed`,\n );\n }\n\n const targetFieldName = `target${capitalize(targetObject.nameSingular)}Id`;\n const linkedObject = isDefined(linkedObjectMetadataUniversalIdentifier)\n ? objectMetadataByUniversalIdentifier.get(\n linkedObjectMetadataUniversalIdentifier,\n )\n : undefined;\n\n if (\n isDefined(linkedObjectMetadataUniversalIdentifier) &&\n !isDefined(linkedObject)\n ) {\n throw new Error(\n `Timeline activity linked object ${linkedObjectMetadataUniversalIdentifier} is not installed`,\n );\n }\n\n const response = await new RestApiClient().post<{\n data: { createTimelineActivity: CreatedTimelineActivity };\n }>('/rest/timelineActivities', {\n ...input,\n timelineActivityTypeId: timelineActivityType.id,\n linkedObjectMetadataId: linkedObject?.id,\n [targetFieldName]: targetRecordId,\n });\n\n return response.data.createTimelineActivity;\n};\n","import {\n type AppKeyValue,\n type AppKeyValueScope,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_KEY_VALUE_QUERY = `\n query GetAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n appKeyValue(key: $key, scope: $scope) {\n key\n value\n scope\n }\n }\n`;\n\nconst SET_APP_KEY_VALUE_MUTATION = `\n mutation SetAppKeyValue($input: SetAppKeyValueInput!) {\n setAppKeyValue(input: $input) {\n key\n value\n scope\n }\n }\n`;\n\nconst DELETE_APP_KEY_VALUE_MUTATION = `\n mutation DeleteAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n deleteAppKeyValue(key: $key, scope: $scope)\n }\n`;\n\nconst DEFAULT_APP_KEY_VALUE_SCOPE: AppKeyValueScope = 'WORKSPACE';\n\ntype KvOptions = {\n scope?: AppKeyValueScope;\n};\n\nexport const kv = {\n async get<TValue = unknown>(\n key: string,\n options?: KvOptions,\n ): Promise<TValue | null> {\n const { appKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { appKeyValue: AppKeyValue | null }\n >({\n query: GET_APP_KEY_VALUE_QUERY,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.get',\n });\n\n return (appKeyValue?.value ?? null) as TValue | null;\n },\n\n async set<TValue>(\n key: string,\n value: TValue,\n options?: KvOptions,\n ): Promise<void> {\n await postGraphqlRequest<\n {\n input: { key: string; value: TValue; scope: AppKeyValueScope };\n },\n { setAppKeyValue: AppKeyValue }\n >({\n query: SET_APP_KEY_VALUE_MUTATION,\n variables: {\n input: {\n key,\n value,\n scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE,\n },\n },\n caller: 'kv.set',\n });\n },\n\n async delete(key: string, options?: KvOptions): Promise<boolean> {\n const { deleteAppKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { deleteAppKeyValue: boolean }\n >({\n query: DELETE_APP_KEY_VALUE_MUTATION,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.delete',\n });\n\n return deleteAppKeyValue;\n },\n};\n","import { type LogicFunctionHttpResponse } from 'twenty-shared/types';\n\nexport type ResponseInit = {\n status?: number;\n headers?: Record<string, string>;\n};\n\nexport class Response implements LogicFunctionHttpResponse {\n readonly __twentyHttpResponse = true as const;\n readonly body: unknown;\n readonly status?: number;\n readonly headers?: Record<string, string>;\n\n constructor(body: unknown, init?: ResponseInit) {\n this.body = body;\n this.status = init?.status;\n this.headers = init?.headers;\n }\n}\n"],"mappings":";;;;;AAEA,IAAIA,KAAK,OAAO,GAAG,SAAS,YAAY,GAAG,SAAS,aAAaC,EAAE,EAAE,yBAAy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