n8n-nodes-base 2.40.2 → 2.41.0
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/cjs/build.tsbuildinfo +1 -1
- package/dist/credentials/ClearbitApi.credentials.d.ts.map +1 -1
- package/dist/credentials/ClearbitApi.credentials.js +1 -0
- package/dist/credentials/ClearbitApi.credentials.js.map +1 -1
- package/dist/credentials/MicrosoftTeamsOAuth2Api.credentials.d.ts.map +1 -1
- package/dist/credentials/MicrosoftTeamsOAuth2Api.credentials.js +1 -0
- package/dist/credentials/MicrosoftTeamsOAuth2Api.credentials.js.map +1 -1
- package/dist/credentials/MondayComApi.credentials.js +1 -1
- package/dist/credentials/NotionApi.credentials.d.ts.map +1 -1
- package/dist/credentials/NotionApi.credentials.js +1 -0
- package/dist/credentials/NotionApi.credentials.js.map +1 -1
- package/dist/credentials/SlackApi.credentials.d.ts.map +1 -1
- package/dist/credentials/SlackApi.credentials.js +1 -0
- package/dist/credentials/SlackApi.credentials.js.map +1 -1
- package/dist/credentials/SlackOAuth2Api.credentials.js +1 -1
- package/dist/credentials/SlackOAuth2Api.credentials.js.map +1 -1
- package/dist/credentials/TelegramApi.credentials.d.ts.map +1 -1
- package/dist/credentials/TelegramApi.credentials.js +1 -0
- package/dist/credentials/TelegramApi.credentials.js.map +1 -1
- package/dist/credentials/common/aws/utils.d.ts +5 -1
- package/dist/credentials/common/aws/utils.d.ts.map +1 -1
- package/dist/credentials/common/aws/utils.js +6 -4
- package/dist/credentials/common/aws/utils.js.map +1 -1
- package/dist/known/credentials.json +4 -2
- package/dist/known/nodes.json +4 -0
- package/dist/node-definitions/.nodes-hash +1 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/emailReadImap/v2.ts +1 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/emailReadImap/v21.ts +1 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/emailReadImap/v22.ts +1 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/index.ts +3 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v1/mode_each.ts +0 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v1/mode_once.ts +0 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v11/mode_each.ts +0 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v11/mode_once.ts +0 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v12/mode_each.ts +0 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v12/mode_once.ts +0 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v13/mode_each.ts +0 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v13/mode_once.ts +0 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v14/index.schema.js +22 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v14/index.ts +15 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v14/mode_each.schema.js +27 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v14/mode_each.ts +99 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v14/mode_once.schema.js +27 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/executeWorkflow/v14/mode_once.ts +99 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/googleAnalytics/v2/resource_report/operation_get.ts +2 -2
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftOutlook/v2/resource_event/operation_create.ts +2 -2
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/index.schema.js +2 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/index.ts +3 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_channel_message/operation_create.schema.js +2 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_channel_message/operation_create.ts +31 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_channel_message/operation_reply.schema.js +2 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_channel_message/operation_reply.ts +31 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_chat/index.schema.js +24 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_chat/index.ts +18 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_chat/operation_create.schema.js +25 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_chat/operation_create.ts +73 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_chat/operation_get.schema.js +23 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_chat/operation_get.ts +31 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_chat/operation_get_all.schema.js +24 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_chat/operation_get_all.ts +37 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_chat_message/operation_create.schema.js +2 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftTeams/v2/resource_chat_message/operation_create.ts +20 -0
- package/dist/nodes/Databricks/Databricks.node.d.ts.map +1 -1
- package/dist/nodes/Databricks/Databricks.node.js +3 -36
- package/dist/nodes/Databricks/Databricks.node.js.map +1 -1
- package/dist/nodes/Databricks/DatabricksTrigger.node.d.ts +6 -0
- package/dist/nodes/Databricks/DatabricksTrigger.node.d.ts.map +1 -0
- package/dist/nodes/Databricks/DatabricksTrigger.node.js +30 -0
- package/dist/nodes/Databricks/DatabricksTrigger.node.js.map +1 -0
- package/dist/nodes/Databricks/DatabricksTrigger.node.json +18 -0
- package/dist/nodes/Databricks/actions/helpers.d.ts +14 -15
- package/dist/nodes/Databricks/actions/helpers.d.ts.map +1 -1
- package/dist/nodes/Databricks/actions/helpers.js +72 -31
- package/dist/nodes/Databricks/actions/helpers.js.map +1 -1
- package/dist/nodes/Databricks/actions/interfaces.d.ts +75 -12
- package/dist/nodes/Databricks/actions/interfaces.d.ts.map +1 -1
- package/dist/nodes/Databricks/actions/job/Job.resource.d.ts +3 -0
- package/dist/nodes/Databricks/actions/job/Job.resource.d.ts.map +1 -1
- package/dist/nodes/Databricks/actions/job/Job.resource.js +4 -1
- package/dist/nodes/Databricks/actions/job/Job.resource.js.map +1 -1
- package/dist/nodes/Databricks/actions/job/getJob.operation.d.ts +3 -0
- package/dist/nodes/Databricks/actions/job/getJob.operation.d.ts.map +1 -0
- package/dist/nodes/Databricks/actions/job/getJob.operation.js +41 -0
- package/dist/nodes/Databricks/actions/job/getJob.operation.js.map +1 -0
- package/dist/nodes/Databricks/actions/job/getRun.operation.d.ts +3 -0
- package/dist/nodes/Databricks/actions/job/getRun.operation.d.ts.map +1 -0
- package/dist/nodes/Databricks/actions/job/getRun.operation.js +36 -0
- package/dist/nodes/Databricks/actions/job/getRun.operation.js.map +1 -0
- package/dist/nodes/Databricks/actions/job/getRunOutput.operation.d.ts +3 -0
- package/dist/nodes/Databricks/actions/job/getRunOutput.operation.d.ts.map +1 -0
- package/dist/nodes/Databricks/actions/job/getRunOutput.operation.js +61 -0
- package/dist/nodes/Databricks/actions/job/getRunOutput.operation.js.map +1 -0
- package/dist/nodes/Databricks/actions/job/run.operation.d.ts.map +1 -1
- package/dist/nodes/Databricks/actions/job/run.operation.js +8 -38
- package/dist/nodes/Databricks/actions/job/run.operation.js.map +1 -1
- package/dist/nodes/Databricks/actions/job/runState.d.ts +11 -0
- package/dist/nodes/Databricks/actions/job/runState.d.ts.map +1 -0
- package/dist/nodes/Databricks/actions/job/runState.js +30 -0
- package/dist/nodes/Databricks/actions/job/runState.js.map +1 -0
- package/dist/nodes/Databricks/actions/router.js +1 -1
- package/dist/nodes/Databricks/actions/router.js.map +1 -1
- package/dist/nodes/Databricks/authentication.d.ts +4 -0
- package/dist/nodes/Databricks/authentication.d.ts.map +1 -0
- package/dist/nodes/Databricks/authentication.js +40 -0
- package/dist/nodes/Databricks/authentication.js.map +1 -0
- package/dist/nodes/Databricks/constants.d.ts +3 -0
- package/dist/nodes/Databricks/constants.d.ts.map +1 -1
- package/dist/nodes/Databricks/constants.js +4 -1
- package/dist/nodes/Databricks/constants.js.map +1 -1
- package/dist/nodes/Databricks/methods/listSearch.d.ts +1 -0
- package/dist/nodes/Databricks/methods/listSearch.d.ts.map +1 -1
- package/dist/nodes/Databricks/methods/listSearch.js +53 -15
- package/dist/nodes/Databricks/methods/listSearch.js.map +1 -1
- package/dist/nodes/Databricks/resources/job/operations.d.ts.map +1 -1
- package/dist/nodes/Databricks/resources/job/operations.js +18 -0
- package/dist/nodes/Databricks/resources/job/operations.js.map +1 -1
- package/dist/nodes/Databricks/resources/job/parameters.d.ts.map +1 -1
- package/dist/nodes/Databricks/resources/job/parameters.js +51 -2
- package/dist/nodes/Databricks/resources/job/parameters.js.map +1 -1
- package/dist/nodes/Databricks/transport/index.d.ts +4 -0
- package/dist/nodes/Databricks/transport/index.d.ts.map +1 -0
- package/dist/nodes/Databricks/transport/index.js +16 -0
- package/dist/nodes/Databricks/transport/index.js.map +1 -0
- package/dist/nodes/Databricks/transport/jobRuns.d.ts +16 -0
- package/dist/nodes/Databricks/transport/jobRuns.d.ts.map +1 -0
- package/dist/nodes/Databricks/transport/jobRuns.js +55 -0
- package/dist/nodes/Databricks/transport/jobRuns.js.map +1 -0
- package/dist/nodes/Databricks/transport/pagination.d.ts +13 -0
- package/dist/nodes/Databricks/transport/pagination.d.ts.map +1 -0
- package/dist/nodes/Databricks/transport/pagination.js +28 -0
- package/dist/nodes/Databricks/transport/pagination.js.map +1 -0
- package/dist/nodes/Databricks/transport/pipelineEvents.d.ts +68 -0
- package/dist/nodes/Databricks/transport/pipelineEvents.d.ts.map +1 -0
- package/dist/nodes/Databricks/transport/pipelineEvents.js +88 -0
- package/dist/nodes/Databricks/transport/pipelineEvents.js.map +1 -0
- package/dist/nodes/EmailReadImap/search-criteria.d.ts +9 -0
- package/dist/nodes/EmailReadImap/search-criteria.d.ts.map +1 -0
- package/dist/nodes/EmailReadImap/search-criteria.js +254 -0
- package/dist/nodes/EmailReadImap/search-criteria.js.map +1 -0
- package/dist/nodes/EmailReadImap/v1/EmailReadImapV1.node.d.ts +1 -3
- package/dist/nodes/EmailReadImap/v1/EmailReadImapV1.node.d.ts.map +1 -1
- package/dist/nodes/EmailReadImap/v1/EmailReadImapV1.node.js +59 -64
- package/dist/nodes/EmailReadImap/v1/EmailReadImapV1.node.js.map +1 -1
- package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.d.ts.map +1 -1
- package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js +16 -5
- package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js.map +1 -1
- package/dist/nodes/EmailReadImap/v2/utils.d.ts +2 -1
- package/dist/nodes/EmailReadImap/v2/utils.d.ts.map +1 -1
- package/dist/nodes/EmailReadImap/v2/utils.js +32 -38
- package/dist/nodes/EmailReadImap/v2/utils.js.map +1 -1
- package/dist/nodes/ExecuteWorkflow/ExecuteWorkflow/ExecuteWorkflow.node.d.ts.map +1 -1
- package/dist/nodes/ExecuteWorkflow/ExecuteWorkflow/ExecuteWorkflow.node.js +48 -42
- package/dist/nodes/ExecuteWorkflow/ExecuteWorkflow/ExecuteWorkflow.node.js.map +1 -1
- package/dist/nodes/Form/v1/FormTriggerV1.node.d.ts +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/channelMessage/create.operation.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/channelMessage/create.operation.js +13 -11
- package/dist/nodes/Microsoft/Teams/v2/actions/channelMessage/create.operation.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/channelMessage/reply.operation.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/channelMessage/reply.operation.js +5 -3
- package/dist/nodes/Microsoft/Teams/v2/actions/channelMessage/reply.operation.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/create.operation.d.ts +31 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/create.operation.d.ts.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/create.operation.js +225 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/create.operation.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/get.operation.d.ts +31 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/get.operation.d.ts.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/get.operation.js +37 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/get.operation.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/getAll.operation.d.ts +31 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/getAll.operation.d.ts.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/getAll.operation.js +43 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/getAll.operation.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/index.d.ts +7 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/index.d.ts.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/index.js +96 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/index.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/sharedGuard.d.ts +10 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/sharedGuard.d.ts.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/sharedGuard.js +20 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chat/sharedGuard.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/create.operation.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/create.operation.js +9 -12
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/create.operation.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/get.operation.js +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/get.operation.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/getAll.operation.js +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/getAll.operation.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/messageActions.js +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/messageActions.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/sendAndWait.operation.js +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/sendAndWait.operation.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/sharedGuard.d.ts +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/sharedGuard.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/chatMessage/sharedGuard.js +2 -2
- package/dist/nodes/Microsoft/Teams/v2/actions/node.type.d.ts +1 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/node.type.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/router.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/router.js +25 -0
- package/dist/nodes/Microsoft/Teams/v2/actions/router.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/versionDescription.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/versionDescription.js +7 -1
- package/dist/nodes/Microsoft/Teams/v2/actions/versionDescription.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/descriptions/common.description.d.ts +22 -3
- package/dist/nodes/Microsoft/Teams/v2/descriptions/common.description.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/descriptions/common.description.js +93 -4
- package/dist/nodes/Microsoft/Teams/v2/descriptions/common.description.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/descriptions/rlc.description.d.ts +6 -0
- package/dist/nodes/Microsoft/Teams/v2/descriptions/rlc.description.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/descriptions/rlc.description.js +53 -1
- package/dist/nodes/Microsoft/Teams/v2/descriptions/rlc.description.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/helpers/utils.d.ts +38 -14
- package/dist/nodes/Microsoft/Teams/v2/helpers/utils.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/helpers/utils.js +268 -65
- package/dist/nodes/Microsoft/Teams/v2/helpers/utils.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/methods/listSearch.d.ts +6 -0
- package/dist/nodes/Microsoft/Teams/v2/methods/listSearch.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/methods/listSearch.js +51 -0
- package/dist/nodes/Microsoft/Teams/v2/methods/listSearch.js.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/transport/index.d.ts.map +1 -1
- package/dist/nodes/Microsoft/Teams/v2/transport/index.js.map +1 -1
- package/dist/nodes/MondayCom/GenericFunctions.d.ts.map +1 -1
- package/dist/nodes/MondayCom/GenericFunctions.js +22 -6
- package/dist/nodes/MondayCom/GenericFunctions.js.map +1 -1
- package/dist/nodes/MondayCom/MondayCom.node.d.ts.map +1 -1
- package/dist/nodes/MondayCom/MondayCom.node.js +41 -37
- package/dist/nodes/MondayCom/MondayCom.node.js.map +1 -1
- package/dist/nodes/S3/GenericFunctions.d.ts.map +1 -1
- package/dist/nodes/S3/GenericFunctions.js +4 -0
- package/dist/nodes/S3/GenericFunctions.js.map +1 -1
- package/dist/nodes/Slack/V2/GenericFunctions.d.ts.map +1 -1
- package/dist/nodes/Slack/V2/GenericFunctions.js +3 -0
- package/dist/nodes/Slack/V2/GenericFunctions.js.map +1 -1
- package/dist/nodes/Telegram/GenericFunctions.d.ts +1 -1
- package/dist/nodes/TheHiveProject/helpers/constants.d.ts +1 -1
- package/dist/types/credentials.json +9 -9
- package/dist/types/nodes.json +7 -6
- package/dist/utils/microsoft/transport.d.ts.map +1 -1
- package/dist/utils/microsoft/transport.js +23 -4
- package/dist/utils/microsoft/transport.js.map +1 -1
- package/package.json +16 -14
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { IExecuteFunctions, ILoadOptionsFunctions, INodeListSearchItems } from 'n8n-workflow';
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, ILoadOptionsFunctions, INode, INodeListSearchItems } from 'n8n-workflow';
|
|
2
|
+
import { NodeOperationError } from 'n8n-workflow';
|
|
3
|
+
import { type UserTargetMessages } from '../../../GenericFunctions';
|
|
2
4
|
/** Where the `<at>` tokens go relative to the message text. The workflow-link footer, when on,
|
|
3
5
|
* always comes last, so `end` means "after the text, before the footer". */
|
|
4
6
|
export type MentionPlacement = 'start' | 'end';
|
|
@@ -10,23 +12,45 @@ export type Mention = {
|
|
|
10
12
|
displayName: string;
|
|
11
13
|
userIdentityType: 'aadUser';
|
|
12
14
|
};
|
|
15
|
+
} | {
|
|
16
|
+
tag: {
|
|
17
|
+
id: string;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
13
20
|
};
|
|
14
21
|
};
|
|
22
|
+
export declare const userTargetMessages: (label: string) => UserTargetMessages;
|
|
15
23
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* yields the authoritative display name.
|
|
24
|
+
* Rewrites Graph's 403 for a missing team-tag scope into copy that names the n8n action. Returns
|
|
25
|
+
* `undefined` for every other error, so both tag call sites stay one line and the two
|
|
26
|
+
* descriptions cannot drift apart.
|
|
20
27
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
28
|
+
* The text has to be read from all three fields. The delegated transport branch in
|
|
29
|
+
* `utils/microsoft/transport.ts` passes `errorOptions.message`, which puts Graph's text in
|
|
30
|
+
* `.message` and clears `.description`; a `NodeApiError` built from a raw response body leaves it
|
|
31
|
+
* in `.description` and `.messages`. Gating on one field alone is green in tests and dead in
|
|
32
|
+
* production.
|
|
23
33
|
*/
|
|
24
|
-
export declare function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
export declare function tagPermissionError(error: unknown, node: INode, message: string, itemIndex?: number): NodeOperationError | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Resolves one user-picker row to the Graph user it names. Graph stores
|
|
37
|
+
* `mentions[].mentioned.user` verbatim and resolves nothing: a UPN or a well-formed but
|
|
38
|
+
* nonexistent GUID is accepted with a 200 and a mention that notifies nobody. So each row goes
|
|
39
|
+
* through `GET /users/{idOrUpn}` first, which also yields the authoritative display name.
|
|
40
|
+
*
|
|
41
|
+
* `label` names the row in every error (`mention 2`, `participant 1`) and must never carry a
|
|
42
|
+
* parameter value. Shared by the mention rows and by `chat:create`'s participant rows.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveUserTarget(this: IExecuteFunctions, raw: unknown, itemIndex: number, label: string): Promise<IDataObject>;
|
|
45
|
+
/**
|
|
46
|
+
* Resolves every mention row to a Graph user or team tag. Graph stores `mentions[].mentioned`
|
|
47
|
+
* verbatim and resolves nothing: a UPN, a well-formed but nonexistent GUID or a bogus tag ID is
|
|
48
|
+
* accepted with a 200 and a mention that notifies nobody. So each row is looked up first, which
|
|
49
|
+
* also yields the authoritative display name.
|
|
50
|
+
*
|
|
51
|
+
* Rows are walked in order, one request each: sequential keeps a failing row unambiguous.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveMentions(this: IExecuteFunctions, itemIndex: number, teamId?: string): Promise<Mention[]>;
|
|
54
|
+
export declare function prepareMessage(this: IExecuteFunctions | ILoadOptionsFunctions, message: string, contentType: string, includeLinkToWorkflow: boolean, instanceId?: string, mentions?: readonly Mention[], mentionPlacement?: MentionPlacement): IDataObject;
|
|
31
55
|
export declare function filterSortSearchListItems(items: INodeListSearchItems[], filter?: string): INodeListSearchItems[];
|
|
32
56
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../nodes/Microsoft/Teams/v2/helpers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../nodes/Microsoft/Teams/v2/helpers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,EACL,oBAAoB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAwC,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGxF,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,2BAA2B,CAAC;AAGnC;4EAC4E;AAC5E,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/C,MAAM,MAAM,OAAO,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EACN;QAAE,IAAI,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,gBAAgB,EAAE,SAAS,CAAA;SAAE,CAAA;KAAE,GAC1E;QAAE,GAAG,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CAChD,CAAC;AAoBF,eAAO,MAAM,kBAAkB,UAAW,MAAM,KAAG,kBAcjD,CAAC;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,GAChB,kBAAkB,GAAG,SAAS,CAWhC;AA6HD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,WAAW,CAAC,CA4CtB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACpC,IAAI,EAAE,iBAAiB,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,EAAE,CAAC,CAkGpB;AAED,wBAAgB,cAAc,CAC7B,IAAI,EAAE,iBAAiB,GAAG,qBAAqB,EAC/C,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,qBAAqB,EAAE,OAAO,EAC9B,UAAU,CAAC,EAAE,MAAM,EAGnB,QAAQ,GAAE,SAAS,OAAO,EAAO,EACjC,gBAAgB,GAAE,gBAA0B,eAyC5C;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,oBAAoB,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,0BAiBvF"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.userTargetMessages = void 0;
|
|
4
|
+
exports.tagPermissionError = tagPermissionError;
|
|
5
|
+
exports.resolveUserTarget = resolveUserTarget;
|
|
3
6
|
exports.resolveMentions = resolveMentions;
|
|
4
7
|
exports.prepareMessage = prepareMessage;
|
|
5
8
|
exports.filterSortSearchListItems = filterSortSearchListItems;
|
|
@@ -7,56 +10,218 @@ const n8n_workflow_1 = require("n8n-workflow");
|
|
|
7
10
|
const query_escaping_1 = require("../../../../../utils/query-escaping");
|
|
8
11
|
const GenericFunctions_1 = require("../../../GenericFunctions");
|
|
9
12
|
const transport_1 = require("../transport");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Escapes the marker text. A B2B guest's display name is third-party input, and an unescaped
|
|
15
|
+
* angle bracket breaks the token. NOT `escapeHtml` from `utils/utilities.ts`: that one decodes.
|
|
16
|
+
*
|
|
17
|
+
* Apply this to the `<at>` inner text AND to `mentions[].mentionText`, so the two are the same
|
|
18
|
+
* string. Graph matches the marker leniently (either form is accepted) but then uses
|
|
19
|
+
* `mentionText.length` to find where the token ends. Feeding it the raw name while the body
|
|
20
|
+
* holds the escaped one makes it resume that many characters early and duplicate the tail of
|
|
21
|
+
* `</at>` into the message, which renders as a stray `/at>` after the chip. Same length on both
|
|
22
|
+
* sides, no drift.
|
|
23
|
+
*/
|
|
24
|
+
function escapeMentionText(text) {
|
|
25
|
+
return text.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');
|
|
26
|
+
}
|
|
27
|
+
// `label` is a node-generated row label (e.g. `mention 2`, `participant 1`), never a
|
|
28
|
+
// user-supplied value. Callers must never pass an id or any parameter value: these messages
|
|
29
|
+
// are surfaced verbatim and must not echo input back.
|
|
30
|
+
const userTargetMessages = (label) => ({
|
|
13
31
|
required: {
|
|
14
|
-
message: `No user selected for
|
|
32
|
+
message: `No user selected for ${label}`,
|
|
15
33
|
description: 'Pick the user from the list, or enter a user ID or email address.',
|
|
16
34
|
},
|
|
17
35
|
dotsOnly: {
|
|
18
|
-
message: `The user for
|
|
36
|
+
message: `The user for ${label} is not valid`,
|
|
19
37
|
description: 'A user ID cannot consist only of dots.',
|
|
20
38
|
},
|
|
21
39
|
invalid: {
|
|
22
|
-
message: `The user for
|
|
40
|
+
message: `The user for ${label} is not valid`,
|
|
23
41
|
description: 'Enter a plain email address or user ID. Remove any slashes, backslashes, colons, commas, spaces, or encoded characters and try again.',
|
|
24
42
|
},
|
|
25
43
|
});
|
|
44
|
+
exports.userTargetMessages = userTargetMessages;
|
|
45
|
+
/**
|
|
46
|
+
* Rewrites Graph's 403 for a missing team-tag scope into copy that names the n8n action. Returns
|
|
47
|
+
* `undefined` for every other error, so both tag call sites stay one line and the two
|
|
48
|
+
* descriptions cannot drift apart.
|
|
49
|
+
*
|
|
50
|
+
* The text has to be read from all three fields. The delegated transport branch in
|
|
51
|
+
* `utils/microsoft/transport.ts` passes `errorOptions.message`, which puts Graph's text in
|
|
52
|
+
* `.message` and clears `.description`; a `NodeApiError` built from a raw response body leaves it
|
|
53
|
+
* in `.description` and `.messages`. Gating on one field alone is green in tests and dead in
|
|
54
|
+
* production.
|
|
55
|
+
*/
|
|
56
|
+
function tagPermissionError(error, node, message, itemIndex) {
|
|
57
|
+
if (!(error instanceof n8n_workflow_1.NodeApiError) || error.httpCode !== '403')
|
|
58
|
+
return undefined;
|
|
59
|
+
if (![error.message, error.description, ...error.messages].join(' ').includes('TeamworkTag')) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
return new n8n_workflow_1.NodeOperationError(node, message, {
|
|
63
|
+
itemIndex,
|
|
64
|
+
description: "This credential does not have permission to read team tags. Add TeamworkTag.Read to the credential's scopes if you set them yourself, then open the credential and select Reconnect. A Microsoft Entra admin must approve it.",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
26
67
|
/**
|
|
27
68
|
* `GET /users/{id}` resolves an object id or a principal name, never a `mail` address, and the
|
|
28
69
|
* two differ for every guest. So a 404 on something that looks like an address gets one more try
|
|
29
70
|
* against `mail` before we give up, which keeps By Email agreeing with From List, whose `$search`
|
|
30
71
|
* already matches on mail.
|
|
31
72
|
*/
|
|
32
|
-
async function
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
73
|
+
async function findUsersByMail(address) {
|
|
74
|
+
const response = (await transport_1.microsoftApiRequest.call(this, 'GET', '/v1.0/users', {}, {
|
|
75
|
+
$filter: `mail eq '${(0, query_escaping_1.escapeODataValue)(address)}'`,
|
|
76
|
+
$select: 'id,displayName,userPrincipalName',
|
|
77
|
+
$top: 2,
|
|
78
|
+
}));
|
|
79
|
+
// The matches, not a single winner: the caller has to tell an ambiguous address apart from
|
|
80
|
+
// an unknown one, because "the user does not exist" is the wrong answer for two matches.
|
|
81
|
+
return Array.isArray(response.value) ? response.value : [];
|
|
39
82
|
}
|
|
40
83
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
84
|
+
* Reads a row field that may hold a resource-locator object. Keyed on key presence, not on
|
|
85
|
+
* truthiness: the everyday "row added, nobody picked yet" state is the RLC default
|
|
86
|
+
* `{ __rl: true, mode: 'list', value: '' }`, and unwrapping it on truthiness would pass the whole
|
|
87
|
+
* object down and tell the user to remove slashes from an ID they never typed. One deliberate
|
|
88
|
+
* delta from `extractValue`: `isResourceLocatorValue` also requires `__rl`, which `extractValueRLC`
|
|
89
|
+
* does not, so a hand-authored `{ mode, value }` without it is stricter here than under the
|
|
90
|
+
* indexed read this replaced. That shape then lands on the object branch below, like
|
|
91
|
+
* `resolveMailbox` in `Microsoft/Outlook/v2/transport`: collapsing it reports "nothing selected"
|
|
92
|
+
* with no request, where stringifying it would send the literal `[object Object]` to Graph and
|
|
93
|
+
* spend a call to learn nothing. A number or a boolean still stringifies, because only an object
|
|
94
|
+
* is guaranteed useless as an ID.
|
|
95
|
+
*/
|
|
96
|
+
const rlcValue = (value) => {
|
|
97
|
+
const raw = (0, n8n_workflow_1.isResourceLocatorValue)(value) ? value.value : value;
|
|
98
|
+
if (typeof raw === 'string')
|
|
99
|
+
return raw.trim();
|
|
100
|
+
return typeof raw === 'number' || typeof raw === 'boolean' ? String(raw) : '';
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Looks a team tag up under the team that owns it. A foreign tag ID 404s under
|
|
104
|
+
* `/teams/{other}/tags/{id}`, which is how team ownership is proven.
|
|
105
|
+
*/
|
|
106
|
+
async function resolveTagMention(tagId, teamId, rowNumber, itemIndex) {
|
|
107
|
+
const node = this.getNode();
|
|
108
|
+
let tag;
|
|
109
|
+
try {
|
|
110
|
+
// `buildTeamsPath`, not `encodeURIComponent`: a tag ID is base64 over `[A-Za-z0-9=]` only
|
|
111
|
+
// (see `teamworkTagRLC`), which needs no encoding, and Graph's own docs interpolate it
|
|
112
|
+
// raw. The user branch encodes only because a B2B guest UPN carries `#EXT#`, which
|
|
113
|
+
// `buildTeamsPath` rejects. It is built inside this try so the catch below attributes a
|
|
114
|
+
// malformed ID to its item.
|
|
115
|
+
const response = (await transport_1.microsoftApiRequest.call(this, 'GET', transport_1.buildTeamsPath.call(this, ['/v1.0/teams/', { id: teamId }, '/tags/', { id: tagId }])));
|
|
116
|
+
// The v1.0 get-by-id docs example wraps the entity in `value` while the list endpoint
|
|
117
|
+
// returns an array under the same key. Drop the fallback once the ENT-350 live spike
|
|
118
|
+
// settles it.
|
|
119
|
+
tag = (response.value ?? response);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
// Only a tag row rewrites its 403. A user row in the same loop keeps Graph's own message,
|
|
123
|
+
// by ENT-324's choice.
|
|
124
|
+
const denied = tagPermissionError(error, node, 'Could not read the team tag', itemIndex);
|
|
125
|
+
if (denied)
|
|
126
|
+
throw denied;
|
|
127
|
+
if (error instanceof n8n_workflow_1.NodeApiError && error.httpCode === '404') {
|
|
128
|
+
throw new n8n_workflow_1.NodeOperationError(node, `Could not find the team tag for mention ${rowNumber}`, {
|
|
129
|
+
itemIndex,
|
|
130
|
+
description: 'Pick the tag from the list, or check that the tag ID is correct and that the tag belongs to the selected team.',
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
throw (0, GenericFunctions_1.stampItemIndexOnError)(error, itemIndex);
|
|
134
|
+
}
|
|
135
|
+
// No fallback for either field, unlike the user branch below. A tag ID is an opaque base64
|
|
136
|
+
// blob, so falling back to it ships a garbage chip that Graph still accepts; and if the
|
|
137
|
+
// response is the list shape, both fields are missing, `mentioned.tag.id` drops out of the
|
|
138
|
+
// body and the run is green with a mention that notifies nobody.
|
|
139
|
+
if (typeof tag.id !== 'string' ||
|
|
140
|
+
!tag.id ||
|
|
141
|
+
typeof tag.displayName !== 'string' ||
|
|
142
|
+
!tag.displayName) {
|
|
143
|
+
throw new n8n_workflow_1.NodeOperationError(node, `Could not read the team tag for mention ${rowNumber}`, {
|
|
144
|
+
itemIndex,
|
|
145
|
+
description: 'Microsoft Graph returned a tag without an ID or a display name.',
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// The ID comes from the response, never from the input: `validateMicrosoftGraphId` trims and
|
|
149
|
+
// percent-decodes, so the path can legitimately differ from what the user typed, and the body
|
|
150
|
+
// is what decides who gets notified.
|
|
151
|
+
return {
|
|
152
|
+
mentionText: tag.displayName,
|
|
153
|
+
mentioned: { tag: { id: tag.id, displayName: tag.displayName } },
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* One Graph lookup per distinct mention target for the whole run, not one per item. The router
|
|
158
|
+
* calls `resolveMentions` once per input item with the same execute context, so a static mention
|
|
159
|
+
* on a 500-item fan-out would otherwise repeat the same lookup 500 times, sequentially. Keyed on
|
|
160
|
+
* the context object, so the cache is collected with the execution and never crosses runs or
|
|
161
|
+
* tenants. Only successes are stored, so a throttled row is retried on the next item.
|
|
162
|
+
*
|
|
163
|
+
* Keys are namespaced by mention type, and a tag key carries its team: the same ID string means
|
|
164
|
+
* different things in the two arms, and a tag only resolves under the team that owns it.
|
|
46
165
|
*/
|
|
47
166
|
const resolvedPerRun = new WeakMap();
|
|
48
167
|
/**
|
|
49
|
-
* Resolves
|
|
50
|
-
* and resolves nothing: a UPN or a well-formed but
|
|
51
|
-
* mention that notifies nobody. So each row goes
|
|
52
|
-
* yields the authoritative display name.
|
|
168
|
+
* Resolves one user-picker row to the Graph user it names. Graph stores
|
|
169
|
+
* `mentions[].mentioned.user` verbatim and resolves nothing: a UPN or a well-formed but
|
|
170
|
+
* nonexistent GUID is accepted with a 200 and a mention that notifies nobody. So each row goes
|
|
171
|
+
* through `GET /users/{idOrUpn}` first, which also yields the authoritative display name.
|
|
172
|
+
*
|
|
173
|
+
* `label` names the row in every error (`mention 2`, `participant 1`) and must never carry a
|
|
174
|
+
* parameter value. Shared by the mention rows and by `chat:create`'s participant rows.
|
|
175
|
+
*/
|
|
176
|
+
async function resolveUserTarget(raw, itemIndex, label) {
|
|
177
|
+
const node = this.getNode();
|
|
178
|
+
// Validate the shape before encoding (`encodeURIComponent` leaves `..` intact) and encode
|
|
179
|
+
// the same trimmed string, since the validator is anchored and callers trim.
|
|
180
|
+
const value = String(raw ?? '').trim();
|
|
181
|
+
try {
|
|
182
|
+
(0, GenericFunctions_1.validateUserTargetId)(value, node, (0, exports.userTargetMessages)(label));
|
|
183
|
+
return (await transport_1.microsoftApiRequest.call(this, 'GET', `/v1.0/users/${encodeURIComponent(value)}`, {}, { $select: 'id,displayName,userPrincipalName' }));
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
if (!(error instanceof n8n_workflow_1.NodeApiError && error.httpCode === '404')) {
|
|
187
|
+
// A validation failure and 403 (missing User.Read.All), 429 or 5xx all keep their
|
|
188
|
+
// own message; only the item index is added.
|
|
189
|
+
throw (0, GenericFunctions_1.stampItemIndexOnError)(error, itemIndex);
|
|
190
|
+
}
|
|
191
|
+
// Only an address can be a `mail` value, so a GUID goes straight to the error.
|
|
192
|
+
const matches = value.includes('@')
|
|
193
|
+
? await findUsersByMail.call(this, value).catch((mailError) => {
|
|
194
|
+
throw (0, GenericFunctions_1.stampItemIndexOnError)(mailError, itemIndex);
|
|
195
|
+
})
|
|
196
|
+
: [];
|
|
197
|
+
if (matches.length > 1) {
|
|
198
|
+
throw new n8n_workflow_1.NodeOperationError(node, `More than one user has that email address for ${label}`, {
|
|
199
|
+
itemIndex,
|
|
200
|
+
description: 'Two or more users in this Microsoft 365 tenant share that email address. Pick the user from the list, or enter their user ID instead.',
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
if (matches.length === 0) {
|
|
204
|
+
throw new n8n_workflow_1.NodeOperationError(node, `Could not find the user for ${label}`, {
|
|
205
|
+
itemIndex,
|
|
206
|
+
description: 'Pick the user from the list, or check that the user ID or email address is correct and that the user exists in this Microsoft 365 tenant.',
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return matches[0];
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Resolves every mention row to a Graph user or team tag. Graph stores `mentions[].mentioned`
|
|
214
|
+
* verbatim and resolves nothing: a UPN, a well-formed but nonexistent GUID or a bogus tag ID is
|
|
215
|
+
* accepted with a 200 and a mention that notifies nobody. So each row is looked up first, which
|
|
216
|
+
* also yields the authoritative display name.
|
|
53
217
|
*
|
|
54
|
-
* Rows are walked in order, one request each:
|
|
55
|
-
* keeps a failing row unambiguous and the resolved array in row order.
|
|
218
|
+
* Rows are walked in order, one request each: sequential keeps a failing row unambiguous.
|
|
56
219
|
*/
|
|
57
|
-
async function resolveMentions(itemIndex) {
|
|
58
|
-
|
|
59
|
-
|
|
220
|
+
async function resolveMentions(itemIndex, teamId) {
|
|
221
|
+
// Read the rows wholesale. An indexed read with `{ extractValue: true }` throws once a row
|
|
222
|
+
// field carries a `displayOptions`, which the mention type discriminator gives both pickers.
|
|
223
|
+
const raw = this.getNodeParameter('mentions.mention', itemIndex, []);
|
|
224
|
+
const rows = Array.isArray(raw) ? raw : [];
|
|
60
225
|
const node = this.getNode();
|
|
61
226
|
const mentions = [];
|
|
62
227
|
let cache = resolvedPerRun.get(this);
|
|
@@ -64,48 +229,62 @@ async function resolveMentions(itemIndex) {
|
|
|
64
229
|
cache = new Map();
|
|
65
230
|
resolvedPerRun.set(this, cache);
|
|
66
231
|
}
|
|
67
|
-
for (let index = 0; index <
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
232
|
+
for (let index = 0; index < rows.length; index++) {
|
|
233
|
+
// A null or non-object row used to fall through lodash `get` to the read's fallback.
|
|
234
|
+
const row = rows[index] ?? {};
|
|
235
|
+
const { mentionType } = row;
|
|
236
|
+
if (mentionType === 'tag') {
|
|
237
|
+
const tagId = rlcValue(row.tagId);
|
|
238
|
+
if (!tagId) {
|
|
239
|
+
throw new n8n_workflow_1.NodeOperationError(node, `No team tag selected for mention ${index + 1}`, {
|
|
240
|
+
itemIndex,
|
|
241
|
+
description: 'Pick the tag from the list, or enter a tag ID.',
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
// `undefined` is a chat message, which has no team and no tag picker; `''` is a
|
|
245
|
+
// channel message whose Team field is empty.
|
|
246
|
+
if (teamId === undefined) {
|
|
247
|
+
throw new n8n_workflow_1.NodeOperationError(node, 'Team tags are not available in a chat message', {
|
|
248
|
+
itemIndex,
|
|
249
|
+
description: `Remove mention ${index + 1} or use a channel message.`,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (!teamId) {
|
|
253
|
+
throw new n8n_workflow_1.NodeOperationError(node, `No team selected for the team tag in mention ${index + 1}`, { itemIndex, description: 'Select the team that owns the tag and try again.' });
|
|
254
|
+
}
|
|
255
|
+
const tagKey = `tag:${teamId}\u0000${tagId}`;
|
|
256
|
+
const cachedTag = cache.get(tagKey);
|
|
257
|
+
if (cachedTag) {
|
|
258
|
+
// Safe to share by reference: `prepareMessage` spreads rather than mutates.
|
|
259
|
+
mentions.push(cachedTag);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
const tagMention = await resolveTagMention.call(this, tagId, teamId, index + 1, itemIndex);
|
|
263
|
+
cache.set(tagKey, tagMention);
|
|
264
|
+
mentions.push(tagMention);
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
// `undefined` is what `chatMessage:create` always sends: its row declares only `userRLC`,
|
|
268
|
+
// so there is no discriminator to read. An unknown value is an error rather than a silent
|
|
269
|
+
// user mention, because it reaches here from imported JSON, the public API and a
|
|
270
|
+
// surviving `$fromAI()` expression.
|
|
271
|
+
if (mentionType !== undefined && mentionType !== 'user') {
|
|
272
|
+
throw new n8n_workflow_1.NodeOperationError(node, `The mention type for mention ${index + 1} is not valid`, {
|
|
273
|
+
itemIndex,
|
|
274
|
+
description: 'Set the mention type to either User or Team Tag.',
|
|
275
|
+
});
|
|
276
|
+
}
|
|
71
277
|
// Validate the shape before encoding (`encodeURIComponent` leaves `..` intact) and encode
|
|
72
278
|
// the same trimmed string, since the validator is anchored and callers trim.
|
|
73
|
-
const value =
|
|
74
|
-
const
|
|
279
|
+
const value = rlcValue(row.userId);
|
|
280
|
+
const userKey = `user:${value}`;
|
|
281
|
+
const cached = cache.get(userKey);
|
|
75
282
|
if (cached) {
|
|
76
283
|
// Safe to share by reference: `prepareMessage` spreads rather than mutates.
|
|
77
284
|
mentions.push(cached);
|
|
78
285
|
continue;
|
|
79
286
|
}
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
(0, GenericFunctions_1.validateUserTargetId)(value, node, mentionMessages(index + 1));
|
|
83
|
-
user = (await transport_1.microsoftApiRequest.call(this, 'GET', `/v1.0/users/${encodeURIComponent(value)}`, {}, { $select: 'id,displayName,userPrincipalName' }));
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
if (error instanceof n8n_workflow_1.NodeApiError && error.httpCode === '404') {
|
|
87
|
-
// Only an address can be a `mail` value, so a GUID goes straight to the error.
|
|
88
|
-
// The fallback runs inside this catch, so its own 403/429/5xx would otherwise
|
|
89
|
-
// escape without the row index the primary lookup stamps on.
|
|
90
|
-
const byMail = value.includes('@')
|
|
91
|
-
? await findUserByMail.call(this, value).catch((mailError) => {
|
|
92
|
-
throw (0, GenericFunctions_1.stampItemIndexOnError)(mailError, itemIndex);
|
|
93
|
-
})
|
|
94
|
-
: undefined;
|
|
95
|
-
if (!byMail) {
|
|
96
|
-
throw new n8n_workflow_1.NodeOperationError(node, `Could not find the user for mention ${index + 1}`, {
|
|
97
|
-
itemIndex,
|
|
98
|
-
description: 'Pick the user from the list, or check that the user ID or email address is correct and that the user exists in this Microsoft 365 tenant.',
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
user = byMail;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
// A validation failure and 403 (missing User.Read.All), 429 or 5xx all keep their
|
|
105
|
-
// own message; only the item index is added.
|
|
106
|
-
throw (0, GenericFunctions_1.stampItemIndexOnError)(error, itemIndex);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
287
|
+
const user = await resolveUserTarget.call(this, value, itemIndex, `mention ${index + 1}`);
|
|
109
288
|
// Directory objects with no display name exist (some guests, some service accounts);
|
|
110
289
|
// without a fallback the mention renders as a blank chip. `||`, so `''` falls through.
|
|
111
290
|
const label = user.displayName || user.userPrincipalName || user.id;
|
|
@@ -115,24 +294,48 @@ async function resolveMentions(itemIndex) {
|
|
|
115
294
|
user: { id: user.id, displayName: label, userIdentityType: 'aadUser' },
|
|
116
295
|
},
|
|
117
296
|
};
|
|
118
|
-
cache.set(
|
|
297
|
+
cache.set(userKey, mention);
|
|
119
298
|
mentions.push(mention);
|
|
120
299
|
}
|
|
121
300
|
return mentions;
|
|
122
301
|
}
|
|
123
|
-
function prepareMessage(message, contentType, includeLinkToWorkflow, instanceId
|
|
302
|
+
function prepareMessage(message, contentType, includeLinkToWorkflow, instanceId,
|
|
303
|
+
// Read-only on purpose. `resolveMentions` caches these per run, so the same object can arrive
|
|
304
|
+
// for several items and mutating one here would corrupt every later item in the run.
|
|
305
|
+
mentions = [], mentionPlacement = 'start') {
|
|
306
|
+
if (mentions.length) {
|
|
307
|
+
// A mention in a `text` message is a hard 400 ("Mentions are only allowed in Html messages").
|
|
308
|
+
contentType = 'html';
|
|
309
|
+
const tokens = mentions
|
|
310
|
+
.map((mention, index) => `<at id="${index}">${escapeMentionText(mention.mentionText)}</at>`)
|
|
311
|
+
.join(' ');
|
|
312
|
+
// The footer is appended after this, so tokens stay above it either way.
|
|
313
|
+
const parts = mentionPlacement === 'end' ? [message, tokens] : [tokens, message];
|
|
314
|
+
message = parts.filter(Boolean).join(' ');
|
|
315
|
+
}
|
|
124
316
|
if (includeLinkToWorkflow) {
|
|
125
317
|
const { id } = this.getWorkflow();
|
|
126
318
|
const link = `${this.getInstanceBaseUrl()}workflow/${id}?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=${encodeURIComponent('n8n-nodes-base.microsoftTeams')}${instanceId ? '_' + instanceId : ''}`;
|
|
127
319
|
contentType = 'html';
|
|
128
320
|
message = `${message}<br><br><em> Powered by <a href="${link}">this n8n workflow</a> </em>`;
|
|
129
321
|
}
|
|
130
|
-
|
|
322
|
+
const body = {
|
|
131
323
|
body: {
|
|
132
324
|
contentType,
|
|
133
325
|
content: message,
|
|
134
326
|
},
|
|
135
327
|
};
|
|
328
|
+
// `id` comes from the same index as the token above. Graph 400s on any mismatch between the
|
|
329
|
+
// two, which is the invariant this function exists to hold.
|
|
330
|
+
if (mentions.length) {
|
|
331
|
+
body.mentions = mentions.map((mention, index) => ({
|
|
332
|
+
...mention,
|
|
333
|
+
id: index,
|
|
334
|
+
// Must be byte-identical to the token's inner text; see `escapeMentionText`.
|
|
335
|
+
mentionText: escapeMentionText(mention.mentionText),
|
|
336
|
+
}));
|
|
337
|
+
}
|
|
338
|
+
return body;
|
|
136
339
|
}
|
|
137
340
|
function filterSortSearchListItems(items, filter) {
|
|
138
341
|
return items
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../nodes/Microsoft/Teams/v2/helpers/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../nodes/Microsoft/Teams/v2/helpers/utils.ts"],"names":[],"mappings":";;;;;;;;AAOA,+CAAwF;AAExF,0DAAyD;AACzD,gEAImC;AACnC,4CAAmE;AAanE;;;;;;;;;;GAUG;AACH,SAAS,iBAAiB,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,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,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YACjD,GAAG,OAAO;YACV,EAAE,EAAE,KAAK;YACT,6EAA6E;YAC7E,WAAW,EAAE,iBAAiB,CAAC,OAAO,CAAC,WAAW,CAAC;SACnD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED,mCAA0C,KAA6B,EAAE,MAAe;IACvF,OAAO,KAAK;SACV,MAAM,CACN,CAAC,IAAI,EAAE,EAAE,CACR,CAAC,MAAM;QACP,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACtD,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CACnE;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACd,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC;YAC7D,OAAO,CAAC,CAAC,CAAC;QACX,CAAC;QACD,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC;YAC7D,OAAO,CAAC,CAAC;QACV,CAAC;QACD,OAAO,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -4,6 +4,12 @@ export declare function getChatMembers(this: ILoadOptionsFunctions, filter?: str
|
|
|
4
4
|
export declare function getUsers(this: ILoadOptionsFunctions, filter?: string, paginationToken?: string): Promise<INodeListSearchResult>;
|
|
5
5
|
export declare function getTeams(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
6
6
|
export declare function getChannels(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
7
|
+
/**
|
|
8
|
+
* Team tags for the mention picker. Mirrors `getChannels` (team-scoped, client-side filtering)
|
|
9
|
+
* rather than `getUsers`: Graph documents no `$search` on `/tags`, and `$filter` cannot do the
|
|
10
|
+
* substring match a picker needs. `/v1.0`, the tags collection is GA.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getTags(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
7
13
|
export declare function getGroups(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
8
14
|
export declare function getPlans(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
9
15
|
export declare function getBuckets(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listSearch.d.ts","sourceRoot":"","sources":["../../../../../../nodes/Microsoft/Teams/v2/methods/listSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,qBAAqB,EAE1B,KAAK,qBAAqB,EAC1B,MAAM,cAAc,CAAC;AAetB,wBAAsB,QAAQ,CAC7B,IAAI,EAAE,qBAAqB,EAC3B,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,qBAAqB,CAAC,CAuGhC;AAED,wBAAsB,cAAc,CACnC,IAAI,EAAE,qBAAqB,EAC3B,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,qBAAqB,CAAC,CA4BhC;AAED,wBAAsB,QAAQ,CAC7B,IAAI,EAAE,qBAAqB,EAC3B,MAAM,CAAC,EAAE,MAAM,EACf,eAAe,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"listSearch.d.ts","sourceRoot":"","sources":["../../../../../../nodes/Microsoft/Teams/v2/methods/listSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,qBAAqB,EAE1B,KAAK,qBAAqB,EAC1B,MAAM,cAAc,CA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|
|
@@ -5,6 +5,7 @@ exports.getChatMembers = getChatMembers;
|
|
|
5
5
|
exports.getUsers = getUsers;
|
|
6
6
|
exports.getTeams = getTeams;
|
|
7
7
|
exports.getChannels = getChannels;
|
|
8
|
+
exports.getTags = getTags;
|
|
8
9
|
exports.getGroups = getGroups;
|
|
9
10
|
exports.getPlans = getPlans;
|
|
10
11
|
exports.getBuckets = getBuckets;
|
|
@@ -143,6 +144,11 @@ async function getUsers(filter, paginationToken) {
|
|
|
143
144
|
catch (error) {
|
|
144
145
|
throw transport_1.rewriteForbiddenUnderSp.call(this, error, "The user list needs the User.Read.All application permission. Grant it with admin consent, or switch the field to By ID and enter the user's object ID.", 'A user principal name also needs User.Read.All, because the node looks it up.');
|
|
145
146
|
}
|
|
147
|
+
// An unexpected shape is not an empty directory: returning the token as well would offer
|
|
148
|
+
// "load more" into nothing.
|
|
149
|
+
if (!Array.isArray(response.value)) {
|
|
150
|
+
return { results: [], paginationToken: undefined };
|
|
151
|
+
}
|
|
146
152
|
const returnData = response.value.map((user) => ({
|
|
147
153
|
name: `${user.displayName} (${user.userPrincipalName})`,
|
|
148
154
|
value: user.id,
|
|
@@ -215,6 +221,51 @@ async function getChannels(filter) {
|
|
|
215
221
|
const results = (0, utils_1.filterSortSearchListItems)(returnData, filter);
|
|
216
222
|
return { results };
|
|
217
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Team tags for the mention picker. Mirrors `getChannels` (team-scoped, client-side filtering)
|
|
226
|
+
* rather than `getUsers`: Graph documents no `$search` on `/tags`, and `$filter` cannot do the
|
|
227
|
+
* substring match a picker needs. `/v1.0`, the tags collection is GA.
|
|
228
|
+
*/
|
|
229
|
+
async function getTags(filter) {
|
|
230
|
+
const teamId = this.getCurrentNodeParameter('teamId', { extractValue: true });
|
|
231
|
+
// Deliberate divergence from `getChannels`, which has no such guard and lets `buildTeamsPath`
|
|
232
|
+
// emit the generic "A required ID is empty" on the same node.
|
|
233
|
+
if (!teamId) {
|
|
234
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Select a team first');
|
|
235
|
+
}
|
|
236
|
+
let value;
|
|
237
|
+
try {
|
|
238
|
+
value = await transport_1.microsoftApiRequestAllItems.call(this, 'value', 'GET', transport_1.buildTeamsPath.call(this, ['/v1.0/teams/', { id: teamId }, '/tags']));
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
// The action belongs in the message, not the description: the resource-locator dropdown
|
|
242
|
+
// renders only the message and drops the description, so guidance put there is invisible.
|
|
243
|
+
// Verified in the editor against a credential without the scope, 2026-09-10.
|
|
244
|
+
throw ((0, utils_1.tagPermissionError)(error, this.getNode(), 'Could not load team tags. Add TeamworkTag.Read to the credential, then reconnect it.') ?? error);
|
|
245
|
+
}
|
|
246
|
+
// Graph sends `memberCount` as a number when listing and as a string when getting one tag.
|
|
247
|
+
const memberCounts = new Map(value.map((tag) => [tag.id, Number(tag.memberCount)]));
|
|
248
|
+
const returnData = value.map((tag) => ({
|
|
249
|
+
// Falls back like `getUsers`: a tag with no display name would otherwise set `name` to
|
|
250
|
+
// `undefined` and throw in the comparator below instead of listing the tags.
|
|
251
|
+
name: tag.displayName || tag.id,
|
|
252
|
+
value: tag.id,
|
|
253
|
+
description: tag.description,
|
|
254
|
+
}));
|
|
255
|
+
// Filter and sort on the bare display name, then append the count. A tag notifies everyone
|
|
256
|
+
// carrying it and the dropdown renders only `name`, so the blast radius has to go in the
|
|
257
|
+
// label, but baking it in first makes every tag match any substring of "(4 members)".
|
|
258
|
+
const results = (0, utils_1.filterSortSearchListItems)(returnData, filter).map((tag) => {
|
|
259
|
+
const memberCount = memberCounts.get(tag.value);
|
|
260
|
+
return memberCount !== undefined && Number.isFinite(memberCount)
|
|
261
|
+
? {
|
|
262
|
+
...tag,
|
|
263
|
+
name: `${tag.name} (${memberCount} ${memberCount === 1 ? 'member' : 'members'})`,
|
|
264
|
+
}
|
|
265
|
+
: tag;
|
|
266
|
+
});
|
|
267
|
+
return { results };
|
|
268
|
+
}
|
|
218
269
|
async function getGroups(filter) {
|
|
219
270
|
const returnData = [];
|
|
220
271
|
const value = await transport_1.microsoftApiRequestAllItems.call(this, 'value', 'GET', transport_1.joinedTeamsEndpoint.call(this));
|