Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/application/commands/connector/identity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("resolveConnectorIdentity", () => {
describe("connectorIdentityHeaders", () => {
test("returns the organization header for an organization identity", () => {
expect(connectorIdentityHeaders({ organization: "acme" })).toEqual({
"x-oo-organization": "acme",
"x-oo-organization-name": "acme",
});
});

Expand Down
6 changes: 3 additions & 3 deletions src/application/commands/connector/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ export function resolveConnectorIdentity(input: {
return { identity: {}, source: "personal" };
}

// Builds the identity request headers (`x-oo-organization`). Returns an empty
// object for the personal identity so callers can spread it unconditionally.
// Builds the identity request headers (`x-oo-organization-name`). Returns an
// empty object for the personal identity so callers can spread it unconditionally.
export function connectorIdentityHeaders(
identity: ConnectorIdentity | undefined,
): Record<string, string> {
const headers: Record<string, string> = {};

if (identity?.organization !== undefined) {
headers["x-oo-organization"] = identity.organization;
headers["x-oo-organization-name"] = identity.organization;
}

return headers;
Expand Down
12 changes: 6 additions & 6 deletions src/application/commands/connector/index.cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ describe("connectorCommand CLI", () => {
expect(requests).toHaveLength(1);
expect(requests[0]?.method).toBe("POST");
expect(requests[0]?.url).toBe("https://connector.oomol.com/v1/proxy/tavily");
expect(requests[0]?.headers.get("x-oo-organization")).toBe("acme");
expect(requests[0]?.headers.get("x-oo-organization-name")).toBe("acme");
await expect(requests[0]?.json()).resolves.toEqual({
body: {
query: "hello",
Expand Down Expand Up @@ -3187,7 +3187,7 @@ describe("connectorCommand CLI", () => {
expect(requests[0]?.url).toBe(
"https://connector.oomol.com/v1/actions/gmail.send_mail",
);
expect(requests[0]?.headers.get("x-oo-organization")).toBe("acme");
expect(requests[0]?.headers.get("x-oo-organization-name")).toBe("acme");
expect(telemetryPayload).toMatchObject({
properties: {
command_full: "connector.run",
Expand Down Expand Up @@ -3271,13 +3271,13 @@ describe("connectorCommand CLI", () => {
expect(requests[0]?.url).toBe(
"https://connector.oomol.com/v1/actions/gmail.send_mail",
);
expect(requests[0]?.headers.get("x-oo-organization")).toBeNull();
expect(requests[0]?.headers.get("x-oo-organization-name")).toBeNull();
// The run POST carries the organization identity.
expect(requests[1]?.method).toBe("POST");
expect(requests[1]?.url).toBe(
"https://connector.oomol.com/v1/actions/gmail.send_mail",
);
expect(requests[1]?.headers.get("x-oo-organization")).toBe("acme");
expect(requests[1]?.headers.get("x-oo-organization-name")).toBe("acme");
}
finally {
await sandbox.cleanup();
Expand Down Expand Up @@ -3330,7 +3330,7 @@ describe("connectorCommand CLI", () => {
expect(requests[0]?.url).toBe(
"https://connector.oomol.com/v1/actions/gmail.send_mail",
);
expect(requests[0]?.headers.get("x-oo-organization")).toBe("acme");
expect(requests[0]?.headers.get("x-oo-organization-name")).toBe("acme");
expect(runTelemetryPayload).toMatchObject({
properties: {
identity_source: "config",
Expand Down Expand Up @@ -3389,7 +3389,7 @@ describe("connectorCommand CLI", () => {
expect(requests[0]?.url).toBe(
"https://connector.oomol.com/v1/actions/gmail.send_mail",
);
expect(requests[0]?.headers.get("x-oo-organization")).toBeNull();
expect(requests[0]?.headers.get("x-oo-organization-name")).toBeNull();
expect(runTelemetryPayload).toMatchObject({
properties: {
identity_source: "personal",
Expand Down
8 changes: 4 additions & 4 deletions src/application/commands/connector/shared.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ describe("connector shared requests", () => {
expect(requests[0]?.url).toBe(
"https://connector.oomol.com/v1/actions/gmail.send_mail",
);
expect(requests[0]?.headers.get("x-oo-organization")).toBe("acme");
expect(requests[0]?.headers.get("x-oo-organization-name")).toBe("acme");
});

test("runConnectorAction omits the organization query and header for the personal identity", async () => {
Expand Down Expand Up @@ -257,7 +257,7 @@ describe("connector shared requests", () => {
expect(requests[0]?.url).toBe(
"https://connector.oomol.com/v1/actions/gmail.send_mail",
);
expect(requests[0]?.headers.get("x-oo-organization")).toBeNull();
expect(requests[0]?.headers.get("x-oo-organization-name")).toBeNull();
});

test("getConnectorActionMetadata never sends an organization query or header", async () => {
Expand Down Expand Up @@ -293,7 +293,7 @@ describe("connector shared requests", () => {
expect(requests[0]?.url).toBe(
"https://connector.oomol.com/v1/actions/gmail.get_message",
);
expect(requests[0]?.headers.get("x-oo-organization")).toBeNull();
expect(requests[0]?.headers.get("x-oo-organization-name")).toBeNull();
});

test("runConnectorProxy sends proxy requests with identity headers", async () => {
Expand Down Expand Up @@ -357,7 +357,7 @@ describe("connector shared requests", () => {
expect(requests).toHaveLength(1);
expect(requests[0]?.url).toBe("https://connector.oomol.com/v1/proxy/tavily");
expect(requests[0]?.headers.get("Authorization")).toBe("secret-1");
expect(requests[0]?.headers.get("x-oo-organization")).toBe("acme");
expect(requests[0]?.headers.get("x-oo-organization-name")).toBe("acme");
await expect(requests[0]?.json()).resolves.toEqual({
endpoint: "/search",
method: "GET",
Expand Down