Documentation menu
Documentation / Commerce engine / crowdfund
Crowdfund
npm install @wabbit/tome-crowdfundFirst install from our registry?
Get a registry token from your credentials page. You need a purchase that includes this package, or a Craft Library membership.
Add the registry and your token to the
.npmrcat the root of your project, with your token in place ofYOUR_TOKEN:@wabbit:registry=https://npm.wabbit.com/ //npm.wabbit.com/:_authToken=YOUR_TOKEN
Tome crowdfunding layer — campaigns, reward tiers, pledges, and the all-or-nothing settlement job (save card at pledge, charge off-session at deadline).
Overview
Tome crowdfunding layer — campaigns, reward tiers, pledges, and the all-or-nothing settlement job (save card at pledge, charge off-session at deadline). Description copied verbatim from package.json.
Layer: domain (per the repo's ARCHITECTURE.md § The Layer Model).
Peer dependencies
Peer ranges, copied from package.json:
| Peer | Range | Optional? |
|---|---|---|
payload | >=3.67.0 | no |
@payloadcms/richtext-lexical | >=3.67.0 | no |
@wabbit/tome-core | >=1.17.0 <2.0.0 | no |
@wabbit/tome-economy | >=0.5.0 | yes |
lucide-react | >=0.460.0 | yes |
stripe is not a peer at any level. Nothing in this package imports it and no API key ever reaches this code — every provider call goes through an adapter the consumer constructs and passes in.
lucide-react is genuinely optional: the layer's Rocket sidebar icon is loaded lazily, and without the package the admin sidebar shows the nav domain's default icon instead.
@wabbit/tome-economy is optional because the coupling is structural, not nominal: the settlement job declares the two adapter methods it needs (chargeSavedPaymentMethod, releaseSavedPaymentMethod) as its own interface, which economy's StripeAdapter and FreeAdapter satisfy with no cast. Economy is still required in practice if you want the Orders the job writes.
60-second quickstart
import { buildConfig } from 'payload'
import { createCrowdfundLayer } from '@wabbit/tome-crowdfund'
export default buildConfig({
collections: [
...createCrowdfundLayer({ userCollection: 'members', mediaCollection: 'media' }),
// ...your other collections
],
})Defaults to know before the first migration: a pledge's optional backer relates to users (userCollection), a campaign's hero image to media (mediaCollection), and a tier's optional reward product to catalog-products (catalogProductsSlug). That tier relationship is built only when it has a target: pass catalogProductsSlug to relate tiers to a products collection you name, or false to omit it. Left unset, it targets catalog-products when @wabbit/tome-catalog is already in the layer registry (call initCatalog() or createCatalogLayer() before createCrowdfundLayer()), and is otherwise omitted with a console warning. If you use catalog through its per-collection factories without registering it, pass catalogProductsSlug: 'catalog-products' explicitly, or the product column is dropped at your next migration.
Pledges cannot be created through the API (create access is () => false); only your server code writes them, with overrideAccess. Campaign admin rights are the crowdfund:admin capability (CROWDFUND_ADMIN_CAPABILITY).
Per-collection factories are exported too, for sites that wire slugs and access by hand:
import {
createCampaignsCollection,
createTiersCollection,
createPledgesCollection,
} from '@wabbit/tome-crowdfund'Module surface
Root entry (@wabbit/tome-crowdfund) — config-graph safe, no Node-only imports:
| Export | What it is |
|---|---|
createCrowdfundLayer(config?) | Canonical layer entry. Returns CollectionConfig[] and registers the layer. |
initCrowdfund(config?) | Registration only (admin sidebar manifest), for hand-wired sites. |
createCampaignsCollection / createTiersCollection / createPledgesCollection | Per-collection factories. |
CROWDFUND_DEFAULT_SLUGS | crowdfund-campaigns / crowdfund-tiers / crowdfund-pledges. |
CROWDFUND_LAYER_VERSION (also standalone at @wabbit/tome-crowdfund/version) | Pinned to package.json by a test. |
adminOnly / publicRead / ownOrAdminRead / hasAdminRole (deprecated shim — use sessionHasCapabilityOrLegacyAdmin from @wabbit/tome-core/auth/repScoping) | The default access shapes, reusable when you override. |
CROWDFUND_ADMIN_CAPABILITY | 'crowdfund:admin' — the capability the admin access shapes check. |
resolveRelationId (deprecated alias — use relationIdRaw from @wabbit/tome-core/utilities/relationId) | Read an id off a relationship field that may be an id or a populated doc. |
| Types | CrowdfundConfig, InitCrowdfundConfig, Campaign, CampaignMode, CampaignStatus (draft / live / settling / funded / failed), Tier, Pledge, PledgeStatus (pledged / captured / failed / released), and each factory's *CollectionConfig. |
@wabbit/tome-crowdfund/server subpath (@wabbit/tome-crowdfund/server) — Node-only job surface:
| Export | What it is |
|---|---|
settleCampaign(payload, config, args) | The settlement pass. Takes now explicitly; safe to run repeatedly. |
createSettleCampaignHandler(config) | Framework-agnostic JobHandler. |
createSettleCampaignTask(config, opts?) | Payload jobs-framework task form (slug SETTLE_CAMPAIGN_TASK_SLUG = settleCrowdfundCampaigns); spread into jobs.tasks. |
createSettleCampaignEndpoint(config, opts?) | CRON_SECRET-guarded endpoint form: POST at SETTLE_CAMPAIGN_PATH (/jobs/settle-crowdfund-campaigns, under Payload's API route) with header Authorization: Bearer <CRON_SECRET>; answers 500 when CRON_SECRET is unset. |
reconcileCampaignStats(payload, args) | Converging re-derivation of pledgedCents / backerCount / tier claimed. |
findPaged / chunk / readPositiveNumber, JOB_PAGE_SIZE, JOB_DEFAULT_MAX_PAGES | Bounded paginated read with an explicit ceiling (re-exported from @wabbit/tome-core/jobs). |
| Types | SettleCampaignConfig, SettleCampaignArgs, SettleCampaignSummary, CampaignSettlementResult, PledgeChargeAdapter (the structural adapter contract), PledgeChargeResult / PledgeChargeSuccess / PledgeChargeFailure, PledgeReleaseResult, ReconcileCampaignStatsArgs, CampaignStats, FindPagedArgs. |
Server / client posture
This package ships no React surface — no .tsx, no 'use client'. Everything under the root entry is Payload configuration (plain objects and factory functions) and is safe anywhere a payload.config.ts is evaluated.
Everything under @wabbit/tome-crowdfund/server is Node-only: it imports @wabbit/tome-core/jobs and talks to a payment provider through the adapter you pass it. Keep it out of any module a browser bundle walks. The split is why the job surface is a separate subpath rather than part of the barrel.
Settlement, in one paragraph
A pledge is a saved card and nothing else — hosted Checkout in mode: 'setup', $0 charged. A manual-capture authorization expires in about seven days and campaigns run about thirty, so authorize-then-capture cannot span a campaign; the card is charged off-session at the deadline, and only if the goal was met. At or after deadline, settleCampaign recomputes the funding verdict from pledge rows (never the denormalized pledgedCents stat), and pledgedTotal >= goalCents funds the campaign — the boundary is inclusive. Funded: each pledge is charged with the pledge id as the provider idempotency key, a completed Order is written per capture, and a decline leaves the pledge pledged with a failureReason to retry inside the dunning window (dunningDays, default 7) before being written off as failed. Not funded: every saved card is detached, pledges go released, and no charge is ever attempted.
import { createSettleCampaignEndpoint } from '@wabbit/tome-crowdfund/server'
import { StripeAdapter } from '@wabbit/tome-economy'
const settle = createSettleCampaignEndpoint({
adapter: new StripeAdapter({
secretKey: process.env.STRIPE_SECRET_KEY!,
webhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
}),
dunningDays: 7,
orderPlaceholders: { customerId: process.env.GUEST_MEMBER_ID! },
})Settlement only considers campaigns in status live or settling. Orders go to economy's orders collection (ordersSlug) with provider: 'stripe' by default (orderProvider: 'free' pairs with the FreeAdapter); pass createOrders: false to capture without writing Orders. When a pledge has no backer or its tier has no product, the Order needs orderPlaceholders ids — without them the Order is skipped (the capture still stands) and the run reports it.
The job is converging: it re-derives the world on every run and is safe to re-run at any point, including mid-dunning. It takes no distributed lock — overlapping runs are made safe (not impossible) by the provider-side idempotency key. Serialise it yourself if you run several instances.
Taking a pledge
This package stores and settles pledges; it does not ship the pledge checkout. The flow a consumer writes, using @wabbit/tome-economy:
- In a server action, create the pledge row (
status: 'pledged',campaign,tier,amountCents,backerEmail, optionalbacker) withoverrideAccess: true. - Call
StripeAdapter#createSetupSession(...)withmetadata: { pledgeId }and redirect the backer to the hosted Checkout (setup mode — nothing is charged). - Pass
onSetupCompletedto economy's Stripe webhook handler; thesetup.completedevent carriespledgeId,customerId,setupIntentIdandpaymentMethodId. Write those onto the pledge — they are the handlessettleCampaigncharges at the deadline.
Testing
pnpm --filter @wabbit/tome-crowdfund testThe suite runs against an in-memory Payload stand-in and a scripted adapter — no keys, no network, no Stripe. Test mode is the only mode this package has ever run in.
Exports
| Import path |
|---|
@wabbit/tome-crowdfund |
@wabbit/tome-crowdfund/server |
@wabbit/tome-crowdfund/version |
Changelog
0.2.xMinor
BREAKING: a default changed — see the Migration note below.
Crowdfund no longer fails Payload config validation when
@wabbit/tome-catalogis not installed.A tier's optional reward
productrelationship is now built only when it has a target: an explicitcatalogProductsSlugstring always builds it,falseomits it, and when unset it targetscatalog-productsonly if catalog is registered in the layer registry (otherwise it is omitted with a console warning). Migration: a site that uses catalog through its per-collection factories without callinginitCatalog()orcreateCatalogLayer()beforecreateCrowdfundLayer()passescatalogProductsSlug: 'catalog-products'to keep the existing column.The layer now loads without
lucide-reactinstalled; the optional peer supplies only the sidebar icon.The
Rocketicon is imported lazily when the layer registers. Previously a static import made every entry point that registers the layer throw on an install withoutlucide-react.Without it, the admin sidebar shows the nav domain's default icon.
3 fixes (0.2.1 – 0.2.3)
- 0.2.3
The changelog, README and license text now use American spellings.
No code or behavior changes.
- 0.2.2
README: subpath and file mentions are written package-qualified (for example
@wabbit/tome-x/render) or as code text, so crawlers no longer resolve them as site URLs. - 0.2.1
Published packages now contain compiled JavaScript and type declarations under a one-line license banner, and no longer include source maps.
What you install: one compiled
.js(ESM) and.cjs(CommonJS) file per source module, its.d.ts/.d.ctsdeclarations, and the stylesheets, fonts and other assets a package already shipped. Every JavaScript module opens with a comment naming the package and its license:/*! @wabbit/<package> — © Wabbit, LLC. Wabbit Tome Commercial License (see LICENSE.md). Not for redistribution. */.The
.mapfiles and thesourceMappingURLcomments that pointed at them are gone, which roughly halves the size of each tarball.Debugging: the code is still unbundled and unminified, one readable file per module, so a stack trace points at real code with real names. Line numbers in a stack trace are one higher than before, because of the banner line.
A
'use client'directive stays the first statement of its module (the banner is a comment above it), so React Server Component boundaries are unchanged.No API change, no runtime behavior change, and nothing to do on upgrade.
In
@wabbit/tome-blocks-gallery, the source snapshotsextractGallerySourcewrites from an installed pack leave out the license banner line, so a component or config snapshot starts at the code and a paid block's preview shows its first 15 lines of real code.
0.1.x
9 fixes (0.1.1 – 0.1.3)
- 0.1.3
ownOrAdminReadnow delegate to core'sownOrCapabilityAccess, with identical results.This closes the crowdfund/fulfillment near-fork that
assert:no-forked-primitivesflagged. - 0.1.3
Local relationship-id helpers are replaced by
@wabbit/tome-core/utilities/relationId.Each call site maps to the core reader with the same return shape (raw vs. stringified id,
nullvs.undefined, polymorphic), so behavior is unchanged. The@wabbit/tome-corepeer floor goes up to>=1.17.0because that is the first core version exportingrelationIdRaw,relationIdsandrelationIdsRaw.resolveRelationId(public) is kept as a deprecated delegate torelationIdRaw, with identical semantics. - 0.1.2
Admin gate → core primitive.
"Is this user an admin?" was answered five incompatible ways across the platform (2026-09-01 sale-readiness audit §5.2); these four packages carried a deliberate clone of the same pre-
can()role-string check, crowdfund's and fulfillment's headers both saying "matching economy verbatim". No behavior change is intended for the legacy path, and tests pin it rather than prose asserting it.crowdfund, fulfillment, rpg now call
sessionHasCapabilityOrLegacyAdmin()from@wabbit/tome-core/auth/repScoping, and compose the owner-scoped WHERE throughownershipOrBypass()from@wabbit/tome-core/access. All three declare@wabbit/tome-coreas a required, explicitly non-optional peer, so these are plain static imports.The legacy path is unchanged: a
rolesarray containing 'admin' is an admin, an unauthenticated request is not, and a non-admin session still resolves to{ [ownerField]: { equals: user.id } }. Deliberately widened: capability grants (crowdfund:admin/fulfillment:admin/rpg:admin) and core'ssuperadmin/super-adminlegacy aliases now pass too — the point of adopting the shared primitive.The Access functions are async now; Payload's
Accesstype has always allowed aPromise, and the capability path needs an await.hasAdminRolestays exported from crowdfund and fulfillment as a@deprecatedback-compat shim with byte-identical semantics;CROWDFUND_ADMIN_CAPABILITYandFULFILLMENT_ADMIN_CAPABILITYare new named exports.economy deliberately does NOT adopt the core primitive, and the reason is a constraint rather than an oversight:
@wabbit/tome-coreis a declared OPTIONAL peer here, the README states in two places that core is genuinely optional, and the only core reference insrc/is a guarded lazyrequire()ininitEconomy. A static import of a core access primitive from a collection factory would silently convert that optional peer into a required one.Instead the ten inline checks across
Orders(×3),Payments(×2),Prices(×4) andVendorEarnings(×1) collapse into one internalisEconomyAdmin()insrc/access/adminGate.ts, implementation moved not rewritten, with a written promotion trigger: the day core becomes a required peer of this package, delete the body and delegate. Orders' unique extrareq.user.collection === 'users'condition is preserved exactly and pinned by a test.New suites:
crowdfund/tests/access.test.ts(14),fulfillment/tests/access.test.ts(16),economy/tests/admin-gate.test.ts(11). Existingcollections.test.tsassertions in crowdfund and fulfillment were updated to await the now-async access results — asserted VALUES unchanged. rpg has no test harness, so its change is covered by typecheck only.The forcing function ships with the consolidation:
eslint.config.mjsgains ano-restricted-syntaxwarn-ratchet banning hand-rolled.roles.includes(...)admin checks inaccess/**,collections/**and*access*.ts, pointing atsessionHasCapabilityOrLegacyAdmin/can. The repo-wide count is 0 (down from 13), with three writteneslint-disableexemptions: the two deprecated back-compat exports and economy's single gate. - 0.1.2
Import
mergeHooks,fieldShapeand the select-option override contract from@wabbit/tome-coreinstead of keeping local copies (2026-09-01 sale-readiness audit §5.1, T3(a)).No API change: every symbol these packages exported before is still exported, now re-exported from core, and every factory produces byte-identical output.
Deleted, with every call site repointed:
org/src/hooks/mergeHooks.ts,lms/src/collections/shared/mergeHooks.ts,sc/src/extensions/mergeHooks.ts→@wabbit/tome-core/hooks/mergeHooks. Core has exported this since July; sc's copy still carried a header claiming "Neither @wabbit/tome-core nor @wabbit/tome-org exports this."lms/src/server/jobs/paginate.ts,crowdfund/src/server/jobs/paginate.ts,workflow/src/server/paginate.ts→@wabbit/tome-core/jobs.org/src/fieldShape.ts+org/src/insertFieldsAfter.ts,lms/src/collections/shared/fieldShape.ts→@wabbit/tome-core/fields/fieldShape. Org'sresolveFieldDescription/FieldDescriptionOverridewere NOT part of the duplicated set and stay in the package, moved toorg/src/fieldDescriptions.ts.org/src/optionOverrides.ts,lms/src/collections/shared/optionOverrides.ts→@wabbit/tome-core/fields/selectOptions;sc/src/collections/registry/shared.tsnow re-exports it (itsextractIdis a separate audit item and is untouched).
Peer floor raised to `@wabbit/tome-core` `>=1.14.0 <2.0.0` in all five packages, because each now imports a subpath or a named export that first exists in that core minor:
./fields/fieldShapeand./fields/selectOptionsare new subpaths, andfindPaged/chunk/readPositiveNumberare new named exports on the pre-existing./jobs. Crowdfund's floor moves from>=1.7.0even though./jobsitself shipped in 1.7.0 — the subpath resolving is not the same thing as the export existing, which is the sharper version of the lesson its own 0.1.1 CHANGELOG records (ERR_PACKAGE_PATH_NOT_EXPORTED).Org moves from
>=1.2.0, lms from>=1.0.0, sc from>=1.11.0, workflow from>=1.7.0.Header comments that pointed at the deleted files, or asserted core did not export these, were corrected rather than left dangling.
- 0.1.2
One
LayerFactoryConfigevery layer factory's config extends, and one factory verb.Fourteen layer packages end in the same one call a consumer writes into
payload.config.ts, and no two agreed on whatconfigmay contain: full seam vocabulary in three (org, lms, ledger), partial in six, NONE in six (2026-09-01 sale-readiness audit §5.3). A site that learnedadminGroupfrom org andhooksfrom sc discovered, package by package, that six factories accept neither — not because the seam had been rejected, but because nothing said it existed.New in core (a NEW exports-map subpath, hence the minor):
@wabbit/tome-core/utilities/layerFactoryConfigexports theLayerFactoryConfiginterface —adminGroup,access(per-collection override map),hooks(appended viamergeHooks, never replacing),extraFields,fieldOverrides,omitFields,fieldOrder,slugs— andapplyLayerFactoryConfig(collections, config), which honors the whole vocabulary in one call and one fixed order (adminGroup → access → hooks → field shape, the last delegated tofields/fieldShape'sapplyFieldShapeso the order cannot drift between layers). Pure: new array, new objects, identity return on an empty config.It is a separate subpath from
./utilities/layerRegistrydeliberately — that module is in core'ssideEffectsarray, and a pure type/vocabulary module should not drag a declared side-effecting module into every factory's type graph.The slug convention is documented rather than forced, because both live shapes are right for what they do: a typed
slugs?: Partial<XSlugs>map for the slugs a layer OWNS (org, sc, accounts — the typed key set makes a typo a compile error, and a homomorphic mapped type satisfies the base'sRecord<string, string | undefined>), and named<name>Slug?: stringscalars for relationship targets in OTHER layers (memberSlug,mediaSlug,eventSlug,rolesSlug) — those are pointers out of a layer, not entries in its key set.*Every `createLayer
config now extends it.** Twelve extendLayerFactoryConfigdirectly and APPLY it throughapplyLayerFactoryConfig(accounts, catalog, crm, crowdfund, deals, fulfillment, lms, marketing, org, sc) or through a targeted application (chrome). Additive in every case: for the six that accepted none of the seams (deals, economy, gamification, marketing, plus forms/intake, see below), the fields are new; for the rest,adminGroup` and friends keep their existing meaning and the applier is a no-op when they are omitted.Two packages accept the vocabulary but do NOT yet apply it, and say so in their type's JSDoc in the required form ("accepted, not yet applied — trigger: …"). economy and gamification both declare
@wabbit/tome-coreas an OPTIONAL peer and hold zero runtime imports of it — gamification reachesregisterLayerthrough a lazyrequire()in a try/catch for exactly this reason.applyLayerFactoryConfigis a runtime VALUE, so importing it at module scope would convert an optional peer into a required one and break every site that installs those packages without core; copying the applier locally is barred byassert:no-forked-primitives. The trigger is stated: the day core becomes a required peer, delete the note and add one line.Both take the type via
import type, which is erased at runtime.Two packages drop seams EXPLICITLY rather than accept-and-ignore. chrome extends
Omit<LayerFactoryConfig, 'access' | 'hooks' | 'extraFields' | 'fieldOverrides' | 'omitFields' | 'fieldOrder' | 'slugs'>because it returns Payload GLOBALS, not collections — those seven are keyed by collection slug and typed againstCollectionConfig, and chrome's slugs already have direct per-surface knobs (header.slug,footer.slug) a parallel map could contradict.The one seam it keeps,
adminGroup, IS applied: globals carryadmin.groupexactly as collections do. rpg extendsOmit<LayerFactoryConfig, 'access'>becauseCharacterSheetsConfigis a single collection's config that doubles as the layer factory's config, and its ownaccessalready means "this collection's access object" — one level shallower than the base's slug-keyed map.Two meanings under one name is the confusion this interface exists to end.
Factory-verb convergence. Three verbs were live.
createWorkflowLayer(config?)is new in@wabbit/tome-workflow(a new export — hence the minor) and returns a spreadable, deliberately EMPTYCollectionConfig[]: this layer is an engine, not a collection set, so the empty array is the honest answer and lets...createWorkflowLayer()compose exactly like every sibling.Its
WorkflowLayerConfigomits every seam for the same reason, and exists as the stable place a real option will land.createGamificationLayerandcreateRpgLayerare pure aliases ofregisterGamificationLayer/registerRpgLayer.initWorkflow,registerGamificationLayerandregisterRpgLayerare all@deprecatedwith sunset at each package's next major; none is removed.Forcing function:
scripts/assert-layer-factory-contract.mjs+pnpm assert:layer-factory-contract, wired intoplatform-discipline.ymlafterassert:layer-version(source reading only, pre-build). Every exportedcreate*Layermust take a config parameter whose type resolves toLayerFactoryConfig— throughextends, an intersection, or an explicitOmit<…>— with verb aliases followed to theirregister*/init*target.Before this change it reported 12 violations and 0 conforming; it now reports 15 conforming, 0 violations. Deliberately NOT checked: whether a factory actually applies what it accepts, because a machine cannot tell a documented deferral from an accident, and a gate that forced silent application would be worse than one that forces a stated deferral.
docs/guides/create-a-new-layer-package.mdgains a "The factory contract" section stating the rule and the three permitted responses.Three factories are ALLOWLISTED with a reason each:
createAiLayerreturns credential wiring and owns no collections, so every seam is meaningless to it;createFormsLayerandcreateIntakeLayerare owned by the forms+intake access wave running in parallel, whose changes rewrite the same files.Peer floors: accounts, catalog, chrome, crm, deals, economy, fulfillment, gamification, marketing and rpg raise
@wabbit/tome-coreto>=1.14.0 <2.0.0. The new subpaths do not exist below that, and a too-low floor is howERR_PACKAGE_PATH_NOT_EXPORTEDreached crowdfund's consumers once already.These are marked
patchbecause the config widening is purely additive; the raised required-peer floor is the reason a release manager may prefer to cut them as minors instead. - 0.1.2
Manifest metadata:
homepage,bugs,engines.All 46 publishable manifests were missing the three fields a consumer sees before any code (2026-09-01 sale-readiness audit §6). Metadata only — no source, no build, no runtime change.
homepagedeep-links to that package README on GitHub (.../tree/main/packages/<dir>#readme). Without it a registry page links to the monorepo root and the reader has to guess which of 46 folders they want.bugs.urlpoints at the repo issue tracker, so a paying customer has a place to report a defect that is not email.engines.nodeis>=22, matching the rootenginesand.nvmrcset the same day. This is a real floor, not decoration: CI on Node 20 could not expand the glob the block packs use fornode --test, and a package installed on Node 20 fails at a runtime the installer cannot connect back to the version.
The forcing function ships with the change:
scripts/assert-manifest-metadata.mjs(rootpnpm assert:manifest-metadata, wired intoplatform-discipline.ymlbesideassert:license-metadata) fails when any publishable manifest lacksdescription,repository.directorymatching its own folder,homepage,bugs,engines.nodeequal to the repo floor,license,filesorsideEffects. It reported 138 violations before this change and 0 after. - 0.1.2
Collapse the audited serial-await fan-outs in Payload hooks, jobs and access checks.
No behavior changes — every try/catch, failure reporter and
overrideAccessjustification is preserved; only the number of round-trips changes.`find({ limit: 0 })` → `payload.count()` —
limit: 0setspagination: falsein the Mongo adapter, so the query loads every matching row into memory to produce one number.@wabbit/tome-orgdocuments this as a production incident inhooks/attendance-count-sync.ts:6-11and had reintroduced it incollections/recruiting/JoinRequest.ts's one-pending-request guard;@wabbit/tome-sc's squadron member recount had the same shape.Independent lookups → `Promise.all` / `Promise.allSettled` — org's
createGiverWindowAccess(a per-request access check that took two serial round-trips),EventAttendance's display-name composer andAwardPresentation's, sc's RSI profile+org page fetches (the hot path for handle validation, against a third-party host), squadron recalcs, and accounts' three offboarding teardown callbacks.allSettledwherever a branch had its own fallback, so a failed member lookup still cannot stop the event title from resolving. sc's RSI adapter keeps its 404 short-circuit exactly, and ledger's per-leg balance guard decides in leg order so the thrownNegativeBalanceErrorstill names the same wallet the serial version did.Independent per-row writes → `batchWrite` (
@wabbit/tome-core/utilities/batch) — org's notification open/resolve fan-outs, the division/team cleanup and sunset cascades (up to 1,000 rows each), the event cascade-delete, the non-atomicmemberCountfallback; lms's certification-expiry sweep (now paced inWRITE_CHUNKchunks like its sibling reconciler) and the course-delete enrollment drop; workflow's deadline sweep; crowdfund's tier-claim reconcile.Same `data` for every row → one bulk `payload.update({ where, data })` — sc's asset-assignment auto-close and the transfer-request GDPR redaction, matching
sc/src/gdpr.ts'smakeNullRefHandler. The auto-close also drops a latent correctness hazard: its page cursor advanced while its own writes removed rows from the filter it was paging over, so a page boundary could skip assignments.Two collection-level fixes. sc's Fleet had two field-level
beforeChangehooks each issuing afindByIDfor the SAME ship on every write; they are now one collection-level hook that reads the ship once and sets bothchassisNameandname. lms'scheckCertificationExpiryre-derivedrecountHoldersonce per expired award with no cache; it now recounts once per affected certification, after the sweep — which is also more correct, since only the final count was ever right.@wabbit/tome-crowdfund'ssettleCampaignpledge loop is untouched and now carries an expliciteslint-disableplus the reason: it captures money one pledge at a time against amaxCapturesPerRunbudget that only bounds anything if the iterations are serialized.@wabbit/tome-org,@wabbit/tome-lms,@wabbit/tome-workflowand@wabbit/tome-crowdfundraise their@wabbit/tome-corepeer floor to>=1.14.0, the release that adds./utilities/batch. org and lms were also understating their floor before this change — both already imported@wabbit/tome-core/jobs, added in core 1.7.0, while declaring>=1.2.0/>=1.0.0. - 0.1.2
README fixes surfaced by the extended
assert:readme-contractgate (2026-09-01 sale-readiness audit, Tier 2), each verified against the package's own manifest or source.- blocks-core — the
./categoriesand./typesentry points are now named in the Public API section; both were published but undocumented. - core — added
/access/orgScoped,/access/vendorScoped,/infra/healthand/infra/env-scaffoldto the additional-subpaths table, and noted that/auth/collections/roleshas a real/auth/collections/Rolescase alias in the exports map. - crowdfund —
CROWDFUND_LAYER_VERSIONis also published standalone at./version; the row now says so. - dispatch — the eight per-block
./blocks/*config subpaths and all eight./components/*component subpaths are enumerated instead of one "etc." row. - forms — the peer table now lists
@wabbit/tome-core,@wabbit/tome-uiandtypescript, which are declaredpeerDependenciesbut appeared only in prose (or not at all). - lms-ui —
StudentProfileEditoris flagged@deprecatedin the component table, matching the tag its source already carries.
- blocks-core — the
- 0.1.1
Raise the tome-core peer floor to >=1.7.0.
The /server subpath imports @wabbit/tome-core/jobs at top level, which first exists in core 1.7.0 — the old >=1.0.0 floor let npm install a combination that fails at runtime with ERR_PACKAGE_PATH_NOT_EXPORTED (tsc cannot catch it; found by the first consumer install).