mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-25 08:53:50 +00:00
Picked up the remaining items from the multi-agent review:
- Hoist Operation / ServerOperation imports in sync.routes.ts so the
upload path no longer needs `as unknown as import('./sync.types').*`
double casts. The Set + filter pattern for accepted ops becomes an
index-zip loop, dropping two iterations + the Set allocation.
- Pull APPROX_BYTES_PER_OP out of two inline locals in sync.service.ts
into sync.const.ts so the constant is a single source of truth and
the trade-off (over-estimate vs observed median op size) is documented
in one place.
- Log when computeOpsStorageBytes silently skips an op whose payload
fails JSON.stringify (BigInt, circular refs). Counter still
under-counts but the cause is visible in logs.
- Update storage-quota docstrings to reflect that calculateStorageUsage /
updateStorageUsage are now legitimately called from the
freeStorageForUpload reconcile path (rare cleanup events), not only
offline.
Tests:
- cleanup.spec.ts: assert updateStorageUsage is NOT called after
deleteOldSyncedOpsForAllUsers (the per-user SUM loop was the DoS).
- storage-quota-cleanup.spec.ts: drop the assertion that
deleteOldestRestorePointAndOps issues a pg_column_size query (it does
not anymore); add a $executeRaw mock that mutates testUsers so the
iterative-cleanup test exercises the real decrement path; tune
starting storage to within a few KB of quota so cleanup's
approximate decrement can detect progress within a few iterations.
- storage-quota.service.spec.ts: add the $executeRaw prisma mock and
unit tests for incrementStorageUsage / decrementStorageUsage
(positive path, Math.floor of non-integer deltas, no-op on
NaN/Infinity/zero/negative, clamped UPDATE for decrement).
|
||
|---|---|---|
| .. | ||
| plugin-api | ||
| plugin-dev | ||
| shared-schema | ||
| super-sync-server | ||
| sync-core | ||
| vite-plugin | ||
| build-packages.js | ||
| README.md | ||
Super Productivity Packages
This directory contains plugin packages and the plugin API for Super Productivity.
Structure
plugin-api/- TypeScript definitions for the plugin APIplugin-dev/- Plugin development examples and toolsapi-test-plugin/- Basic API test pluginprocrastination-buster/- Example SolidJS-based pluginyesterday-tasks-plugin/- Simple plugin showing yesterday's tasksboilerplate-solid-js/- Template for creating new SolidJS plugins (not built)sync-md/- Markdown sync plugin (not built)
Building Packages
All packages are built automatically when running the main build process:
npm run build:packages
This command:
- Builds the plugin-api TypeScript definitions
- Builds plugins that require compilation (e.g., procrastination-buster)
- Copies plugin files to
src/assets/for inclusion in the app
Development
To work on a specific plugin:
cd plugin-dev/[plugin-name]
npm install
npm run dev
Adding a New Plugin
- Create a new directory in
plugin-dev/ - Add the plugin configuration to
/packages/build-packages.js - Run
npm run build:packagesto test the build
Notes
- The
boilerplate-solid-jsandsync-mdplugins are development templates and are not included in production builds - Plugin files are automatically copied to
src/assets/during the build process - The build script handles dependency installation automatically