MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / requestApiAccess

Function requestApiAccess

src/standalone/api/kernels/apiAccess.ts:30–53  ·  view source on GitHub ↗
(extensionId: string)

Source from the content-addressed store, hash-verified

28 cachedAccessInfo = undefined;
29}
30export async function requestApiAccess(extensionId: string): Promise<{ accessAllowed: boolean }> {
31 if (!workspace.isTrusted) {
32 return { accessAllowed: false };
33 }
34 if (extensionId === JVSC_EXTENSION_ID) {
35 // Our own extension can use this API (used in tests)
36 return { accessAllowed: true };
37 }
38 let apiAccess = extensionApiAccess.get(extensionId);
39 if (!apiAccess) {
40 apiAccess = requestKernelAccessImpl(extensionId);
41 extensionApiAccess.set(extensionId, apiAccess);
42 void apiAccess.then(({ result }) => {
43 if (
44 (result === 'learnMore' || result === 'cancelled') &&
45 extensionApiAccess.get(extensionId) === apiAccess
46 ) {
47 extensionApiAccess.delete(extensionId);
48 extensionsTriedAccessingApi.add(extensionId);
49 }
50 });
51 }
52 return apiAccess.then(({ result }) => ({ accessAllowed: result === 'allowed' }));
53}
54
55async function requestKernelAccessImpl(
56 extensionId: string

Callers 2

doCheckAccessMethod · 0.90

Calls 5

requestKernelAccessImplFunction · 0.85
getMethod · 0.65
setMethod · 0.65
deleteMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected