@jwilleke/ngdpbase-types
The TypeScript types an ngdpbase add-on compiles against, and a test kit of core's own values. Published with each ngdpbase release, at the same version. A dev dependency only: it never ships to a site, where host and engine hand the add-on the running core.
npm install --save-dev @jwilleke/ngdpbase-types@<your ngdpbase.minVersion>
import type { AddonModule, AddonHost, WikiEngine } from '@jwilleke/ngdpbase-types';
import { buildAddonHost, openAddonTestDatabase, toCsv, formatters } from '@jwilleke/ngdpbase-types/testing';
- The main entry is types only. Importing it at run time fails, on purpose. An add-on takes core's values from
host(AddonHost: the request and audit helpers, the logger,guardedFetch, the egress tools,isAtLeast,zonedParts) and a manager's job fromengine.getManager(such asPageManager.pageUrlorPolicyDecisionPoint.usersHolding); it never imports core's values (#1813). /testingis for tests.buildAddonHost(slug, defaults, setEnabledForPerson?, engine?)is the real host;host.setEnabledForPersoncalls the setter you pass (it refuses without one), andenginenames the system principalhost.systemContext(reason)uses (core's fallback without one).openAddonTestDatabase(owner, { migrations, ledgerTable })is the handleopenAddonDatabasereturns, in memory.toCsvisExportManager.toCsv.formattersis a plugin'scontext.formatters.
The add-on guide is docs/guides/addons-developer-guide.md.