@happyvertical/smrt-content 0.57.46 → 0.57.47

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 (39) hide show
  1. package/AGENTS.md +3 -1
  2. package/README.md +2 -2
  3. package/dist/chunks/content-query-DEa3aUp2.js +4252 -0
  4. package/dist/chunks/content-query-DEa3aUp2.js.map +1 -0
  5. package/dist/chunks/{content-versions-CbSEo4t3.js → content-versions-D5urSpdA.js} +2 -2
  6. package/dist/chunks/{content-versions-CbSEo4t3.js.map → content-versions-D5urSpdA.js.map} +1 -1
  7. package/dist/chunks/{contents-OJ7rkSyW.js → contents-CtbFHv-N.js} +6 -5
  8. package/dist/chunks/{contents-OJ7rkSyW.js.map → contents-CtbFHv-N.js.map} +1 -1
  9. package/dist/chunks/tenant-keyed-lookup-8z_TQG3s.js +30 -0
  10. package/dist/chunks/tenant-keyed-lookup-8z_TQG3s.js.map +1 -0
  11. package/dist/content-contributions.d.ts.map +1 -1
  12. package/dist/content-contributor.d.ts +6 -0
  13. package/dist/content-contributor.d.ts.map +1 -1
  14. package/dist/content-contributors.d.ts +10 -1
  15. package/dist/content-contributors.d.ts.map +1 -1
  16. package/dist/content-governance-assignment.d.ts.map +1 -1
  17. package/dist/content-governance-assignments.d.ts +10 -1
  18. package/dist/content-governance-assignments.d.ts.map +1 -1
  19. package/dist/content-governance-policies.d.ts +9 -1
  20. package/dist/content-governance-policies.d.ts.map +1 -1
  21. package/dist/content-governance-policy.d.ts.map +1 -1
  22. package/dist/content-governance-profile.d.ts.map +1 -1
  23. package/dist/content-governance-profiles.d.ts +9 -1
  24. package/dist/content-governance-profiles.d.ts.map +1 -1
  25. package/dist/content-governance.d.ts +16 -0
  26. package/dist/content-governance.d.ts.map +1 -1
  27. package/dist/content.d.ts.map +1 -1
  28. package/dist/contents.d.ts +0 -12
  29. package/dist/contents.d.ts.map +1 -1
  30. package/dist/index.js +109 -28
  31. package/dist/index.js.map +1 -1
  32. package/dist/manifest.json +171 -44
  33. package/dist/server.js +1 -1
  34. package/dist/smrt-knowledge.json +18 -9
  35. package/dist/tenant-keyed-lookup.d.ts +30 -0
  36. package/dist/tenant-keyed-lookup.d.ts.map +1 -0
  37. package/package.json +24 -24
  38. package/dist/chunks/content-query-DPHBcml5.js +0 -4233
  39. package/dist/chunks/content-query-DPHBcml5.js.map +0 -1
package/AGENTS.md CHANGED
@@ -22,8 +22,9 @@ you are editing. This file keeps what holds across the package.
22
22
  - **ContentGovernancePolicy**: Persisted review policy (key, label, kind, instructions)
23
23
  - **ContentGovernanceProfile**: Persisted review profile (key, label, requirements array)
24
24
  - **ContentGovernanceAssignment**: Governs content type/variant → profile mapping, feature flags
25
+ - Governance policies/profiles/assignments are keyed `(tenant_id, key)` (#3305 M1): NULL-tenant rows are the global layer, a tenant row overrides its key. `getByKey()` / `resolveForContent()` return the tenant's row (explicit `tenantId`, else the context), else the global one; a system context reads the global layer only. Model reference checks run in the row's own scope
25
26
  - **ContentContribution**: Held inbound submission with status lifecycle (submitted → approved/rejected/withdrawn → promoted)
26
- - **ContentContributor**: Contributor profile resolved by email, with trust level (standard/trusted/blocked)
27
+ - **ContentContributor**: Contributor profile resolved by email, with trust level (standard/trusted/blocked). Keyed `(tenant_id, email)` on the lowercased, trimmed email (normalized on every save, #3305 M1); `getByEmail()` / `findOrCreateByEmail()` resolve within one tenant (explicit `tenantId`, else the context; neither → global) with no global fallback, and link a profile of the same tenant
27
28
  - **ContentContributionType**: Configures intake channels, rules, and promotion mapping. Keyed per tenant (`tenant_id`, `key`); NULL-tenant rows are the global defaults each tenant can override by key
28
29
  - **ContentContributionRevision**: Revision history for held submissions
29
30
  - **ContentContributionAttachment**: Held file metadata; becomes an `Asset` on promotion
@@ -210,5 +211,6 @@ import {
210
211
  - **`pnpm typecheck` regenerates package-owned routes safely**: Svelte's analysis may load dependent package Vite configs, but those configs anchor their root to their own package. Content's generated API routes therefore remain under `src/routes/api/v1` and the bounded `.gitignore` block stays stable (#2199).
211
212
  - **Tests import generated routes and that is fine**: `contents-api.test.ts` imports `contents/+server.ts` and `contents/[id]/+server.ts` to exercise the generated CRUD handlers against a real SQLite database. The `test` script runs `svelte-kit sync` first, which regenerates the whole route tree, so those files exist by the time Vitest loads — no committed copy needed. Run `pnpm test`, never bare `vitest`, or the imports fail to resolve
212
213
  - **`generate:test` exists for the callers that bypass `test`**: `scripts/check-coverage.mjs` runs bare `vitest --coverage`, so without a `generate:test` hook the route imports above fail and the Coverage Gate reports `no coverage produced` rather than a real percentage. It is `cache: false` in `packages/content/turbo.json` — the root task's `outputs` describe core's manifest, so a turbo cache hit would restore nothing and silently skip `svelte-kit sync`
214
+ - **Tenant-local keys rollout (#3305 M1)**: `smrt db:migrate` adds `<table>_tenant_id_{email,key}_idx` and drops the superseded `<table>_{email,key}_idx` in one migration; rows are untouched (every row satisfies the wider key). Old code upserts on the old arbiter, so deploy the code and the migration together in a writer-drained window; reverting afterwards needs collision analysis, since tenants may then share a key
213
215
  - **Chat tables**: chat endpoint requires `@happyvertical/smrt-chat` tables; dev server handles missing tables gracefully
214
216
  - **Dev server bootstraps all classes**: `hooks.server.ts` generates schemas for all 13 local `@smrt()` classes plus cross-package manifests
package/README.md CHANGED
@@ -394,7 +394,7 @@ Key behavior:
394
394
  - web and email intake normalize into the same contribution package
395
395
  - one contribution can contain one primary text submission plus zero or more held files
396
396
  - asset-only submissions are allowed when the type permits empty text
397
- - contributors are resolved by email and linked to a `Profile`
397
+ - contributors are resolved by email within one tenant (`(tenant_id, email)`) and linked to a `Profile` of the same tenant
398
398
  - trust levels are `standard`, `trusted`, or `blocked`
399
399
  - intake rules can accept, quarantine, or reject before editorial review
400
400
  - approval promotes into normal draft `Content` and `Asset` records with provenance metadata
@@ -607,7 +607,7 @@ reassemble into a live tag.
607
607
  | `ContentContribution` | Held inbound submission with approval, rejection, withdrawal, and promotion actions |
608
608
  | `ContentContributions` | Contribution collection with web intake, email ingestion, inbox, and contributor views |
609
609
  | `ContentContributionType` | Persisted contribution-type override for app-defined intake rules and promotion mapping |
610
- | `ContentContributor` | Contributor profile/trust record resolved by email |
610
+ | `ContentContributor` | Contributor profile/trust record resolved by email within its tenant |
611
611
  | `ContentContributionRevision` | Revision history for held submissions |
612
612
  | `ContentContributionAttachment` | Held file metadata that only becomes an `Asset` on promotion |
613
613
  | `ContentGovernancePolicy` | Persisted review policy definition |