Skip to content

Commit 580b986

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

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
@@ -674,6 +674,7 @@ Examples:
674674
-`\u2007https://api.trigger.dev/custom-prefix/\u2007` (figure-space wrapper trimmed)
675675
-`\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-space wrapper trimmed)
676676
-`\u2009https://api.trigger.dev/custom-prefix/\u2009` (thin-space wrapper trimmed)
677+
-`\u2008https://api.trigger.dev/custom-prefix/\u2008` (punctuation-space wrapper trimmed)
677678
-`\u205Fhttps://api.trigger.dev/custom-prefix/\u205F` (medium-mathematical-space wrapper trimmed)
678679
-`\u3000https://api.trigger.dev/custom-prefix/\u3000` (ideographic-space wrapper trimmed)
679680
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
@@ -709,6 +710,7 @@ Examples:
709710
-`https://api.trigger.dev/\u2007internal`
710711
-`https://api.trigger.dev/\u200Ainternal`
711712
-`https://api.trigger.dev/\u2009internal`
713+
-`https://api.trigger.dev/\u2008internal`
712714
-`https://api.trigger.dev/\u202Finternal`
713715
-`https://api.trigger.dev/\u205Finternal`
714716
-`https://api.trigger.dev/\u180Einternal`

packages/ai/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ Examples:
181181
-`\u2007https://api.trigger.dev/custom-prefix/\u2007` (figure-space wrapper trimmed)
182182
-`\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-space wrapper trimmed)
183183
-`\u2009https://api.trigger.dev/custom-prefix/\u2009` (thin-space wrapper trimmed)
184+
-`\u2008https://api.trigger.dev/custom-prefix/\u2008` (punctuation-space wrapper trimmed)
184185
-`\u205Fhttps://api.trigger.dev/custom-prefix/\u205F` (medium-mathematical-space wrapper trimmed)
185186
-`\u3000https://api.trigger.dev/custom-prefix/\u3000` (ideographic-space wrapper trimmed)
186187
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
@@ -216,6 +217,7 @@ Examples:
216217
-`https://api.trigger.dev/\u2007internal` (internal figure-space characters)
217218
-`https://api.trigger.dev/\u200Ainternal` (internal hair-space characters)
218219
-`https://api.trigger.dev/\u2009internal` (internal thin-space characters)
220+
-`https://api.trigger.dev/\u2008internal` (internal punctuation-space characters)
219221
-`https://api.trigger.dev/\u202Finternal` (internal narrow no-break space characters)
220222
-`https://api.trigger.dev/\u205Finternal` (internal medium-mathematical-space characters)
221223
-`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
@@ -983,6 +983,17 @@ describe("TriggerChatTransport", function () {
983983
}).toThrowError("baseURL must not contain internal whitespace characters");
984984
});
985985

986+
it("throws when baseURL contains internal punctuation-space characters", function () {
987+
expect(function () {
988+
new TriggerChatTransport({
989+
task: "chat-task",
990+
accessToken: "pk_trigger",
991+
baseURL: "https://api.trigger.dev/\u2008internal",
992+
stream: "chat-stream",
993+
});
994+
}).toThrowError("baseURL must not contain internal whitespace characters");
995+
});
996+
986997
it("throws when baseURL contains internal mongolian-vowel-separator characters", function () {
987998
expect(function () {
988999
new TriggerChatTransport({
@@ -1522,6 +1533,17 @@ describe("TriggerChatTransport", function () {
15221533
}).not.toThrow();
15231534
});
15241535

1536+
it("accepts punctuation-space wrapped baseURL values", function () {
1537+
expect(function () {
1538+
new TriggerChatTransport({
1539+
task: "chat-task",
1540+
accessToken: "pk_trigger",
1541+
baseURL: "\u2008https://api.trigger.dev/custom-prefix/\u2008",
1542+
stream: "chat-stream",
1543+
});
1544+
}).not.toThrow();
1545+
});
1546+
15251547
it("accepts ideographic-space wrapped baseURL values", function () {
15261548
expect(function () {
15271549
new TriggerChatTransport({
@@ -4164,6 +4186,17 @@ describe("TriggerChatTransport", function () {
41644186
}).toThrowError("baseURL must not contain internal whitespace characters");
41654187
});
41664188

4189+
it("throws from factory when baseURL contains internal punctuation-space characters", function () {
4190+
expect(function () {
4191+
createTriggerChatTransport({
4192+
task: "chat-task",
4193+
accessToken: "pk_trigger",
4194+
baseURL: "https://api.trigger.dev/\u2008internal",
4195+
stream: "chat-stream",
4196+
});
4197+
}).toThrowError("baseURL must not contain internal whitespace characters");
4198+
});
4199+
41674200
it("throws from factory when baseURL contains internal mongolian-vowel-separator characters", function () {
41684201
expect(function () {
41694202
createTriggerChatTransport({
@@ -4692,6 +4725,17 @@ describe("TriggerChatTransport", function () {
46924725
}).not.toThrow();
46934726
});
46944727

4728+
it("accepts punctuation-space wrapped baseURL values from factory", function () {
4729+
expect(function () {
4730+
createTriggerChatTransport({
4731+
task: "chat-task",
4732+
accessToken: "pk_trigger",
4733+
baseURL: "\u2008https://api.trigger.dev/custom-prefix/\u2008",
4734+
stream: "chat-stream",
4735+
});
4736+
}).not.toThrow();
4737+
});
4738+
46954739
it("accepts ideographic-space wrapped baseURL values from factory", function () {
46964740
expect(function () {
46974741
createTriggerChatTransport({

0 commit comments

Comments
 (0)