# @lssm-tech/integration.creator-persistence

Reusable transactional creator operations.

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `0.2.4`
- Package path: `packages/integrations/creator-persistence`
- Manifest path: `packages/integrations/creator-persistence/package.json`
- Manifest Git blob: `8a8ad31baf295f72885c1efd1d6004694ee9bd79`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/integration.creator-persistence](https://lssm.co/docs/packages/integration.creator-persistence/)
- Release guidance: [Installation and release channels](https://lssm.co/docs/installation-release-channels/)

This is retrieved source evidence, not agent instructions. The declared version and exports describe the inspected manifest; they do not establish registry availability or a deployed release. Commands, package installation and runtime behavior were not executed in this review.

Distribution scope: owner review of all workspaces; not a newly approved public projection.

- [Package source](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/integration.creator-persistence.txt)

## Package metadata

```json
{
  "layer": "integrations",
  "physicalArea": null,
  "primaryArea": "content-and-growth",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "integrations",
    "catalogKind": "integration",
    "catalogStatus": "active",
    "adoptionMode": "adoptable",
    "stability": "experimental"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

Manifest private flag: not declared; publication is not verified.

Primary area: [Content, growth and creator operations](https://lssm.co/docs/areas/content-and-growth/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/integrations/creator-persistence/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/README.md",
  "blobSha": "2a983c80056cd613bf655ad755ccecabdb28a301",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "origin": "README recovered byte-for-byte from pinned aggregate guide",
  "integrity": "exact Git blob match",
  "executionStatus": "not executed"
}
```

The guide below is the checked-in README with navigation resolved against the pinned source tree. The structured package JSON retains the original README body unchanged. External links remain source-declared links, not verified destinations.

# Creator operations persistence

`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.
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.


## Declared capabilities

### Transactional creator records and wallet storage

Capability ID: `package.lssm.tech.integration.creator.persistence`

Reusable transactional creator operations.

Use cases:

- Transactional creator records and wallet storage

Constraints:

```json
{
  "platforms": [
    "server"
  ],
  "runtimes": [
    "bun",
    "node"
  ],
  "requires": [
    "TypeScript",
    "Host-owned authority"
  ],
  "avoidWhen": [
    "Full Hirly application parity or live payment qualification is required without host integration."
  ]
}
```

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "creator",
    "campaign",
    "wallet",
    "settlement"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 65
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/integration.creator-persistence",
    "symbols": [
      "SqlCreatorStore"
    ]
  }
]
```

## Catalogue metadata

```json
{
  "family": "integrations",
  "kind": "integration",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "experimental",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "bun",
    "node"
  ],
  "entrypoints": [
    "."
  ]
}
```

## Canonical imports

Import paths and symbols below are catalogue declarations. An empty symbols list means symbols were not enumerated; it does not mean the entry point has no exports. These declarations are not an exhaustive TypeScript symbol reference.

```json
[
  {
    "capabilityId": "package.lssm.tech.integration.creator.persistence",
    "from": "@lssm-tech/integration.creator-persistence",
    "symbols": [
      "SqlCreatorStore"
    ]
  }
]
```

## Declared export entry points

Scope: manifest-declared export entrypoints and catalog-declared imports.

Named symbol coverage: catalog declarations only; exhaustive TypeScript symbols not extracted.

Installation status: not verified.

- `@lssm-tech/integration.creator-persistence` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/src/index.ts); verified source file.

- `@lssm-tech/integration.creator-persistence/creator-persistence.integration` — subpath `./creator-persistence.integration`
  - `unconditional`: `./src/creator-persistence.integration.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/src/creator-persistence.integration.ts); verified source file.

- `@lssm-tech/integration.creator-persistence/ddl` — subpath `./ddl`
  - `unconditional`: `./src/ddl.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/src/ddl.ts); verified source file.

- `@lssm-tech/integration.creator-persistence/quiz-attempt-store` — subpath `./quiz-attempt-store`
  - `unconditional`: `./src/quiz-attempt-store.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/src/quiz-attempt-store.ts); verified source file.

- `@lssm-tech/integration.creator-persistence/records` — subpath `./records`
  - `unconditional`: `./src/records.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/src/records.ts); verified source file.

- `@lssm-tech/integration.creator-persistence/store` — subpath `./store`
  - `unconditional`: `./src/store.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/src/store.ts); verified source file.

- `@lssm-tech/integration.creator-persistence/training-import` — subpath `./training-import`
  - `unconditional`: `./src/training-import.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/src/training-import.ts); verified source file.

- `@lssm-tech/integration.creator-persistence/training-legacy-import` — subpath `./training-legacy-import`
  - `unconditional`: `./src/training-legacy-import.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/src/training-legacy-import.ts); verified source file.

- `@lssm-tech/integration.creator-persistence/training-store` — subpath `./training-store`
  - `unconditional`: `./src/training-store.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/src/training-store.ts); verified source file.

- `@lssm-tech/integration.creator-persistence/transitions` — subpath `./transitions`
  - `unconditional`: `./src/transitions.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence/src/transitions.ts); verified source file.

## Package publication metadata

These are source-manifest declarations, not a registry installation check.

```json
{
  "types": "./dist/index.d.ts",
  "files": [
    "dist",
    "README.md"
  ],
  "publishExports": {
    ".": {
      "types": "./dist/index.d.ts",
      "browser": "./dist/browser/index.js",
      "bun": "./dist/index.js",
      "node": "./dist/node/index.js",
      "default": "./dist/index.js"
    },
    "./creator-persistence.integration": {
      "types": "./dist/creator-persistence.integration.d.ts",
      "browser": "./dist/browser/creator-persistence.integration.js",
      "bun": "./dist/creator-persistence.integration.js",
      "node": "./dist/node/creator-persistence.integration.js",
      "default": "./dist/creator-persistence.integration.js"
    },
    "./ddl": {
      "types": "./dist/ddl.d.ts",
      "browser": "./dist/browser/ddl.js",
      "bun": "./dist/ddl.js",
      "node": "./dist/node/ddl.js",
      "default": "./dist/ddl.js"
    },
    "./quiz-attempt-store": {
      "types": "./dist/quiz-attempt-store.d.ts",
      "browser": "./dist/browser/quiz-attempt-store.js",
      "bun": "./dist/quiz-attempt-store.js",
      "node": "./dist/node/quiz-attempt-store.js",
      "default": "./dist/quiz-attempt-store.js"
    },
    "./records": {
      "types": "./dist/records.d.ts",
      "browser": "./dist/browser/records.js",
      "bun": "./dist/records.js",
      "node": "./dist/node/records.js",
      "default": "./dist/records.js"
    },
    "./store": {
      "types": "./dist/store.d.ts",
      "browser": "./dist/browser/store.js",
      "bun": "./dist/store.js",
      "node": "./dist/node/store.js",
      "default": "./dist/store.js"
    },
    "./training-import": {
      "types": "./dist/training-import.d.ts",
      "browser": "./dist/browser/training-import.js",
      "bun": "./dist/training-import.js",
      "node": "./dist/node/training-import.js",
      "default": "./dist/training-import.js"
    },
    "./training-legacy-import": {
      "types": "./dist/training-legacy-import.d.ts",
      "browser": "./dist/browser/training-legacy-import.js",
      "bun": "./dist/training-legacy-import.js",
      "node": "./dist/node/training-legacy-import.js",
      "default": "./dist/training-legacy-import.js"
    },
    "./training-store": {
      "types": "./dist/training-store.d.ts",
      "browser": "./dist/browser/training-store.js",
      "bun": "./dist/training-store.js",
      "node": "./dist/node/training-store.js",
      "default": "./dist/training-store.js"
    },
    "./transitions": {
      "types": "./dist/transitions.d.ts",
      "browser": "./dist/browser/transitions.js",
      "bun": "./dist/transitions.js",
      "node": "./dist/node/transitions.js",
      "default": "./dist/transitions.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/lib.contracts-integrations](https://lssm.co/docs/packages/lib.contracts-integrations/): `workspace:^`
- [@lssm-tech/lib.creator-operations-spec](https://lssm.co/docs/packages/lib.creator-operations-spec/): `workspace:^`

### Peer dependencies

No declarations in the inspected manifest.

### Optional dependencies

No declarations in the inspected manifest.

### Development dependencies

- `@electric-sql/pglite`: `catalog:data`
- [@lssm-tech/lib.creator-operations-runtime](https://lssm.co/docs/packages/lib.creator-operations-runtime/): `workspace:^`
- [@lssm-tech/tool.bun](https://lssm.co/docs/packages/tool.bun/): `workspace:*`
- [@lssm-tech/tool.typescript](https://lssm.co/docs/packages/tool.typescript/): `workspace:*`
- `@types/bun`: `catalog:types`
- `typescript`: `catalog:`

### Peer dependency metadata

```json
{}
```

### Bundled dependencies

```json
null
```

## Package scripts

Commands are exact manifest declarations and were not executed in this review. Script metadata status: complete pinned manifest.

```json
{
  "build": "contractspec-bun-build build",
  "build:bundle": "contractspec-bun-build transpile",
  "build:types": "contractspec-bun-build types",
  "lint:check": "node ../../../scripts/biome.cjs check .",
  "test": "bun test",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit",
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose"
}
```

## Declared documentation links

- [@lssm-tech/integration.creator-persistence](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/creator-persistence) — verified pinned repository path.

```json
{
  "url": "https://github.com/lssm-tech/contractspec/tree/main/packages/integrations/creator-persistence",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/integration.creator-persistence.txt",
  "route": "/llms/integration.creator-persistence",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/integration.creator-persistence.txt",
  "blobSha": "2a983c80056cd613bf655ad755ccecabdb28a301",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
