Skip to content
ContractSpec
Start here

Package manual · integrations

·Content, growth and creator operations

integration.creator-persistence

Reusable transactional creator operations.

integrationsintegrationv0.2.4experimentalserverbunnode
@lssm-tech/integration.creator-persistence
bun add @lssm-tech/integration.creator-persistence
Package source ↗Manifest ↗

Manifest declarations describe the current workspace; they do not verify registry publication or runtime execution.

Package guide

SqlCreatorStore implements canonical creator records, immutable agreements, accruals and ledger entries using the existing DatabaseProvider transaction port. The host owns connection configuration, schema migration and runtime database roles.

Call migrate() through the host migration workflow. State is placed in the private creator_operations schema. Workspace-level row locks serialize financial mutations; record revision checks and history updates commit together. Compound unique indexes protect accepted terms, observation accruals and ledger sources.

Wallet availability subtracts paid debits and all reserved/submitting/unknown payouts and obligations held by live payout batches. Adjustment lines are listable by party (FINANCE-01h). Payout batches are guarded per item: each item settles, reconciles and releases on its own, and approval narrowing is kept append-only in the batch approval history. Campaign compensation terms (FINANCE-01i) are the record kinds compensationTermsVersion and compensationTermsSupersession. Insert guards allow one draft per campaign and a contiguous version chain; update guards keep confirmed versions and every identity field immutable, move a draft's terms revision by exactly one, keep revision, terms and fingerprint on confirmation, and refuse any change to a supersession. There is no delete path. Mixed currency or scale totals are never combined. The adapter has no provider calls, secrets, public Data API routes or authority defaults. Production payout rails and Hirly data migration require separate qualification.

SqlCreatorTrainingStore implements scope/creator-serialized training state and immutable request receipts through the library-owned DatabaseProvider. State and receipt commit together; creator/course identity is preserved and version conflicts fail. Migrate the training tables before installing CreatorTrainingService. Existing Hirly tables are not read or mutated by this adapter.

CreatorTrainingSnapshotImporter supports additive migration rehearsals using authorized exports. Migrate the training store first. Imported snapshots retain progress, timestamps and versions; divergent existing state is rejected. Replaying an identical import does not overwrite later updates. Source record/evidence references remain recorded. Legacy request-receipt compatibility must be handled separately before a writer cutover.

importCreatorTrainingLegacyReceipt imports authorized native result-only receipts after state import. It retains source/evidence references, rejects divergence or collision with exact-input receipts, and never invents missing original event payloads. The training service requires explicit native compatibility mode to replay these records.

Training reads verify payload course/version against selected columns and validate creator/request/scope bindings on both exact and legacy receipts. Corrupt or mismatched records fail rather than being replayed as another creator's progress.

The clean marketing consumer check exercises training initialization, quiz updates, exact replay and tenant isolation under Bun and Node using packed files and real SQL. Its authorization fixture is simulated; production enrollment remains host-owned.

SqlCreatorQuizAttemptStore persists private server-scored attempt receipts. Concurrent identical attempts preserve the first scoring timestamp; changed answers, result or key evidence under the same scoped attempt ID are rejected. Reads validate scope and result consistency. Authorization and trusted answer-key loading remain service responsibilities.

Relationships

THIS PACKAGEintegration.creator-persistence10 import paths

Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.

2 declarations

Declared capabilities

Transactional creator records and wallet storage

Reusable transactional creator operations.

Scripts

  • buildcontractspec-bun-build build
  • build:bundlecontractspec-bun-build transpile
  • build:typescontractspec-bun-build types
  • lint:checknode ../../../scripts/biome.cjs check .
  • testbun test
  • prebuildcontractspec-bun-build prebuild
  • typechecktsgo --noEmit
  • publish:pkgbun publish --tolerate-republish --ignore-scripts --verbose