@happyvertical/smrt-content 0.61.3 → 0.61.5

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 (33) hide show
  1. package/dist/chunks/{content-corrections-QyinPkfN.js → content-corrections-DgJ2duqR.js} +2 -1
  2. package/dist/chunks/content-corrections-DgJ2duqR.js.map +1 -0
  3. package/dist/chunks/content-query-Cvl7H0ui.js +4255 -0
  4. package/dist/chunks/content-query-Cvl7H0ui.js.map +1 -0
  5. package/dist/chunks/{content-reviews-H9ANWEi7.js → content-reviews-mzf5p6fz.js} +2 -1
  6. package/dist/chunks/content-reviews-mzf5p6fz.js.map +1 -0
  7. package/dist/chunks/{content-versions-Cw5nnYDl.js → content-versions-B5pIX39n.js} +3 -2
  8. package/dist/chunks/content-versions-B5pIX39n.js.map +1 -0
  9. package/dist/chunks/{contents-DjT0fTu8.js → contents-lNXJe6LN.js} +4 -4
  10. package/dist/chunks/contents-lNXJe6LN.js.map +1 -0
  11. package/dist/content-asset.d.ts.map +1 -1
  12. package/dist/content-contribution-attachment.d.ts.map +1 -1
  13. package/dist/content-contribution-revision.d.ts.map +1 -1
  14. package/dist/content-contribution.d.ts +1 -1
  15. package/dist/content-contribution.d.ts.map +1 -1
  16. package/dist/content-contributor.d.ts.map +1 -1
  17. package/dist/content-correction.d.ts.map +1 -1
  18. package/dist/content-review.d.ts.map +1 -1
  19. package/dist/content-version.d.ts.map +1 -1
  20. package/dist/content.d.ts.map +1 -1
  21. package/dist/contents.d.ts.map +1 -1
  22. package/dist/index.js +43 -17
  23. package/dist/index.js.map +1 -1
  24. package/dist/manifest.json +1520 -477
  25. package/dist/server.js +1 -1
  26. package/dist/smrt-knowledge.json +10 -10
  27. package/package.json +24 -24
  28. package/dist/chunks/content-corrections-QyinPkfN.js.map +0 -1
  29. package/dist/chunks/content-query-D4gwn8nD.js +0 -4246
  30. package/dist/chunks/content-query-D4gwn8nD.js.map +0 -1
  31. package/dist/chunks/content-reviews-H9ANWEi7.js.map +0 -1
  32. package/dist/chunks/content-versions-Cw5nnYDl.js.map +0 -1
  33. package/dist/chunks/contents-DjT0fTu8.js.map +0 -1
@@ -62,6 +62,7 @@ var ContentCorrection = class extends SmrtObject {
62
62
  __publicField$1(ContentCorrection, "__smrtPackage__", "@happyvertical/smrt-content");
63
63
  __decorateClass$1([foreignKey("Content", {
64
64
  required: true,
65
+ requiredFor: "identity",
65
66
  onDelete: "CASCADE"
66
67
  }), field({ description: "The piece being corrected." })], ContentCorrection.prototype, "contentId", 2);
67
68
  __decorateClass$1([foreignKey("ContentVersion", { onDelete: "CASCADE" })], ContentCorrection.prototype, "contentVersionId", 2);
@@ -157,4 +158,4 @@ ContentCorrectionCollection = __decorateClass([smrt({
157
158
  //#endregion
158
159
  export { content_corrections_exports as n, ContentCorrection as r, ContentCorrectionCollection as t };
159
160
 
160
- //# sourceMappingURL=content-corrections-QyinPkfN.js.map
161
+ //# sourceMappingURL=content-corrections-DgJ2duqR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-corrections-DgJ2duqR.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', {\n required: true,\n requiredFor: 'identity',\n onDelete: 'CASCADE',\n })\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":";;;;;;;;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