@aglyn/aglyn 1.0.0-beta.149 → 1.0.0-beta.151

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.
Files changed (36) hide show
  1. package/package.json +10 -10
  2. package/src/lib/app-utils/console-routes.d.ts +0 -40
  3. package/src/lib/app-utils/console-routes.js +15 -13
  4. package/src/lib/app-utils/console-routes.js.map +1 -1
  5. package/src/lib/app-utils/contexts.d.ts +1 -0
  6. package/src/lib/app-utils/contexts.js +1 -0
  7. package/src/lib/app-utils/contexts.js.map +1 -1
  8. package/src/lib/app-utils/docs-help.generated.d.ts +24 -0
  9. package/src/lib/app-utils/docs-help.generated.js +61 -0
  10. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  11. package/src/lib/app-utils/index.d.ts +1 -0
  12. package/src/lib/app-utils/index.js +1 -0
  13. package/src/lib/app-utils/index.js.map +1 -1
  14. package/src/lib/app-utils/media-src.d.ts +93 -0
  15. package/src/lib/app-utils/media-src.js +114 -0
  16. package/src/lib/app-utils/media-src.js.map +1 -0
  17. package/src/lib/app-utils/page-header-help-context.d.ts +83 -0
  18. package/src/lib/app-utils/page-header-help-context.js +56 -0
  19. package/src/lib/app-utils/page-header-help-context.js.map +1 -0
  20. package/src/lib/app-utils/release-flags.js +5 -4
  21. package/src/lib/app-utils/release-flags.js.map +1 -1
  22. package/src/lib/app-utils/staff-role-gate.d.ts +56 -0
  23. package/src/lib/app-utils/staff-role-gate.js +46 -0
  24. package/src/lib/app-utils/staff-role-gate.js.map +1 -0
  25. package/src/lib/plugin-manager/feature-plugins.d.ts +113 -23
  26. package/src/lib/plugin-manager/feature-plugins.js +15 -19
  27. package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
  28. package/src/lib/plugin-manager/plugin-media-publish.d.ts +88 -0
  29. package/src/lib/plugin-manager/plugin-media-publish.js +118 -0
  30. package/src/lib/plugin-manager/plugin-media-publish.js.map +1 -0
  31. package/src/lib/plugin-manager/plugin-route-metadata.d.ts +141 -0
  32. package/src/lib/plugin-manager/plugin-route-metadata.js +140 -0
  33. package/src/lib/plugin-manager/plugin-route-metadata.js.map +1 -0
  34. package/src/lib/plugin-manager/plugin-site-cache.d.ts +78 -0
  35. package/src/lib/plugin-manager/plugin-site-cache.js +125 -0
  36. package/src/lib/plugin-manager/plugin-site-cache.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-site-cache.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * HOW A PLUGIN DROPS A SITE'S CACHED PAGES (AGL-3080).\n *\n * The shell hands this one down rather than up. Every other contract in this\n * directory is a plugin telling the shell something; this is the shell\n * telling plugins it can do something — purge the rendered HTML of a site —\n * because purging it takes the tenant's cache tags and revalidation paths,\n * which live in the app and are not a plugin's to know.\n *\n * ## The case, and why it is a kill switch rather than a nicety\n *\n * A marketplace plugin can be REVOKED. Revoking writes a stop on the\n * version, and the tenant refuses revoked bytes at render time — but a page\n * already rendered and cached does not re-render to find that out. So the\n * revoke has a second half: drop the cached pages of every site running it.\n * Without it a revoked plugin keeps executing in visitors' browsers for as\n * long as the cache holds, which is the whole failure the stop exists to\n * prevent.\n *\n * ## ⛔ AN ABSENT IMPLEMENTATION IS AN ANSWER, AND IT IS `complete: false`\n *\n * The registry is filled by the APP at boot. A process that has not filled\n * it resolves \"no cache to drop\" — indistinguishable, from the inside, from\n * a workspace whose sites were all already fresh. That is the AGL-3025 shape\n * and on this path it means a revoked plugin quietly kept serving.\n *\n * So there is no silent branch. {@link dropPluginSiteCache} always answers a\n * {@link PluginSiteCacheResult}, and `complete` is false whenever the drop\n * did not certainly happen — nothing registered, or the implementation\n * threw. A caller acts on that: the revoke itself must still stand (a plugin\n * left un-revoked because a cache purge failed is strictly worse), but the\n * reader has to be told the purge did not run, and the log has to carry it.\n *\n * ## The split, in one line\n *\n * The plugin knows WHICH sites — that is its own install pins, its own\n * collection. The shell knows HOW to drop one, and owns the fan-out policy:\n * the cap, the concurrency, and saying out loud when a cap truncated the\n * list. Neither half is guessable from the other side.\n */\n\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginService,\n} from './plugin-services'\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\n\n/** What the caller wants dropped, and why. */\nexport interface PluginSiteCacheRequest {\n /**\n * The sites whose rendered pages must go. Duplicates are the caller's to\n * avoid or not — the implementation is free to collapse them.\n */\n hostIds: readonly string[]\n /**\n * Why, in a few words, for the fan-out's own logging: a truncated purge\n * is only debuggable if the record says what it was purging for.\n * `'marketplace listing revoked'`, not `'revoke'`.\n */\n reason: string\n}\n\nexport interface PluginSiteCacheResult {\n /** Sites whose cached pages were dropped. */\n dropped: number\n /**\n * Sites deliberately left holding cached pages because the fan-out hit\n * its cap. Not an error — a decision the shell made and logged — but a\n * number a caller may want to surface, because those sites are still\n * serving what was just stopped.\n */\n skipped: number\n /**\n * Whether the drop certainly happened. FALSE when no implementation is\n * registered or one threw, and a caller must not read `dropped: 0` as\n * \"there was nothing to drop\" without checking this first.\n */\n complete: boolean\n}\n\nexport interface PluginSiteCache {\n drop(request: PluginSiteCacheRequest): Promise<PluginSiteCacheResult>\n}\n\n/**\n * One implementation: the app's. Two would be two cache layers disagreeing\n * about whether a page is gone, and the second to register would be the one\n * nobody knew about.\n */\nexport const PLUGIN_SITE_CACHE = definePluginServiceContract<PluginSiteCache>(\n 'core.site-cache',\n { multiple: false },\n)\n\n/**\n * Installs the app's implementation. Called once, at server boot, by the app\n * that owns the tenant's cache.\n *\n * `pluginId` is required from outside a plugin's register fn, as it is for\n * every service: the app passes its own marker, and the contract refuses an\n * anonymous registration rather than accepting one nothing can be traced to.\n */\nexport function registerPluginSiteCache(\n cache: PluginSiteCache,\n options?: { pluginId?: string },\n): void {\n if (typeof cache?.drop !== 'function') {\n throw new Error('a site cache needs a drop function')\n }\n registerPluginService(PLUGIN_SITE_CACHE, cache, {\n ...(options?.pluginId ? { pluginId: options.pluginId } : {}),\n })\n}\n\n/** Whether an implementation is installed — for a caller that wants to say so. */\nexport function hasPluginSiteCache(): boolean {\n return Boolean(resolvePluginService(PLUGIN_SITE_CACHE))\n}\n\n/**\n * Drops the cached pages of the named sites.\n *\n * NEVER THROWS and never silently succeeds: a failure comes back as\n * `complete: false` with the reason logged, because the callers are stop\n * paths that must complete their own work either way. Read `complete`\n * before reading `dropped`.\n */\nexport async function dropPluginSiteCache(\n request: PluginSiteCacheRequest,\n): Promise<PluginSiteCacheResult> {\n const hostIds = [...new Set(request.hostIds.filter(Boolean))]\n if (!hostIds.length) {\n // Nothing asked for is the one case where \"nothing dropped\" is complete\n // on its own terms, whether or not anything is registered.\n return { dropped: 0, skipped: 0, complete: true }\n }\n const cache = resolvePluginService(PLUGIN_SITE_CACHE)\n if (!cache) {\n console.error(\n `[site-cache] no implementation is installed, so ${hostIds.length} ` +\n `site(s) keep their cached pages after: ${request.reason}. The app ` +\n 'registers this at boot; a process that has not is serving stopped ' +\n 'content.',\n )\n return { dropped: 0, skipped: 0, complete: false }\n }\n try {\n return await cache.drop({ ...request, hostIds })\n } catch (error) {\n console.error(\n `[site-cache] the drop failed after: ${request.reason}`,\n error,\n )\n return { dropped: 0, skipped: 0, complete: false }\n }\n}\n"],"names":["definePluginServiceContract","registerPluginService","resolvePluginService","PLUGIN_SITE_CACHE","multiple","registerPluginSiteCache","cache","options","drop","Error","pluginId","hasPluginSiteCache","Boolean","dropPluginSiteCache","request","hostIds","Set","filter","length","dropped","skipped","complete","console","error","reason"],"mappings":";AAA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