mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-10-30 14:47:36 +00:00
Drop the dual-licensed `ee/` tree entirely. All features previously
locked behind the Hanzo Dataroom Commercial License are now part of the
AGPL-3.0 core and freely available — custom domains, branded viewing,
advanced analytics, watermarks, access controls, Q&A, AI vector stores,
workflows, SAML SSO, dataroom invitations, conversations, templates.
Layout changes:
* `ee/features/{ai,conversations,workflows,permissions,storage,templates,
dataroom-invitations,access-notifications,security,conversions}/` →
`features/<name>/` (AGPL).
* `ee/limits/` → `lib/billing/limits/` with every plan resolving to an
unlimited profile (no users/links/documents/domains/datarooms cap,
conversations and watermarks always on).
* `ee/stripe/` → `lib/billing/legacy/` (already a compat shim over
`@hanzoai/commerce`; renewal-reminder webhook is now a no-op).
* `ee/features/billing/cancellation/` deleted. Pause/unpause/cancel/
retention routes now compile against `lib/billing/cancellation.ts`
stubs that return 410 Gone; `isTeamPaused`/`isTeamPausedById` in
`lib/billing/paused.ts` always report active. `CancellationModal` is
a no-op shim in `components/billing/`.
* `app/(ee)/api/*` route group folded into `app/api/*` (SAML auth,
SCIM, AI chat, workflows, FAQ, link-upload).
Build: `npm run build` green.
110 lines
3.0 KiB
TypeScript
110 lines
3.0 KiB
TypeScript
import {
|
|
type StorageConfig,
|
|
getStorageConfig,
|
|
getTeamStorageConfigById,
|
|
} from "@/features/storage/config";
|
|
import { LambdaClient } from "@aws-sdk/client-lambda";
|
|
import { S3Client } from "@aws-sdk/client-s3";
|
|
|
|
export const getS3Client = (storageRegion?: string) => {
|
|
const NEXT_PUBLIC_UPLOAD_TRANSPORT = process.env.NEXT_PUBLIC_UPLOAD_TRANSPORT;
|
|
|
|
if (NEXT_PUBLIC_UPLOAD_TRANSPORT !== "s3") {
|
|
throw new Error("Invalid upload transport");
|
|
}
|
|
|
|
const config = getStorageConfig(storageRegion);
|
|
|
|
return new S3Client({
|
|
endpoint: config.endpoint || undefined,
|
|
region: config.region,
|
|
credentials: {
|
|
accessKeyId: config.accessKeyId,
|
|
secretAccessKey: config.secretAccessKey,
|
|
},
|
|
});
|
|
};
|
|
|
|
export const getS3ClientForTeam = async (teamId: string) => {
|
|
const NEXT_PUBLIC_UPLOAD_TRANSPORT = process.env.NEXT_PUBLIC_UPLOAD_TRANSPORT;
|
|
|
|
if (NEXT_PUBLIC_UPLOAD_TRANSPORT !== "s3") {
|
|
throw new Error("Invalid upload transport");
|
|
}
|
|
|
|
const config = await getTeamStorageConfigById(teamId);
|
|
|
|
return new S3Client({
|
|
endpoint: config.endpoint || undefined,
|
|
region: config.region,
|
|
credentials: {
|
|
accessKeyId: config.accessKeyId,
|
|
secretAccessKey: config.secretAccessKey,
|
|
},
|
|
});
|
|
};
|
|
|
|
export const getLambdaClient = (storageRegion?: string) => {
|
|
const NEXT_PUBLIC_UPLOAD_TRANSPORT = process.env.NEXT_PUBLIC_UPLOAD_TRANSPORT;
|
|
|
|
if (NEXT_PUBLIC_UPLOAD_TRANSPORT !== "s3") {
|
|
throw new Error("Invalid upload transport");
|
|
}
|
|
|
|
const config = getStorageConfig(storageRegion);
|
|
|
|
return new LambdaClient({
|
|
region: config.region,
|
|
credentials: {
|
|
accessKeyId: config.accessKeyId,
|
|
secretAccessKey: config.secretAccessKey,
|
|
},
|
|
});
|
|
};
|
|
|
|
export const getLambdaClientForTeam = async (teamId: string) => {
|
|
const NEXT_PUBLIC_UPLOAD_TRANSPORT = process.env.NEXT_PUBLIC_UPLOAD_TRANSPORT;
|
|
|
|
if (NEXT_PUBLIC_UPLOAD_TRANSPORT !== "s3") {
|
|
throw new Error("Invalid upload transport");
|
|
}
|
|
|
|
const config = await getTeamStorageConfigById(teamId);
|
|
|
|
return new LambdaClient({
|
|
region: config.region,
|
|
credentials: {
|
|
accessKeyId: config.accessKeyId,
|
|
secretAccessKey: config.secretAccessKey,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Gets both S3 client and storage config for a team in a single call.
|
|
* This is more efficient than calling getS3ClientForTeam and getTeamStorageConfigById separately.
|
|
*
|
|
* @param teamId - The team ID
|
|
* @returns Promise<{ client: S3Client, config: StorageConfig }> - Both client and config
|
|
*/
|
|
export const getTeamS3ClientAndConfig = async (teamId: string) => {
|
|
const NEXT_PUBLIC_UPLOAD_TRANSPORT = process.env.NEXT_PUBLIC_UPLOAD_TRANSPORT;
|
|
|
|
if (NEXT_PUBLIC_UPLOAD_TRANSPORT !== "s3") {
|
|
throw new Error("Invalid upload transport");
|
|
}
|
|
|
|
const config = await getTeamStorageConfigById(teamId);
|
|
|
|
const client = new S3Client({
|
|
endpoint: config.endpoint || undefined,
|
|
region: config.region,
|
|
credentials: {
|
|
accessKeyId: config.accessKeyId,
|
|
secretAccessKey: config.secretAccessKey,
|
|
},
|
|
});
|
|
|
|
return { client, config };
|
|
};
|