// What the generated tenant-isolation suite (test/isolation.test.ts) needs of this module, from this // folder: one fixture per tenant-scoped procedure, each called as a member of one organization with // another's slugs, which the resolver must refuse before the Archive service is reached. // // The module keeps no row of its own, so it seeds nothing: what a fixture names is the other tenant's // project, and an id is any well-formed one (the service is never asked). The suite reads this file by // its place whether or not the module is on, and checks only the procedures the app registers, so // while the module is off (the template's default) it brings no fixture; `procedures.test.ts` runs the // same fixtures against the module on its own, on or off. import type { TransportCaller } from "@conusai-kit/core" import type { IsolationFixture, IsolationTenant } from "@conusai-kit/testing" import { businessModulesOn } from "../../index.js" const SOMEWHERE = "00000000-0000-4000-8000-000000000001" const inProjectOf = (t: IsolationTenant) => ({ org: t.orgSlug, workspace: t.workspaceSlug, project: t.projectSlug }) export const archiveIsolationFixtures: Record = { "archive.document.list": { input: (t) => inProjectOf(t) }, "archive.document.get": { input: (t) => ({ ...inProjectOf(t), documentId: SOMEWHERE }) }, "archive.document.register": { input: (t) => ({ ...inProjectOf(t), title: "Intruder", retentionClass: "anything", fileId: SOMEWHERE, requestId: SOMEWHERE, }), }, "archive.version.add": { input: (t) => ({ ...inProjectOf(t), documentId: SOMEWHERE, revision: "1", fileId: SOMEWHERE, requestId: SOMEWHERE, }), }, "archive.document.hold": { input: (t) => ({ ...inProjectOf(t), documentId: SOMEWHERE, revision: "1", legalHold: true, requestId: SOMEWHERE }), }, "archive.document.dispose": { input: (t) => ({ ...inProjectOf(t), documentId: SOMEWHERE, revision: "1", requestId: SOMEWHERE }), }, "archive.retention.list": { input: (t) => inProjectOf(t) }, "archive.retention.create": { input: (t) => ({ ...inProjectOf(t), code: "intruder", keepFor: "P1Y", from: "created", requestId: SOMEWHERE }), }, "archive.disposal.list": { input: (t) => inProjectOf(t) }, } /** The shape the suite reads (`modules/notes/__tests__/isolation.ts` names it), so no other module is imported. */ export const isolation: { seed( call: TransportCaller, inProject: { org: string; workspace: string; project: string }, ): Promise> fixtures: Record } = { seed: async () => ({}), fixtures: businessModulesOn.includes("archive") ? archiveIsolationFixtures : {}, }