mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 18:07:00 +01:00
Merge origin/master and renumber additive Speko migrations
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
commit
bf1ead3772
65 files changed
+5336
-56682
No files matched your search
@@ -43,6 +43,24 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe("tenant-session recovery", () => {
|
||||
it("loads anonymous Dot consent despite concurrent protected background probes", async () => {
|
||||
const reload = vi.fn();
|
||||
const requestId = `pcmcp_request_${"a".repeat(43)}`;
|
||||
const recovery = createTenantSessionRecoveryCoordinator(reload, () => `/dot-connect/${requestId}`);
|
||||
vi.spyOn(tenantSessionRecovery, "recoverIfNeeded").mockImplementation(recovery.recoverIfNeeded);
|
||||
fetchMock.mockImplementation((url: string) => Promise.resolve(
|
||||
url.includes("/dot-mcp/requests/")
|
||||
? jsonResponse({ id: requestId, agentConnection: true })
|
||||
: errorResponse({ error: "tenant_session_required" }),
|
||||
));
|
||||
|
||||
const background = api.get("/health");
|
||||
const consent = api.get(`/dot-mcp/requests/${requestId}`);
|
||||
await expect(background).rejects.toMatchObject({ status: 401 });
|
||||
await expect(consent).resolves.toEqual({ id: requestId, agentConnection: true });
|
||||
expect(reload).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("keeps concurrent failures pending and schedules one top-level reload", async () => {
|
||||
const reload = vi.fn();
|
||||
const recovery = createTenantSessionRecoveryCoordinator(reload);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { SubscriptionCostReport, UpdateSubscriptionPrice } from "@paperclipai/shared";
|
||||
import { api } from "./client";
|
||||
|
||||
export const subscriptionsApi = {
|
||||
report(companyId: string, from?: string, to?: string) {
|
||||
const query = new URLSearchParams();
|
||||
if (from) query.set("from", from);
|
||||
if (to) query.set("to", to);
|
||||
if (!from && !to) query.set("period", "all");
|
||||
return api.get<SubscriptionCostReport>(`/companies/${companyId}/costs/subscriptions?${query}`);
|
||||
},
|
||||
refresh: (companyId: string) => api.post<{ status: string }>(`/companies/${companyId}/costs/subscriptions/refresh`, {}),
|
||||
update: (companyId: string, id: string, input: UpdateSubscriptionPrice) =>
|
||||
api.patch(`/companies/${companyId}/costs/subscriptions/${id}`, input),
|
||||
link: (companyId: string, id: string, targetId: string, expectedRevision: number, targetRevision: number) =>
|
||||
api.post(`/companies/${companyId}/costs/subscriptions/${id}/link`, { targetId, expectedRevision, targetRevision }),
|
||||
};
|
||||
Reference in new issue
Block a user