@effect/chat-teams 0.0.0 → 4.1.5
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/AGENTS.md +434 -0
- package/CLAUDE.md +434 -0
- package/LICENSE +21 -0
- package/README.md +116 -0
- package/ai-docs/README.md +44 -0
- package/ai-docs/package.json +36 -0
- package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +52 -0
- package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
- package/ai-docs/src/01_effect/01_basics/index.md +7 -0
- package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
- package/ai-docs/src/01_effect/02_schema/index.md +7 -0
- package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
- package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
- package/ai-docs/src/01_effect/03_services/index.md +5 -0
- package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
- package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
- package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
- package/ai-docs/src/01_effect/04_errors/index.md +1 -0
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
- package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
- package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
- package/ai-docs/src/01_effect/05_resources/index.md +3 -0
- package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
- package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
- package/ai-docs/src/01_effect/06_running/index.md +1 -0
- package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
- package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
- package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
- package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
- package/ai-docs/src/03_stream/30_encoding.ts +163 -0
- package/ai-docs/src/03_stream/index.md +4 -0
- package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
- package/ai-docs/src/04_integration/index.md +5 -0
- package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
- package/ai-docs/src/05_batching/index.md +3 -0
- package/ai-docs/src/06_schedule/10_schedules.ts +111 -0
- package/ai-docs/src/06_schedule/index.md +3 -0
- package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
- package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
- package/ai-docs/src/07_datetime/index.md +5 -0
- package/ai-docs/src/08_observability/10_logging.ts +66 -0
- package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
- package/ai-docs/src/08_observability/index.md +7 -0
- package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
- package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
- package/ai-docs/src/09_testing/index.md +1 -0
- package/ai-docs/src/10_predicate/01_basics.ts +14 -0
- package/ai-docs/src/10_predicate/index.md +9 -0
- package/ai-docs/src/40_sql/10_basics.ts +175 -0
- package/ai-docs/src/40_sql/index.md +6 -0
- package/ai-docs/src/50_http-client/10_basics.ts +102 -0
- package/ai-docs/src/50_http-client/index.md +3 -0
- package/ai-docs/src/51_http-server/10_basics.ts +118 -0
- package/ai-docs/src/51_http-server/20_testing.ts +100 -0
- package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
- package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
- package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
- package/ai-docs/src/51_http-server/fixtures/api/Users.ts +107 -0
- package/ai-docs/src/51_http-server/fixtures/domain/User.ts +21 -0
- package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
- package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +37 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +80 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users.ts +183 -0
- package/ai-docs/src/51_http-server/index.md +3 -0
- package/ai-docs/src/52_graphql/10_basics.ts +117 -0
- package/ai-docs/src/52_graphql/20_testing.ts +45 -0
- package/ai-docs/src/52_graphql/30_batching.ts +118 -0
- package/ai-docs/src/52_graphql/40_aliased-batching.ts +124 -0
- package/ai-docs/src/52_graphql/50_errors-and-retries.ts +74 -0
- package/ai-docs/src/52_graphql/index.md +6 -0
- package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
- package/ai-docs/src/60_child-process/index.md +3 -0
- package/ai-docs/src/70_cli/10_basics.ts +162 -0
- package/ai-docs/src/70_cli/index.md +5 -0
- package/ai-docs/src/71_ai/10_language-model.ts +156 -0
- package/ai-docs/src/71_ai/20_tools.ts +226 -0
- package/ai-docs/src/71_ai/30_chat.ts +158 -0
- package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
- package/ai-docs/src/71_ai/index.md +5 -0
- package/ai-docs/src/80_cluster/10_entities.ts +97 -0
- package/ai-docs/src/80_cluster/index.md +4 -0
- package/ai-docs/src/index.md +10 -0
- package/ai-docs/tsconfig.json +28 -0
- package/dist/TeamsChat.d.ts +318 -0
- package/dist/TeamsChat.d.ts.map +1 -0
- package/dist/TeamsChat.js +316 -0
- package/dist/TeamsChat.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/adapter.d.ts +2 -0
- package/dist/internal/adapter.d.ts.map +1 -0
- package/dist/internal/adapter.js +300 -0
- package/dist/internal/adapter.js.map +1 -0
- package/dist/internal/address.d.ts +2 -0
- package/dist/internal/address.d.ts.map +1 -0
- package/dist/internal/address.js +52 -0
- package/dist/internal/address.js.map +1 -0
- package/dist/internal/auth.d.ts +2 -0
- package/dist/internal/auth.d.ts.map +1 -0
- package/dist/internal/auth.js +142 -0
- package/dist/internal/auth.js.map +1 -0
- package/dist/internal/connector.d.ts +2 -0
- package/dist/internal/connector.d.ts.map +1 -0
- package/dist/internal/connector.js +173 -0
- package/dist/internal/connector.js.map +1 -0
- package/dist/internal/download.d.ts +5 -0
- package/dist/internal/download.d.ts.map +1 -0
- package/dist/internal/download.js +183 -0
- package/dist/internal/download.js.map +1 -0
- package/dist/internal/envelope.d.ts +2 -0
- package/dist/internal/envelope.d.ts.map +1 -0
- package/dist/internal/envelope.js +337 -0
- package/dist/internal/envelope.js.map +1 -0
- package/dist/internal/errors.d.ts +2 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +113 -0
- package/dist/internal/errors.js.map +1 -0
- package/dist/internal/interactions.d.ts +2 -0
- package/dist/internal/interactions.d.ts.map +1 -0
- package/dist/internal/interactions.js +288 -0
- package/dist/internal/interactions.js.map +1 -0
- package/dist/internal/length.d.ts +2 -0
- package/dist/internal/length.d.ts.map +1 -0
- package/dist/internal/length.js +147 -0
- package/dist/internal/length.js.map +1 -0
- package/dist/internal/normalize.d.ts +2 -0
- package/dist/internal/normalize.d.ts.map +1 -0
- package/dist/internal/normalize.js +224 -0
- package/dist/internal/normalize.js.map +1 -0
- package/dist/internal/parse.d.ts +2 -0
- package/dist/internal/parse.d.ts.map +1 -0
- package/dist/internal/parse.js +33 -0
- package/dist/internal/parse.js.map +1 -0
- package/dist/internal/render.d.ts +2 -0
- package/dist/internal/render.d.ts.map +1 -0
- package/dist/internal/render.js +316 -0
- package/dist/internal/render.js.map +1 -0
- package/dist/internal/webhook.d.ts +2 -0
- package/dist/internal/webhook.d.ts.map +1 -0
- package/dist/internal/webhook.js +88 -0
- package/dist/internal/webhook.js.map +1 -0
- package/package.json +61 -1
- package/src/TeamsChat.ts +470 -0
- package/src/index.ts +12 -0
- package/src/internal/adapter.ts +351 -0
- package/src/internal/address.ts +67 -0
- package/src/internal/auth.ts +192 -0
- package/src/internal/connector.ts +253 -0
- package/src/internal/download.ts +277 -0
- package/src/internal/envelope.ts +427 -0
- package/src/internal/errors.ts +94 -0
- package/src/internal/interactions.ts +294 -0
- package/src/internal/length.ts +170 -0
- package/src/internal/normalize.ts +232 -0
- package/src/internal/parse.ts +41 -0
- package/src/internal/render.ts +318 -0
- package/src/internal/webhook.ts +117 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import * as DateTime from "effect/DateTime";
|
|
2
|
+
import * as Option from "effect/Option";
|
|
3
|
+
import * as Address from "./address.js";
|
|
4
|
+
import * as Download from "./download.js";
|
|
5
|
+
import { isObject, object, string } from "./parse.js";
|
|
6
|
+
/** The bot's own Connector id. @internal */
|
|
7
|
+
export const botId = appId => `28:${appId}`;
|
|
8
|
+
/**
|
|
9
|
+
* The public id of a user: the Entra object id for a person, the Connector
|
|
10
|
+
* id (`29:…`, `28:…`) for a bot or anyone without one.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export const userId = account => string(account, "aadObjectId") ?? string(account, "id");
|
|
15
|
+
/**
|
|
16
|
+
* Whether the activity was sent to the bot alone, as a targeted message.
|
|
17
|
+
* Read from `recipient.isTargeted`.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export const isTargeted = activity => object(activity, "recipient")?.isTargeted === true;
|
|
22
|
+
/**
|
|
23
|
+
* Where a message lives, and what kind of address it is. A channel post's
|
|
24
|
+
* conversation names the post itself as its reply chain root: such a post
|
|
25
|
+
* is addressed to the channel, and is the opener of the thread under it.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export const locate = (conversationId, messageId, conversationType) => {
|
|
30
|
+
if (conversationId === undefined || conversationId.length > Address.maxIdLength) return undefined;
|
|
31
|
+
const parts = Address.parts(Address.thread(conversationId));
|
|
32
|
+
if (Option.isNone(parts)) return undefined;
|
|
33
|
+
const {
|
|
34
|
+
base,
|
|
35
|
+
root
|
|
36
|
+
} = parts.value;
|
|
37
|
+
if (root !== undefined && root === messageId) return {
|
|
38
|
+
thread: Address.thread(base),
|
|
39
|
+
kind: "channel"
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
thread: Address.thread(conversationId),
|
|
43
|
+
kind: root !== undefined ? "thread" : conversationType === "personal" ? "direct" : "channel"
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
/** Where an activity's message lives. @internal */
|
|
47
|
+
export const threadOf = activity => {
|
|
48
|
+
const conversation = object(activity, "conversation");
|
|
49
|
+
return locate(string(conversation, "id"), string(activity, "id"), string(conversation, "conversationType"));
|
|
50
|
+
};
|
|
51
|
+
const timestamp = activity => {
|
|
52
|
+
const value = string(activity, "timestamp");
|
|
53
|
+
if (value === undefined) return undefined;
|
|
54
|
+
return Option.getOrUndefined(DateTime.make(value).pipe(Option.map(DateTime.toUtc)));
|
|
55
|
+
};
|
|
56
|
+
const mentionKind = (mentioned, conversationId) => {
|
|
57
|
+
if (string(mentioned, "type") === "tag") return "role";
|
|
58
|
+
const id = string(mentioned, "id") ?? "";
|
|
59
|
+
if (id === Address.baseConversation(conversationId) || id.startsWith("19:")) return "channel";
|
|
60
|
+
return "user";
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The mention entities, in order, located in `text` by their `<at>` text.
|
|
64
|
+
* An entity whose text is not found is left out.
|
|
65
|
+
*/
|
|
66
|
+
const mentions = (activity, text, self) => {
|
|
67
|
+
const entities = activity.entities;
|
|
68
|
+
if (!Array.isArray(entities)) return [];
|
|
69
|
+
const conversationId = string(object(activity, "conversation"), "id") ?? "";
|
|
70
|
+
const out = [];
|
|
71
|
+
let from = 0;
|
|
72
|
+
for (const entity of entities) {
|
|
73
|
+
if (!isObject(entity) || entity.type !== "mention") continue;
|
|
74
|
+
const mentioned = object(entity, "mentioned");
|
|
75
|
+
const token = string(entity, "text");
|
|
76
|
+
const id = userId(mentioned);
|
|
77
|
+
if (mentioned === undefined || token === undefined || id === undefined) continue;
|
|
78
|
+
const start = text.indexOf(token, from);
|
|
79
|
+
if (start === -1) continue;
|
|
80
|
+
from = start + token.length;
|
|
81
|
+
out.push({
|
|
82
|
+
kind: mentionKind(mentioned, conversationId),
|
|
83
|
+
id,
|
|
84
|
+
start,
|
|
85
|
+
end: start + token.length,
|
|
86
|
+
isSelf: string(mentioned, "id") === self
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
};
|
|
91
|
+
const attachments = (activity, context) => {
|
|
92
|
+
const list = activity.attachments;
|
|
93
|
+
const serviceUrl = string(activity, "serviceUrl");
|
|
94
|
+
if (!Array.isArray(list) || serviceUrl === undefined) return [];
|
|
95
|
+
const conversationType = string(object(activity, "conversation"), "conversationType");
|
|
96
|
+
const out = [];
|
|
97
|
+
for (const attachment of list) {
|
|
98
|
+
if (isObject(attachment) && attachment.contentType === "text/html") continue;
|
|
99
|
+
const classified = Download.classify(attachment, {
|
|
100
|
+
serviceUrl,
|
|
101
|
+
...(conversationType === undefined ? {} : {
|
|
102
|
+
conversationType
|
|
103
|
+
}),
|
|
104
|
+
connectorHosts: context.connectorHosts,
|
|
105
|
+
fileHostSuffixes: context.fileHostSuffixes
|
|
106
|
+
});
|
|
107
|
+
if (classified !== undefined) out.push(classified);
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* A `message` activity as a `ChatMessage`.
|
|
113
|
+
*
|
|
114
|
+
* - `text` is Teams' `text` as delivered, with `<at>…</at>` for each
|
|
115
|
+
* mention, which is where `mentions` point.
|
|
116
|
+
* - The author id follows `userId`. `raw` keeps the Connector id.
|
|
117
|
+
*
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
export const message = (activity, context) => {
|
|
121
|
+
const id = string(activity, "id");
|
|
122
|
+
const from = object(activity, "from");
|
|
123
|
+
const author = userId(from);
|
|
124
|
+
const at = threadOf(activity);
|
|
125
|
+
const time = timestamp(activity);
|
|
126
|
+
if (id === undefined || author === undefined || at === undefined || time === undefined) {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
const self = botId(context.appId);
|
|
130
|
+
const connectorId = string(from, "id") ?? "";
|
|
131
|
+
const text = typeof activity.text === "string" ? activity.text : "";
|
|
132
|
+
const name = string(from, "name");
|
|
133
|
+
return {
|
|
134
|
+
id,
|
|
135
|
+
thread: at.thread,
|
|
136
|
+
author: {
|
|
137
|
+
id: author,
|
|
138
|
+
...(name === undefined ? {} : {
|
|
139
|
+
name
|
|
140
|
+
}),
|
|
141
|
+
isBot: connectorId.startsWith("28:"),
|
|
142
|
+
isSelf: connectorId === self
|
|
143
|
+
},
|
|
144
|
+
text,
|
|
145
|
+
mentions: mentions(activity, text, self),
|
|
146
|
+
attachments: attachments(activity, context),
|
|
147
|
+
timestamp: time,
|
|
148
|
+
raw: activity
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
const reactionEmoji = {
|
|
152
|
+
like: "\u{1F44D}",
|
|
153
|
+
heart: "\u2764\uFE0F",
|
|
154
|
+
laugh: "\u{1F606}",
|
|
155
|
+
surprised: "\u{1F62E}",
|
|
156
|
+
sad: "\u{1F622}",
|
|
157
|
+
angry: "\u{1F621}"
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* A Teams reaction type as an emoji: the six documented types as Unicode,
|
|
161
|
+
* any other as `custom:{type}`.
|
|
162
|
+
*
|
|
163
|
+
* @internal
|
|
164
|
+
*/
|
|
165
|
+
export const emoji = type => reactionEmoji[type] ?? `custom:${type}`;
|
|
166
|
+
const reactions = activity => {
|
|
167
|
+
const messageId = string(activity, "replyToId");
|
|
168
|
+
const user = userId(object(activity, "from"));
|
|
169
|
+
const at = threadOf(activity);
|
|
170
|
+
if (messageId === undefined || user === undefined || at === undefined) return [];
|
|
171
|
+
const time = timestamp(activity);
|
|
172
|
+
const out = [];
|
|
173
|
+
for (const [key, tag] of [["reactionsAdded", "ReactionAdded"], ["reactionsRemoved", "ReactionRemoved"]]) {
|
|
174
|
+
const list = activity[key];
|
|
175
|
+
if (!Array.isArray(list)) continue;
|
|
176
|
+
for (const reaction of list) {
|
|
177
|
+
const type = string(reaction, "type");
|
|
178
|
+
if (type === undefined) continue;
|
|
179
|
+
out.push({
|
|
180
|
+
_tag: tag,
|
|
181
|
+
thread: at.thread,
|
|
182
|
+
messageId,
|
|
183
|
+
userId: user,
|
|
184
|
+
emoji: emoji(type),
|
|
185
|
+
...(time === undefined ? {} : {
|
|
186
|
+
timestamp: time
|
|
187
|
+
}),
|
|
188
|
+
raw: activity
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return out;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* A verified, untargeted activity as zero or more events. A `message`
|
|
196
|
+
* carrying a card submit (`value`) is an interaction, not a message, and
|
|
197
|
+
* gives none here.
|
|
198
|
+
*
|
|
199
|
+
* @internal
|
|
200
|
+
*/
|
|
201
|
+
export const normalize = (activity, context) => {
|
|
202
|
+
if (!isObject(activity) || isTargeted(activity)) return [];
|
|
203
|
+
switch (activity.type) {
|
|
204
|
+
case "message":
|
|
205
|
+
{
|
|
206
|
+
if (activity.value !== undefined) return [];
|
|
207
|
+
const at = threadOf(activity);
|
|
208
|
+
const created = message(activity, context);
|
|
209
|
+
if (at === undefined || created === undefined) return [];
|
|
210
|
+
return [{
|
|
211
|
+
_tag: "MessageCreated",
|
|
212
|
+
thread: at.thread,
|
|
213
|
+
kind: at.kind,
|
|
214
|
+
message: created,
|
|
215
|
+
raw: activity
|
|
216
|
+
}];
|
|
217
|
+
}
|
|
218
|
+
case "messageReaction":
|
|
219
|
+
return reactions(activity);
|
|
220
|
+
default:
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normal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AO,EAAE;QACxD,OAAO,CAAC;UAAE,IAAI,EAAE,gBAAgB;UAAE,MAAM,EAAE,EAAE,CAAC,MAAM;UAAE,IAAI,EAAE,EAAE,CAAC,IAAI;UAAE,OAAO,EAAE,OAAO;UAAE,GAAG,EAAE;QAAQ,CAAE,CAAC;MACxG;IACA,KAAK,iBAAiB;MACpB,OAAO,SAAS,CAAC,QAAQ,CAAC;IAC5B;MACE,OAAO,EAAE;EACb;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/internal/parse.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Readers for untrusted input: fields of parsed JSON, and URLs.
|
|
3
|
+
*/
|
|
4
|
+
import * as Predicate from "effect/Predicate";
|
|
5
|
+
/** @internal */
|
|
6
|
+
export const isObject = u => Predicate.isObject(u);
|
|
7
|
+
/** A non-empty string field of `value`, when `value` is an object. @internal */
|
|
8
|
+
export const string = (value, key) => {
|
|
9
|
+
const field = isObject(value) ? value[key] : undefined;
|
|
10
|
+
return typeof field === "string" && field.length > 0 ? field : undefined;
|
|
11
|
+
};
|
|
12
|
+
/** An object field of `value`, when `value` is an object. @internal */
|
|
13
|
+
export const object = (value, key) => {
|
|
14
|
+
const field = isObject(value) ? value[key] : undefined;
|
|
15
|
+
return isObject(field) ? field : undefined;
|
|
16
|
+
};
|
|
17
|
+
/** The JSON value of `text`, or `undefined` when it is not JSON. @internal */
|
|
18
|
+
export const parseJson = text => {
|
|
19
|
+
try {
|
|
20
|
+
return JSON.parse(text);
|
|
21
|
+
} catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const parseUrl = (input, base) => {
|
|
27
|
+
try {
|
|
28
|
+
return new URL(input, base);
|
|
29
|
+
} catch {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","names":[],"sources":["../../src/internal/parse.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAK,SAAS,MAAM,kBAAkB;AAM7C;AACA,OAAO,MAAM,QAAQ,GAAI,CAAU,IAAsB,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE9E;AACA,OAAO,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,GAAW,KAAwB;EACxE,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS;EACtD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,SAAS;AAC1E,CAAC;AAED;AACA,OAAO,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,GAAW,KAA4B;EAC5E,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS;EACtD,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,SAAS;AAC5C,CAAC;AAED;AACA,OAAO,MAAM,SAAS,GAAI,IAAY,IAAa;EACjD,IAAI;IACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;EACzB,CAAC,CAAC,MAAM;IACN,OAAO,SAAS;EAClB;AACF,CAAC;AAED;AACA,OAAO,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,IAAa,KAAqB;EACxE,IAAI;IACF,OAAO,IAAI,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC;EAC7B,CAAC,CAAC,MAAM;IACN,OAAO,SAAS;EAClB;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/internal/render.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { toWellFormed } from "effect/String";
|
|
2
|
+
/** @internal */
|
|
3
|
+
export const cardContentType = "application/vnd.microsoft.card.adaptive";
|
|
4
|
+
/**
|
|
5
|
+
* The most actions in one `ActionSet` row: the number of actions Teams
|
|
6
|
+
* shows in a row before it moves the rest into an overflow menu.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export const actionsPerRow = 6;
|
|
11
|
+
/**
|
|
12
|
+
* Escapes `<` and `&`, so that no HTML tag, `<at>` mention or entity
|
|
13
|
+
* forms in text Teams reads as Markdown.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export const escapeText = text => text.replace(/[<&]/g, c => c === "<" ? "<" : "&");
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const textActivity = markdown => ({
|
|
20
|
+
type: "message",
|
|
21
|
+
text: escapeDollars(escapeText(toWellFormed(markdown))),
|
|
22
|
+
textFormat: "extendedmarkdown"
|
|
23
|
+
});
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const textBlock = text => ({
|
|
26
|
+
type: "TextBlock",
|
|
27
|
+
text,
|
|
28
|
+
wrap: true
|
|
29
|
+
});
|
|
30
|
+
/** @internal */
|
|
31
|
+
export const codeBlock = (codeSnippet, language) => ({
|
|
32
|
+
type: "CodeBlock",
|
|
33
|
+
codeSnippet,
|
|
34
|
+
language
|
|
35
|
+
});
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const column = {
|
|
38
|
+
width: 1
|
|
39
|
+
};
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const tableCell = text => ({
|
|
42
|
+
type: "TableCell",
|
|
43
|
+
items: [textBlock(text)]
|
|
44
|
+
});
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const tableRow = cells => ({
|
|
47
|
+
type: "TableRow",
|
|
48
|
+
cells: cells.map(tableCell)
|
|
49
|
+
});
|
|
50
|
+
/** A table with one column for each cell of its widest row. @internal */
|
|
51
|
+
export const table = rows => ({
|
|
52
|
+
type: "Table",
|
|
53
|
+
firstRowAsHeaders: true,
|
|
54
|
+
columns: Array.from({
|
|
55
|
+
length: Math.max(0, ...rows.map(row => row.length))
|
|
56
|
+
}, () => column),
|
|
57
|
+
rows: rows.map(tableRow)
|
|
58
|
+
});
|
|
59
|
+
/** @internal */
|
|
60
|
+
export const actionSet = actions => ({
|
|
61
|
+
type: "ActionSet",
|
|
62
|
+
actions
|
|
63
|
+
});
|
|
64
|
+
/** @internal */
|
|
65
|
+
export const card = body => ({
|
|
66
|
+
type: "AdaptiveCard",
|
|
67
|
+
version: "1.5",
|
|
68
|
+
body,
|
|
69
|
+
msteams: {
|
|
70
|
+
width: "Full"
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
/** @internal */
|
|
74
|
+
export const cardActivityOf = body => ({
|
|
75
|
+
type: "message",
|
|
76
|
+
attachments: [{
|
|
77
|
+
contentType: cardContentType,
|
|
78
|
+
content: card(body)
|
|
79
|
+
}]
|
|
80
|
+
});
|
|
81
|
+
const styles = {
|
|
82
|
+
primary: "positive",
|
|
83
|
+
danger: "destructive"
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* `Action.Execute`, with `Action.Submit` as the fallback for clients
|
|
87
|
+
* without Universal Actions. `token` carries the button's id and value.
|
|
88
|
+
*
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export const buttonAction = (button, token) => {
|
|
92
|
+
const title = toWellFormed(button.label);
|
|
93
|
+
const style = button.style === "primary" || button.style === "danger" ? {
|
|
94
|
+
style: styles[button.style]
|
|
95
|
+
} : {};
|
|
96
|
+
return {
|
|
97
|
+
type: "Action.Execute",
|
|
98
|
+
title,
|
|
99
|
+
verb: "effect",
|
|
100
|
+
data: {
|
|
101
|
+
effect: token
|
|
102
|
+
},
|
|
103
|
+
...style,
|
|
104
|
+
fallback: {
|
|
105
|
+
type: "Action.Submit",
|
|
106
|
+
title,
|
|
107
|
+
data: {
|
|
108
|
+
effect: token
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* A button that opens a dialog: an `Action.Submit` with `task/fetch`,
|
|
115
|
+
* smaller than the `Action.Execute` and fallback the measure prices.
|
|
116
|
+
*
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
export const dialogAction = (button, token) => ({
|
|
120
|
+
type: "Action.Submit",
|
|
121
|
+
title: toWellFormed(button.label),
|
|
122
|
+
data: {
|
|
123
|
+
msteams: {
|
|
124
|
+
type: "task/fetch"
|
|
125
|
+
},
|
|
126
|
+
effect: token
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
/** @internal */
|
|
130
|
+
export const linkAction = link => ({
|
|
131
|
+
type: "Action.OpenUrl",
|
|
132
|
+
title: toWellFormed(link.label),
|
|
133
|
+
url: toWellFormed(link.url)
|
|
134
|
+
});
|
|
135
|
+
/**
|
|
136
|
+
* The card form. Selects are not rendered: the adapter refuses them first.
|
|
137
|
+
*
|
|
138
|
+
* @internal
|
|
139
|
+
*/
|
|
140
|
+
export const cardActivity = (markdown, actions, encode, opensDialog = () => false) => {
|
|
141
|
+
const body = blocks(markdown);
|
|
142
|
+
const rendered = [];
|
|
143
|
+
for (const action of actions) {
|
|
144
|
+
if (action._tag === "Button") {
|
|
145
|
+
rendered.push(opensDialog(action) ? dialogAction(action, encode(action)) : buttonAction(action, encode(action)));
|
|
146
|
+
} else if (action._tag === "LinkButton") rendered.push(linkAction(action));
|
|
147
|
+
}
|
|
148
|
+
for (let i = 0; i < rendered.length; i += actionsPerRow) {
|
|
149
|
+
body.push(actionSet(rendered.slice(i, i + actionsPerRow)));
|
|
150
|
+
}
|
|
151
|
+
return cardActivityOf(body);
|
|
152
|
+
};
|
|
153
|
+
const fenceOpen = line => {
|
|
154
|
+
const match = /^( {0,3})(`{3,}|~{3,})(.*)$/.exec(line);
|
|
155
|
+
if (match === null) return undefined;
|
|
156
|
+
const [, spaces, marker, info] = match;
|
|
157
|
+
if (marker[0] === "`" && info.includes("`")) return undefined;
|
|
158
|
+
const word = info.trim().split(/\s+/)[0];
|
|
159
|
+
return {
|
|
160
|
+
indent: spaces.length,
|
|
161
|
+
marker,
|
|
162
|
+
language: word === "" ? "PlainText" : word
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
const stripFenceIndent = (line, indent) => {
|
|
166
|
+
let i = 0;
|
|
167
|
+
while (i < indent && line[i] === " ") i++;
|
|
168
|
+
// An opening fence is at most three columns in, so a tab crossed here ends at column four.
|
|
169
|
+
if (i < indent && line[i] === "\t") return " ".repeat(4 - indent) + line.slice(i + 1);
|
|
170
|
+
return line.slice(i);
|
|
171
|
+
};
|
|
172
|
+
const fenceCloses = (fence, line) => {
|
|
173
|
+
const match = /^ {0,3}(`{3,}|~{3,})[ \t]*$/.exec(line);
|
|
174
|
+
return match !== null && match[1][0] === fence.marker[0] && match[1].length >= fence.marker.length;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Escapes each `$` outside code as `\$`, so that Teams reads no math in
|
|
178
|
+
* the text form. A `$` the Markdown already escapes, after an odd run of
|
|
179
|
+
* backslashes, is left alone, and so is code: fenced blocks and code spans
|
|
180
|
+
* on one line. One unit per `$` at most, as `Length.weight` prices it.
|
|
181
|
+
*
|
|
182
|
+
* @internal
|
|
183
|
+
*/
|
|
184
|
+
export const escapeDollars = markdown => {
|
|
185
|
+
const parts = markdown.split(/(\r\n|\r|\n)/);
|
|
186
|
+
let fence;
|
|
187
|
+
for (let i = 0; i < parts.length; i += 2) {
|
|
188
|
+
const line = parts[i];
|
|
189
|
+
if (fence !== undefined) {
|
|
190
|
+
if (fenceCloses(fence, line)) fence = undefined;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
fence = fenceOpen(line);
|
|
194
|
+
if (fence === undefined) parts[i] = escapeLine(line);
|
|
195
|
+
}
|
|
196
|
+
return parts.join("");
|
|
197
|
+
};
|
|
198
|
+
const escapeLine = line => {
|
|
199
|
+
let out = "";
|
|
200
|
+
let i = 0;
|
|
201
|
+
while (i < line.length) {
|
|
202
|
+
const char = line[i];
|
|
203
|
+
if (char === "`") {
|
|
204
|
+
let run = 1;
|
|
205
|
+
while (line[i + run] === "`") run++;
|
|
206
|
+
const ticks = "`".repeat(run);
|
|
207
|
+
const close = findRun(line, ticks, i + run);
|
|
208
|
+
const end = close === -1 ? i + run : close + run;
|
|
209
|
+
out += line.slice(i, end);
|
|
210
|
+
i = end;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (char === "$") {
|
|
214
|
+
let backslashes = 0;
|
|
215
|
+
while (line[i - 1 - backslashes] === "\\") backslashes++;
|
|
216
|
+
out += backslashes % 2 === 0 ? "\\$" : "$";
|
|
217
|
+
} else out += char;
|
|
218
|
+
i++;
|
|
219
|
+
}
|
|
220
|
+
return out;
|
|
221
|
+
};
|
|
222
|
+
/** The index of a run of exactly `ticks` from `from`, or -1. */
|
|
223
|
+
const findRun = (line, ticks, from) => {
|
|
224
|
+
for (let at = line.indexOf(ticks, from); at !== -1; at = line.indexOf(ticks, at + 1)) {
|
|
225
|
+
if (line[at - 1] !== "`" && line[at + ticks.length] !== "`") return at;
|
|
226
|
+
}
|
|
227
|
+
return -1;
|
|
228
|
+
};
|
|
229
|
+
const delimiterRow = /^[ \t]*\|?(?:[ \t]*:?-+:?[ \t]*\|)*[ \t]*:?-+:?[ \t]*\|?[ \t]*$/;
|
|
230
|
+
const isDelimiter = line => line.includes("|") && delimiterRow.test(line);
|
|
231
|
+
/** The cells of a table row. There are never more than its pipes plus one. */
|
|
232
|
+
const cells = line => {
|
|
233
|
+
let row = line.trim();
|
|
234
|
+
if (row.startsWith("|")) row = row.slice(1);
|
|
235
|
+
if (row.endsWith("|") && !row.endsWith("\\|")) row = row.slice(0, -1);
|
|
236
|
+
return row.split(/(?<!\\)\|/).map(cell => escapeText(cell.trim().replace(/\\\|/g, "|")));
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* One line of a paragraph, with the block syntax a TextBlock cannot show
|
|
240
|
+
* taken off: quote markers and heading markers are dropped, and the first
|
|
241
|
+
* list marker is kept. `> - # x` becomes `- x`.
|
|
242
|
+
*/
|
|
243
|
+
const flatten = line => {
|
|
244
|
+
let rest = line;
|
|
245
|
+
let marker = "";
|
|
246
|
+
for (;;) {
|
|
247
|
+
const quote = /^ {0,3}> ?/.exec(rest);
|
|
248
|
+
if (quote !== null) {
|
|
249
|
+
rest = rest.slice(quote[0].length);
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (marker === "") {
|
|
253
|
+
const list = /^[ \t]*(?:[-*+]|\d{1,9}[.)])(?:[ \t]+|$)/.exec(rest);
|
|
254
|
+
if (list !== null) {
|
|
255
|
+
marker = list[0];
|
|
256
|
+
rest = rest.slice(marker.length);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const heading = /^ {0,3}#{1,6}(?:[ \t]+|$)/.exec(rest);
|
|
261
|
+
if (heading !== null) {
|
|
262
|
+
rest = rest.slice(heading[0].length);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
return marker + rest;
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* The card body for Markdown: `TextBlock`, `CodeBlock` and `Table`
|
|
270
|
+
* elements in the order of the source. Consecutive lines of text share one
|
|
271
|
+
* `TextBlock`, joined by `\n`.
|
|
272
|
+
*
|
|
273
|
+
* @internal
|
|
274
|
+
*/
|
|
275
|
+
export const blocks = markdown => {
|
|
276
|
+
const lines = toWellFormed(markdown).split(/\r\n|\r|\n/);
|
|
277
|
+
const body = [];
|
|
278
|
+
let text = [];
|
|
279
|
+
const flush = () => {
|
|
280
|
+
let start = 0;
|
|
281
|
+
let end = text.length;
|
|
282
|
+
while (start < end && text[start].trim() === "") start++;
|
|
283
|
+
while (end > start && text[end - 1].trim() === "") end--;
|
|
284
|
+
if (start < end) body.push(textBlock(escapeText(text.slice(start, end).join("\n"))));
|
|
285
|
+
text = [];
|
|
286
|
+
};
|
|
287
|
+
let i = 0;
|
|
288
|
+
while (i < lines.length) {
|
|
289
|
+
const line = lines[i];
|
|
290
|
+
const fence = fenceOpen(line);
|
|
291
|
+
if (fence !== undefined) {
|
|
292
|
+
flush();
|
|
293
|
+
const code = [];
|
|
294
|
+
i++;
|
|
295
|
+
while (i < lines.length && !fenceCloses(fence, lines[i])) code.push(stripFenceIndent(lines[i++], fence.indent));
|
|
296
|
+
i++;
|
|
297
|
+
body.push(codeBlock(code.join("\n"), fence.language));
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (line.includes("|") && i + 1 < lines.length && isDelimiter(lines[i + 1])) {
|
|
301
|
+
flush();
|
|
302
|
+
const rows = [cells(line)];
|
|
303
|
+
i += 2;
|
|
304
|
+
while (i < lines.length && lines[i].includes("|") && fenceOpen(lines[i]) === undefined) {
|
|
305
|
+
rows.push(cells(lines[i++]));
|
|
306
|
+
}
|
|
307
|
+
body.push(table(rows));
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
text.push(flatten(line));
|
|
311
|
+
i++;
|
|
312
|
+
}
|
|
313
|
+
flush();
|
|
314
|
+
return body;
|
|
315
|
+
};
|
|
316
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","names":[],"sources":["../../src/internal/render.ts"],"sourcesContent":[null],"mappings":"AAWA,SAAS,YAAY,QAAQ,eAAe;AAE5C;AACA,OAAO,MAAM,eAAe,GAAG,yCAAyC;AAExE;;;;;;AAMA,OAAO,MAAM,aAAa,GAAG,CAAC;AAE9B;;;;;;AAMA,OAAO,MAAM,UAAU,GAAI,IAAY,IAAa,IAAI,CAAC,OAAO,CAAC,OAAO,EAAG,CA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