Add invisible-separator precedence coverage and docs example
Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
@@ -710,6 +710,7 @@ Examples of ordering:
|
||||
- `ftp://example.com?x=1` → `baseURL must use http or https protocol`
|
||||
- `https://user:pass@example.com?x=1` → `baseURL must not include query parameters or hash fragments`
|
||||
- `ftp://user:pass@example.com/in valid?x=1` → `baseURL must not contain internal whitespace characters`
|
||||
- `ftp://user:pass@example.com/\u2060invalid?x=1#fragment` → `baseURL must not contain internal whitespace characters`
|
||||
|
||||
For richer TypeScript ergonomics in app code, `@trigger.dev/ai` also exports:
|
||||
|
||||
|
||||
@@ -217,6 +217,7 @@ Examples of ordering:
|
||||
- `ftp://example.com?x=1` → `baseURL must use http or https protocol`
|
||||
- `https://user:pass@example.com?x=1` → `baseURL must not include query parameters or hash fragments`
|
||||
- `ftp://user:pass@example.com/in valid?x=1` → `baseURL must not contain internal whitespace characters`
|
||||
- `ftp://user:pass@example.com/\u2060invalid?x=1#fragment` → `baseURL must not contain internal whitespace characters`
|
||||
|
||||
## `ai.tool(...)` example
|
||||
|
||||
|
||||
@@ -1094,6 +1094,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("prioritizes invisible-separator validation over protocol/query/hash/credential validation", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "ftp://user:pass@example.com/\u2060invalid?query=1#fragment",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("prioritizes query/hash validation over credential validation", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
@@ -3899,6 +3910,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("prioritizes invisible-separator validation over protocol/query/hash/credential validation in factory", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "ftp://user:pass@example.com/\u2060invalid?query=1#fragment",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("prioritizes query/hash validation over credential validation in factory", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
|
||||
Reference in New Issue
Block a user