mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-04 08:30:39 +00:00
lint: sync Apps.js with linter rules
This is comitted separately because it should not have any functional changes. Do not skip this in a `git bisect`, but do not revert this when testing commits for functional changes.
This commit is contained in:
@@ -16,31 +16,31 @@ class Apps {
|
||||
this.appID = puter.appID;
|
||||
}
|
||||
|
||||
#addUserIterationToApp(app) {
|
||||
#addUserIterationToApp (app) {
|
||||
app.getUsers = async (params) => {
|
||||
params = params ?? {};
|
||||
return (await puter.drivers.call('app-telemetry', 'app-telemetry', 'get_users', { app_uuid: app.uid, limit: params.limit, offset: params.offset })).result;
|
||||
}
|
||||
};
|
||||
app.users = async function* (pageSize = 100) {
|
||||
let offset = 0;
|
||||
|
||||
while (true) {
|
||||
while ( true ) {
|
||||
const users = await app.getUsers({ limit: pageSize, offset });
|
||||
|
||||
if (!users || users.length === 0) return;
|
||||
if ( !users || users.length === 0 ) return;
|
||||
|
||||
for (const user of users) {
|
||||
for ( const user of users ) {
|
||||
yield user;
|
||||
}
|
||||
|
||||
offset += users.length;
|
||||
if (users.length < pageSize) return;
|
||||
if ( users.length < pageSize ) return;
|
||||
}
|
||||
}
|
||||
};
|
||||
return app;
|
||||
}
|
||||
|
||||
#addUserIterationToApps(apps) {
|
||||
#addUserIterationToApps (apps) {
|
||||
apps.forEach(app => {
|
||||
this.#addUserIterationToApp(app);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user