@happyvertical/smrt-content 0.57.35 → 0.57.37

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 (32) hide show
  1. package/AGENTS.md +1 -0
  2. package/dist/chunks/{content-corrections-BYT3Qdw5.js → content-corrections-QyinPkfN.js} +10 -3
  3. package/dist/chunks/content-corrections-QyinPkfN.js.map +1 -0
  4. package/dist/chunks/{content-query-jQhfFnhO.js → content-query-DxZAmAPW.js} +36 -37
  5. package/dist/chunks/content-query-DxZAmAPW.js.map +1 -0
  6. package/dist/chunks/{content-reviews-B6h2aJ9m.js → content-reviews-H9ANWEi7.js} +9 -3
  7. package/dist/chunks/content-reviews-H9ANWEi7.js.map +1 -0
  8. package/dist/chunks/{content-versions-BKAWUCzE.js → content-versions-D0VjHrvd.js} +10 -4
  9. package/dist/chunks/content-versions-D0VjHrvd.js.map +1 -0
  10. package/dist/chunks/{contents-DYBgt7rZ.js → contents-C9eZRig7.js} +2 -2
  11. package/dist/chunks/{contents-DYBgt7rZ.js.map → contents-C9eZRig7.js.map} +1 -1
  12. package/dist/content-contribution.d.ts.map +1 -1
  13. package/dist/content-contributor.d.ts.map +1 -1
  14. package/dist/content-correction.d.ts.map +1 -1
  15. package/dist/content-query.d.ts.map +1 -1
  16. package/dist/content-review.d.ts.map +1 -1
  17. package/dist/content-version.d.ts.map +1 -1
  18. package/dist/content.d.ts.map +1 -1
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +315 -11
  22. package/dist/index.js.map +1 -1
  23. package/dist/manifest.json +795 -59
  24. package/dist/recipes.d.ts +423 -0
  25. package/dist/recipes.d.ts.map +1 -0
  26. package/dist/server.js +1 -1
  27. package/dist/smrt-knowledge.json +613 -79
  28. package/package.json +24 -24
  29. package/dist/chunks/content-corrections-BYT3Qdw5.js.map +0 -1
  30. package/dist/chunks/content-query-jQhfFnhO.js.map +0 -1
  31. package/dist/chunks/content-reviews-B6h2aJ9m.js.map +0 -1
  32. package/dist/chunks/content-versions-BKAWUCzE.js.map +0 -1
package/AGENTS.md CHANGED
@@ -27,6 +27,7 @@ you are editing. This file keeps what holds across the package.
27
27
  - **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
28
  - **ContentContributionRevision**: Revision history for held submissions
29
29
  - **ContentContributionAttachment**: Held file metadata; becomes an `Asset` on promotion
30
+ - **Recipe `content.articles`** (`src/recipes.ts`, help in `src/articles.recipe.md`): Articles over the exposed `Content` base narrowed to `type = 'article'` (the `Article` subclass is closed), plus versions, corrections, reviews and contributions for the planner and other catalog hosts. Fields it shows carry `@field({ description })` in plain words; keep them when editing the models.
30
31
 
31
32
  ## Contents Collection
32
33
 
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { SmrtCollection, SmrtObject, crossPackageRef, foreignKey, smrt } from "@happyvertical/smrt-core";
2
+ import { SmrtCollection, SmrtObject, crossPackageRef, field, foreignKey, smrt } from "@happyvertical/smrt-core";
3
3
  import { TenantScoped, tenantId } from "@happyvertical/smrt-tenancy";
4
4
  //#region src/content-correction.ts
5
5
  var __defProp$1 = Object.defineProperty;
@@ -63,11 +63,18 @@ __publicField$1(ContentCorrection, "__smrtPackage__", "@happyvertical/smrt-conte
63
63
  __decorateClass$1([foreignKey("Content", {
64
64
  required: true,
65
65
  onDelete: "CASCADE"
66
- })], ContentCorrection.prototype, "contentId", 2);
66
+ }), field({ description: "The piece being corrected." })], ContentCorrection.prototype, "contentId", 2);
67
67
  __decorateClass$1([foreignKey("ContentVersion", { onDelete: "CASCADE" })], ContentCorrection.prototype, "contentVersionId", 2);
68
68
  __decorateClass$1([crossPackageRef("@happyvertical/smrt-facts:Fact")], ContentCorrection.prototype, "factId", 2);
69
69
  __decorateClass$1([crossPackageRef("@happyvertical/smrt-facts:Fact")], ContentCorrection.prototype, "replacementFactId", 2);
70
+ __decorateClass$1([field({ description: "What kind of mistake it fixes: a fact, a safety concern, wording or something else." })], ContentCorrection.prototype, "correctionType", 2);
71
+ __decorateClass$1([field({ description: "Where the correction stands: a draft, published or retracted." })], ContentCorrection.prototype, "status", 2);
72
+ __decorateClass$1([field({ description: "A short note on what was wrong and how it was fixed." })], ContentCorrection.prototype, "summary", 2);
73
+ __decorateClass$1([field({ description: "The wording that was wrong." })], ContentCorrection.prototype, "incorrectText", 2);
74
+ __decorateClass$1([field({ description: "The wording that replaces it." })], ContentCorrection.prototype, "correctedText", 2);
75
+ __decorateClass$1([field({ description: "The note readers see about this correction." })], ContentCorrection.prototype, "publicNote", 2);
70
76
  __decorateClass$1([tenantId({ nullable: true })], ContentCorrection.prototype, "tenantId", 2);
77
+ __decorateClass$1([field({ description: "When the correction was made public." })], ContentCorrection.prototype, "publishedAt", 2);
71
78
  ContentCorrection = __decorateClass$1([TenantScoped({ mode: "optional" }), smrt({
72
79
  tableName: "content_corrections",
73
80
  api: { include: [
@@ -150,4 +157,4 @@ ContentCorrectionCollection = __decorateClass([smrt({
150
157
  //#endregion
151
158
  export { content_corrections_exports as n, ContentCorrection as r, ContentCorrectionCollection as t };
152
159
 
153
- //# sourceMappingURL=content-corrections-BYT3Qdw5.js.map
160
+ //# sourceMappingURL=content-corrections-QyinPkfN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-corrections-QyinPkfN.js","names":[],"sources":["../../src/content-correction.ts","../../src/content-corrections.ts"],"sourcesContent":["import type { SmrtObjectOptions } from '@happyvertical/smrt-core';\nimport {\n crossPackageRef,\n field,\n foreignKey,\n SmrtObject,\n smrt,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport type {\n ContentCorrectionStatus,\n ContentCorrectionType,\n} from './content-governance';\n\nexport interface ContentCorrectionOptions extends SmrtObjectOptions {\n contentId?: string;\n contentVersionId?: string;\n factId?: string;\n replacementFactId?: string;\n correctionType?: ContentCorrectionType;\n status?: ContentCorrectionStatus;\n summary?: string;\n incorrectText?: string;\n correctedText?: string;\n publicNote?: string;\n metadata?: string | Record<string, unknown>;\n tenantId?: string | null;\n publishedAt?: Date | null;\n createdAt?: Date;\n updatedAt?: Date;\n}\n\n@TenantScoped({ mode: 'optional' })\n@smrt({\n tableName: 'content_corrections',\n api: { include: ['list', 'get', 'create', 'update'] },\n mcp: { include: ['list', 'get', 'create', 'update'] },\n cli: { skipApiCheck: true },\n})\nexport class ContentCorrection extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-content\";\n @foreignKey('Content', { required: true, onDelete: 'CASCADE' })\n @field({ description: 'The piece being corrected.' })\n contentId = '';\n\n @foreignKey('ContentVersion', { onDelete: 'CASCADE' })\n contentVersionId = '';\n\n @crossPackageRef('@happyvertical/smrt-facts:Fact')\n factId = '';\n\n @crossPackageRef('@happyvertical/smrt-facts:Fact')\n replacementFactId = '';\n @field({\n description:\n 'What kind of mistake it fixes: a fact, a safety concern, wording or something else.',\n })\n correctionType: ContentCorrectionType = 'fact';\n\n @field({\n description:\n 'Where the correction stands: a draft, published or retracted.',\n })\n status: ContentCorrectionStatus = 'draft';\n\n @field({\n description: 'A short note on what was wrong and how it was fixed.',\n })\n summary = '';\n\n @field({ description: 'The wording that was wrong.' })\n incorrectText = '';\n\n @field({ description: 'The wording that replaces it.' })\n correctedText = '';\n\n @field({ description: 'The note readers see about this correction.' })\n publicNote = '';\n metadata = '';\n\n @tenantId({ nullable: true })\n tenantId: string | null = null;\n\n @field({ description: 'When the correction was made public.' })\n publishedAt: Date | null = null;\n createdAt = new Date();\n updatedAt = new Date();\n\n constructor(options: ContentCorrectionOptions = {}) {\n super(options);\n if (options.contentId) this.contentId = options.contentId;\n if (options.contentVersionId !== undefined)\n this.contentVersionId = options.contentVersionId;\n if (options.factId !== undefined) this.factId = options.factId;\n if (options.replacementFactId !== undefined)\n this.replacementFactId = options.replacementFactId;\n if (options.correctionType !== undefined)\n this.correctionType = options.correctionType;\n if (options.status !== undefined) this.status = options.status;\n if (options.summary !== undefined) this.summary = options.summary;\n if (options.incorrectText !== undefined)\n this.incorrectText = options.incorrectText;\n if (options.correctedText !== undefined)\n this.correctedText = options.correctedText;\n if (options.publicNote !== undefined) this.publicNote = options.publicNote;\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.publishedAt !== undefined)\n this.publishedAt = options.publishedAt;\n if (options.createdAt) this.createdAt = options.createdAt;\n if (options.updatedAt) this.updatedAt = options.updatedAt;\n\n if (options.metadata !== undefined) {\n this.metadata =\n typeof options.metadata === 'string'\n ? options.metadata\n : JSON.stringify(options.metadata);\n }\n }\n\n getMetadata(): Record<string, unknown> {\n try {\n return this.metadata ? JSON.parse(this.metadata) : {};\n } catch {\n return {};\n }\n }\n}\n","import { SmrtCollection, smrt } from '@happyvertical/smrt-core';\nimport { ContentCorrection } from './content-correction';\n\n// The collection's own @smrt() surface: its read helpers are published\n// operations (the API explorer and the workbench call them). A collection\n// inherits only its model's CRUD verbs, so it lists the helpers it opens here.\n// The CRUD verbs repeat the model's because a collection decorator's config\n// is merged over its model's at runtime.\n@smrt({\n // Mirror the model's storage so the collection decorator cannot plan a\n // different table for it.\n tableName: 'content_corrections',\n api: {\n include: [\n 'list',\n 'get',\n 'create',\n 'update',\n 'listForContent',\n 'getPublishedForContent',\n ],\n },\n mcp: {\n include: [\n 'list',\n 'get',\n 'create',\n 'update',\n 'listForContent',\n 'getPublishedForContent',\n ],\n },\n})\nexport class ContentCorrectionCollection extends SmrtCollection<ContentCorrection> { static __smrtPackage__ = \"@happyvertical/smrt-content\";\n static readonly _itemClass = ContentCorrection;\n\n async listForContent(contentId: string): Promise<ContentCorrection[]> {\n return this.list({\n where: { contentId },\n orderBy: 'created_at DESC',\n });\n }\n\n async getPublishedForContent(\n contentId: string,\n ): Promise<ContentCorrection[]> {\n return this.list({\n where: { contentId, status: 'published' },\n orderBy: 'published_at DESC',\n });\n }\n\n async issue(\n options: ConstructorParameters<typeof ContentCorrection>[0],\n ): Promise<ContentCorrection> {\n if (!options) {\n return this.create({});\n }\n\n return this.create({\n ...options,\n metadata:\n typeof options.metadata === 'string'\n ? options.metadata\n : options.metadata\n ? JSON.stringify(options.metadata)\n : undefined,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuCO,IAAM,oBAAN,cAAgC,WAAW;CAGhD,YAAY;CAGZ,mBAAmB;CAGnB,SAAS;CAGT,oBAAoB;CAKpB,iBAAwC;CAMxC,SAAkC;CAKlC,UAAU;CAGV,gBAAgB;CAGhB,gBAAgB;CAGhB,aAAa;CACb,WAAW;CAGX,WAA0B;CAG1B,cAA2B;CAC3B,4BAAY,IAAI,KAAK;CACrB,4BAAY,IAAI,KAAK;CAErB,YAAY,UAAoC,CAAC,GAAG;EAClD,MAAM,OAAO;EACb,IAAI,QAAQ,WAAW,KAAK,YAAY,QAAQ;EAChD,IAAI,QAAQ,qBAAqB,KAAA,GAC/B,KAAK,mBAAmB,QAAQ;EAClC,IAAI,QAAQ,WAAW,KAAA,GAAW,KAAK,SAAS,QAAQ;EACxD,IAAI,QAAQ,sBAAsB,KAAA,GAChC,KAAK,oBAAoB,QAAQ;EACnC,IAAI,QAAQ,mBAAmB,KAAA,GAC7B,KAAK,iBAAiB,QAAQ;EAChC,IAAI,QAAQ,WAAW,KAAA,GAAW,KAAK,SAAS,QAAQ;EACxD,IAAI,QAAQ,YAAY,KAAA,GAAW,KAAK,UAAU,QAAQ;EAC1D,IAAI,QAAQ,kBAAkB,KAAA,GAC5B,KAAK,gBAAgB,QAAQ;EAC/B,IAAI,QAAQ,kBAAkB,KAAA,GAC5B,KAAK,gBAAgB,QAAQ;EAC/B,IAAI,QAAQ,eAAe,KAAA,GAAW,KAAK,aAAa,QAAQ;EAChE,IAAI,QAAQ,aAAa,KAAA,GAAW,KAAK,WAAW,QAAQ;EAC5D,IAAI,QAAQ,gBAAgB,KAAA,GAC1B,KAAK,cAAc,QAAQ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