fix: extensions (#2881)

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Daniel Salazar
2026-05-01 16:36:15 -07:00
committed by GitHub
parent 0ffb7d3d1e
commit 2c261fc6c0
3 changed files with 71 additions and 17 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ export const PuterController =
public onServerShutdown() {
return;
}
public getReportedCosts(): Record<string, unknown>[] {
public async getReportedCosts() {
return [];
}
public registerRoutes(_router: PuterRouter) {}
+69 -15
View File
@@ -278,9 +278,19 @@ export const extension = {
get: (_target: object, prop: string) => {
const proxiedObj = clientsContainers[prop];
if (!proxiedObj) {
throw new Error(
`Called before initialization: ${name}.${prop}`,
);
const proxyProxyHandler = {
get: (_target2: object, prop2: string) => {
const proxiedObj2 =
clientsContainers[prop][prop2];
if (!proxiedObj2) {
throw new Error(
`extension.import('client:${prop}') missing property '${prop2}'`,
);
}
return proxiedObj2;
},
};
return new Proxy({}, proxyProxyHandler) as object;
}
return proxiedObj;
},
@@ -292,10 +302,21 @@ export const extension = {
const proxyHandler = {
get: (_target: object, prop: string) => {
const proxiedObj = storesContainers[prop];
if (!proxiedObj) {
throw new Error(
`Called before initialization: ${name}.${prop}`,
);
const proxyProxyHandler = {
get: (_target2: object, prop2: string) => {
const proxiedObj2 =
clientsContainers[prop][prop2];
if (!proxiedObj2) {
throw new Error(
`extension.import('client:${prop}') missing property '${prop2}'`,
);
}
return proxiedObj2;
},
};
return new Proxy({}, proxyProxyHandler) as object;
}
return proxiedObj;
},
@@ -307,10 +328,21 @@ export const extension = {
const proxyHandler = {
get: (_target: object, prop: string) => {
const proxiedObj = servicesContainers[prop];
if (!proxiedObj) {
throw new Error(
`Called before initialization: ${name}.${prop}`,
);
const proxyProxyHandler = {
get: (_target2: object, prop2: string) => {
const proxiedObj2 =
clientsContainers[prop][prop2];
if (!proxiedObj2) {
throw new Error(
`extension.import('client:${prop}') missing property '${prop2}'`,
);
}
return proxiedObj2;
},
};
return new Proxy({}, proxyProxyHandler) as object;
}
return proxiedObj;
},
@@ -322,10 +354,21 @@ export const extension = {
const proxyHandler = {
get: (_target: object, prop: string) => {
const proxiedObj = controllersContainers[prop];
if (!proxiedObj) {
throw new Error(
`Called before initialization: ${name}.${prop}`,
);
const proxyProxyHandler = {
get: (_target2: object, prop2: string) => {
const proxiedObj2 =
clientsContainers[prop][prop2];
if (!proxiedObj2) {
throw new Error(
`extension.import('client:${prop}') missing property '${prop2}'`,
);
}
return proxiedObj2;
},
};
return new Proxy({}, proxyProxyHandler) as object;
}
return proxiedObj;
},
@@ -337,10 +380,21 @@ export const extension = {
const proxyHandler = {
get: (_target: object, prop: string) => {
const proxiedObj = driversContainers[prop];
if (!proxiedObj) {
throw new Error(
`Called before initialization: ${name}.${prop}`,
);
const proxyProxyHandler = {
get: (_target2: object, prop2: string) => {
const proxiedObj2 =
clientsContainers[prop][prop2];
if (!proxiedObj2) {
throw new Error(
`extension.import('client:${prop}') missing property '${prop2}'`,
);
}
return proxiedObj2;
},
};
return new Proxy({}, proxyProxyHandler) as object;
}
return proxiedObj;
},
+1 -1
View File
@@ -3060,7 +3060,7 @@ export class FSService extends PuterService {
{},
);
} catch {
// Non-critical — the response is the source of truth.
console.warn('missing event emissions');
}
}