@roottale/cms-core 0.70.1 → 0.72.0
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.
- package/CHANGELOG.md +27 -0
- package/README.md +21 -0
- package/dist/chunk-WNU53PSH.js +197 -0
- package/dist/chunk-WNU53PSH.js.map +1 -0
- package/dist/index.cjs +424 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -1
- package/dist/index.d.ts +130 -1
- package/dist/index.js +151 -1
- package/dist/index.js.map +1 -1
- package/dist/visual-edit-contract-DzlMel7r.d.cts +822 -0
- package/dist/visual-edit-contract-DzlMel7r.d.ts +822 -0
- package/dist/visual-edit.cjs +339 -0
- package/dist/visual-edit.cjs.map +1 -0
- package/dist/visual-edit.d.cts +77 -0
- package/dist/visual-edit.d.ts +77 -0
- package/dist/visual-edit.js +153 -0
- package/dist/visual-edit.js.map +1 -0
- package/package.json +7 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z, ZodSchema } from 'zod';
|
|
2
|
+
export { V as VISUAL_EDIT_ATTRIBUTE, a as VISUAL_EDIT_PROTOCOL, b as VISUAL_EDIT_PROTOCOL_VERSION, c as VisualEditAddress, d as VisualEditMessage, e as VisualEditMode, f as VisualEditPayload, g as VisualPreviewTarget, h as VisualRenderReceipt, i as VisualViewportPosition, j as buildVisualEditPreviewUrl, k as isVisualEditOrigin, p as parseVisualEditAddress, l as parseVisualEditMessage, s as sameVisualDependencies, m as sameVisualPreviewTarget, v as visualEditAddressKey, n as visualEditAddressSchema, o as visualEditAttributes, q as visualPreviewTargetSchema, r as visualRenderReceiptSchema } from './visual-edit-contract-DzlMel7r.cjs';
|
|
2
3
|
|
|
3
4
|
/** WP-compatible name pattern: `core/<x>` | `roottale/<x>` */
|
|
4
5
|
declare const BLOCK_NAME_PATTERN: RegExp;
|
|
@@ -11606,6 +11607,134 @@ declare function selectContentQuery<T extends ContentPolicyPost>(query: ContentQ
|
|
|
11606
11607
|
};
|
|
11607
11608
|
}): ContentQueryResult<T>;
|
|
11608
11609
|
|
|
11610
|
+
interface ContentScope {
|
|
11611
|
+
readonly tenantId: string;
|
|
11612
|
+
readonly siteId: string;
|
|
11613
|
+
}
|
|
11614
|
+
interface ContentCandidate extends ContentScope {
|
|
11615
|
+
readonly id: string;
|
|
11616
|
+
readonly modelKey: string;
|
|
11617
|
+
readonly status: string;
|
|
11618
|
+
readonly termIds: readonly string[];
|
|
11619
|
+
readonly title: string;
|
|
11620
|
+
readonly path: string | null;
|
|
11621
|
+
readonly publishedAt: string | null;
|
|
11622
|
+
readonly position?: number;
|
|
11623
|
+
}
|
|
11624
|
+
interface RelatedContentOptions {
|
|
11625
|
+
readonly scope: ContentScope;
|
|
11626
|
+
readonly sourceId?: string;
|
|
11627
|
+
readonly termIds: readonly string[];
|
|
11628
|
+
readonly models: readonly {
|
|
11629
|
+
readonly modelKey: string;
|
|
11630
|
+
readonly maxCount: number;
|
|
11631
|
+
}[];
|
|
11632
|
+
readonly includeDescendants?: boolean;
|
|
11633
|
+
/** Each value contains the caller's explicitly resolved descendant IDs, not slugs or labels. */
|
|
11634
|
+
readonly descendantTermIds?: Readonly<Record<string, readonly string[]>>;
|
|
11635
|
+
}
|
|
11636
|
+
interface RelatedContentGroup<T extends ContentCandidate = ContentCandidate> {
|
|
11637
|
+
readonly modelKey: string;
|
|
11638
|
+
readonly items: readonly T[];
|
|
11639
|
+
}
|
|
11640
|
+
type ContentCtaMode = "auto" | "manual" | "off";
|
|
11641
|
+
interface ContentCtaOptions {
|
|
11642
|
+
readonly scope: ContentScope;
|
|
11643
|
+
readonly sourceId?: string;
|
|
11644
|
+
readonly primaryTermId?: string | null;
|
|
11645
|
+
readonly detailModelKeys: readonly string[];
|
|
11646
|
+
readonly cta: {
|
|
11647
|
+
readonly mode: ContentCtaMode;
|
|
11648
|
+
readonly targetPostId?: string | null;
|
|
11649
|
+
};
|
|
11650
|
+
}
|
|
11651
|
+
type ContentCtaHiddenReason = "disabled" | "manual_target_missing" | "manual_target_unavailable" | "primary_term_missing" | "auto_target_missing" | "auto_target_ambiguous";
|
|
11652
|
+
type ContentCtaResult<T extends ContentCandidate = ContentCandidate> = {
|
|
11653
|
+
readonly state: "resolved";
|
|
11654
|
+
readonly mode: "auto" | "manual";
|
|
11655
|
+
readonly target: T;
|
|
11656
|
+
} | {
|
|
11657
|
+
readonly state: "hidden";
|
|
11658
|
+
readonly mode: ContentCtaMode;
|
|
11659
|
+
readonly reason: ContentCtaHiddenReason;
|
|
11660
|
+
};
|
|
11661
|
+
/** Empty classifications produce empty lists. No title, path, model or content is inferred. */
|
|
11662
|
+
declare function selectRelatedContent<T extends ContentCandidate>(candidates: readonly T[], options: RelatedContentOptions): RelatedContentGroup<T>[];
|
|
11663
|
+
/** Manual selection is authoritative: an unavailable target stays hidden instead of falling back. */
|
|
11664
|
+
declare function resolveContentCta<T extends ContentCandidate>(candidates: readonly T[], options: ContentCtaOptions): ContentCtaResult<T>;
|
|
11665
|
+
interface VisibleFaqCandidate extends FaqEntry {
|
|
11666
|
+
readonly id: string;
|
|
11667
|
+
readonly visible: boolean;
|
|
11668
|
+
readonly deleted?: boolean;
|
|
11669
|
+
}
|
|
11670
|
+
interface VisibleFaqEntry extends FaqEntry {
|
|
11671
|
+
readonly id: string;
|
|
11672
|
+
}
|
|
11673
|
+
/** Render this same selection when passing the result to FAQ structured data. */
|
|
11674
|
+
declare function selectVisibleFaqEntries(entries: readonly VisibleFaqCandidate[]): VisibleFaqEntry[];
|
|
11675
|
+
declare function visibleFaqPageJsonLd(entries: readonly VisibleFaqCandidate[]): Record<string, unknown> | null;
|
|
11676
|
+
interface ProfileQualificationInput {
|
|
11677
|
+
readonly qualification?: string | readonly string[] | null;
|
|
11678
|
+
readonly alumniOf?: string | readonly string[] | null;
|
|
11679
|
+
}
|
|
11680
|
+
interface ProfileQualificationProperties {
|
|
11681
|
+
readonly hasCredential?: readonly {
|
|
11682
|
+
readonly "@type": "EducationalOccupationalCredential";
|
|
11683
|
+
readonly name: string;
|
|
11684
|
+
}[];
|
|
11685
|
+
readonly alumniOf?: readonly {
|
|
11686
|
+
readonly "@type": "EducationalOrganization";
|
|
11687
|
+
readonly name: string;
|
|
11688
|
+
}[];
|
|
11689
|
+
}
|
|
11690
|
+
/** These are Person properties. Never infer a credential or school from a title, role or biography. */
|
|
11691
|
+
declare function profileQualificationJsonLdProperties(input: ProfileQualificationInput): ProfileQualificationProperties;
|
|
11692
|
+
|
|
11693
|
+
/**
|
|
11694
|
+
* Paths start at the serialized ACF root. Each array traversal requires @<uuid>.
|
|
11695
|
+
* Unknown properties and repeaters with missing or duplicate IDs throw; no defaults are invented.
|
|
11696
|
+
*/
|
|
11697
|
+
declare function getContentValue(values: Readonly<Record<string, unknown>>, path: readonly string[]): unknown;
|
|
11698
|
+
/**
|
|
11699
|
+
* Clone only the changed branch and preserve stable IDs. Whole-array replacement is allowed.
|
|
11700
|
+
* Leaf permissions and all replacement-value validation belong to the compiled content contract.
|
|
11701
|
+
*/
|
|
11702
|
+
declare function setContentValue(values: Readonly<Record<string, unknown>>, path: readonly string[], value: unknown): Record<string, unknown>;
|
|
11703
|
+
|
|
11704
|
+
interface ContentDependencyEntity extends ContentScope {
|
|
11705
|
+
readonly id: string;
|
|
11706
|
+
readonly modelKey: string;
|
|
11707
|
+
readonly termIds: readonly string[];
|
|
11708
|
+
readonly path: string | null;
|
|
11709
|
+
}
|
|
11710
|
+
interface ContentQueryDependency {
|
|
11711
|
+
readonly modelKeys: readonly string[];
|
|
11712
|
+
/** Omitted: all content in these models. Empty: nothing. Descendants must be explicitly expanded. */
|
|
11713
|
+
readonly termIds?: readonly string[];
|
|
11714
|
+
}
|
|
11715
|
+
/** A declared public route and the content whose changes can alter its rendered output. */
|
|
11716
|
+
interface ContentPathDependency extends ContentScope {
|
|
11717
|
+
readonly path: string;
|
|
11718
|
+
readonly entityIds?: readonly string[];
|
|
11719
|
+
readonly queries?: readonly ContentQueryDependency[];
|
|
11720
|
+
readonly singletonKeys?: readonly string[];
|
|
11721
|
+
}
|
|
11722
|
+
interface ContentDependencyChange {
|
|
11723
|
+
readonly scope: ContentScope;
|
|
11724
|
+
readonly before?: ContentDependencyEntity | null;
|
|
11725
|
+
readonly after?: ContentDependencyEntity | null;
|
|
11726
|
+
/** Scoped tombstone IDs still invalidate direct/manual references when the target no longer exists. */
|
|
11727
|
+
readonly entityIds?: readonly string[];
|
|
11728
|
+
readonly singletonKeys?: readonly string[];
|
|
11729
|
+
}
|
|
11730
|
+
/**
|
|
11731
|
+
* Query edges represent related lists, category hubs and auto CTAs; entity edges represent direct
|
|
11732
|
+
* includes and manual CTAs. Before and after facts are both needed on classification or URL moves.
|
|
11733
|
+
* Do not filter snapshots by their new publication status: unpublishing must evict previous output.
|
|
11734
|
+
* The caller owns the complete dependency graph and persisted before snapshot; no DB reads occur here.
|
|
11735
|
+
*/
|
|
11736
|
+
declare function resolveContentDependencyPaths(dependencies: readonly ContentPathDependency[], change: ContentDependencyChange): string[];
|
|
11737
|
+
|
|
11609
11738
|
/** 검색 관리의 등록·검토·공개 Proxy가 공유하는 정확 경로 계약. */
|
|
11610
11739
|
type NormalizedRedirectSourceResult = {
|
|
11611
11740
|
readonly ok: true;
|
|
@@ -11628,4 +11757,4 @@ declare function isProtectedRedirectPath(path: string): boolean;
|
|
|
11628
11757
|
declare function normalizeRedirectSource(raw: string): NormalizedRedirectSourceResult;
|
|
11629
11758
|
declare function normalizeRedirectTarget(raw: string): NormalizedRedirectTargetResult;
|
|
11630
11759
|
|
|
11631
|
-
export { BLOCK_NAME_PATTERN, type BindingResolver, type Block, type BlockBinding, type BlockDefinition, type BlockRegistry, CMS_FONT_SIZES, CMS_IMAGE_WIDTHS, CMS_LINE_HEIGHTS, CMS_PARAGRAPH_SPACINGS, type CategoryTreeEntry, type CategoryTreeEntryCategory, type CategoryTreeEntryResolution, type CategoryTreePresentation, type CategoryTreeTerm, type ClientHydrationSpec, type ContentPolicy, type ContentPolicyCheck, ContentPolicyCheckSchema, ContentPolicyFieldNameSchema, type ContentPolicyFieldRef, ContentPolicyInternalPathSchema, type ContentPolicyOptions, type ContentPolicyPost, type ContentPolicyResult, type ContentPolicyScalarCheck, ContentPolicyScalarCheckSchema, ContentPolicyScalarSchema, ContentPolicySchema, ContentPolicyWhenSchema, type ContentQuery, type ContentQueryCandidate, ContentQueryFilterSchema, type ContentQueryOptions, type ContentQueryResult, ContentQuerySchema, DEFAULT_SITE_PATTERN_PRESENTATION, EMPTY_SITE_PATTERN_PLACEMENTS, type EmbedProvider, FIELD_BINDING_SOURCE, FIELD_BINDING_SOURCE_ALIAS, type FaqEntry, IMAGE_ALT_MAX_LENGTH, INTERNAL_CONTENT_LINK_CLASS, INTERNAL_CONTENT_LINK_PENDING_ATTR, INTERNAL_CONTENT_LINK_PENDING_CLASS, INTERNAL_CONTENT_LINK_TOKEN_SOURCE, type InternalContentLinkResolver, type InternalContentLinkToken, LEGACY_BLOG_DETAIL_PATH, METADATA_FIELDS, type MetadataDefaultRules, MetadataDefaultRulesSchema, type MetadataDefaultsDeclaration, type MetadataDefaultsInput, type MetadataField, MetadataFieldSchema, type MetadataPatch, MetadataPatchSchema, type MetadataResolutionInput, type MetadataRobotsPolicy, MetadataRobotsPolicySchema, type MetadataTarget, type MetadataTargetKind, MetadataTargetKindSchema, type MetadataTextRule, MetadataTextRuleSchema, type MetadataValues, MetadataValuesSchema, type NormalizedEmbed, type NormalizedRedirectSourceResult, type NormalizedRedirectTargetResult, PHASE_1_CORE_BLOCKS, PHASE_1_CSP, POST_FOOTER_SLOT, type PatternSlots, type Phase1CoreBlockName, type PostBodySource, type PreviewTokenPayload, type PublicPathContext, type PublicPathPost, type PublicPathPresentation, type PublicRouteMetadata, type RoutablePost, type RouteCollection, SITE_PATTERN_BUTTON_COLORS_MAX, SITE_PATTERN_KEY_PATTERN, SITE_PATTERN_PLACEMENTS_KEY, SITE_PATTERN_SLOTS, type SectionLock, type SectionLockViolation, type SectionLockViolationCode, type SitePatternLayout, type SitePatternLinkStyle, type SitePatternPlacementRule, type SitePatternPlacements, type SitePatternPresentation, type SitePatternSlotKey, applyBlockBindings, bindingSrcValue, bindingTextValue, blockSchema, boundFieldValue, chainResolvers, cmsFontSize, cmsImageAlign, cmsImageStyle, cmsImageWidth, cmsLineHeight, cmsParagraphSpacing, collectContentPolicyFieldRefs, collectContentQueryFieldRefs, collectMetadataDefaultFieldRefs, contentPolicyBodyText, contentPolicySafeHttpsUrl, createFieldBindingResolver, emptyPatternSlots, ensureImportedHtmlDocumentRoots, ensureStableIds, evaluateContentPolicy, evaluateContentQuery, extractFaqEntries, faqPageJsonLd, findInternalContentLinkTokens, findSectionLockViolations, findSitePatternPlacementRule, formatMetadataDefaults, formatSectionLockViolations, htmlToPlainText, injectStableIdsTree, internalContentKeyFromPath, internalContentLinkResolverFrom, internalContentPathIndex, isAllowedEmbedSrc, isAllowedMapEmbedSrc, isInCollectionMode, isProtectedRedirectPath, isReservedCategoryTreeSlug, isSectionContentPropPath, isSitePatternSlotKey, isValidBlock, isValidSitePatternKey, issuePreviewToken, matchesContentScalarCheck, mergeMetadataPatch, metadataBodyParagraphs, metadataContentImageUrl, metadataVideoThumbnail, normalizeEmbed, normalizeHexColor, normalizeImageAlt, normalizeRedirectPath, normalizeRedirectSource, normalizeRedirectTarget, parseBlock, postsForCollection, postsInAnyCollection, postsNotInAnyCollection, readMetadataValues, readSitePatternPlacements, readSitePatternPresentation, referencedSitePatternKeys, renderInternalContentLinksInHtml, renderInternalContentLinksInText, resolveCategoryPath, resolveCategoryTreeChain, resolveCategoryTreeEntryCategory, resolveCategoryTreeEntryPath, resolveCategoryTreeHubPaths, resolveCategoryTreeSelection, resolveMetadata, resolvePatternSlots, resolvePostBodySource, resolvePostCategorySlug, resolvePostCollection, resolvePostPath, resolvePostPublicPath, resolvePostUrl, sanitizeHtml, sanitizeImportedCss, sanitizeImportedHtml, scopeImportedCss, selectContentQuery, serializeBlock, setSitePatternPlacementRule, sitePatternButtonColor, sitePatternPresentationAttributes, validateCollections, verifyPreviewToken };
|
|
11760
|
+
export { BLOCK_NAME_PATTERN, type BindingResolver, type Block, type BlockBinding, type BlockDefinition, type BlockRegistry, CMS_FONT_SIZES, CMS_IMAGE_WIDTHS, CMS_LINE_HEIGHTS, CMS_PARAGRAPH_SPACINGS, type CategoryTreeEntry, type CategoryTreeEntryCategory, type CategoryTreeEntryResolution, type CategoryTreePresentation, type CategoryTreeTerm, type ClientHydrationSpec, type ContentCandidate, type ContentCtaHiddenReason, type ContentCtaMode, type ContentCtaOptions, type ContentCtaResult, type ContentDependencyChange, type ContentDependencyEntity, type ContentPathDependency, type ContentPolicy, type ContentPolicyCheck, ContentPolicyCheckSchema, ContentPolicyFieldNameSchema, type ContentPolicyFieldRef, ContentPolicyInternalPathSchema, type ContentPolicyOptions, type ContentPolicyPost, type ContentPolicyResult, type ContentPolicyScalarCheck, ContentPolicyScalarCheckSchema, ContentPolicyScalarSchema, ContentPolicySchema, ContentPolicyWhenSchema, type ContentQuery, type ContentQueryCandidate, type ContentQueryDependency, ContentQueryFilterSchema, type ContentQueryOptions, type ContentQueryResult, ContentQuerySchema, type ContentScope, DEFAULT_SITE_PATTERN_PRESENTATION, EMPTY_SITE_PATTERN_PLACEMENTS, type EmbedProvider, FIELD_BINDING_SOURCE, FIELD_BINDING_SOURCE_ALIAS, type FaqEntry, IMAGE_ALT_MAX_LENGTH, INTERNAL_CONTENT_LINK_CLASS, INTERNAL_CONTENT_LINK_PENDING_ATTR, INTERNAL_CONTENT_LINK_PENDING_CLASS, INTERNAL_CONTENT_LINK_TOKEN_SOURCE, type InternalContentLinkResolver, type InternalContentLinkToken, LEGACY_BLOG_DETAIL_PATH, METADATA_FIELDS, type MetadataDefaultRules, MetadataDefaultRulesSchema, type MetadataDefaultsDeclaration, type MetadataDefaultsInput, type MetadataField, MetadataFieldSchema, type MetadataPatch, MetadataPatchSchema, type MetadataResolutionInput, type MetadataRobotsPolicy, MetadataRobotsPolicySchema, type MetadataTarget, type MetadataTargetKind, MetadataTargetKindSchema, type MetadataTextRule, MetadataTextRuleSchema, type MetadataValues, MetadataValuesSchema, type NormalizedEmbed, type NormalizedRedirectSourceResult, type NormalizedRedirectTargetResult, PHASE_1_CORE_BLOCKS, PHASE_1_CSP, POST_FOOTER_SLOT, type PatternSlots, type Phase1CoreBlockName, type PostBodySource, type PreviewTokenPayload, type ProfileQualificationInput, type ProfileQualificationProperties, type PublicPathContext, type PublicPathPost, type PublicPathPresentation, type PublicRouteMetadata, type RelatedContentGroup, type RelatedContentOptions, type RoutablePost, type RouteCollection, SITE_PATTERN_BUTTON_COLORS_MAX, SITE_PATTERN_KEY_PATTERN, SITE_PATTERN_PLACEMENTS_KEY, SITE_PATTERN_SLOTS, type SectionLock, type SectionLockViolation, type SectionLockViolationCode, type SitePatternLayout, type SitePatternLinkStyle, type SitePatternPlacementRule, type SitePatternPlacements, type SitePatternPresentation, type SitePatternSlotKey, type VisibleFaqCandidate, type VisibleFaqEntry, applyBlockBindings, bindingSrcValue, bindingTextValue, blockSchema, boundFieldValue, chainResolvers, cmsFontSize, cmsImageAlign, cmsImageStyle, cmsImageWidth, cmsLineHeight, cmsParagraphSpacing, collectContentPolicyFieldRefs, collectContentQueryFieldRefs, collectMetadataDefaultFieldRefs, contentPolicyBodyText, contentPolicySafeHttpsUrl, createFieldBindingResolver, emptyPatternSlots, ensureImportedHtmlDocumentRoots, ensureStableIds, evaluateContentPolicy, evaluateContentQuery, extractFaqEntries, faqPageJsonLd, findInternalContentLinkTokens, findSectionLockViolations, findSitePatternPlacementRule, formatMetadataDefaults, formatSectionLockViolations, getContentValue, htmlToPlainText, injectStableIdsTree, internalContentKeyFromPath, internalContentLinkResolverFrom, internalContentPathIndex, isAllowedEmbedSrc, isAllowedMapEmbedSrc, isInCollectionMode, isProtectedRedirectPath, isReservedCategoryTreeSlug, isSectionContentPropPath, isSitePatternSlotKey, isValidBlock, isValidSitePatternKey, issuePreviewToken, matchesContentScalarCheck, mergeMetadataPatch, metadataBodyParagraphs, metadataContentImageUrl, metadataVideoThumbnail, normalizeEmbed, normalizeHexColor, normalizeImageAlt, normalizeRedirectPath, normalizeRedirectSource, normalizeRedirectTarget, parseBlock, postsForCollection, postsInAnyCollection, postsNotInAnyCollection, profileQualificationJsonLdProperties, readMetadataValues, readSitePatternPlacements, readSitePatternPresentation, referencedSitePatternKeys, renderInternalContentLinksInHtml, renderInternalContentLinksInText, resolveCategoryPath, resolveCategoryTreeChain, resolveCategoryTreeEntryCategory, resolveCategoryTreeEntryPath, resolveCategoryTreeHubPaths, resolveCategoryTreeSelection, resolveContentCta, resolveContentDependencyPaths, resolveMetadata, resolvePatternSlots, resolvePostBodySource, resolvePostCategorySlug, resolvePostCollection, resolvePostPath, resolvePostPublicPath, resolvePostUrl, sanitizeHtml, sanitizeImportedCss, sanitizeImportedHtml, scopeImportedCss, selectContentQuery, selectRelatedContent, selectVisibleFaqEntries, serializeBlock, setContentValue, setSitePatternPlacementRule, sitePatternButtonColor, sitePatternPresentationAttributes, validateCollections, verifyPreviewToken, visibleFaqPageJsonLd };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z, ZodSchema } from 'zod';
|
|
2
|
+
export { V as VISUAL_EDIT_ATTRIBUTE, a as VISUAL_EDIT_PROTOCOL, b as VISUAL_EDIT_PROTOCOL_VERSION, c as VisualEditAddress, d as VisualEditMessage, e as VisualEditMode, f as VisualEditPayload, g as VisualPreviewTarget, h as VisualRenderReceipt, i as VisualViewportPosition, j as buildVisualEditPreviewUrl, k as isVisualEditOrigin, p as parseVisualEditAddress, l as parseVisualEditMessage, s as sameVisualDependencies, m as sameVisualPreviewTarget, v as visualEditAddressKey, n as visualEditAddressSchema, o as visualEditAttributes, q as visualPreviewTargetSchema, r as visualRenderReceiptSchema } from './visual-edit-contract-DzlMel7r.js';
|
|
2
3
|
|
|
3
4
|
/** WP-compatible name pattern: `core/<x>` | `roottale/<x>` */
|
|
4
5
|
declare const BLOCK_NAME_PATTERN: RegExp;
|
|
@@ -11606,6 +11607,134 @@ declare function selectContentQuery<T extends ContentPolicyPost>(query: ContentQ
|
|
|
11606
11607
|
};
|
|
11607
11608
|
}): ContentQueryResult<T>;
|
|
11608
11609
|
|
|
11610
|
+
interface ContentScope {
|
|
11611
|
+
readonly tenantId: string;
|
|
11612
|
+
readonly siteId: string;
|
|
11613
|
+
}
|
|
11614
|
+
interface ContentCandidate extends ContentScope {
|
|
11615
|
+
readonly id: string;
|
|
11616
|
+
readonly modelKey: string;
|
|
11617
|
+
readonly status: string;
|
|
11618
|
+
readonly termIds: readonly string[];
|
|
11619
|
+
readonly title: string;
|
|
11620
|
+
readonly path: string | null;
|
|
11621
|
+
readonly publishedAt: string | null;
|
|
11622
|
+
readonly position?: number;
|
|
11623
|
+
}
|
|
11624
|
+
interface RelatedContentOptions {
|
|
11625
|
+
readonly scope: ContentScope;
|
|
11626
|
+
readonly sourceId?: string;
|
|
11627
|
+
readonly termIds: readonly string[];
|
|
11628
|
+
readonly models: readonly {
|
|
11629
|
+
readonly modelKey: string;
|
|
11630
|
+
readonly maxCount: number;
|
|
11631
|
+
}[];
|
|
11632
|
+
readonly includeDescendants?: boolean;
|
|
11633
|
+
/** Each value contains the caller's explicitly resolved descendant IDs, not slugs or labels. */
|
|
11634
|
+
readonly descendantTermIds?: Readonly<Record<string, readonly string[]>>;
|
|
11635
|
+
}
|
|
11636
|
+
interface RelatedContentGroup<T extends ContentCandidate = ContentCandidate> {
|
|
11637
|
+
readonly modelKey: string;
|
|
11638
|
+
readonly items: readonly T[];
|
|
11639
|
+
}
|
|
11640
|
+
type ContentCtaMode = "auto" | "manual" | "off";
|
|
11641
|
+
interface ContentCtaOptions {
|
|
11642
|
+
readonly scope: ContentScope;
|
|
11643
|
+
readonly sourceId?: string;
|
|
11644
|
+
readonly primaryTermId?: string | null;
|
|
11645
|
+
readonly detailModelKeys: readonly string[];
|
|
11646
|
+
readonly cta: {
|
|
11647
|
+
readonly mode: ContentCtaMode;
|
|
11648
|
+
readonly targetPostId?: string | null;
|
|
11649
|
+
};
|
|
11650
|
+
}
|
|
11651
|
+
type ContentCtaHiddenReason = "disabled" | "manual_target_missing" | "manual_target_unavailable" | "primary_term_missing" | "auto_target_missing" | "auto_target_ambiguous";
|
|
11652
|
+
type ContentCtaResult<T extends ContentCandidate = ContentCandidate> = {
|
|
11653
|
+
readonly state: "resolved";
|
|
11654
|
+
readonly mode: "auto" | "manual";
|
|
11655
|
+
readonly target: T;
|
|
11656
|
+
} | {
|
|
11657
|
+
readonly state: "hidden";
|
|
11658
|
+
readonly mode: ContentCtaMode;
|
|
11659
|
+
readonly reason: ContentCtaHiddenReason;
|
|
11660
|
+
};
|
|
11661
|
+
/** Empty classifications produce empty lists. No title, path, model or content is inferred. */
|
|
11662
|
+
declare function selectRelatedContent<T extends ContentCandidate>(candidates: readonly T[], options: RelatedContentOptions): RelatedContentGroup<T>[];
|
|
11663
|
+
/** Manual selection is authoritative: an unavailable target stays hidden instead of falling back. */
|
|
11664
|
+
declare function resolveContentCta<T extends ContentCandidate>(candidates: readonly T[], options: ContentCtaOptions): ContentCtaResult<T>;
|
|
11665
|
+
interface VisibleFaqCandidate extends FaqEntry {
|
|
11666
|
+
readonly id: string;
|
|
11667
|
+
readonly visible: boolean;
|
|
11668
|
+
readonly deleted?: boolean;
|
|
11669
|
+
}
|
|
11670
|
+
interface VisibleFaqEntry extends FaqEntry {
|
|
11671
|
+
readonly id: string;
|
|
11672
|
+
}
|
|
11673
|
+
/** Render this same selection when passing the result to FAQ structured data. */
|
|
11674
|
+
declare function selectVisibleFaqEntries(entries: readonly VisibleFaqCandidate[]): VisibleFaqEntry[];
|
|
11675
|
+
declare function visibleFaqPageJsonLd(entries: readonly VisibleFaqCandidate[]): Record<string, unknown> | null;
|
|
11676
|
+
interface ProfileQualificationInput {
|
|
11677
|
+
readonly qualification?: string | readonly string[] | null;
|
|
11678
|
+
readonly alumniOf?: string | readonly string[] | null;
|
|
11679
|
+
}
|
|
11680
|
+
interface ProfileQualificationProperties {
|
|
11681
|
+
readonly hasCredential?: readonly {
|
|
11682
|
+
readonly "@type": "EducationalOccupationalCredential";
|
|
11683
|
+
readonly name: string;
|
|
11684
|
+
}[];
|
|
11685
|
+
readonly alumniOf?: readonly {
|
|
11686
|
+
readonly "@type": "EducationalOrganization";
|
|
11687
|
+
readonly name: string;
|
|
11688
|
+
}[];
|
|
11689
|
+
}
|
|
11690
|
+
/** These are Person properties. Never infer a credential or school from a title, role or biography. */
|
|
11691
|
+
declare function profileQualificationJsonLdProperties(input: ProfileQualificationInput): ProfileQualificationProperties;
|
|
11692
|
+
|
|
11693
|
+
/**
|
|
11694
|
+
* Paths start at the serialized ACF root. Each array traversal requires @<uuid>.
|
|
11695
|
+
* Unknown properties and repeaters with missing or duplicate IDs throw; no defaults are invented.
|
|
11696
|
+
*/
|
|
11697
|
+
declare function getContentValue(values: Readonly<Record<string, unknown>>, path: readonly string[]): unknown;
|
|
11698
|
+
/**
|
|
11699
|
+
* Clone only the changed branch and preserve stable IDs. Whole-array replacement is allowed.
|
|
11700
|
+
* Leaf permissions and all replacement-value validation belong to the compiled content contract.
|
|
11701
|
+
*/
|
|
11702
|
+
declare function setContentValue(values: Readonly<Record<string, unknown>>, path: readonly string[], value: unknown): Record<string, unknown>;
|
|
11703
|
+
|
|
11704
|
+
interface ContentDependencyEntity extends ContentScope {
|
|
11705
|
+
readonly id: string;
|
|
11706
|
+
readonly modelKey: string;
|
|
11707
|
+
readonly termIds: readonly string[];
|
|
11708
|
+
readonly path: string | null;
|
|
11709
|
+
}
|
|
11710
|
+
interface ContentQueryDependency {
|
|
11711
|
+
readonly modelKeys: readonly string[];
|
|
11712
|
+
/** Omitted: all content in these models. Empty: nothing. Descendants must be explicitly expanded. */
|
|
11713
|
+
readonly termIds?: readonly string[];
|
|
11714
|
+
}
|
|
11715
|
+
/** A declared public route and the content whose changes can alter its rendered output. */
|
|
11716
|
+
interface ContentPathDependency extends ContentScope {
|
|
11717
|
+
readonly path: string;
|
|
11718
|
+
readonly entityIds?: readonly string[];
|
|
11719
|
+
readonly queries?: readonly ContentQueryDependency[];
|
|
11720
|
+
readonly singletonKeys?: readonly string[];
|
|
11721
|
+
}
|
|
11722
|
+
interface ContentDependencyChange {
|
|
11723
|
+
readonly scope: ContentScope;
|
|
11724
|
+
readonly before?: ContentDependencyEntity | null;
|
|
11725
|
+
readonly after?: ContentDependencyEntity | null;
|
|
11726
|
+
/** Scoped tombstone IDs still invalidate direct/manual references when the target no longer exists. */
|
|
11727
|
+
readonly entityIds?: readonly string[];
|
|
11728
|
+
readonly singletonKeys?: readonly string[];
|
|
11729
|
+
}
|
|
11730
|
+
/**
|
|
11731
|
+
* Query edges represent related lists, category hubs and auto CTAs; entity edges represent direct
|
|
11732
|
+
* includes and manual CTAs. Before and after facts are both needed on classification or URL moves.
|
|
11733
|
+
* Do not filter snapshots by their new publication status: unpublishing must evict previous output.
|
|
11734
|
+
* The caller owns the complete dependency graph and persisted before snapshot; no DB reads occur here.
|
|
11735
|
+
*/
|
|
11736
|
+
declare function resolveContentDependencyPaths(dependencies: readonly ContentPathDependency[], change: ContentDependencyChange): string[];
|
|
11737
|
+
|
|
11609
11738
|
/** 검색 관리의 등록·검토·공개 Proxy가 공유하는 정확 경로 계약. */
|
|
11610
11739
|
type NormalizedRedirectSourceResult = {
|
|
11611
11740
|
readonly ok: true;
|
|
@@ -11628,4 +11757,4 @@ declare function isProtectedRedirectPath(path: string): boolean;
|
|
|
11628
11757
|
declare function normalizeRedirectSource(raw: string): NormalizedRedirectSourceResult;
|
|
11629
11758
|
declare function normalizeRedirectTarget(raw: string): NormalizedRedirectTargetResult;
|
|
11630
11759
|
|
|
11631
|
-
export { BLOCK_NAME_PATTERN, type BindingResolver, type Block, type BlockBinding, type BlockDefinition, type BlockRegistry, CMS_FONT_SIZES, CMS_IMAGE_WIDTHS, CMS_LINE_HEIGHTS, CMS_PARAGRAPH_SPACINGS, type CategoryTreeEntry, type CategoryTreeEntryCategory, type CategoryTreeEntryResolution, type CategoryTreePresentation, type CategoryTreeTerm, type ClientHydrationSpec, type ContentPolicy, type ContentPolicyCheck, ContentPolicyCheckSchema, ContentPolicyFieldNameSchema, type ContentPolicyFieldRef, ContentPolicyInternalPathSchema, type ContentPolicyOptions, type ContentPolicyPost, type ContentPolicyResult, type ContentPolicyScalarCheck, ContentPolicyScalarCheckSchema, ContentPolicyScalarSchema, ContentPolicySchema, ContentPolicyWhenSchema, type ContentQuery, type ContentQueryCandidate, ContentQueryFilterSchema, type ContentQueryOptions, type ContentQueryResult, ContentQuerySchema, DEFAULT_SITE_PATTERN_PRESENTATION, EMPTY_SITE_PATTERN_PLACEMENTS, type EmbedProvider, FIELD_BINDING_SOURCE, FIELD_BINDING_SOURCE_ALIAS, type FaqEntry, IMAGE_ALT_MAX_LENGTH, INTERNAL_CONTENT_LINK_CLASS, INTERNAL_CONTENT_LINK_PENDING_ATTR, INTERNAL_CONTENT_LINK_PENDING_CLASS, INTERNAL_CONTENT_LINK_TOKEN_SOURCE, type InternalContentLinkResolver, type InternalContentLinkToken, LEGACY_BLOG_DETAIL_PATH, METADATA_FIELDS, type MetadataDefaultRules, MetadataDefaultRulesSchema, type MetadataDefaultsDeclaration, type MetadataDefaultsInput, type MetadataField, MetadataFieldSchema, type MetadataPatch, MetadataPatchSchema, type MetadataResolutionInput, type MetadataRobotsPolicy, MetadataRobotsPolicySchema, type MetadataTarget, type MetadataTargetKind, MetadataTargetKindSchema, type MetadataTextRule, MetadataTextRuleSchema, type MetadataValues, MetadataValuesSchema, type NormalizedEmbed, type NormalizedRedirectSourceResult, type NormalizedRedirectTargetResult, PHASE_1_CORE_BLOCKS, PHASE_1_CSP, POST_FOOTER_SLOT, type PatternSlots, type Phase1CoreBlockName, type PostBodySource, type PreviewTokenPayload, type PublicPathContext, type PublicPathPost, type PublicPathPresentation, type PublicRouteMetadata, type RoutablePost, type RouteCollection, SITE_PATTERN_BUTTON_COLORS_MAX, SITE_PATTERN_KEY_PATTERN, SITE_PATTERN_PLACEMENTS_KEY, SITE_PATTERN_SLOTS, type SectionLock, type SectionLockViolation, type SectionLockViolationCode, type SitePatternLayout, type SitePatternLinkStyle, type SitePatternPlacementRule, type SitePatternPlacements, type SitePatternPresentation, type SitePatternSlotKey, applyBlockBindings, bindingSrcValue, bindingTextValue, blockSchema, boundFieldValue, chainResolvers, cmsFontSize, cmsImageAlign, cmsImageStyle, cmsImageWidth, cmsLineHeight, cmsParagraphSpacing, collectContentPolicyFieldRefs, collectContentQueryFieldRefs, collectMetadataDefaultFieldRefs, contentPolicyBodyText, contentPolicySafeHttpsUrl, createFieldBindingResolver, emptyPatternSlots, ensureImportedHtmlDocumentRoots, ensureStableIds, evaluateContentPolicy, evaluateContentQuery, extractFaqEntries, faqPageJsonLd, findInternalContentLinkTokens, findSectionLockViolations, findSitePatternPlacementRule, formatMetadataDefaults, formatSectionLockViolations, htmlToPlainText, injectStableIdsTree, internalContentKeyFromPath, internalContentLinkResolverFrom, internalContentPathIndex, isAllowedEmbedSrc, isAllowedMapEmbedSrc, isInCollectionMode, isProtectedRedirectPath, isReservedCategoryTreeSlug, isSectionContentPropPath, isSitePatternSlotKey, isValidBlock, isValidSitePatternKey, issuePreviewToken, matchesContentScalarCheck, mergeMetadataPatch, metadataBodyParagraphs, metadataContentImageUrl, metadataVideoThumbnail, normalizeEmbed, normalizeHexColor, normalizeImageAlt, normalizeRedirectPath, normalizeRedirectSource, normalizeRedirectTarget, parseBlock, postsForCollection, postsInAnyCollection, postsNotInAnyCollection, readMetadataValues, readSitePatternPlacements, readSitePatternPresentation, referencedSitePatternKeys, renderInternalContentLinksInHtml, renderInternalContentLinksInText, resolveCategoryPath, resolveCategoryTreeChain, resolveCategoryTreeEntryCategory, resolveCategoryTreeEntryPath, resolveCategoryTreeHubPaths, resolveCategoryTreeSelection, resolveMetadata, resolvePatternSlots, resolvePostBodySource, resolvePostCategorySlug, resolvePostCollection, resolvePostPath, resolvePostPublicPath, resolvePostUrl, sanitizeHtml, sanitizeImportedCss, sanitizeImportedHtml, scopeImportedCss, selectContentQuery, serializeBlock, setSitePatternPlacementRule, sitePatternButtonColor, sitePatternPresentationAttributes, validateCollections, verifyPreviewToken };
|
|
11760
|
+
export { BLOCK_NAME_PATTERN, type BindingResolver, type Block, type BlockBinding, type BlockDefinition, type BlockRegistry, CMS_FONT_SIZES, CMS_IMAGE_WIDTHS, CMS_LINE_HEIGHTS, CMS_PARAGRAPH_SPACINGS, type CategoryTreeEntry, type CategoryTreeEntryCategory, type CategoryTreeEntryResolution, type CategoryTreePresentation, type CategoryTreeTerm, type ClientHydrationSpec, type ContentCandidate, type ContentCtaHiddenReason, type ContentCtaMode, type ContentCtaOptions, type ContentCtaResult, type ContentDependencyChange, type ContentDependencyEntity, type ContentPathDependency, type ContentPolicy, type ContentPolicyCheck, ContentPolicyCheckSchema, ContentPolicyFieldNameSchema, type ContentPolicyFieldRef, ContentPolicyInternalPathSchema, type ContentPolicyOptions, type ContentPolicyPost, type ContentPolicyResult, type ContentPolicyScalarCheck, ContentPolicyScalarCheckSchema, ContentPolicyScalarSchema, ContentPolicySchema, ContentPolicyWhenSchema, type ContentQuery, type ContentQueryCandidate, type ContentQueryDependency, ContentQueryFilterSchema, type ContentQueryOptions, type ContentQueryResult, ContentQuerySchema, type ContentScope, DEFAULT_SITE_PATTERN_PRESENTATION, EMPTY_SITE_PATTERN_PLACEMENTS, type EmbedProvider, FIELD_BINDING_SOURCE, FIELD_BINDING_SOURCE_ALIAS, type FaqEntry, IMAGE_ALT_MAX_LENGTH, INTERNAL_CONTENT_LINK_CLASS, INTERNAL_CONTENT_LINK_PENDING_ATTR, INTERNAL_CONTENT_LINK_PENDING_CLASS, INTERNAL_CONTENT_LINK_TOKEN_SOURCE, type InternalContentLinkResolver, type InternalContentLinkToken, LEGACY_BLOG_DETAIL_PATH, METADATA_FIELDS, type MetadataDefaultRules, MetadataDefaultRulesSchema, type MetadataDefaultsDeclaration, type MetadataDefaultsInput, type MetadataField, MetadataFieldSchema, type MetadataPatch, MetadataPatchSchema, type MetadataResolutionInput, type MetadataRobotsPolicy, MetadataRobotsPolicySchema, type MetadataTarget, type MetadataTargetKind, MetadataTargetKindSchema, type MetadataTextRule, MetadataTextRuleSchema, type MetadataValues, MetadataValuesSchema, type NormalizedEmbed, type NormalizedRedirectSourceResult, type NormalizedRedirectTargetResult, PHASE_1_CORE_BLOCKS, PHASE_1_CSP, POST_FOOTER_SLOT, type PatternSlots, type Phase1CoreBlockName, type PostBodySource, type PreviewTokenPayload, type ProfileQualificationInput, type ProfileQualificationProperties, type PublicPathContext, type PublicPathPost, type PublicPathPresentation, type PublicRouteMetadata, type RelatedContentGroup, type RelatedContentOptions, type RoutablePost, type RouteCollection, SITE_PATTERN_BUTTON_COLORS_MAX, SITE_PATTERN_KEY_PATTERN, SITE_PATTERN_PLACEMENTS_KEY, SITE_PATTERN_SLOTS, type SectionLock, type SectionLockViolation, type SectionLockViolationCode, type SitePatternLayout, type SitePatternLinkStyle, type SitePatternPlacementRule, type SitePatternPlacements, type SitePatternPresentation, type SitePatternSlotKey, type VisibleFaqCandidate, type VisibleFaqEntry, applyBlockBindings, bindingSrcValue, bindingTextValue, blockSchema, boundFieldValue, chainResolvers, cmsFontSize, cmsImageAlign, cmsImageStyle, cmsImageWidth, cmsLineHeight, cmsParagraphSpacing, collectContentPolicyFieldRefs, collectContentQueryFieldRefs, collectMetadataDefaultFieldRefs, contentPolicyBodyText, contentPolicySafeHttpsUrl, createFieldBindingResolver, emptyPatternSlots, ensureImportedHtmlDocumentRoots, ensureStableIds, evaluateContentPolicy, evaluateContentQuery, extractFaqEntries, faqPageJsonLd, findInternalContentLinkTokens, findSectionLockViolations, findSitePatternPlacementRule, formatMetadataDefaults, formatSectionLockViolations, getContentValue, htmlToPlainText, injectStableIdsTree, internalContentKeyFromPath, internalContentLinkResolverFrom, internalContentPathIndex, isAllowedEmbedSrc, isAllowedMapEmbedSrc, isInCollectionMode, isProtectedRedirectPath, isReservedCategoryTreeSlug, isSectionContentPropPath, isSitePatternSlotKey, isValidBlock, isValidSitePatternKey, issuePreviewToken, matchesContentScalarCheck, mergeMetadataPatch, metadataBodyParagraphs, metadataContentImageUrl, metadataVideoThumbnail, normalizeEmbed, normalizeHexColor, normalizeImageAlt, normalizeRedirectPath, normalizeRedirectSource, normalizeRedirectTarget, parseBlock, postsForCollection, postsInAnyCollection, postsNotInAnyCollection, profileQualificationJsonLdProperties, readMetadataValues, readSitePatternPlacements, readSitePatternPresentation, referencedSitePatternKeys, renderInternalContentLinksInHtml, renderInternalContentLinksInText, resolveCategoryPath, resolveCategoryTreeChain, resolveCategoryTreeEntryCategory, resolveCategoryTreeEntryPath, resolveCategoryTreeHubPaths, resolveCategoryTreeSelection, resolveContentCta, resolveContentDependencyPaths, resolveMetadata, resolvePatternSlots, resolvePostBodySource, resolvePostCategorySlug, resolvePostCollection, resolvePostPath, resolvePostPublicPath, resolvePostUrl, sanitizeHtml, sanitizeImportedCss, sanitizeImportedHtml, scopeImportedCss, selectContentQuery, selectRelatedContent, selectVisibleFaqEntries, serializeBlock, setContentValue, setSitePatternPlacementRule, sitePatternButtonColor, sitePatternPresentationAttributes, validateCollections, verifyPreviewToken, visibleFaqPageJsonLd };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VISUAL_EDIT_ATTRIBUTE,
|
|
3
|
+
VISUAL_EDIT_PROTOCOL,
|
|
4
|
+
VISUAL_EDIT_PROTOCOL_VERSION,
|
|
5
|
+
buildVisualEditPreviewUrl,
|
|
6
|
+
getContentValue,
|
|
7
|
+
isVisualEditOrigin,
|
|
8
|
+
parseVisualEditAddress,
|
|
9
|
+
parseVisualEditMessage,
|
|
10
|
+
sameVisualDependencies,
|
|
11
|
+
sameVisualPreviewTarget,
|
|
12
|
+
setContentValue,
|
|
13
|
+
visualEditAddressKey,
|
|
14
|
+
visualEditAddressSchema,
|
|
15
|
+
visualEditAttributes,
|
|
16
|
+
visualPreviewTargetSchema,
|
|
17
|
+
visualRenderReceiptSchema
|
|
18
|
+
} from "./chunk-WNU53PSH.js";
|
|
19
|
+
|
|
1
20
|
// src/block.ts
|
|
2
21
|
import { z } from "zod";
|
|
3
22
|
var BLOCK_NAME_PATTERN = /^(core|roottale)\/[a-z0-9-]+$/;
|
|
@@ -2538,6 +2557,115 @@ function selectContentQuery(query, posts, policies, options) {
|
|
|
2538
2557
|
return evaluateContentQuery(query, candidates, options);
|
|
2539
2558
|
}
|
|
2540
2559
|
|
|
2560
|
+
// src/content-relations.ts
|
|
2561
|
+
function assertScope(scope) {
|
|
2562
|
+
if (!scope.tenantId.trim() || !scope.siteId.trim()) throw new Error("Content scope requires tenantId and siteId");
|
|
2563
|
+
}
|
|
2564
|
+
function publishedCandidates(candidates, scope, sourceId) {
|
|
2565
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2566
|
+
return candidates.filter((candidate) => {
|
|
2567
|
+
if (candidate.tenantId !== scope.tenantId || candidate.siteId !== scope.siteId || candidate.id === sourceId || candidate.status !== "published" || !candidate.id.trim() || !candidate.title.trim() || !ContentPolicyInternalPathSchema.safeParse(candidate.path).success || !Number.isFinite(Date.parse(candidate.publishedAt ?? "")) || seen.has(candidate.id)) return false;
|
|
2568
|
+
seen.add(candidate.id);
|
|
2569
|
+
return true;
|
|
2570
|
+
});
|
|
2571
|
+
}
|
|
2572
|
+
function latestFirst(left, right) {
|
|
2573
|
+
return Date.parse(right.publishedAt) - Date.parse(left.publishedAt) || (left.id < right.id ? -1 : left.id > right.id ? 1 : 0);
|
|
2574
|
+
}
|
|
2575
|
+
function selectRelatedContent(candidates, options) {
|
|
2576
|
+
assertScope(options.scope);
|
|
2577
|
+
const termIds = new Set(options.termIds.filter((id) => id.trim()));
|
|
2578
|
+
if (options.includeDescendants) {
|
|
2579
|
+
for (const termId of options.termIds) {
|
|
2580
|
+
if (!termId.trim() || !Object.hasOwn(options.descendantTermIds ?? {}, termId)) continue;
|
|
2581
|
+
for (const descendantId of options.descendantTermIds[termId] ?? []) {
|
|
2582
|
+
if (descendantId.trim()) termIds.add(descendantId);
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
const selected = publishedCandidates(candidates, options.scope, options.sourceId).filter((candidate) => candidate.termIds.some((id) => termIds.has(id))).sort(latestFirst);
|
|
2587
|
+
return options.models.map(({ modelKey, maxCount }) => {
|
|
2588
|
+
if (!Number.isSafeInteger(maxCount) || maxCount < 0) throw new Error("Related content maxCount must be a non-negative integer");
|
|
2589
|
+
return { modelKey, items: selected.filter((candidate) => candidate.modelKey === modelKey).slice(0, maxCount) };
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
function resolveContentCta(candidates, options) {
|
|
2593
|
+
assertScope(options.scope);
|
|
2594
|
+
const { mode, targetPostId } = options.cta;
|
|
2595
|
+
const hidden = (reason) => ({ state: "hidden", mode, reason });
|
|
2596
|
+
if (mode === "off") return hidden("disabled");
|
|
2597
|
+
const published = publishedCandidates(candidates, options.scope, options.sourceId);
|
|
2598
|
+
if (mode === "manual") {
|
|
2599
|
+
if (!targetPostId?.trim()) return hidden("manual_target_missing");
|
|
2600
|
+
const target = published.find((candidate) => candidate.id === targetPostId);
|
|
2601
|
+
return target ? { state: "resolved", mode, target } : hidden("manual_target_unavailable");
|
|
2602
|
+
}
|
|
2603
|
+
if (!options.primaryTermId?.trim()) return hidden("primary_term_missing");
|
|
2604
|
+
const targets = published.filter((candidate) => options.detailModelKeys.includes(candidate.modelKey) && candidate.termIds.includes(options.primaryTermId));
|
|
2605
|
+
if (targets.length === 0) return hidden("auto_target_missing");
|
|
2606
|
+
if (targets.length > 1) return hidden("auto_target_ambiguous");
|
|
2607
|
+
return { state: "resolved", mode, target: targets[0] };
|
|
2608
|
+
}
|
|
2609
|
+
function plainFact(value) {
|
|
2610
|
+
return value.replace(/\s+/gu, " ").trim();
|
|
2611
|
+
}
|
|
2612
|
+
function selectVisibleFaqEntries(entries) {
|
|
2613
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2614
|
+
const selected = [];
|
|
2615
|
+
for (const entry of entries) {
|
|
2616
|
+
const id = entry.id.trim();
|
|
2617
|
+
const question = plainFact(entry.question);
|
|
2618
|
+
const answer = plainFact(entry.answer);
|
|
2619
|
+
if (!entry.visible || entry.deleted || !id || !question || !answer || seen.has(id)) continue;
|
|
2620
|
+
seen.add(id);
|
|
2621
|
+
selected.push({ id, question, answer });
|
|
2622
|
+
}
|
|
2623
|
+
return selected;
|
|
2624
|
+
}
|
|
2625
|
+
function visibleFaqPageJsonLd(entries) {
|
|
2626
|
+
return faqPageJsonLd(selectVisibleFaqEntries(entries));
|
|
2627
|
+
}
|
|
2628
|
+
function enteredNames(value) {
|
|
2629
|
+
const values = typeof value === "string" ? [value] : value ?? [];
|
|
2630
|
+
return [...new Set(values.map(plainFact).filter(Boolean))];
|
|
2631
|
+
}
|
|
2632
|
+
function profileQualificationJsonLdProperties(input) {
|
|
2633
|
+
const qualifications = enteredNames(input.qualification);
|
|
2634
|
+
const alumni = enteredNames(input.alumniOf);
|
|
2635
|
+
return {
|
|
2636
|
+
...qualifications.length ? { hasCredential: qualifications.map((name) => ({ "@type": "EducationalOccupationalCredential", name })) } : {},
|
|
2637
|
+
...alumni.length ? { alumniOf: alumni.map((name) => ({ "@type": "EducationalOrganization", name })) } : {}
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
// src/content-dependencies.ts
|
|
2642
|
+
function inScope(value, scope) {
|
|
2643
|
+
return value.tenantId === scope.tenantId && value.siteId === scope.siteId;
|
|
2644
|
+
}
|
|
2645
|
+
function matchesQuery(entity, query) {
|
|
2646
|
+
return query.modelKeys.includes(entity.modelKey) && (query.termIds === void 0 || entity.termIds.some((id) => id.trim() && query.termIds.includes(id)));
|
|
2647
|
+
}
|
|
2648
|
+
function resolveContentDependencyPaths(dependencies, change) {
|
|
2649
|
+
const { scope } = change;
|
|
2650
|
+
if (!scope.tenantId.trim() || !scope.siteId.trim()) throw new Error("Content scope requires tenantId and siteId");
|
|
2651
|
+
const snapshots = [change.before, change.after].filter((entity) => entity != null && inScope(entity, scope));
|
|
2652
|
+
const entityIds = new Set([...snapshots.map(({ id }) => id), ...change.entityIds ?? []].filter((id) => id.trim()));
|
|
2653
|
+
const singletonKeys = new Set((change.singletonKeys ?? []).filter((key) => key.trim()));
|
|
2654
|
+
const paths = /* @__PURE__ */ new Set();
|
|
2655
|
+
const includePath = (path) => {
|
|
2656
|
+
if (path !== null && ContentPolicyInternalPathSchema.safeParse(path).success) paths.add(path);
|
|
2657
|
+
};
|
|
2658
|
+
for (const snapshot of snapshots) includePath(snapshot.path);
|
|
2659
|
+
for (const dependency of dependencies) {
|
|
2660
|
+
if (!inScope(dependency, scope)) continue;
|
|
2661
|
+
const direct = dependency.entityIds?.some((id) => entityIds.has(id));
|
|
2662
|
+
const shared = dependency.singletonKeys?.some((key) => singletonKeys.has(key));
|
|
2663
|
+
const queried = dependency.queries?.some((query) => snapshots.some((entity) => matchesQuery(entity, query)));
|
|
2664
|
+
if (direct || shared || queried) includePath(dependency.path);
|
|
2665
|
+
}
|
|
2666
|
+
return [...paths].sort();
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2541
2669
|
// src/redirect-paths.ts
|
|
2542
2670
|
var CONTROL_OR_BACKSLASH = /[\\\u0000-\u001f\u007f]/u;
|
|
2543
2671
|
var PROTECTED_PREFIX = /^\/(?:api|_next|_vercel|auth|admin|login|logout|revalidate|preview|assets|static|images|fonts|\.well-known)(?:\/|$)/i;
|
|
@@ -2638,11 +2766,15 @@ export {
|
|
|
2638
2766
|
SITE_PATTERN_KEY_PATTERN,
|
|
2639
2767
|
SITE_PATTERN_PLACEMENTS_KEY,
|
|
2640
2768
|
SITE_PATTERN_SLOTS,
|
|
2769
|
+
VISUAL_EDIT_ATTRIBUTE,
|
|
2770
|
+
VISUAL_EDIT_PROTOCOL,
|
|
2771
|
+
VISUAL_EDIT_PROTOCOL_VERSION,
|
|
2641
2772
|
applyBlockBindings,
|
|
2642
2773
|
bindingSrcValue,
|
|
2643
2774
|
bindingTextValue,
|
|
2644
2775
|
blockSchema,
|
|
2645
2776
|
boundFieldValue,
|
|
2777
|
+
buildVisualEditPreviewUrl,
|
|
2646
2778
|
chainResolvers,
|
|
2647
2779
|
cmsFontSize,
|
|
2648
2780
|
cmsImageAlign,
|
|
@@ -2668,6 +2800,7 @@ export {
|
|
|
2668
2800
|
findSitePatternPlacementRule,
|
|
2669
2801
|
formatMetadataDefaults,
|
|
2670
2802
|
formatSectionLockViolations,
|
|
2803
|
+
getContentValue,
|
|
2671
2804
|
htmlToPlainText,
|
|
2672
2805
|
injectStableIdsTree,
|
|
2673
2806
|
internalContentKeyFromPath,
|
|
@@ -2682,6 +2815,7 @@ export {
|
|
|
2682
2815
|
isSitePatternSlotKey,
|
|
2683
2816
|
isValidBlock,
|
|
2684
2817
|
isValidSitePatternKey,
|
|
2818
|
+
isVisualEditOrigin,
|
|
2685
2819
|
issuePreviewToken,
|
|
2686
2820
|
matchesContentScalarCheck,
|
|
2687
2821
|
mergeMetadataPatch,
|
|
@@ -2695,9 +2829,12 @@ export {
|
|
|
2695
2829
|
normalizeRedirectSource,
|
|
2696
2830
|
normalizeRedirectTarget,
|
|
2697
2831
|
parseBlock,
|
|
2832
|
+
parseVisualEditAddress,
|
|
2833
|
+
parseVisualEditMessage,
|
|
2698
2834
|
postsForCollection,
|
|
2699
2835
|
postsInAnyCollection,
|
|
2700
2836
|
postsNotInAnyCollection,
|
|
2837
|
+
profileQualificationJsonLdProperties,
|
|
2701
2838
|
readMetadataValues,
|
|
2702
2839
|
readSitePatternPlacements,
|
|
2703
2840
|
readSitePatternPresentation,
|
|
@@ -2710,6 +2847,8 @@ export {
|
|
|
2710
2847
|
resolveCategoryTreeEntryPath,
|
|
2711
2848
|
resolveCategoryTreeHubPaths,
|
|
2712
2849
|
resolveCategoryTreeSelection,
|
|
2850
|
+
resolveContentCta,
|
|
2851
|
+
resolveContentDependencyPaths,
|
|
2713
2852
|
resolveMetadata,
|
|
2714
2853
|
resolvePatternSlots,
|
|
2715
2854
|
resolvePostBodySource,
|
|
@@ -2718,16 +2857,27 @@ export {
|
|
|
2718
2857
|
resolvePostPath,
|
|
2719
2858
|
resolvePostPublicPath,
|
|
2720
2859
|
resolvePostUrl,
|
|
2860
|
+
sameVisualDependencies,
|
|
2861
|
+
sameVisualPreviewTarget,
|
|
2721
2862
|
sanitizeHtml,
|
|
2722
2863
|
sanitizeImportedCss,
|
|
2723
2864
|
sanitizeImportedHtml,
|
|
2724
2865
|
scopeImportedCss,
|
|
2725
2866
|
selectContentQuery,
|
|
2867
|
+
selectRelatedContent,
|
|
2868
|
+
selectVisibleFaqEntries,
|
|
2726
2869
|
serializeBlock,
|
|
2870
|
+
setContentValue,
|
|
2727
2871
|
setSitePatternPlacementRule,
|
|
2728
2872
|
sitePatternButtonColor,
|
|
2729
2873
|
sitePatternPresentationAttributes,
|
|
2730
2874
|
validateCollections,
|
|
2731
|
-
verifyPreviewToken
|
|
2875
|
+
verifyPreviewToken,
|
|
2876
|
+
visibleFaqPageJsonLd,
|
|
2877
|
+
visualEditAddressKey,
|
|
2878
|
+
visualEditAddressSchema,
|
|
2879
|
+
visualEditAttributes,
|
|
2880
|
+
visualPreviewTargetSchema,
|
|
2881
|
+
visualRenderReceiptSchema
|
|
2732
2882
|
};
|
|
2733
2883
|
//# sourceMappingURL=index.js.map
|