@odla-ai/brand 0.7.2 → 0.8.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/dist/index.cjs +113 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +115 -4
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { P as ProposalKind, a as ProposalStatus, A as AssetKind, b as AssetAnalysis, B as BookStatus, c as BrandTokensSnapshot, d as PaletteStatus, S as Swatch, e as PaletteSource, f as SectionKind, g as SectionStatus, h as SwatchRole } from './index-r6SGidYT.cjs';
|
|
2
2
|
export { i as ASSET_KINDS, j as BOOK_STATUSES, k as BRAND_CHART_TOKENS, l as BRAND_CHAT_TOKENS, m as BRAND_DERIVED_TOKENS, n as BRAND_EMITTED_TOKENS, o as BRAND_NS, p as BRAND_REQUIRED_TOKENS, q as BrandTokens, C as CompileInput, r as CompiledBrandTokens, D as DARK_FLIP_L_MAX, s as DARK_FLIP_L_MIN, t as DEFAULT_ACCENT_SEED, u as DESIGN_ASSET_KIND, I as ImagerySection, L as LogoSection, M as MapResult, v as PALETTE_SOURCES, w as PALETTE_STATUSES, x as PROPOSAL_KINDS, y as PROPOSAL_STATUSES, z as PaletteSection, R as ROLE_TOKEN, E as RenderTokensCssOptions, F as SECTION_KINDS, G as SECTION_STATUSES, H as SWATCH_ROLES, T as TokenWarning, J as TypographySection, V as VoiceSection, K as compileBrandTokens, N as deriveDarkTokens, O as mapPaletteToTokens, Q as renderTokensCss } from './index-r6SGidYT.cjs';
|
|
3
3
|
import { ToolHandler, Skill, ToolDef, Persona, Inference, AgentRunInput, ImageBlock, OracleContentBlock } from '@odla-ai/ai';
|
|
4
|
+
import { PromotionAdapterResult } from '@odla-ai/promotion';
|
|
4
5
|
|
|
5
6
|
/** One entry of the bundle's base64 asset manifest, without its payload. */
|
|
6
7
|
interface DesignBundleAsset {
|
|
@@ -1901,4 +1902,15 @@ interface CreateBrandIntegrationOptions {
|
|
|
1901
1902
|
*/
|
|
1902
1903
|
declare function createBrandIntegration(options?: CreateBrandIntegrationOptions): BrandIntegrationDescriptor;
|
|
1903
1904
|
|
|
1904
|
-
|
|
1905
|
+
/** Stable adapter identity bound into Brand artifact provenance. */
|
|
1906
|
+
declare const BRAND_PROMOTION_ADAPTER = "@odla-ai/brand/v1";
|
|
1907
|
+
/** Approved Brand rows required to export one bounded promotion selection. */
|
|
1908
|
+
interface BrandPromotionInput {
|
|
1909
|
+
book: BrandBook;
|
|
1910
|
+
sections: readonly BrandSection[];
|
|
1911
|
+
palettes: readonly BrandPalette[];
|
|
1912
|
+
}
|
|
1913
|
+
/** Export only human-approved, provider-independent Brand state. */
|
|
1914
|
+
declare function exportBrandPromotion(input: BrandPromotionInput): PromotionAdapterResult;
|
|
1915
|
+
|
|
1916
|
+
export { ASSET_CONTENT_TYPES, type AcceptProposalInput, AssetAnalysis, AssetKind, type AttrType, type AudienceChildren, BRAND_AGENT_PROFILE, BRAND_DISCUSSION_REFERENCE_KINDS, BRAND_INSTRUCTIONS, BRAND_PROMOTION_ADAPTER, BRAND_RULES, BRAND_SCHEMA, BookStatus, type BrandActor, type BrandAgentBridge, type BrandAgentProfile, type BrandApprovalReceipt, type BrandAsset, type BrandAttrs, type BrandBook, type BrandBotTriggerOpts, type BrandCapabilityAuthority, BrandConflictError, type BrandDb, type BrandDecisionBinding, type BrandDeps, type BrandDiscussionReference, type BrandDiscussionReferenceKind, type BrandDiscussionReferenceTarget, type BrandDiscussionSwatch, type BrandDispatchBody, type BrandDispatchDeps, type BrandEntityRef, type BrandFetchedBytes, type BrandFileRecord, BrandForbiddenError, BrandGoneError, type BrandHumanAuthorityConsumption, BrandInputError, type BrandIntegrationDescriptor, type BrandIntegrationProbe, type BrandLookup, BrandNotFoundError, type BrandOp, type BrandPalette, type BrandPrincipalProjection, type BrandPromotionInput, type BrandProposal, type BrandProposalProvenance, type BrandProposalReviewSnapshot, type BrandResult, BrandReviewStateChangedError, type BrandRouteCtx, type BrandRouteOpts, type BrandRow, type BrandRule, type BrandRules, type BrandScalar, type BrandSection, type BrandSkillOpts, type BrandSkillSelf, type BrandSourceAssetSnapshot, type BrandStorage, BrandTokensSnapshot, type BrandToolCtx, type BrandTransactGuard, type BrandTransactOptions, type BrandTrigger, type BrandUploadBody, type BrandVisionCapabilities, type BrandVisionSpec, CHART_DELTA_MIN, CHAT_MESSAGE_NS, CSS_NAMED_COLORS, type ContrastKind, type CreateAssetInput, type CreateBookInput, type CreateBrandIntegrationOptions, type CreateBrandPersonaOpts, DEFAULT_BRAND_SYSTEM, DESIGN_CONTENT_TYPES, type DeriveChartOptions, type DerivePaletteOptions, type DesignAssetGroup, type DesignBundle, type DesignBundleAsset, type DesignColorUse, type DesignDecompilation, type DesignDigest, type DesignManifestEntry, type DesignOutlineEntry, type DesignProp, type DesignTokenSets, type DesignTokenSkip, type Hsl, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type LightnessDirection, MAX_COLORS, MAX_EXTERNALS, MAX_FONTS, MAX_HEADING_CHARS, MAX_OUTLINE_ENTRIES, MAX_PROPS, MAX_SWATCHES, MAX_THUMBNAIL_CHARS, MAX_VIEW_BYTES, type NamedColor, type NearestNamedColor, type Oklab, type Oklch, PICK_TEXT_DEFAULT_CANDIDATES, PaletteSource, PaletteStatus, ProposalKind, ProposalStatus, type ProposePaletteInput, type ProposeSectionInput, RAMP_L_MAX, RAMP_L_MIN, type RejectProposalInput, type ResolvedBrandDeps, type Rgb, type ScannedDeclaration, SectionKind, SectionStatus, type SerializedAttr, type SerializedEntity, type SerializedLink, type SerializedLinkEnd, type SerializedSchema, Swatch, SwatchRole, type UpsertSectionInput, acceptProposalOps, adjustLightnessUntil, analogous, assertAnalysis, assertAssetContentType, assertHex, assertSectionContent, assertSwatches, assetTools, attachedBrandAssetIds, audienceFanoutOps, base64ByteLength, base64FromBytes, beginAssetDeleteOps, bookForChannel, bookTools, brandAuthorityRef, brandBotTrigger, brandDiscussionReferenceHref, brandDiscussionReferenceId, brandInputFor, brandIntegration, brandJsonDigest, brandRules, brandSkill, canonicalBrandJson, capString, capStringArray, clamp01, clampToGamut, collapseWhitespace, complementary, contrastRatio, contrastReport, createAssetOps, createBookOps, createBrandIntegration, createBrandPersona, createBrandRoutes, cssColorToHex, decodeEntities, deltaEOK, deltaEOKLab, deriveChartColors, derivePalette, digestDesignBundle, digestDesignHtml, dispatchBrandTurn, exportBrandPromotion, extractColors, extractDesignTokens, extractFonts, extractOutline, extractProps, extractThumbnailSvg, extractTitle, finishAssetDeleteOps, formatBrandDiscussionReference, groupAssets, hexToOklch, hslToRgb, htmlToText, inSrgbGamut, isBoundedBrandJson, isBrandHumanAuthorityConsumption, isDesignBundle, linearToSrgb, meetsAA, meetsAAA, monochrome, nearestNamedColor, normalizeHex, oklabToOklch, oklabToRgb, oklchToHex, oklchToOklab, paletteTools, parseBrandDiscussionReference, parseBrandDispatch, parseDesignBundle, parseHex, pickTextOn, proposalAsWritten, proposalReviewSnapshot, proposePaletteOps, proposeSectionOps, readDesignManifest, readTools, receiptAsWritten, recordAnalysisOps, rejectProposalOps, relativeLuminance, resolveDeps, resolveVarRefs, rgbToHsl, rgbToOklab, rotateHue, rowAsWritten, safeFileName, scanCustomProperties, sectionKey, splitComplementary, srgbToLinear, stripCssComments, styleSheetText, supportsBrandVision, swatchesFromDesignTokens, tetradic, tintShadeRamp, toHex, triadic, updateBookOps, upsertSectionOps, verifyBrandApprovalReceipt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { P as ProposalKind, a as ProposalStatus, A as AssetKind, b as AssetAnalysis, B as BookStatus, c as BrandTokensSnapshot, d as PaletteStatus, S as Swatch, e as PaletteSource, f as SectionKind, g as SectionStatus, h as SwatchRole } from './index-r6SGidYT.js';
|
|
2
2
|
export { i as ASSET_KINDS, j as BOOK_STATUSES, k as BRAND_CHART_TOKENS, l as BRAND_CHAT_TOKENS, m as BRAND_DERIVED_TOKENS, n as BRAND_EMITTED_TOKENS, o as BRAND_NS, p as BRAND_REQUIRED_TOKENS, q as BrandTokens, C as CompileInput, r as CompiledBrandTokens, D as DARK_FLIP_L_MAX, s as DARK_FLIP_L_MIN, t as DEFAULT_ACCENT_SEED, u as DESIGN_ASSET_KIND, I as ImagerySection, L as LogoSection, M as MapResult, v as PALETTE_SOURCES, w as PALETTE_STATUSES, x as PROPOSAL_KINDS, y as PROPOSAL_STATUSES, z as PaletteSection, R as ROLE_TOKEN, E as RenderTokensCssOptions, F as SECTION_KINDS, G as SECTION_STATUSES, H as SWATCH_ROLES, T as TokenWarning, J as TypographySection, V as VoiceSection, K as compileBrandTokens, N as deriveDarkTokens, O as mapPaletteToTokens, Q as renderTokensCss } from './index-r6SGidYT.js';
|
|
3
3
|
import { ToolHandler, Skill, ToolDef, Persona, Inference, AgentRunInput, ImageBlock, OracleContentBlock } from '@odla-ai/ai';
|
|
4
|
+
import { PromotionAdapterResult } from '@odla-ai/promotion';
|
|
4
5
|
|
|
5
6
|
/** One entry of the bundle's base64 asset manifest, without its payload. */
|
|
6
7
|
interface DesignBundleAsset {
|
|
@@ -1901,4 +1902,15 @@ interface CreateBrandIntegrationOptions {
|
|
|
1901
1902
|
*/
|
|
1902
1903
|
declare function createBrandIntegration(options?: CreateBrandIntegrationOptions): BrandIntegrationDescriptor;
|
|
1903
1904
|
|
|
1904
|
-
|
|
1905
|
+
/** Stable adapter identity bound into Brand artifact provenance. */
|
|
1906
|
+
declare const BRAND_PROMOTION_ADAPTER = "@odla-ai/brand/v1";
|
|
1907
|
+
/** Approved Brand rows required to export one bounded promotion selection. */
|
|
1908
|
+
interface BrandPromotionInput {
|
|
1909
|
+
book: BrandBook;
|
|
1910
|
+
sections: readonly BrandSection[];
|
|
1911
|
+
palettes: readonly BrandPalette[];
|
|
1912
|
+
}
|
|
1913
|
+
/** Export only human-approved, provider-independent Brand state. */
|
|
1914
|
+
declare function exportBrandPromotion(input: BrandPromotionInput): PromotionAdapterResult;
|
|
1915
|
+
|
|
1916
|
+
export { ASSET_CONTENT_TYPES, type AcceptProposalInput, AssetAnalysis, AssetKind, type AttrType, type AudienceChildren, BRAND_AGENT_PROFILE, BRAND_DISCUSSION_REFERENCE_KINDS, BRAND_INSTRUCTIONS, BRAND_PROMOTION_ADAPTER, BRAND_RULES, BRAND_SCHEMA, BookStatus, type BrandActor, type BrandAgentBridge, type BrandAgentProfile, type BrandApprovalReceipt, type BrandAsset, type BrandAttrs, type BrandBook, type BrandBotTriggerOpts, type BrandCapabilityAuthority, BrandConflictError, type BrandDb, type BrandDecisionBinding, type BrandDeps, type BrandDiscussionReference, type BrandDiscussionReferenceKind, type BrandDiscussionReferenceTarget, type BrandDiscussionSwatch, type BrandDispatchBody, type BrandDispatchDeps, type BrandEntityRef, type BrandFetchedBytes, type BrandFileRecord, BrandForbiddenError, BrandGoneError, type BrandHumanAuthorityConsumption, BrandInputError, type BrandIntegrationDescriptor, type BrandIntegrationProbe, type BrandLookup, BrandNotFoundError, type BrandOp, type BrandPalette, type BrandPrincipalProjection, type BrandPromotionInput, type BrandProposal, type BrandProposalProvenance, type BrandProposalReviewSnapshot, type BrandResult, BrandReviewStateChangedError, type BrandRouteCtx, type BrandRouteOpts, type BrandRow, type BrandRule, type BrandRules, type BrandScalar, type BrandSection, type BrandSkillOpts, type BrandSkillSelf, type BrandSourceAssetSnapshot, type BrandStorage, BrandTokensSnapshot, type BrandToolCtx, type BrandTransactGuard, type BrandTransactOptions, type BrandTrigger, type BrandUploadBody, type BrandVisionCapabilities, type BrandVisionSpec, CHART_DELTA_MIN, CHAT_MESSAGE_NS, CSS_NAMED_COLORS, type ContrastKind, type CreateAssetInput, type CreateBookInput, type CreateBrandIntegrationOptions, type CreateBrandPersonaOpts, DEFAULT_BRAND_SYSTEM, DESIGN_CONTENT_TYPES, type DeriveChartOptions, type DerivePaletteOptions, type DesignAssetGroup, type DesignBundle, type DesignBundleAsset, type DesignColorUse, type DesignDecompilation, type DesignDigest, type DesignManifestEntry, type DesignOutlineEntry, type DesignProp, type DesignTokenSets, type DesignTokenSkip, type Hsl, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type LightnessDirection, MAX_COLORS, MAX_EXTERNALS, MAX_FONTS, MAX_HEADING_CHARS, MAX_OUTLINE_ENTRIES, MAX_PROPS, MAX_SWATCHES, MAX_THUMBNAIL_CHARS, MAX_VIEW_BYTES, type NamedColor, type NearestNamedColor, type Oklab, type Oklch, PICK_TEXT_DEFAULT_CANDIDATES, PaletteSource, PaletteStatus, ProposalKind, ProposalStatus, type ProposePaletteInput, type ProposeSectionInput, RAMP_L_MAX, RAMP_L_MIN, type RejectProposalInput, type ResolvedBrandDeps, type Rgb, type ScannedDeclaration, SectionKind, SectionStatus, type SerializedAttr, type SerializedEntity, type SerializedLink, type SerializedLinkEnd, type SerializedSchema, Swatch, SwatchRole, type UpsertSectionInput, acceptProposalOps, adjustLightnessUntil, analogous, assertAnalysis, assertAssetContentType, assertHex, assertSectionContent, assertSwatches, assetTools, attachedBrandAssetIds, audienceFanoutOps, base64ByteLength, base64FromBytes, beginAssetDeleteOps, bookForChannel, bookTools, brandAuthorityRef, brandBotTrigger, brandDiscussionReferenceHref, brandDiscussionReferenceId, brandInputFor, brandIntegration, brandJsonDigest, brandRules, brandSkill, canonicalBrandJson, capString, capStringArray, clamp01, clampToGamut, collapseWhitespace, complementary, contrastRatio, contrastReport, createAssetOps, createBookOps, createBrandIntegration, createBrandPersona, createBrandRoutes, cssColorToHex, decodeEntities, deltaEOK, deltaEOKLab, deriveChartColors, derivePalette, digestDesignBundle, digestDesignHtml, dispatchBrandTurn, exportBrandPromotion, extractColors, extractDesignTokens, extractFonts, extractOutline, extractProps, extractThumbnailSvg, extractTitle, finishAssetDeleteOps, formatBrandDiscussionReference, groupAssets, hexToOklch, hslToRgb, htmlToText, inSrgbGamut, isBoundedBrandJson, isBrandHumanAuthorityConsumption, isDesignBundle, linearToSrgb, meetsAA, meetsAAA, monochrome, nearestNamedColor, normalizeHex, oklabToOklch, oklabToRgb, oklchToHex, oklchToOklab, paletteTools, parseBrandDiscussionReference, parseBrandDispatch, parseDesignBundle, parseHex, pickTextOn, proposalAsWritten, proposalReviewSnapshot, proposePaletteOps, proposeSectionOps, readDesignManifest, readTools, receiptAsWritten, recordAnalysisOps, rejectProposalOps, relativeLuminance, resolveDeps, resolveVarRefs, rgbToHsl, rgbToOklab, rotateHue, rowAsWritten, safeFileName, scanCustomProperties, sectionKey, splitComplementary, srgbToLinear, stripCssComments, styleSheetText, supportsBrandVision, swatchesFromDesignTokens, tetradic, tintShadeRamp, toHex, triadic, updateBookOps, upsertSectionOps, verifyBrandApprovalReceipt };
|
package/dist/index.js
CHANGED
|
@@ -708,14 +708,14 @@ var SNAPSHOT_REQUIRED = [
|
|
|
708
708
|
];
|
|
709
709
|
function validSnapshotShape(value) {
|
|
710
710
|
if (!record3(value) || !exactKeys(value, SNAPSHOT_REQUIRED)) return false;
|
|
711
|
-
const
|
|
712
|
-
return boundedString(value.id) && boundedString(value.bookId) && typeof value.kind === "string" && PROPOSAL_KINDS.includes(value.kind) && value.status === "open" && record3(value.payload) && boundedString(value.rationale, 2e3) && record3(
|
|
711
|
+
const provenance2 = value.provenance;
|
|
712
|
+
return boundedString(value.id) && boundedString(value.bookId) && typeof value.kind === "string" && PROPOSAL_KINDS.includes(value.kind) && value.status === "open" && record3(value.payload) && boundedString(value.rationale, 2e3) && record3(provenance2) && exactKeys(provenance2, [
|
|
713
713
|
"sourceAssetId",
|
|
714
714
|
"sourceAsset",
|
|
715
715
|
"messageId",
|
|
716
716
|
"turnId",
|
|
717
717
|
"taintLabels"
|
|
718
|
-
]) && (
|
|
718
|
+
]) && (provenance2.sourceAssetId === null || boundedString(provenance2.sourceAssetId)) && (provenance2.sourceAsset === null || record3(provenance2.sourceAsset) && exactKeys(provenance2.sourceAsset, [
|
|
719
719
|
"assetId",
|
|
720
720
|
"contentDigest",
|
|
721
721
|
"objectEtag",
|
|
@@ -724,7 +724,7 @@ function validSnapshotShape(value) {
|
|
|
724
724
|
"contentType",
|
|
725
725
|
"analysisRevision",
|
|
726
726
|
"analysisDigest"
|
|
727
|
-
]) && boundedString(
|
|
727
|
+
]) && boundedString(provenance2.sourceAsset.assetId) && typeof provenance2.sourceAsset.contentDigest === "string" && DIGEST.test(provenance2.sourceAsset.contentDigest) && boundedString(provenance2.sourceAsset.objectEtag) && Number.isSafeInteger(provenance2.sourceAsset.objectSize) && provenance2.sourceAsset.objectSize > 0 && typeof provenance2.sourceAsset.pathDigest === "string" && DIGEST.test(provenance2.sourceAsset.pathDigest) && (provenance2.sourceAsset.contentType === null || boundedString(provenance2.sourceAsset.contentType, 160)) && (provenance2.sourceAsset.analysisRevision === null || Number.isSafeInteger(provenance2.sourceAsset.analysisRevision) && provenance2.sourceAsset.analysisRevision >= 0) && (provenance2.sourceAsset.analysisDigest === null || typeof provenance2.sourceAsset.analysisDigest === "string" && DIGEST.test(provenance2.sourceAsset.analysisDigest))) && (provenance2.sourceAssetId === null && provenance2.sourceAsset === null || provenance2.sourceAssetId !== null && provenance2.sourceAsset !== null && provenance2.sourceAsset.assetId === provenance2.sourceAssetId) && (provenance2.messageId === null || boundedString(provenance2.messageId)) && (provenance2.turnId === null || boundedString(provenance2.turnId)) && Array.isArray(provenance2.taintLabels) && provenance2.taintLabels.length <= 16 && provenance2.taintLabels.every((label) => boundedString(label, 120)) && new Set(provenance2.taintLabels).size === provenance2.taintLabels.length && typeof value.reviewDigest === "string" && DIGEST.test(value.reviewDigest) && Array.isArray(value.audience) && value.audience.length > 0 && value.audience.length <= 100 && value.audience.every((id) => boundedString(id)) && new Set(value.audience).size === value.audience.length && boundedString(value.createdBy) && boundedString(value.createdAuthorityRef) && safeTime(value.createdAt);
|
|
728
728
|
}
|
|
729
729
|
var CONSUMPTION_REQUIRED = [
|
|
730
730
|
"id",
|
|
@@ -4365,6 +4365,115 @@ function createBrandIntegration(options = {}) {
|
|
|
4365
4365
|
probes: [{ path: `${basePath}/books`, expectedStatus: 401 }]
|
|
4366
4366
|
};
|
|
4367
4367
|
}
|
|
4368
|
+
|
|
4369
|
+
// src/promotion.ts
|
|
4370
|
+
import {
|
|
4371
|
+
canonicalPromotionValue
|
|
4372
|
+
} from "@odla-ai/promotion";
|
|
4373
|
+
var BRAND_PROMOTION_ADAPTER = "@odla-ai/brand/v1";
|
|
4374
|
+
var provenance = (sourceIds, receiptDigests = []) => ({
|
|
4375
|
+
adapter: BRAND_PROMOTION_ADAPTER,
|
|
4376
|
+
sourceIds: [...sourceIds].sort(),
|
|
4377
|
+
receiptDigests: [...receiptDigests].sort()
|
|
4378
|
+
});
|
|
4379
|
+
var exclusions = (book) => [
|
|
4380
|
+
{
|
|
4381
|
+
kind: "brand.runtime",
|
|
4382
|
+
id: book.slug,
|
|
4383
|
+
reason: "environment_local",
|
|
4384
|
+
paths: [`${BRAND_NS.book}.ownerId`, `${BRAND_NS.book}.memberIds`, `${BRAND_NS.book}.channelId`, `${BRAND_NS.book}.*At`],
|
|
4385
|
+
detail: "Ownership, roster, channel, and timestamps remain local to the target environment."
|
|
4386
|
+
},
|
|
4387
|
+
{
|
|
4388
|
+
kind: "brand.drafts",
|
|
4389
|
+
id: book.slug,
|
|
4390
|
+
reason: "draft_state",
|
|
4391
|
+
paths: [`${BRAND_NS.proposal}.*`, `${BRAND_NS.section}[status=draft]`],
|
|
4392
|
+
detail: "Open proposals and unapproved sections are review state, not published brand content."
|
|
4393
|
+
},
|
|
4394
|
+
{
|
|
4395
|
+
kind: "brand.assets",
|
|
4396
|
+
id: book.slug,
|
|
4397
|
+
reason: "provider_identity",
|
|
4398
|
+
paths: [`${BRAND_NS.asset}.storageObjectId`, `${BRAND_NS.asset}.path`, `${BRAND_NS.asset}.*AuthorityRef`],
|
|
4399
|
+
detail: "Stored files and provider object identities require a separate asset-transfer contract."
|
|
4400
|
+
},
|
|
4401
|
+
{
|
|
4402
|
+
kind: "brand.authority",
|
|
4403
|
+
id: book.slug,
|
|
4404
|
+
reason: "authority_history",
|
|
4405
|
+
paths: [`${BRAND_NS.approvalReceipt}.*`, `${BRAND_NS.palette}.audience`],
|
|
4406
|
+
detail: "Authority rows stay immutable in their source environment; artifacts retain only receipt digests and ids."
|
|
4407
|
+
}
|
|
4408
|
+
];
|
|
4409
|
+
function exportBrandPromotion(input) {
|
|
4410
|
+
const { book } = input;
|
|
4411
|
+
if (book.status !== "active") throw new TypeError(`brand book ${book.slug} is not active`);
|
|
4412
|
+
const revision = `brand:${book.slug}:${book.activationRevision}`;
|
|
4413
|
+
const artifacts = [];
|
|
4414
|
+
if (book.tokens) {
|
|
4415
|
+
const {
|
|
4416
|
+
compiledAt: _compiledAt,
|
|
4417
|
+
paletteReceiptId,
|
|
4418
|
+
paletteActionDigest,
|
|
4419
|
+
typographyReceiptId,
|
|
4420
|
+
typographyActionDigest,
|
|
4421
|
+
sourceDigest,
|
|
4422
|
+
...stableTokens
|
|
4423
|
+
} = book.tokens;
|
|
4424
|
+
artifacts.push({
|
|
4425
|
+
kind: "brand.tokens",
|
|
4426
|
+
id: book.slug,
|
|
4427
|
+
sourceRevision: revision,
|
|
4428
|
+
provenance: provenance(
|
|
4429
|
+
[book.id, book.tokens.paletteId, paletteReceiptId, typographyReceiptId].filter((value) => Boolean(value)),
|
|
4430
|
+
[sourceDigest, paletteActionDigest, typographyActionDigest].filter((value) => Boolean(value))
|
|
4431
|
+
),
|
|
4432
|
+
content: canonicalPromotionValue({ bookSlug: book.slug, tokens: stableTokens })
|
|
4433
|
+
});
|
|
4434
|
+
}
|
|
4435
|
+
for (const section of input.sections.filter((row) => row.bookId === book.id && row.status === "approved")) {
|
|
4436
|
+
if (!section.approvalReceiptId || !section.approvalActionDigest) {
|
|
4437
|
+
throw new TypeError(`approved brand section ${section.key} lacks approval provenance`);
|
|
4438
|
+
}
|
|
4439
|
+
artifacts.push({
|
|
4440
|
+
kind: "brand.section",
|
|
4441
|
+
id: `${book.slug}/${section.kind}`,
|
|
4442
|
+
sourceRevision: revision,
|
|
4443
|
+
provenance: provenance([book.id, section.id, section.approvalReceiptId], [section.approvalActionDigest]),
|
|
4444
|
+
content: canonicalPromotionValue({ bookSlug: book.slug, kind: section.kind, content: section.content })
|
|
4445
|
+
});
|
|
4446
|
+
}
|
|
4447
|
+
const activePalette2 = input.palettes.find((row) => row.bookId === book.id && row.id === book.activePaletteId && row.status === "active");
|
|
4448
|
+
if (book.activePaletteId && !activePalette2) throw new TypeError(`active palette ${book.activePaletteId} is unavailable`);
|
|
4449
|
+
if (activePalette2) {
|
|
4450
|
+
artifacts.push({
|
|
4451
|
+
kind: "brand.palette",
|
|
4452
|
+
id: `${book.slug}/${activePalette2.id}`,
|
|
4453
|
+
sourceRevision: revision,
|
|
4454
|
+
provenance: provenance([book.id, activePalette2.id, activePalette2.proposalId, activePalette2.approvalReceiptId], [activePalette2.approvalActionDigest]),
|
|
4455
|
+
content: canonicalPromotionValue({
|
|
4456
|
+
bookSlug: book.slug,
|
|
4457
|
+
name: activePalette2.name,
|
|
4458
|
+
swatches: activePalette2.swatches,
|
|
4459
|
+
source: activePalette2.source,
|
|
4460
|
+
...activePalette2.seedHex ? { seedHex: activePalette2.seedHex } : {},
|
|
4461
|
+
...activePalette2.rationale ? { rationale: activePalette2.rationale } : {}
|
|
4462
|
+
})
|
|
4463
|
+
});
|
|
4464
|
+
}
|
|
4465
|
+
return {
|
|
4466
|
+
adapter: BRAND_PROMOTION_ADAPTER,
|
|
4467
|
+
artifacts,
|
|
4468
|
+
exclusions: exclusions(book),
|
|
4469
|
+
preconditions: [{
|
|
4470
|
+
code: "brand.schema",
|
|
4471
|
+
path: "services.brand.schemaVersion",
|
|
4472
|
+
expected: 1,
|
|
4473
|
+
detail: "The target must expose the Brand v1 approved-content schema."
|
|
4474
|
+
}]
|
|
4475
|
+
};
|
|
4476
|
+
}
|
|
4368
4477
|
export {
|
|
4369
4478
|
ASSET_CONTENT_TYPES,
|
|
4370
4479
|
ASSET_KINDS,
|
|
@@ -4377,6 +4486,7 @@ export {
|
|
|
4377
4486
|
BRAND_EMITTED_TOKENS,
|
|
4378
4487
|
BRAND_INSTRUCTIONS,
|
|
4379
4488
|
BRAND_NS,
|
|
4489
|
+
BRAND_PROMOTION_ADAPTER,
|
|
4380
4490
|
BRAND_REQUIRED_TOKENS,
|
|
4381
4491
|
BRAND_RULES,
|
|
4382
4492
|
BRAND_SCHEMA,
|
|
@@ -4465,6 +4575,7 @@ export {
|
|
|
4465
4575
|
digestDesignBundle,
|
|
4466
4576
|
digestDesignHtml,
|
|
4467
4577
|
dispatchBrandTurn,
|
|
4578
|
+
exportBrandPromotion,
|
|
4468
4579
|
extractColors,
|
|
4469
4580
|
extractDesignTokens,
|
|
4470
4581
|
extractFonts,
|