Skip to content

Commit 2ce01e1

Browse files
Cover six-per-em-space baseURL wrapper and internal validation
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 580b986 commit 2ce01e1

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

docs/tasks/streams.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ Examples:
675675
-`\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-space wrapper trimmed)
676676
-`\u2009https://api.trigger.dev/custom-prefix/\u2009` (thin-space wrapper trimmed)
677677
-`\u2008https://api.trigger.dev/custom-prefix/\u2008` (punctuation-space wrapper trimmed)
678+
-`\u2006https://api.trigger.dev/custom-prefix/\u2006` (six-per-em-space wrapper trimmed)
678679
-`\u205Fhttps://api.trigger.dev/custom-prefix/\u205F` (medium-mathematical-space wrapper trimmed)
679680
-`\u3000https://api.trigger.dev/custom-prefix/\u3000` (ideographic-space wrapper trimmed)
680681
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
@@ -711,6 +712,7 @@ Examples:
711712
-`https://api.trigger.dev/\u200Ainternal`
712713
-`https://api.trigger.dev/\u2009internal`
713714
-`https://api.trigger.dev/\u2008internal`
715+
-`https://api.trigger.dev/\u2006internal`
714716
-`https://api.trigger.dev/\u202Finternal`
715717
-`https://api.trigger.dev/\u205Finternal`
716718
-`https://api.trigger.dev/\u180Einternal`

packages/ai/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ Examples:
182182
-`\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-space wrapper trimmed)
183183
-`\u2009https://api.trigger.dev/custom-prefix/\u2009` (thin-space wrapper trimmed)
184184
-`\u2008https://api.trigger.dev/custom-prefix/\u2008` (punctuation-space wrapper trimmed)
185+
-`\u2006https://api.trigger.dev/custom-prefix/\u2006` (six-per-em-space wrapper trimmed)
185186
-`\u205Fhttps://api.trigger.dev/custom-prefix/\u205F` (medium-mathematical-space wrapper trimmed)
186187
-`\u3000https://api.trigger.dev/custom-prefix/\u3000` (ideographic-space wrapper trimmed)
187188
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
@@ -218,6 +219,7 @@ Examples:
218219
-`https://api.trigger.dev/\u200Ainternal` (internal hair-space characters)
219220
-`https://api.trigger.dev/\u2009internal` (internal thin-space characters)
220221
-`https://api.trigger.dev/\u2008internal` (internal punctuation-space characters)
222+
-`https://api.trigger.dev/\u2006internal` (internal six-per-em-space characters)
221223
-`https://api.trigger.dev/\u202Finternal` (internal narrow no-break space characters)
222224
-`https://api.trigger.dev/\u205Finternal` (internal medium-mathematical-space characters)
223225
-`https://api.trigger.dev/\u180Einternal` (internal mongolian-vowel-separator characters)

packages/ai/src/chatTransport.test.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,17 @@ describe("TriggerChatTransport", function () {
994994
}).toThrowError("baseURL must not contain internal whitespace characters");
995995
});
996996

997+
it("throws when baseURL contains internal six-per-em-space characters", function () {
998+
expect(function () {
999+
new TriggerChatTransport({
1000+
task: "chat-task",
1001+
accessToken: "pk_trigger",
1002+
baseURL: "https://api.trigger.dev/\u2006internal",
1003+
stream: "chat-stream",
1004+
});
1005+
}).toThrowError("baseURL must not contain internal whitespace characters");
1006+
});
1007+
9971008
it("throws when baseURL contains internal mongolian-vowel-separator characters", function () {
9981009
expect(function () {
9991010
new TriggerChatTransport({
@@ -1544,6 +1555,17 @@ describe("TriggerChatTransport", function () {
15441555
}).not.toThrow();
15451556
});
15461557

1558+
it("accepts six-per-em-space wrapped baseURL values", function () {
1559+
expect(function () {
1560+
new TriggerChatTransport({
1561+
task: "chat-task",
1562+
accessToken: "pk_trigger",
1563+
baseURL: "\u2006https://api.trigger.dev/custom-prefix/\u2006",
1564+
stream: "chat-stream",
1565+
});
1566+
}).not.toThrow();
1567+
});
1568+
15471569
it("accepts ideographic-space wrapped baseURL values", function () {
15481570
expect(function () {
15491571
new TriggerChatTransport({
@@ -4197,6 +4219,17 @@ describe("TriggerChatTransport", function () {
41974219
}).toThrowError("baseURL must not contain internal whitespace characters");
41984220
});
41994221

4222+
it("throws from factory when baseURL contains internal six-per-em-space characters", function () {
4223+
expect(function () {
4224+
createTriggerChatTransport({
4225+
task: "chat-task",
4226+
accessToken: "pk_trigger",
4227+
baseURL: "https://api.trigger.dev/\u2006internal",
4228+
stream: "chat-stream",
4229+
});
4230+
}).toThrowError("baseURL must not contain internal whitespace characters");
4231+
});
4232+
42004233
it("throws from factory when baseURL contains internal mongolian-vowel-separator characters", function () {
42014234
expect(function () {
42024235
createTriggerChatTransport({
@@ -4736,6 +4769,17 @@ describe("TriggerChatTransport", function () {
47364769
}).not.toThrow();
47374770
});
47384771

4772+
it("accepts six-per-em-space wrapped baseURL values from factory", function () {
4773+
expect(function () {
4774+
createTriggerChatTransport({
4775+
task: "chat-task",
4776+
accessToken: "pk_trigger",
4777+
baseURL: "\u2006https://api.trigger.dev/custom-prefix/\u2006",
4778+
stream: "chat-stream",
4779+
});
4780+
}).not.toThrow();
4781+
});
4782+
47394783
it("accepts ideographic-space wrapped baseURL values from factory", function () {
47404784
expect(function () {
47414785
createTriggerChatTransport({

0 commit comments

Comments
 (0)