MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseScope

Function parseScope

packages/core/sdk/src/migration-spec.ts:47–59  ·  view source on GitHub ↗
(scopeId: string)

Source from the content-addressed store, hash-verified

45// ---------------------------------------------------------------------------
46
47export const parseScope = (scopeId: string): OwnerKeys | null => {
48 if (scopeId.startsWith("user-org:")) {
49 const parts = scopeId.split(":");
50 if (parts.length !== 3) return null;
51 const [, user, org] = parts;
52 if (!user || !org || !user.startsWith("user_") || !org.startsWith("org_")) return null;
53 return { owner: "user", subject: user, tenant: org };
54 }
55 if (scopeId.startsWith("org_") && !scopeId.includes(":")) {
56 return { owner: "org", subject: ORG_SUBJECT, tenant: scopeId };
57 }
58 return null;
59};
60
61export type ScopeOwnerResolver = (scopeId: string) => OwnerKeys | null;
62

Callers 2

localOwnerForScopeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected