MCPcopy
hub / github.com/CapSoftware/Cap / importFromLoom

Function importFromLoom

apps/web/actions/loom.ts:454–486  ·  view source on GitHub ↗
({
	loomUrl,
	orgId,
}: {
	loomUrl: string;
	orgId: Organisation.OrganisationId;
})

Source from the content-addressed store, hash-verified

452}
453
454export async function importFromLoom({
455 loomUrl,
456 orgId,
457}: {
458 loomUrl: string;
459 orgId: Organisation.OrganisationId;
460}): Promise<LoomImportResult> {
461 const user = await getCurrentUser();
462 if (!user) return { success: false, error: "Unauthorized" };
463
464 if (!userIsPro(user)) {
465 return {
466 success: false,
467 error: "Importing from Loom requires a Cap Pro subscription.",
468 };
469 }
470
471 await requireOrganizationAccess(user.id, orgId);
472
473 const isRateLimited = await createLoomImportRateLimitCheck(user.id);
474 if (await isRateLimited()) {
475 return {
476 success: false,
477 error: LOOM_IMPORT_RATE_LIMIT_ERROR,
478 };
479 }
480
481 return importLoomVideoForOwner({
482 loomUrl,
483 orgId,
484 ownerId: user.id,
485 });
486}
487
488function normalizeImportEmail(email: string) {
489 return email.trim().toLowerCase();

Callers 3

handleImportFunction · 0.90
handleSingleImportFunction · 0.90

Calls 5

userIsProFunction · 0.90
importLoomVideoForOwnerFunction · 0.85
isRateLimitedFunction · 0.50

Tested by

no test coverage detected