@3sln/trove 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/core/src/index.js +1 -1
- package/packages/core/src/indexers/registry.js +11 -0
- package/packages/core/src/plugins/index.js +44 -6
- package/packages/core/src/plugins/indexers.js +52 -0
- package/packages/core/src/plugins/runtime.js +41 -0
- package/packages/core/src/plugins/workerLoaderRuntime.js +160 -0
- package/packages/core/src/vfs.js +14 -3
- package/packages/server/src/adapters/worker-tasks.js +11 -0
- package/packages/server/src/engine/providers/core.js +12 -5
- package/packages/server/src/index.js +90 -0
- package/packages/server/src/routes.js +18 -2
- package/packages/web/dist/assets/main-wpfmmbfd.js.map +2 -2
|
@@ -966,12 +966,28 @@ export function createRouter() {
|
|
|
966
966
|
// Install: upload the raw package zip; grants via ?grants=files,storage. The server
|
|
967
967
|
// re-parses + validates and gates on scope (admin for server indexers / shared
|
|
968
968
|
// resources), then stores the blob (deduped by digest) + the install record.
|
|
969
|
-
r.post('/api/plugins/install', ['plugins'], async ({ plugins, principal, req, query }) => {
|
|
969
|
+
r.post('/api/plugins/install', ['plugins', 'backgroundWork'], async ({ plugins, principal, req, query, backgroundWork }) => {
|
|
970
970
|
requirePlugins(plugins);
|
|
971
971
|
requirePrincipal(principal);
|
|
972
972
|
const bytes = await readBytesCapped(req, plugins.maxPackageBytes || 32 * 1024 * 1024);
|
|
973
973
|
const grants = query.grants ? String(query.grants).split(',').map((s) => s.trim()).filter(Boolean) : undefined;
|
|
974
|
-
|
|
974
|
+
const install = await plugins.install({ principal, bytes, grants });
|
|
975
|
+
|
|
976
|
+
// A new indexer only earns its keep over files that are ALREADY here, and re-reading
|
|
977
|
+
// them is not work an install request can finish — so it is scheduled, not awaited.
|
|
978
|
+
// Skipped when the deployment cannot run them: `indexersSkipped` says so, and a task
|
|
979
|
+
// that indexes nothing is worse than no task, because it reports success.
|
|
980
|
+
let backfill = null;
|
|
981
|
+
if (install.indexers?.length && !install.indexersSkipped) {
|
|
982
|
+
const { task } = await backgroundWork.beginBackfill({
|
|
983
|
+
indexerIds: install.indexers.map((i) => i.id),
|
|
984
|
+
reason: `Indexing existing files for ${install.pluginId}`,
|
|
985
|
+
});
|
|
986
|
+
backfill = task;
|
|
987
|
+
}
|
|
988
|
+
// The task rides back with the install so a client can watch it rather than
|
|
989
|
+
// discovering later that its drive is quietly re-indexing.
|
|
990
|
+
return { install, backfill };
|
|
975
991
|
}, { cost: 'install' });
|
|
976
992
|
|
|
977
993
|
// List this account's server-installed plugins (for cross-device sync).
|