Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: accept unset space for CLI folder moves

Richie McIlroyc582a74d6d5d
diff --git a/apps/web/__tests__/unit/agent-api-contract.test.ts b/apps/web/__tests__/unit/agent-api-contract.test.ts
index c288cdb9d..f2c5deea2 100644
--- a/apps/web/__tests__/unit/agent-api-contract.test.ts
+++ b/apps/web/__tests__/unit/agent-api-contract.test.ts
@@ -16,6 +16,28 @@ const status = {
};
describe("agent API contract", () => {
+ it("accepts installed clients' null space for personal and organization moves", () => {
+ const decode = Schema.decodeUnknownSync(Agent.AgentMoveCapInput);
+ for (const container of ["personal", "organization", "space"]) {
+ const input = {
+ container,
+ organizationId: "org_synthetic_1",
+ folderId: null,
+ };
+ expect(decode(input)).toEqual(input);
+ expect(decode({ ...input, spaceId: null })).toEqual({
+ ...input,
+ spaceId: null,
+ });
+ expect(decode({ ...input, spaceId: "space_synthetic_1" })).toEqual({
+ ...input,
+ spaceId: "space_synthetic_1",
+ });
+ expect(() => decode({ ...input, spaceId: 42 })).toThrow();
+ expect(() => decode({ ...input, organizationId: null })).toThrow();
+ }
+ });
+
it("accepts omitted and null Loom import options from installed clients", () => {
const loomUrl = "https://www.loom.com/share/synthetic";
const decode = Schema.decodeUnknownSync(Agent.AgentLoomImportInput);
diff --git a/packages/web-domain/src/Agent.ts b/packages/web-domain/src/Agent.ts
index 2ac134832..b09795d80 100644
--- a/packages/web-domain/src/Agent.ts
+++ b/packages/web-domain/src/Agent.ts
@@ -1229,7 +1229,7 @@ export const AgentSpaceMemberUpdateInput = Schema.Struct({
export const AgentMoveCapInput = Schema.Struct({
container: Schema.Literal("personal", "organization", "space"),
organizationId: OrganisationId,
- spaceId: Schema.optional(SpaceIdOrOrganisationId),
+ spaceId: Schema.optional(Schema.NullOr(SpaceIdOrOrganisationId)),
folderId: Schema.NullOr(FolderId),
});