@sonordev/contracts 2.20.0 → 2.21.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 +12 -0
- package/README.md +103 -0
- package/dist/funnels.d.ts +37 -0
- package/dist/funnels.js +35 -6
- package/dist/funnels.mjs +34 -7
- package/dist/outreach.js +45 -1
- package/dist/outreach.mjs +45 -1
- package/dist/resonance.d.ts +1191 -99
- package/dist/resonance.js +224 -19
- package/dist/resonance.mjs +214 -20
- package/package.json +1 -1
package/dist/resonance.mjs
CHANGED
|
@@ -394,7 +394,7 @@ var budget = refine2(object2({ total: money, dailyAllocationCeiling: nullable2(m
|
|
|
394
394
|
for (const m of [v.reserveMargin, v.maxChange, ...v.dailyAllocationCeiling ? [v.dailyAllocationCeiling] : []]) if (m.currency !== v.total.currency) fail2(p, "currency mismatch");
|
|
395
395
|
if (BigInt(v.reserveMargin.amountMicros) > BigInt(v.total.amountMicros)) fail2(p, "reserve exceeds total");
|
|
396
396
|
});
|
|
397
|
-
var
|
|
397
|
+
var allocationPolicyFields = {
|
|
398
398
|
schemaVersion: literal2(1),
|
|
399
399
|
sourceRef: nullable2(resource),
|
|
400
400
|
decisionKind: literal2("observational_allocation"),
|
|
@@ -411,7 +411,10 @@ var matureOptimizationPolicy = object2({
|
|
|
411
411
|
uncertaintyMethod: literal2("observational_cpql_missing_outcome_bound_v1"),
|
|
412
412
|
attributionModel: choice2("first_party_source", "first_touch", "last_touch", "provider_reported", RESONANCE_ATTRIBUTION_MODEL),
|
|
413
413
|
requiredChecks: list2(choice2("tracking", "dedupe", "qualification", "uncertainty", "assignment", "power"), 6, 1)
|
|
414
|
-
}
|
|
414
|
+
};
|
|
415
|
+
var matureOptimizationPolicy = object2(allocationPolicyFields);
|
|
416
|
+
var reportedPolicyFields = { ...allocationPolicyFields, algorithm: literal2("reported_cpql_conserved_transfer_v1"), costBasis: literal2("provider_reported_snapshot_v1"), costRevisionRisk: literal2("accepted_provisional") };
|
|
417
|
+
var reportedOptimizationPolicy = object2({ ...reportedPolicyFields, readClockKind: literal2("sql_before_provider_read_lower_bound_v1") });
|
|
415
418
|
function uniqueList(item, max, min = 0) {
|
|
416
419
|
const base = list2(item, max, min);
|
|
417
420
|
return field2({ ...base.schema, uniqueItems: true }, (v, p) => {
|
|
@@ -446,10 +449,10 @@ var finiteMetaCandidatePolicy = object2({
|
|
|
446
449
|
stopRules: uniqueList(finiteStopRule, 8, 8),
|
|
447
450
|
expiresAt: instant
|
|
448
451
|
});
|
|
449
|
-
var optimizationPolicy = union2(matureOptimizationPolicy, finiteMetaCandidatePolicy);
|
|
452
|
+
var optimizationPolicy = union2(matureOptimizationPolicy, finiteMetaCandidatePolicy, reportedOptimizationPolicy);
|
|
450
453
|
function parseResonanceOptimizationPolicy(v) {
|
|
451
454
|
const r = optimizationPolicy.read(v, "optimizationPolicy");
|
|
452
|
-
if (r.algorithm
|
|
455
|
+
if (r.algorithm !== "finite_meta_candidates_v1") {
|
|
453
456
|
unique(r.requiredChecks, "optimizationPolicy.requiredChecks");
|
|
454
457
|
return r;
|
|
455
458
|
}
|
|
@@ -573,14 +576,37 @@ var websiteVisitFeed = object2({ profile: literal2(RESONANCE_WEBSITE_VISIT_PROFI
|
|
|
573
576
|
matchingProfileRef
|
|
574
577
|
}), 100, 1) });
|
|
575
578
|
var RESONANCE_WEBSITE_VISIT_FEED_JSON_SCHEMA = websiteVisitFeed.schema;
|
|
576
|
-
var
|
|
577
|
-
|
|
579
|
+
var providerReportingChannelIds = refine2(uniqueList(uuid, 100, 1), (ids, p) => unique(ids.map((id) => id.toLowerCase()), p));
|
|
580
|
+
var providerReportingSelection = object2({ agentContactId: uuid, channelIds: providerReportingChannelIds });
|
|
581
|
+
var providerReportingGrant = refine2(object2({ purpose: literal2("provider_reporting_refresh"), orgId: uuid, projectId: uuid, agentContactId: uuid, principalContactId: uuid, channelIds: providerReportingChannelIds }), (v, p) => {
|
|
582
|
+
if (v.agentContactId.toLowerCase() === v.principalContactId.toLowerCase()) fail2(p + ".principalContactId", "agent and human principal must remain distinct");
|
|
583
|
+
});
|
|
584
|
+
var parseResonanceProviderReportingSelection = (v) => providerReportingSelection.read(v, "providerReportingSelection");
|
|
585
|
+
var parseResonanceProviderReportingGrant = (v) => providerReportingGrant.read(v, "providerReportingGrant");
|
|
586
|
+
var RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA = providerReportingSelection.schema;
|
|
587
|
+
var RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA = providerReportingGrant.schema;
|
|
588
|
+
var mandateScope = object2({ projectId: uuid, campaignId: uuid, preparedPlanId: uuid, reviewDigest: digest, accountBindingIds: list2(uuid, 100), sites: list2(site, 50, 1), budget, creativeRefs: list2(creative, 100, 1), audienceRuleRefs: list2(audience, 100), goal: objective, allowedOperations: mandateAllowedOperations, allowedTransformationRef: nullable2(resource), expiresAt: instant, websiteVisitFeed: optional2(websiteVisitFeed), providerReporting: optional2(providerReportingGrant) });
|
|
589
|
+
function parseResonanceMandateScope(v, preparedPlan) {
|
|
578
590
|
const r = mandateScope.read(v, "mandateScope");
|
|
579
591
|
scoped(r, r.projectId, r.sites, "mandateScope");
|
|
580
592
|
if (r.websiteVisitFeed) {
|
|
581
593
|
unique(r.websiteVisitFeed.channels.map((c) => c.channelId), "mandateScope.websiteVisitFeed.channels");
|
|
582
594
|
for (const c of r.websiteVisitFeed.channels) unique(c.resourceRuleRefs.map((rule) => rule.id), "mandateScope.websiteVisitFeed.resourceRuleRefs");
|
|
583
595
|
}
|
|
596
|
+
if (r.providerReporting) {
|
|
597
|
+
const grant = r.providerReporting, p = "mandateScope.providerReporting";
|
|
598
|
+
if (grant.projectId !== r.projectId) fail2(p + ".projectId", "must match the original mandate project");
|
|
599
|
+
if (Date.parse(r.expiresAt) <= Date.parse(r.budget.startAt) || Date.parse(r.expiresAt) > Date.parse(r.budget.endAt)) fail2(p, "reporting remains inside the original mandate flight and expiry");
|
|
600
|
+
if (preparedPlan !== void 0) {
|
|
601
|
+
const plan = parseResonancePreparedPlan(preparedPlan);
|
|
602
|
+
if (r.projectId !== plan.projectId || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || canonical(r.goal) !== canonical(plan.definition.objective) || canonical(r.budget) !== canonical(plan.definition.budget)) fail2(p, "requires the exact original plan, review, goal and flight");
|
|
603
|
+
if (r.sites.some((site2) => !plan.definition.sites.includes(site2)) || r.accountBindingIds.some((id) => !plan.accounts.some((account) => account.id === id))) fail2(p, "mandate sites and accounts must stay inside the original plan");
|
|
604
|
+
for (const id of grant.channelIds) {
|
|
605
|
+
const channel2 = plan.definition.channels.find((c) => c.id === id);
|
|
606
|
+
if (!channel2 || !("provider" in channel2) || !r.sites.includes(channel2.site) || !r.accountBindingIds.includes(channel2.accountBindingId)) fail2(p + ".channelIds", "requires an explicit original paid channel inside mandate sites and accounts");
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
584
610
|
return r;
|
|
585
611
|
}
|
|
586
612
|
var websiteVisitTimes = object2({ occurredAt: instant, receivedAt: instant });
|
|
@@ -988,15 +1014,18 @@ var allocationHorizon = union2(
|
|
|
988
1014
|
);
|
|
989
1015
|
var uncertaintySource = object2({ method: literal2(RESONANCE_CPQL_UNCERTAINTY_METHOD), eligibleContacts: decimal, fullyResolvedContacts: decimal, qualifiedContacts: decimal, verifiedSpend: money, sourceRevision: revision, qualificationRuleRef: resource, universeComplete: literal2(true), spendPeriodComplete: literal2(true) });
|
|
990
1016
|
function cpqlMissingOutcomeBound(input) {
|
|
1017
|
+
return conditionalCpqlOutcomeBound(input, input.verifiedSpend);
|
|
1018
|
+
}
|
|
1019
|
+
function conditionalCpqlOutcomeBound(input, spend) {
|
|
991
1020
|
const n = BigInt(decimal.read(input.eligibleContacts, "bound.eligibleContacts"));
|
|
992
1021
|
const c = BigInt(decimal.read(input.fullyResolvedContacts, "bound.fullyResolvedContacts"));
|
|
993
1022
|
const k = BigInt(decimal.read(input.qualifiedContacts, "bound.qualifiedContacts"));
|
|
994
1023
|
if (c > n || k > c) fail2("bound", "inconsistent unique-contact source universe");
|
|
995
|
-
if (n === 0n || k === 0n || parseMoney(
|
|
1024
|
+
if (n === 0n || k === 0n || parseMoney(spend).amountMicros === "0") return null;
|
|
996
1025
|
const u = n - c, denominator = 2n * k + u;
|
|
997
1026
|
return Number((10000n * u + denominator - 1n) / denominator);
|
|
998
1027
|
}
|
|
999
|
-
var
|
|
1028
|
+
var allocationEvidenceFields = {
|
|
1000
1029
|
id: uuid,
|
|
1001
1030
|
revision,
|
|
1002
1031
|
evidenceDigest: digest,
|
|
@@ -1017,13 +1046,42 @@ var matureOptimizationEvidence = object2({
|
|
|
1017
1046
|
trackingState: choice2("healthy", "blocked", "unknown"),
|
|
1018
1047
|
coverageBasisPoints: nullable2(integer2(0, 1e4)),
|
|
1019
1048
|
assignmentCheck: choice2("pass", "failed", "unknown", "not_applicable"),
|
|
1020
|
-
powerCheck: choice2("pass", "failed", "unknown", "not_applicable")
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1049
|
+
powerCheck: choice2("pass", "failed", "unknown", "not_applicable")
|
|
1050
|
+
};
|
|
1051
|
+
var allocationChannelFields = { channelId: uuid, site, accountBindingId: uuid, trackingState: choice2("healthy", "blocked", "unknown"), coverageBasisPoints: nullable2(integer2(0, 1e4)), coverageFamily: choice2("crm_attribution", "provider_import", "experiment_exposure"), coverageDefinitionRef: resource, coveredNumerator: nullable2(decimal), eligibleDenominator: nullable2(decimal), uncertaintyBasisPoints: nullable2(integer2(0, 1e4)), uncertaintySource: nullable2(uncertaintySource), dedupeCheck: choice2("pass", "failed", "unknown", "not_applicable"), qualificationCheck: choice2("pass", "failed", "unknown", "not_applicable"), reasonCodes: list2(text2(80), 50), capabilityRevision: revision, budgetMode: choice2("campaign_total", "average_daily", "lifetime", "daily"), allocationHorizon: nullable2(allocationHorizon), matureThrough: nullable2(instant), dataThrough: nullable2(instant), goalRevision: revision, countingUnit: choice2("unique_source", "unique_qualified_contact", "net_order"), attributionModel: text2(100), attributionWindowDays: integer2(1, 365), policyRevision: revision, currentAllocation: money, remoteSnapshotDigest: digest, observations: list2(metric, 100), providerUnitExponent: refine2(integer2(0, 6), (v, p) => {
|
|
1052
|
+
if (![0, 2, 3, 6].includes(v)) fail2(p, "unsupported provider exponent");
|
|
1053
|
+
}), providerMaxUnits: decimal };
|
|
1054
|
+
var { uncertaintySource: _legacyUncertaintyField, ...reportedChannelFields } = allocationChannelFields;
|
|
1055
|
+
var matureOptimizationEvidence = object2({ ...allocationEvidenceFields, resolvedPolicy: matureOptimizationPolicy, channels: list2(object2({ ...allocationChannelFields, uncertaintySource: nullable2(uncertaintySource) }), 100, 1) });
|
|
1056
|
+
var reportedCostFields = { basis: literal2("provider_reported_snapshot_v1"), observationId: uuid, sourceEvidenceDigest: digest, reportedSpend: money, queriedFrom: instant, queriedThrough: instant, firstReceivedAt: instant, receivedAt: instant, recordedAt: instant, providerFinality: literal2("unknown"), correctionsPossible: literal2(true) };
|
|
1057
|
+
var reportedOutcomeSource = object2({ method: literal2(RESONANCE_CPQL_UNCERTAINTY_METHOD), eligibleContacts: decimal, fullyResolvedContacts: decimal, qualifiedContacts: decimal, sourceRevision: revision, qualificationRuleRef: resource, universeComplete: literal2(true) });
|
|
1058
|
+
var nativeSqlReadInstant = refine2(text2(32, /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d{1,6}))?(?:Z|\+00:00)$/), (v, p) => {
|
|
1059
|
+
const match = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d{1,6}))?(?:Z|\+00:00)$/.exec(v);
|
|
1060
|
+
const projected = match[1] + "." + (match[2] ?? "").padEnd(3, "0").slice(0, 3) + "Z";
|
|
1061
|
+
if (!Number.isFinite(Date.parse(projected)) || new Date(projected).toISOString() !== projected) fail2(p, "invalid native SQL UTC instant");
|
|
1062
|
+
});
|
|
1063
|
+
var providerReadClock = object2({ kind: literal2("sql_before_provider_read_lower_bound_v1"), notBeforeAt: nativeSqlReadInstant });
|
|
1064
|
+
var channelReportedCost = object2({ ...reportedCostFields, readClock: providerReadClock });
|
|
1065
|
+
var reportedOptimizationEvidence = object2({
|
|
1066
|
+
...allocationEvidenceFields,
|
|
1067
|
+
evidenceKind: literal2("reported_cpql_sql_clock_v1"),
|
|
1068
|
+
resolvedPolicy: reportedOptimizationPolicy,
|
|
1069
|
+
channels: list2(object2({ ...reportedChannelFields, channelReportedCost, outcomeSource: reportedOutcomeSource }), 100, 1)
|
|
1024
1070
|
});
|
|
1071
|
+
function reportedCpqlMissingOutcomeBound(input) {
|
|
1072
|
+
return conditionalCpqlOutcomeBound(input, input.reportedSpend);
|
|
1073
|
+
}
|
|
1025
1074
|
function parseMatureOptimizationEvidence(v) {
|
|
1026
1075
|
const r = matureOptimizationEvidence.read(v, "optimizationEvidence");
|
|
1076
|
+
for (const c of r.channels) {
|
|
1077
|
+
if (c.uncertaintySource === null) {
|
|
1078
|
+
if (c.uncertaintyBasisPoints !== null) fail2("optimizationEvidence.channels.uncertainty", "no bound without source witness");
|
|
1079
|
+
} else if (c.uncertaintySource.verifiedSpend.currency !== c.currentAllocation.currency || c.uncertaintyBasisPoints !== cpqlMissingOutcomeBound(c.uncertaintySource)) fail2("optimizationEvidence.channels.uncertainty", "source bound mismatch");
|
|
1080
|
+
}
|
|
1081
|
+
checkAllocationEvidence(r);
|
|
1082
|
+
return r;
|
|
1083
|
+
}
|
|
1084
|
+
function checkAllocationEvidence(r) {
|
|
1027
1085
|
if (r.objective.measurementRevision !== r.goalRevision) fail2("optimizationEvidence.goalRevision", "goal snapshot mismatch");
|
|
1028
1086
|
if (Date.parse(r.windowEnd) <= Date.parse(r.windowStart) || r.dataThrough !== null && Date.parse(r.dataThrough) > Date.parse(r.observedAt)) fail2("optimizationEvidence.window", "invalid observed window");
|
|
1029
1087
|
const sites = r.channels.map((c) => c.site);
|
|
@@ -1031,9 +1089,6 @@ function parseMatureOptimizationEvidence(v) {
|
|
|
1031
1089
|
unique(r.channels.map((c) => c.channelId), "optimizationEvidence.channels");
|
|
1032
1090
|
const currency2 = r.channels[0].currentAllocation.currency;
|
|
1033
1091
|
for (const c of r.channels) {
|
|
1034
|
-
if (c.uncertaintySource === null) {
|
|
1035
|
-
if (c.uncertaintyBasisPoints !== null) fail2("optimizationEvidence.channels.uncertainty", "no bound without source witness");
|
|
1036
|
-
} else if (c.uncertaintySource.verifiedSpend.currency !== c.currentAllocation.currency || c.uncertaintyBasisPoints !== cpqlMissingOutcomeBound(c.uncertaintySource)) fail2("optimizationEvidence.channels.uncertainty", "source bound mismatch");
|
|
1037
1092
|
if (c.allocationHorizon !== null && (["campaign_total", "lifetime"].includes(c.budgetMode) ? c.allocationHorizon.kind !== "finite_period" : c.allocationHorizon.kind !== "daily_average")) fail2("optimizationEvidence.channels.allocationHorizon", "unapproved budget period normalization");
|
|
1038
1093
|
if (c.coveredNumerator === null || c.eligibleDenominator === null || c.eligibleDenominator === "0") {
|
|
1039
1094
|
if (c.coverageBasisPoints !== null) fail2("optimizationEvidence.channels.coverage", "unknown denominator means unknown coverage");
|
|
@@ -1050,8 +1105,50 @@ function parseMatureOptimizationEvidence(v) {
|
|
|
1050
1105
|
if (observation.campaignId !== r.campaignId || observation.site !== c.site) fail2("optimizationEvidence.channels.observations", "scope mismatch");
|
|
1051
1106
|
}
|
|
1052
1107
|
}
|
|
1108
|
+
}
|
|
1109
|
+
function parseReportedOptimizationEvidence(v) {
|
|
1110
|
+
const r = reportedOptimizationEvidence.read(v, "optimizationEvidence");
|
|
1111
|
+
checkReportedAllocationEvidence(r);
|
|
1053
1112
|
return r;
|
|
1054
1113
|
}
|
|
1114
|
+
function checkReportedAllocationEvidence(r) {
|
|
1115
|
+
const p = "optimizationEvidence";
|
|
1116
|
+
parseResonanceOptimizationPolicy(r.resolvedPolicy);
|
|
1117
|
+
if (r.objective.source.kind !== "qualified_lead" || r.objective.countingUnit !== "unique_qualified_contact" || !r.objective.qualificationRuleRef || r.objective.qualificationRuleRef.module !== "crm") fail2(p + ".objective", "requires the original independent qualified-contact source");
|
|
1118
|
+
if (r.dataThrough !== null) fail2(p + ".dataThrough", "query coverage cannot become mature provider dataThrough");
|
|
1119
|
+
unique(r.channels.map((c) => c.channelReportedCost.observationId), p + ".channels.channelReportedCost.observationId");
|
|
1120
|
+
const observedAt = Date.parse(r.observedAt), windowStart = Date.parse(r.windowStart), windowEnd = Date.parse(r.windowEnd);
|
|
1121
|
+
if (windowEnd <= windowStart || windowEnd > observedAt) fail2(p + ".window", "requires a completed observed interval");
|
|
1122
|
+
let commonZone;
|
|
1123
|
+
for (const c of r.channels) {
|
|
1124
|
+
const cost = c.channelReportedCost, outcome = c.outcomeSource;
|
|
1125
|
+
if (c.dataThrough !== null) fail2(p + ".channels.dataThrough", "query coverage cannot become mature provider dataThrough");
|
|
1126
|
+
if (Date.parse(cost.queriedFrom) !== windowStart || Date.parse(cost.queriedThrough) !== windowEnd) fail2(p + ".channels.channelReportedCost", "requires the exact common query interval");
|
|
1127
|
+
const firstReceived = Date.parse(cost.firstReceivedAt), received = Date.parse(cost.receivedAt), recorded = Date.parse(cost.recordedAt);
|
|
1128
|
+
const anchor = Date.parse(cost.readClock.notBeforeAt);
|
|
1129
|
+
if (received < firstReceived) fail2(p + ".channels.channelReportedCost", "HTTP receipts must retain internal ordering");
|
|
1130
|
+
if (anchor < windowEnd || anchor > recorded || recorded > observedAt || observedAt - anchor > r.resolvedPolicy.maxEvidenceAgeSeconds * 1e3) fail2(p + ".channels.channelReportedCost.readClock", "requires the original fresh SQL-before-HTTP lower bound and SQL receipt order");
|
|
1131
|
+
if (cost.reportedSpend.currency !== c.currentAllocation.currency || canonical(outcome.qualificationRuleRef) !== canonical(r.objective.qualificationRuleRef)) fail2(p + ".channels.outcomeSource", "requires original qualification reference and currency");
|
|
1132
|
+
if (c.uncertaintyBasisPoints !== reportedCpqlMissingOutcomeBound({ ...outcome, reportedSpend: cost.reportedSpend })) fail2(p + ".channels.uncertainty", "conditional source bound mismatch");
|
|
1133
|
+
const spends = c.observations.filter((o) => o.name === "spend");
|
|
1134
|
+
if (spends.length !== 1) fail2(p + ".channels.observations", "requires one exact provider spend snapshot, never overlapping sums");
|
|
1135
|
+
const spend = spends[0];
|
|
1136
|
+
if (spend.state !== "observed" || spend.source !== "provider" || spend.countingUnit !== "provider_aggregate" || spend.attributionModel !== "provider_reported" || spend.value.kind !== "money" || canonical(spend.value.money) !== canonical(cost.reportedSpend) || Date.parse(spend.windowStart) !== windowStart || Date.parse(spend.windowEnd) !== windowEnd || spend.dataThrough !== null || Date.parse(spend.asOf) !== recorded) fail2(p + ".channels.observations", "reported spend must match the exact nonfinal provider snapshot");
|
|
1137
|
+
const outcomes = c.observations.filter((o) => o.name === "qualified_goals");
|
|
1138
|
+
if (outcomes.length !== 1) fail2(p + ".channels.observations", "requires one independent qualified-contact source");
|
|
1139
|
+
const qualified = outcomes[0];
|
|
1140
|
+
if (qualified.state !== "observed" || qualified.source !== "first_party" || qualified.sourceRef !== outcome.sourceRevision || qualified.goalRevision !== r.goalRevision || qualified.countingUnit !== "unique_qualified_contact" || qualified.attributionModel !== r.resolvedPolicy.attributionModel || qualified.value.kind !== "count" || qualified.value.count !== outcome.qualifiedContacts || qualified.eligibleExposures !== outcome.eligibleContacts || qualified.matureOutcomes !== outcome.qualifiedContacts || qualified.dataThrough === null || Date.parse(qualified.dataThrough) < windowEnd || Date.parse(qualified.dataThrough) > observedAt || c.matureThrough === null || Date.parse(c.matureThrough) < windowEnd || Date.parse(c.matureThrough) > observedAt) fail2(p + ".channels.outcomeSource", "requires independent mature qualified-contact evidence");
|
|
1141
|
+
const formatter = new Intl.DateTimeFormat("en-GB", { timeZone: spend.timeZone, hour: "2-digit", minute: "2-digit", second: "2-digit", hourCycle: "h23" });
|
|
1142
|
+
if ([r.windowStart, r.windowEnd].some((t) => new Date(t).getUTCMilliseconds() !== 0 || formatter.format(new Date(t)) !== "00:00:00") || commonZone !== void 0 && commonZone !== spend.timeZone) fail2(p + ".channels.observations", "requires common advertiser-local completed days without rounding");
|
|
1143
|
+
commonZone = spend.timeZone;
|
|
1144
|
+
for (const o of c.observations) {
|
|
1145
|
+
parseResonanceMetricObservation(o);
|
|
1146
|
+
if (o.projectId !== r.projectId || o.campaignId !== r.campaignId || o.site !== c.site || Date.parse(o.windowStart) !== windowStart || Date.parse(o.windowEnd) !== windowEnd || o.timeZone !== spend.timeZone || Date.parse(o.asOf) > observedAt) fail2(p + ".channels.observations", "foreign or mismatched observation interval");
|
|
1147
|
+
if (o.source === "provider" && o.dataThrough !== null) fail2(p + ".channels.observations", "reported provider observation remains nonfinal");
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
checkAllocationEvidence(r);
|
|
1151
|
+
}
|
|
1055
1152
|
var optimizationEvidenceRefFields = { id: uuid, revision, evidenceDigest: digest };
|
|
1056
1153
|
var optimizationEvidenceRef = object2(optimizationEvidenceRefFields);
|
|
1057
1154
|
var finiteOwnMeasurement = union2(
|
|
@@ -1104,11 +1201,12 @@ var finiteOptimizationEvidence = object2({
|
|
|
1104
1201
|
inventoryState: choice2("complete", "incomplete", "unknown"),
|
|
1105
1202
|
candidates: list2(finiteCandidateObservation, 100, 1)
|
|
1106
1203
|
});
|
|
1107
|
-
var optimizationEvidence = union2(matureOptimizationEvidence, finiteOptimizationEvidence);
|
|
1204
|
+
var optimizationEvidence = union2(matureOptimizationEvidence, finiteOptimizationEvidence, reportedOptimizationEvidence);
|
|
1108
1205
|
function parseResonanceOptimizationEvidence(v, preparedPlan) {
|
|
1109
1206
|
const r = optimizationEvidence.read(v, "optimizationEvidence");
|
|
1110
1207
|
if (preparedPlan !== void 0) checkOptimizationEvidencePlan(r, parseResonancePreparedPlan(preparedPlan));
|
|
1111
1208
|
if (!("evidenceKind" in r)) return parseMatureOptimizationEvidence(r);
|
|
1209
|
+
if (r.evidenceKind === "reported_cpql_sql_clock_v1") return parseReportedOptimizationEvidence(r);
|
|
1112
1210
|
const p = "optimizationEvidence", policy = parseResonanceOptimizationPolicy(r.resolvedPolicy);
|
|
1113
1211
|
if (r.objective.measurementRevision !== r.goalRevision || r.objective.countingUnit !== "unique_qualified_contact" || canonical(policy.measurementGuard.sourceRef) !== canonical(r.objective.source) || canonical(policy.measurementGuard.qualificationRuleRef) !== canonical(r.objective.qualificationRuleRef) || policy.measurementGuard.maturityDelaySeconds !== r.objective.maturityDelaySeconds) fail2(p + ".objective", "finite policy must retain the original qualified objective");
|
|
1114
1212
|
if (Date.parse(r.windowEnd) <= Date.parse(r.windowStart) || r.dataThrough !== null && Date.parse(r.dataThrough) > Date.parse(r.observedAt)) fail2(p + ".window", "invalid observed window");
|
|
@@ -1139,6 +1237,15 @@ function checkOptimizationEvidencePlan(e, plan) {
|
|
|
1139
1237
|
const p = "optimizationEvidence";
|
|
1140
1238
|
if (e.projectId !== plan.projectId || e.campaignId !== plan.campaignId || e.preparedPlanId !== plan.id || e.reviewDigest !== plan.reviewDigest || canonical(e.objective) !== canonical(plan.definition.objective) || canonical(e.resolvedPolicy) !== canonical(plan.resolvedEvidencePolicy)) fail2(p + ".preparedPlanId", "requires the exact original prepared scope and policy");
|
|
1141
1239
|
if (!("evidenceKind" in e)) return;
|
|
1240
|
+
if (e.evidenceKind === "reported_cpql_sql_clock_v1") {
|
|
1241
|
+
const cohort = plan.resolvedQualificationRule?.cohort;
|
|
1242
|
+
if (!cohort || Date.parse(e.windowStart) < Date.parse(cohort.startAt) || Date.parse(e.windowEnd) > Date.parse(cohort.endAt)) fail2(p + ".window", "outside the original frozen qualification cohort");
|
|
1243
|
+
for (const c of e.channels) {
|
|
1244
|
+
const original = plan.definition.channels.find((x) => x.id === c.channelId), account = plan.accounts.find((x) => x.id === c.accountBindingId);
|
|
1245
|
+
if (!original || !("provider" in original) || original.site !== c.site || original.accountBindingId !== c.accountBindingId || !account || c.observations.some((o) => o.timeZone !== account.timeZone)) fail2(p + ".channels", "reported evidence must retain original channel/account/site/timezone");
|
|
1246
|
+
}
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1142
1249
|
for (const observed of e.candidates) {
|
|
1143
1250
|
const original = plan.definition.channels.find((c) => c.id === observed.channelId), preview2 = plan.channelPreviews.find((c) => c.channelId === observed.channelId);
|
|
1144
1251
|
if (!original || original.kind !== "meta_retargeting" || !preview2 || observed.site !== original.site || observed.accountBindingId !== original.accountBindingId || canonical(observed.cap) !== canonical(original.allocation) || canonical(observed.manifestRef) !== canonical(preview2.manifestRef)) fail2(p + ".candidates", "candidate projection differs from original channel and manifest");
|
|
@@ -1218,11 +1325,18 @@ function checkOptimizationDecisionEvidence(d, e) {
|
|
|
1218
1325
|
if (d.projectId !== e.projectId || d.campaignId !== e.campaignId || d.preparedPlanId !== e.preparedPlanId || d.reviewDigest !== e.reviewDigest || d.policyDigest !== e.policyDigest || canonical(d.evidenceRef) !== canonical({ id: e.id, revision: e.revision, evidenceDigest: e.evidenceDigest })) fail2(p + ".evidenceRef", "must bind the exact original evidence and review");
|
|
1219
1326
|
if (Date.parse(d.createdAt) < Date.parse(e.observedAt)) fail2(p + ".createdAt", "precedes actual evidence");
|
|
1220
1327
|
if (d.decisionKind !== "preapproved_candidate_operation") {
|
|
1221
|
-
if ("evidenceKind" in e) fail2(p + ".decisionKind", "mature decisions cannot borrow finite lifecycle evidence");
|
|
1328
|
+
if ("evidenceKind" in e && e.evidenceKind !== "reported_cpql_sql_clock_v1") fail2(p + ".decisionKind", "mature decisions cannot borrow finite lifecycle evidence");
|
|
1329
|
+
if ("evidenceKind" in e && e.evidenceKind === "reported_cpql_sql_clock_v1" ? d.algorithmRevision !== e.resolvedPolicy.algorithm || d.decisionKind !== "observational_allocation" : d.algorithmRevision === "reported_cpql_conserved_transfer_v1") fail2(p + ".algorithmRevision", "reported-cost decisions require the exact reported evidence policy");
|
|
1330
|
+
if ("evidenceKind" in e && e.evidenceKind === "reported_cpql_sql_clock_v1") {
|
|
1331
|
+
const deadline = Math.min(Date.parse(e.observedAt), ...e.channels.flatMap((c) => [Date.parse(c.channelReportedCost.readClock.notBeforeAt), Date.parse(c.channelReportedCost.recordedAt)])) + e.resolvedPolicy.maxEvidenceAgeSeconds * 1e3;
|
|
1332
|
+
if (Date.parse(d.createdAt) > deadline || Date.parse(d.expiresAt) > deadline) fail2(p + ".expiresAt", "outside original HTTP/database evidence freshness");
|
|
1333
|
+
const refs = e.channels.flatMap((c) => [c.channelReportedCost.observationId, c.outcomeSource.sourceRevision]);
|
|
1334
|
+
if (refs.some((ref) => !d.sourceRefs.includes(ref))) fail2(p + ".sourceRefs", "requires immutable reported-cost and independent outcome sources");
|
|
1335
|
+
}
|
|
1222
1336
|
if (d.algorithmRevision === "finite_meta_candidates_v1") fail2(p + ".algorithmRevision", "mature decisions cannot use the finite algorithm");
|
|
1223
1337
|
return;
|
|
1224
1338
|
}
|
|
1225
|
-
if (!("evidenceKind" in e)) fail2(p + ".decisionKind", "finite actions require finite lifecycle evidence");
|
|
1339
|
+
if (!("evidenceKind" in e) || e.evidenceKind !== "finite_candidate_lifecycle_v1") fail2(p + ".decisionKind", "finite actions require finite lifecycle evidence");
|
|
1226
1340
|
const finite = e, policy = finite.resolvedPolicy;
|
|
1227
1341
|
if (Date.parse(d.createdAt) - Date.parse(finite.observedAt) > policy.measurementGuard.maxEvidenceAgeSeconds * 1e3 || Date.parse(d.expiresAt) > Date.parse(policy.expiresAt)) fail2(p + ".expiresAt", "outside current policy/evidence freshness");
|
|
1228
1342
|
for (const a of d.candidateActions) {
|
|
@@ -1614,7 +1728,7 @@ var feedSelection = refine2(object2({ channels: list2(object2({ channelId: uuid,
|
|
|
1614
1728
|
unique(v.channels.map((c) => c.channelId), p + ".channels");
|
|
1615
1729
|
for (const c of v.channels) unique(c.resourceRuleRefs.map((ref) => ref.id), p + ".resourceRuleRefs");
|
|
1616
1730
|
});
|
|
1617
|
-
var mandateDraftRequest = object2({ expectedRevision: integer2(1), allowedOperations: mandateAllowedOperations, expiresAt: instant, websiteVisitFeedSelection: optional2(feedSelection) });
|
|
1731
|
+
var mandateDraftRequest = object2({ expectedRevision: integer2(1), allowedOperations: mandateAllowedOperations, expiresAt: instant, websiteVisitFeedSelection: optional2(feedSelection), providerReporting: optional2(providerReportingSelection) });
|
|
1618
1732
|
var parseResonanceMandateDraftRequest = (v) => mandateDraftRequest.read(v, "mandateDraftRequest");
|
|
1619
1733
|
var RESONANCE_MANDATE_DRAFT_REQUEST_JSON_SCHEMA = mandateDraftRequest.schema;
|
|
1620
1734
|
var feedReview = object2({ schemaVersion: literal2(1), approval: mandateApproval, mandateRef, configurations: list2(metaSnapshot, 100), current: object2({ state: choice2("not_enabled", "eligible", "invalidated", "unavailable"), checkedAt: instant, expiresAt: nullable2(instant), reasonCodes: uniqueList(text2(200), 100) }) });
|
|
@@ -1646,5 +1760,85 @@ function parseResonanceWebsiteVisitFeedReview(v, context) {
|
|
|
1646
1760
|
return r;
|
|
1647
1761
|
}
|
|
1648
1762
|
var RESONANCE_WEBSITE_VISIT_FEED_REVIEW_JSON_SCHEMA = feedReview.schema;
|
|
1763
|
+
var observationIdentity = { observationId: uuid, channelId: uuid, versionId: uuid, accountBindingId: uuid };
|
|
1764
|
+
var publicObservationMetric = union2(
|
|
1765
|
+
object2({ ...metricBase, ...observationIdentity, source: choice2("provider", "first_party"), state: literal2("observed"), value: metricValue }),
|
|
1766
|
+
object2({ ...metricBase, ...observationIdentity, source: choice2("provider", "first_party"), state: choice2("unknown", "insufficient", "delayed", "unavailable"), value: literal2(null), reasonCode: text2(80) })
|
|
1767
|
+
);
|
|
1768
|
+
function parseResonancePublicObservationMetric(v) {
|
|
1769
|
+
const r = publicObservationMetric.read(v, "observationItem");
|
|
1770
|
+
const { observationId: _observation, channelId: _channel, versionId: _version, accountBindingId: _account, ...body } = r;
|
|
1771
|
+
parseResonanceMetricObservation(body);
|
|
1772
|
+
return r;
|
|
1773
|
+
}
|
|
1774
|
+
var observationDenominators = object2({ eligibleContacts: nullable2(decimal), fullyResolvedContacts: nullable2(decimal), qualifiedContacts: nullable2(decimal) });
|
|
1775
|
+
var observationSupportFields = { ...observationIdentity, currency, fetchedAt: instant, dataThrough: nullable2(instant), coverage: choice2("unknown", "partial", "complete"), reasonCode: nullable2(text2(80)), denominators: observationDenominators };
|
|
1776
|
+
var firstPartyObservationSupport = object2({ ...observationSupportFields, source: literal2("first_party") });
|
|
1777
|
+
var providerObservationSupport = object2({
|
|
1778
|
+
...observationSupportFields,
|
|
1779
|
+
source: literal2("provider"),
|
|
1780
|
+
firstReceivedAt: nullable2(instant),
|
|
1781
|
+
receivedAt: nullable2(instant),
|
|
1782
|
+
recordedAt: nullable2(instant),
|
|
1783
|
+
readClock: nullable2(providerReadClock),
|
|
1784
|
+
providerFinality: literal2("unknown"),
|
|
1785
|
+
correctionsPossible: literal2(true),
|
|
1786
|
+
coverageBasis: choice2("closed_query_snapshot", "not_established")
|
|
1787
|
+
});
|
|
1788
|
+
var observationSupport = union2(firstPartyObservationSupport, providerObservationSupport);
|
|
1789
|
+
function parseResonanceObservationSupport(v) {
|
|
1790
|
+
const r = observationSupport.read(v, "observationSupport"), p = "observationSupport", d = r.denominators;
|
|
1791
|
+
if (d.fullyResolvedContacts !== null && (d.eligibleContacts === null || BigInt(d.fullyResolvedContacts) > BigInt(d.eligibleContacts)) || d.qualifiedContacts !== null && (d.fullyResolvedContacts === null || BigInt(d.qualifiedContacts) > BigInt(d.fullyResolvedContacts))) fail2(p + ".denominators", "inconsistent independent contact universe");
|
|
1792
|
+
if (r.source === "provider") {
|
|
1793
|
+
if (Object.values(d).some((v2) => v2 !== null)) fail2(p + ".denominators", "provider reporting cannot supply qualified-contact denominators");
|
|
1794
|
+
if (r.firstReceivedAt !== null && (r.receivedAt === null || Date.parse(r.firstReceivedAt) > Date.parse(r.receivedAt))) fail2(p + ".firstReceivedAt", "preserve actual internal HTTP receipt order");
|
|
1795
|
+
if (r.recordedAt !== null && Date.parse(r.recordedAt) !== Date.parse(r.fetchedAt)) fail2(p + ".recordedAt", "must retain the native immutable SQL write time");
|
|
1796
|
+
if (r.readClock !== null && (r.firstReceivedAt === null || r.receivedAt === null || r.recordedAt === null || Date.parse(r.readClock.notBeforeAt) > Date.parse(r.recordedAt))) fail2(p + ".readClock", "requires actual earliest/final HTTP metadata and SQL lower-bound chronology");
|
|
1797
|
+
if (r.coverageBasis === "closed_query_snapshot" ? r.coverage !== "complete" || r.reasonCode !== null || r.receivedAt === null || r.recordedAt === null || r.dataThrough !== null : r.coverage === "complete") fail2(p + ".coverage", "distinguish revisable query coverage from unestablished legacy reporting");
|
|
1798
|
+
}
|
|
1799
|
+
return r;
|
|
1800
|
+
}
|
|
1801
|
+
var observationsPage = object2({ items: list2(publicObservationMetric, 300), nextCursor: nullable2(uuid), observedAt: instant, support: list2(observationSupport, 300) });
|
|
1802
|
+
function parseResonanceObservationsPage(v) {
|
|
1803
|
+
const r = observationsPage.read(v, "observationsPage"), p = "observationsPage";
|
|
1804
|
+
if (r.items.length !== r.support.length) fail2(p + ".support", "requires one support entry for each metric item");
|
|
1805
|
+
const pairs = /* @__PURE__ */ new Set(), rows = /* @__PURE__ */ new Map(), observedAt = Date.parse(r.observedAt);
|
|
1806
|
+
let previous;
|
|
1807
|
+
const first = r.items[0];
|
|
1808
|
+
for (let i = 0; i < r.items.length; i++) {
|
|
1809
|
+
const item = parseResonancePublicObservationMetric(r.items[i]), s = parseResonanceObservationSupport(r.support[i]), rowId = item.observationId.toLowerCase();
|
|
1810
|
+
if (Object.keys(observationIdentity).some((k) => item[k] !== s[k])) fail2(p + ".support", "item/support observation, channel, version and account must align in order");
|
|
1811
|
+
if (item.source !== s.source || item.projectId !== first.projectId || item.campaignId !== first.campaignId || item.site !== first.site) fail2(p + ".items", "requires one scoped provider or first-party page");
|
|
1812
|
+
if (Date.parse(item.asOf) !== Date.parse(s.fetchedAt) || Date.parse(s.fetchedAt) > observedAt || item.dataThrough === null !== (s.dataThrough === null) || item.dataThrough !== null && s.dataThrough !== null && Date.parse(item.dataThrough) !== Date.parse(s.dataThrough)) fail2(p + ".support", "preserve native SQL observation chronology and data-through meaning");
|
|
1813
|
+
if (item.state === "observed" && item.value.kind === "money" && item.value.money.currency !== s.currency) fail2(p + ".support.currency", "observed money must retain account currency");
|
|
1814
|
+
if (previous !== void 0 && rowId < previous) fail2(p + ".items", "native-row UUID order cannot be replaced by metric/time sorting");
|
|
1815
|
+
previous = rowId;
|
|
1816
|
+
const key = rowId + ":" + item.name;
|
|
1817
|
+
if (pairs.has(key)) fail2(p + ".items", "duplicate observation/metric pair");
|
|
1818
|
+
pairs.add(key);
|
|
1819
|
+
const supportIdentity = { ...s, fetchedAt: Date.parse(s.fetchedAt), dataThrough: s.dataThrough === null ? null : Date.parse(s.dataThrough), ...s.source === "provider" ? { firstReceivedAt: s.firstReceivedAt === null ? null : Date.parse(s.firstReceivedAt), receivedAt: s.receivedAt === null ? null : Date.parse(s.receivedAt), recordedAt: s.recordedAt === null ? null : Date.parse(s.recordedAt) } : {} };
|
|
1820
|
+
const row = canonical({ projectId: item.projectId, campaignId: item.campaignId, site: item.site, channelId: item.channelId, versionId: item.versionId, accountBindingId: item.accountBindingId, source: item.source, windowStart: Date.parse(item.windowStart), windowEnd: Date.parse(item.windowEnd), timeZone: item.timeZone, fetchedAt: Date.parse(s.fetchedAt), support: supportIdentity });
|
|
1821
|
+
if (rows.has(rowId) && rows.get(rowId) !== row) fail2(p + ".support", "one immutable native observation cannot change identity or support across metrics");
|
|
1822
|
+
rows.set(rowId, row);
|
|
1823
|
+
if (s.source === "provider") {
|
|
1824
|
+
if (item.state === "observed" && (s.coverage !== "complete" || s.coverageBasis !== "closed_query_snapshot" || s.reasonCode !== null)) fail2(p + ".support", "observed provider values require complete genuine closed-query support");
|
|
1825
|
+
if (!["spend", "impressions", "clicks"].includes(item.name) || item.sourceRef !== item.observationId || item.countingUnit !== "provider_aggregate" || item.attributionModel !== "provider_reported") fail2(p + ".items", "provider metrics retain exact native observation and aggregate semantics");
|
|
1826
|
+
if (s.readClock !== null && Date.parse(s.readClock.notBeforeAt) < Date.parse(item.windowEnd)) fail2(p + ".support.readClock", "SQL pre-read lower bound must follow the completed query window");
|
|
1827
|
+
} else {
|
|
1828
|
+
const d = s.denominators;
|
|
1829
|
+
if (item.name !== "qualified_goals" || item.countingUnit !== "unique_qualified_contact" || item.goalRevision === null || item.attributionModel !== RESONANCE_ATTRIBUTION_MODEL || item.eligibleExposures !== null || item.matureOutcomes !== null) fail2(p + ".items", "preserve genuine first-party qualification without fabricated exposure counts");
|
|
1830
|
+
const coverage = d.eligibleContacts === null || d.eligibleContacts === "0" || d.fullyResolvedContacts === null ? null : Number(BigInt(d.fullyResolvedContacts) * 10000n / BigInt(d.eligibleContacts));
|
|
1831
|
+
if (item.coverageBasisPoints !== coverage) fail2(p + ".support.denominators", "contact resolution coverage must match the independent universe");
|
|
1832
|
+
if (item.state !== "observed" && (s.coverage === "complete" || s.reasonCode !== item.reasonCode)) fail2(p + ".support", "unresolved qualified sources keep incomplete coverage and their native reason");
|
|
1833
|
+
if (item.state === "observed" && (s.coverage !== "complete" || s.reasonCode !== null || d.eligibleContacts === null || d.fullyResolvedContacts !== d.eligibleContacts || d.qualifiedContacts === null || item.value.kind !== "count" || item.value.count !== d.qualifiedContacts)) fail2(p + ".support", "observed qualified count requires its complete independent native universe");
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
if (rows.size > 100) fail2(p + ".items", "at most 100 native rows per page");
|
|
1837
|
+
if (r.nextCursor !== null && (!r.items.length || r.nextCursor.toLowerCase() !== previous)) fail2(p + ".nextCursor", "cursor must retain the final native row, not a metric offset");
|
|
1838
|
+
return r;
|
|
1839
|
+
}
|
|
1840
|
+
var RESONANCE_PUBLIC_OBSERVATION_METRIC_JSON_SCHEMA = publicObservationMetric.schema;
|
|
1841
|
+
var RESONANCE_OBSERVATION_SUPPORT_JSON_SCHEMA = observationSupport.schema;
|
|
1842
|
+
var RESONANCE_OBSERVATIONS_PAGE_JSON_SCHEMA = observationsPage.schema;
|
|
1649
1843
|
|
|
1650
|
-
export { MAX_MONEY_MICROS, MONEY_EXPONENT, MONEY_JSON_SCHEMA, RESONANCE_ACCEPT_COMMAND_JSON_SCHEMA, RESONANCE_ACCOUNT_CAPABILITY_JSON_SCHEMA, RESONANCE_ATTRIBUTION_MODEL, RESONANCE_AUDIENCE_DRAFT_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_AUDIENCE_RULE_REF_JSON_SCHEMA, RESONANCE_BINDING_COMMAND_JSON_SCHEMA, RESONANCE_CAMPAIGN_DEFINITION_JSON_SCHEMA, RESONANCE_CAMPAIGN_DRAFT_JSON_SCHEMA, RESONANCE_CAMPAIGN_VIEW_JSON_SCHEMA, RESONANCE_CLICK_IDENTIFIERS_JSON_SCHEMA, RESONANCE_COMMAND_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_JSON_SCHEMA, RESONANCE_CONSENT_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_UPDATE_JSON_SCHEMA, RESONANCE_CONVERSION_JSON_SCHEMA, RESONANCE_CPQL_UNCERTAINTY_METHOD, RESONANCE_CURRENCIES, RESONANCE_EXPERIMENT_COMPLETE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_CREATE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LIFECYCLE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LINK_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_REF_JSON_SCHEMA, RESONANCE_EXPERIMENT_UPDATE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_REVIEW_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_GOOGLE_SETUP_SPEC_JSON_SCHEMA, RESONANCE_GOOGLE_SIGNAL_SEMANTICS, RESONANCE_GOOGLE_SOURCE_CATEGORIES, RESONANCE_MANDATE_ACTION_KIND, RESONANCE_MANDATE_APPROVAL_JSON_SCHEMA, RESONANCE_MANDATE_DRAFT_REQUEST_JSON_SCHEMA, RESONANCE_MANDATE_REF_JSON_SCHEMA, RESONANCE_MANDATE_SCOPE_JSON_SCHEMA, RESONANCE_MANDATE_TARGET_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_CURRENT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIG_JSON_SCHEMA, RESONANCE_MEASUREMENT_OCCURRENCE_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_METRIC_JSON_SCHEMA, RESONANCE_OCCURRENCE_RESPONSE_JSON_SCHEMA, RESONANCE_OPTIMIZATION_DECISION_JSON_SCHEMA, RESONANCE_OPTIMIZATION_EVIDENCE_JSON_SCHEMA, RESONANCE_OPTIMIZATION_POLICY_JSON_SCHEMA, RESONANCE_PREPARED_PLAN_JSON_SCHEMA, RESONANCE_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RECEIPT_JSON_SCHEMA, RESONANCE_RESOLVED_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RESOURCE_REF_JSON_SCHEMA, RESONANCE_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_SCHEMA_VERSION, RESONANCE_SOURCE_MARKER_JSON_SCHEMA, RESONANCE_SOURCE_MARKER_PARAMETER, RESONANCE_SUBJECT_HEADER, RESONANCE_SUBJECT_RENEW_COMMAND_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_REVIEW_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_PROFILE, ResonanceValidationError, addMoney, compareMoney, cpqlMissingOutcomeBound, formatMoney, googleConversionActionSemantics, googleUploadClicksSetupSemantics, moneyFromProviderUnits, moneyToProviderUnits, parseMoney, parseResonanceAcceptCommand, parseResonanceAccountCapability, parseResonanceAudienceDraftSaveCommand, parseResonanceAudienceRuleRef, parseResonanceBindingCommand, parseResonanceCampaignDefinition, parseResonanceCampaignDraft, parseResonanceCampaignSaveCommand, parseResonanceCampaignView, parseResonanceClickIdentifiers, parseResonanceCommand, parseResonanceCommandPrepareRequest, parseResonanceCommandPrepareResponse, parseResonanceConsentResponse, parseResonanceConsentSnapshot, parseResonanceConsentUpdate, parseResonanceConversionEnvelope, parseResonanceExperimentCompleteCommand, parseResonanceExperimentCreateCommand, parseResonanceExperimentExposure, parseResonanceExperimentLifecycleCommand, parseResonanceExperimentLinkCommand, parseResonanceExperimentRef, parseResonanceExperimentUpdateCommand, parseResonanceGoogleConfigurationReview, parseResonanceGoogleConfigurationSaveCommand, parseResonanceGoogleConfigurationSaveResponse, parseResonanceGoogleConfigurationSnapshot, parseResonanceGoogleConfigurationView, parseResonanceGoogleUploadClicksCustomGoalSpec, parseResonanceMandateApprovalPayload, parseResonanceMandateDraftRequest, parseResonanceMandateRef, parseResonanceMandateScope, parseResonanceMandateTarget, parseResonanceMeasurementConfig, parseResonanceMeasurementConfigurationCurrent, parseResonanceMeasurementConfigurationSaveCommand, parseResonanceMeasurementConfigurationSaveResponse, parseResonanceMeasurementConfigurationSnapshot, parseResonanceMeasurementOccurrence, parseResonanceMetaConfigurationSaveCommand, parseResonanceMetaConfigurationSaveResponse, parseResonanceMetaConfigurationSnapshot, parseResonanceMetaConfigurationView, parseResonanceMetricObservation, parseResonanceOccurrenceResponse, parseResonanceOptimizationDecision, parseResonanceOptimizationEvidence, parseResonanceOptimizationPolicy, parseResonancePrepareCommand, parseResonancePreparedPlan, parseResonanceQualificationRule, parseResonanceReceipt, parseResonanceResolvedQualificationRule, parseResonanceResourceRef, parseResonanceSourceMarker, parseResonanceSubjectRenewCommand, parseResonanceWebsiteVisitFeedReview, projectResonanceGoogleConfiguration, projectResonanceMeasurementConfiguration, projectResonanceMetaConfiguration, resonanceCommandDigestInput, resonanceGoogleConfigurationDigestInput, resonanceGoogleSetupDigestInput, resonanceMandateDigestInput, resonanceMeasurementConfigDigestInput, resonanceMeasurementConfigurationSaveDigestInput, resonanceMetaConfigurationDigestInput, resonanceMetaConfigurationSaveDigestInput, resonanceOptimizationDecisionDigestInput, resonanceOptimizationEvidenceDigestInput, resonanceOptimizationPolicyDigestInput, resonancePlanIssues, resonanceWebsiteVisitEventTime, resonanceWebsiteVisitProfileDigestInput, subtractMoney };
|
|
1844
|
+
export { MAX_MONEY_MICROS, MONEY_EXPONENT, MONEY_JSON_SCHEMA, RESONANCE_ACCEPT_COMMAND_JSON_SCHEMA, RESONANCE_ACCOUNT_CAPABILITY_JSON_SCHEMA, RESONANCE_ATTRIBUTION_MODEL, RESONANCE_AUDIENCE_DRAFT_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_AUDIENCE_RULE_REF_JSON_SCHEMA, RESONANCE_BINDING_COMMAND_JSON_SCHEMA, RESONANCE_CAMPAIGN_DEFINITION_JSON_SCHEMA, RESONANCE_CAMPAIGN_DRAFT_JSON_SCHEMA, RESONANCE_CAMPAIGN_VIEW_JSON_SCHEMA, RESONANCE_CLICK_IDENTIFIERS_JSON_SCHEMA, RESONANCE_COMMAND_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_JSON_SCHEMA, RESONANCE_CONSENT_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_UPDATE_JSON_SCHEMA, RESONANCE_CONVERSION_JSON_SCHEMA, RESONANCE_CPQL_UNCERTAINTY_METHOD, RESONANCE_CURRENCIES, RESONANCE_EXPERIMENT_COMPLETE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_CREATE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LIFECYCLE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LINK_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_REF_JSON_SCHEMA, RESONANCE_EXPERIMENT_UPDATE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_REVIEW_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_GOOGLE_SETUP_SPEC_JSON_SCHEMA, RESONANCE_GOOGLE_SIGNAL_SEMANTICS, RESONANCE_GOOGLE_SOURCE_CATEGORIES, RESONANCE_MANDATE_ACTION_KIND, RESONANCE_MANDATE_APPROVAL_JSON_SCHEMA, RESONANCE_MANDATE_DRAFT_REQUEST_JSON_SCHEMA, RESONANCE_MANDATE_REF_JSON_SCHEMA, RESONANCE_MANDATE_SCOPE_JSON_SCHEMA, RESONANCE_MANDATE_TARGET_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_CURRENT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIG_JSON_SCHEMA, RESONANCE_MEASUREMENT_OCCURRENCE_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_METRIC_JSON_SCHEMA, RESONANCE_OBSERVATIONS_PAGE_JSON_SCHEMA, RESONANCE_OBSERVATION_SUPPORT_JSON_SCHEMA, RESONANCE_OCCURRENCE_RESPONSE_JSON_SCHEMA, RESONANCE_OPTIMIZATION_DECISION_JSON_SCHEMA, RESONANCE_OPTIMIZATION_EVIDENCE_JSON_SCHEMA, RESONANCE_OPTIMIZATION_POLICY_JSON_SCHEMA, RESONANCE_PREPARED_PLAN_JSON_SCHEMA, RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA, RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA, RESONANCE_PUBLIC_OBSERVATION_METRIC_JSON_SCHEMA, RESONANCE_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RECEIPT_JSON_SCHEMA, RESONANCE_RESOLVED_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RESOURCE_REF_JSON_SCHEMA, RESONANCE_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_SCHEMA_VERSION, RESONANCE_SOURCE_MARKER_JSON_SCHEMA, RESONANCE_SOURCE_MARKER_PARAMETER, RESONANCE_SUBJECT_HEADER, RESONANCE_SUBJECT_RENEW_COMMAND_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_REVIEW_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_PROFILE, ResonanceValidationError, addMoney, compareMoney, cpqlMissingOutcomeBound, formatMoney, googleConversionActionSemantics, googleUploadClicksSetupSemantics, moneyFromProviderUnits, moneyToProviderUnits, parseMoney, parseResonanceAcceptCommand, parseResonanceAccountCapability, parseResonanceAudienceDraftSaveCommand, parseResonanceAudienceRuleRef, parseResonanceBindingCommand, parseResonanceCampaignDefinition, parseResonanceCampaignDraft, parseResonanceCampaignSaveCommand, parseResonanceCampaignView, parseResonanceClickIdentifiers, parseResonanceCommand, parseResonanceCommandPrepareRequest, parseResonanceCommandPrepareResponse, parseResonanceConsentResponse, parseResonanceConsentSnapshot, parseResonanceConsentUpdate, parseResonanceConversionEnvelope, parseResonanceExperimentCompleteCommand, parseResonanceExperimentCreateCommand, parseResonanceExperimentExposure, parseResonanceExperimentLifecycleCommand, parseResonanceExperimentLinkCommand, parseResonanceExperimentRef, parseResonanceExperimentUpdateCommand, parseResonanceGoogleConfigurationReview, parseResonanceGoogleConfigurationSaveCommand, parseResonanceGoogleConfigurationSaveResponse, parseResonanceGoogleConfigurationSnapshot, parseResonanceGoogleConfigurationView, parseResonanceGoogleUploadClicksCustomGoalSpec, parseResonanceMandateApprovalPayload, parseResonanceMandateDraftRequest, parseResonanceMandateRef, parseResonanceMandateScope, parseResonanceMandateTarget, parseResonanceMeasurementConfig, parseResonanceMeasurementConfigurationCurrent, parseResonanceMeasurementConfigurationSaveCommand, parseResonanceMeasurementConfigurationSaveResponse, parseResonanceMeasurementConfigurationSnapshot, parseResonanceMeasurementOccurrence, parseResonanceMetaConfigurationSaveCommand, parseResonanceMetaConfigurationSaveResponse, parseResonanceMetaConfigurationSnapshot, parseResonanceMetaConfigurationView, parseResonanceMetricObservation, parseResonanceObservationSupport, parseResonanceObservationsPage, parseResonanceOccurrenceResponse, parseResonanceOptimizationDecision, parseResonanceOptimizationEvidence, parseResonanceOptimizationPolicy, parseResonancePrepareCommand, parseResonancePreparedPlan, parseResonanceProviderReportingGrant, parseResonanceProviderReportingSelection, parseResonancePublicObservationMetric, parseResonanceQualificationRule, parseResonanceReceipt, parseResonanceResolvedQualificationRule, parseResonanceResourceRef, parseResonanceSourceMarker, parseResonanceSubjectRenewCommand, parseResonanceWebsiteVisitFeedReview, projectResonanceGoogleConfiguration, projectResonanceMeasurementConfiguration, projectResonanceMetaConfiguration, reportedCpqlMissingOutcomeBound, resonanceCommandDigestInput, resonanceGoogleConfigurationDigestInput, resonanceGoogleSetupDigestInput, resonanceMandateDigestInput, resonanceMeasurementConfigDigestInput, resonanceMeasurementConfigurationSaveDigestInput, resonanceMetaConfigurationDigestInput, resonanceMetaConfigurationSaveDigestInput, resonanceOptimizationDecisionDigestInput, resonanceOptimizationEvidenceDigestInput, resonanceOptimizationPolicyDigestInput, resonancePlanIssues, resonanceWebsiteVisitEventTime, resonanceWebsiteVisitProfileDigestInput, subtractMoney };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonordev/contracts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.0",
|
|
4
4
|
"description": "The rules Sonor's sites, APIs and dashboard share: popup blocks and site design tokens, site hosts, SEO page identity, title quality, llms.txt sanitizers, shared form validation, fleet heartbeats, slot content and signing, site cache tags, portfolio metrics, the house voice's contraction rule, how a proposal's site plan counts its pages, what separates an error page from a page's content, which stored JSON-LD is a template's unfilled placeholder, where prose splits into sentences, which Sonor records Signal reads into a project's knowledge and the address each one is stored under, what outbound email and text may claim about a business and whether a sent email arrived intact, what a segment of outreach is and who may turn one on, a page's own name taken from its title or its slug, which Broadcast card layouts and review compositions are drawn and what a retired one draws as, what a publication's branding may hold, which literal hosts are refused as public fetch destinations, which inbox cards are decisions a bulk action leaves alone, what a rep's call outcome (positive, negative or left voicemail) changes on a prospect, and which buying role a job title says (owner, decision maker, influencer or gatekeeper). Pure functions, no dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|