Skip to content

Commit 7caa78f

Browse files
Cover hair-space baseURL wrapper and internal validation
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 79a2d39 commit 7caa78f

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
@@ -672,6 +672,7 @@ Examples:
672672
-`\u00A0https://api.trigger.dev/custom-prefix/\u00A0` (non-breaking-space wrapper trimmed)
673673
-`\u1680https://api.trigger.dev/custom-prefix/\u1680` (ogham-space-mark wrapper trimmed)
674674
-`\u2007https://api.trigger.dev/custom-prefix/\u2007` (figure-space wrapper trimmed)
675+
-`\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-space wrapper trimmed)
675676
-`\u205Fhttps://api.trigger.dev/custom-prefix/\u205F` (medium-mathematical-space wrapper trimmed)
676677
-`\u3000https://api.trigger.dev/custom-prefix/\u3000` (ideographic-space wrapper trimmed)
677678
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
@@ -705,6 +706,7 @@ Examples:
705706
-`https://api.trigger.dev/\u200Dinternal`
706707
-`https://api.trigger.dev/\u1680internal`
707708
-`https://api.trigger.dev/\u2007internal`
709+
-`https://api.trigger.dev/\u200Ainternal`
708710
-`https://api.trigger.dev/\u202Finternal`
709711
-`https://api.trigger.dev/\u205Finternal`
710712
-`https://api.trigger.dev/\u180Einternal`

packages/ai/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ Examples:
179179
-`\u00A0https://api.trigger.dev/custom-prefix/\u00A0` (non-breaking-space wrapper trimmed)
180180
-`\u1680https://api.trigger.dev/custom-prefix/\u1680` (ogham-space-mark wrapper trimmed)
181181
-`\u2007https://api.trigger.dev/custom-prefix/\u2007` (figure-space wrapper trimmed)
182+
-`\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-space wrapper trimmed)
182183
-`\u205Fhttps://api.trigger.dev/custom-prefix/\u205F` (medium-mathematical-space wrapper trimmed)
183184
-`\u3000https://api.trigger.dev/custom-prefix/\u3000` (ideographic-space wrapper trimmed)
184185
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
@@ -212,6 +213,7 @@ Examples:
212213
-`https://api.trigger.dev/\u200Dinternal` (internal zero-width-joiner characters)
213214
-`https://api.trigger.dev/\u1680internal` (internal ogham-space-mark characters)
214215
-`https://api.trigger.dev/\u2007internal` (internal figure-space characters)
216+
-`https://api.trigger.dev/\u200Ainternal` (internal hair-space characters)
215217
-`https://api.trigger.dev/\u202Finternal` (internal narrow no-break space characters)
216218
-`https://api.trigger.dev/\u205Finternal` (internal medium-mathematical-space characters)
217219
-`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
@@ -961,6 +961,17 @@ describe("TriggerChatTransport", function () {
961961
}).toThrowError("baseURL must not contain internal whitespace characters");
962962
});
963963

964+
it("throws when baseURL contains internal hair-space characters", function () {
965+
expect(function () {
966+
new TriggerChatTransport({
967+
task: "chat-task",
968+
accessToken: "pk_trigger",
969+
baseURL: "https://api.trigger.dev/\u200Ainternal",
970+
stream: "chat-stream",
971+
});
972+
}).toThrowError("baseURL must not contain internal whitespace characters");
973+
});
974+
964975
it("throws when baseURL contains internal mongolian-vowel-separator characters", function () {
965976
expect(function () {
966977
new TriggerChatTransport({
@@ -1478,6 +1489,17 @@ describe("TriggerChatTransport", function () {
14781489
}).not.toThrow();
14791490
});
14801491

1492+
it("accepts hair-space wrapped baseURL values", function () {
1493+
expect(function () {
1494+
new TriggerChatTransport({
1495+
task: "chat-task",
1496+
accessToken: "pk_trigger",
1497+
baseURL: "\u200Ahttps://api.trigger.dev/custom-prefix/\u200A",
1498+
stream: "chat-stream",
1499+
});
1500+
}).not.toThrow();
1501+
});
1502+
14811503
it("accepts ideographic-space wrapped baseURL values", function () {
14821504
expect(function () {
14831505
new TriggerChatTransport({
@@ -4098,6 +4120,17 @@ describe("TriggerChatTransport", function () {
40984120
}).toThrowError("baseURL must not contain internal whitespace characters");
40994121
});
41004122

4123+
it("throws from factory when baseURL contains internal hair-space characters", function () {
4124+
expect(function () {
4125+
createTriggerChatTransport({
4126+
task: "chat-task",
4127+
accessToken: "pk_trigger",
4128+
baseURL: "https://api.trigger.dev/\u200Ainternal",
4129+
stream: "chat-stream",
4130+
});
4131+
}).toThrowError("baseURL must not contain internal whitespace characters");
4132+
});
4133+
41014134
it("throws from factory when baseURL contains internal mongolian-vowel-separator characters", function () {
41024135
expect(function () {
41034136
createTriggerChatTransport({
@@ -4604,6 +4637,17 @@ describe("TriggerChatTransport", function () {
46044637
}).not.toThrow();
46054638
});
46064639

4640+
it("accepts hair-space wrapped baseURL values from factory", function () {
4641+
expect(function () {
4642+
createTriggerChatTransport({
4643+
task: "chat-task",
4644+
accessToken: "pk_trigger",
4645+
baseURL: "\u200Ahttps://api.trigger.dev/custom-prefix/\u200A",
4646+
stream: "chat-stream",
4647+
});
4648+
}).not.toThrow();
4649+
});
4650+
46074651
it("accepts ideographic-space wrapped baseURL values from factory", function () {
46084652
expect(function () {
46094653
createTriggerChatTransport({

0 commit comments

Comments
 (0)