@uwmd/core 1.3.0 → 1.5.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/browser.d.ts +10 -4
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +5 -2
- package/dist/browser.js.map +1 -1
- package/dist/cascade.d.ts +60 -6
- package/dist/cascade.d.ts.map +1 -1
- package/dist/cascade.js +93 -14
- package/dist/cascade.js.map +1 -1
- package/dist/cli.js +269 -11
- package/dist/cli.js.map +1 -1
- package/dist/composition.d.ts +182 -0
- package/dist/composition.d.ts.map +1 -0
- package/dist/composition.js +536 -0
- package/dist/composition.js.map +1 -0
- package/dist/context.js +23 -23
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/lite-bridge.d.ts +9 -0
- package/dist/lite-bridge.d.ts.map +1 -1
- package/dist/lite-bridge.js +44 -5
- package/dist/lite-bridge.js.map +1 -1
- package/dist/lite.js +37 -1
- package/dist/lite.js.map +1 -1
- package/dist/market-data.d.ts +134 -0
- package/dist/market-data.d.ts.map +1 -0
- package/dist/market-data.js +292 -0
- package/dist/market-data.js.map +1 -0
- package/dist/protocol.d.ts +57 -8
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +74 -4
- package/dist/protocol.js.map +1 -1
- package/dist/receipts.d.ts +189 -9
- package/dist/receipts.d.ts.map +1 -1
- package/dist/receipts.js +373 -14
- package/dist/receipts.js.map +1 -1
- package/dist/report.js +165 -165
- package/dist/types.d.ts +54 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/validator.d.ts.map +1 -1
- package/dist/validator.js +17 -0
- package/dist/validator.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
// `market-data-v1` document profile (RFC 0022).
|
|
2
|
+
//
|
|
3
|
+
// A market-data document carries dated, attributable *observations* — not
|
|
4
|
+
// conclusions. It has no `deal_id`, contains no calculations, and no pack
|
|
5
|
+
// applies to it. Making an external number attributable is the entire point;
|
|
6
|
+
// this module does not make it true.
|
|
7
|
+
//
|
|
8
|
+
// Two rules carry the profile's weight, and both are refusals rather than
|
|
9
|
+
// warnings:
|
|
10
|
+
//
|
|
11
|
+
// 1. `document_id`, `as_of`, `provider`, and `geo` are required. An
|
|
12
|
+
// observation set with no as-of date or no named provider is not
|
|
13
|
+
// attributable, and storing it with those fields blank would leave a
|
|
14
|
+
// number in the file that nothing can ever trace.
|
|
15
|
+
// 2. Every observation states a `basis`. A number with no stated basis is an
|
|
16
|
+
// assertion, and this profile is for observations.
|
|
17
|
+
//
|
|
18
|
+
// Browser-safe: no network access of any kind. Resolution reads a parsed
|
|
19
|
+
// document, never a vendor API — a host querying a live warehouse implements
|
|
20
|
+
// `MarketDataLookup` directly and snapshots to a document when it needs a
|
|
21
|
+
// receipt.
|
|
22
|
+
import { EXTENSION_SECTION_PREFIX, isStandardSectionId, MARKET_DATA_PROFILE, } from './protocol.js';
|
|
23
|
+
export const MARKET_DATA_PROFILE_ID = MARKET_DATA_PROFILE;
|
|
24
|
+
/** The section a market-data document carries its observations in. */
|
|
25
|
+
export const MARKET_OBSERVATIONS_SECTION = 'market_observations';
|
|
26
|
+
export class MarketDataError extends Error {
|
|
27
|
+
code;
|
|
28
|
+
constructor(code, message) {
|
|
29
|
+
super(`[${code}] ${message}`);
|
|
30
|
+
this.name = 'MarketDataError';
|
|
31
|
+
this.code = code;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function mdError(code, message, pointer) {
|
|
35
|
+
return { category: 'validate', code, message, ...(pointer ? { pointer } : {}) };
|
|
36
|
+
}
|
|
37
|
+
function isRecord(v) {
|
|
38
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
39
|
+
}
|
|
40
|
+
function nonEmptyString(v) {
|
|
41
|
+
return typeof v === 'string' && v.trim() !== '';
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `YYYY-MM-DD`, and a real calendar date. The round-trip check rejects
|
|
45
|
+
* `2026-02-30`, which `Date.parse` would otherwise roll forward to March 2 —
|
|
46
|
+
* silently dating an observation set to a day that does not exist.
|
|
47
|
+
*/
|
|
48
|
+
const AS_OF_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
49
|
+
export function isValidAsOf(value) {
|
|
50
|
+
if (!AS_OF_PATTERN.test(value))
|
|
51
|
+
return false;
|
|
52
|
+
const date = new Date(`${value}T00:00:00Z`);
|
|
53
|
+
if (Number.isNaN(date.getTime()))
|
|
54
|
+
return false;
|
|
55
|
+
return date.toISOString().slice(0, 10) === value;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A field path is `<section>.<rest>`, where `<section>` is registered by
|
|
59
|
+
* FORMAT_SPEC Part IV or is an `x_` extension section (§ 4.21). The bare
|
|
60
|
+
* section id with no `rest` is rejected: an observation about an entire section
|
|
61
|
+
* is not a value a deal record could carry at a path.
|
|
62
|
+
*/
|
|
63
|
+
export function isDealFieldPath(path) {
|
|
64
|
+
const dot = path.indexOf('.');
|
|
65
|
+
if (dot <= 0 || dot === path.length - 1)
|
|
66
|
+
return false;
|
|
67
|
+
const section = path.slice(0, dot);
|
|
68
|
+
const rest = path.slice(dot + 1);
|
|
69
|
+
if (rest.trim() === '')
|
|
70
|
+
return false;
|
|
71
|
+
return isStandardSectionId(section) || section.startsWith(EXTENSION_SECTION_PREFIX);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Validate a market-data document, returning every problem rather than the
|
|
75
|
+
* first. Returns `[]` when the candidate conforms.
|
|
76
|
+
*/
|
|
77
|
+
export function validateMarketDataDocument(candidate) {
|
|
78
|
+
const errors = [];
|
|
79
|
+
if (!isRecord(candidate)) {
|
|
80
|
+
return [mdError('MD-001', 'Market-data document must be an object.')];
|
|
81
|
+
}
|
|
82
|
+
const doc = candidate;
|
|
83
|
+
for (const key of ['document_id', 'provider', 'geo']) {
|
|
84
|
+
if (!nonEmptyString(doc[key])) {
|
|
85
|
+
errors.push(mdError('MD-002', `${key} is required and must be a non-empty string.`, key));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (!nonEmptyString(doc.as_of)) {
|
|
89
|
+
errors.push(mdError('MD-003', 'as_of is required — an observation set with no vintage is not attributable.', 'as_of'));
|
|
90
|
+
}
|
|
91
|
+
else if (!isValidAsOf(doc.as_of)) {
|
|
92
|
+
errors.push(mdError('MD-004', `as_of must be a real calendar date as YYYY-MM-DD; got '${doc.as_of}'.`, 'as_of'));
|
|
93
|
+
}
|
|
94
|
+
// A market-data document is not an underwriting record, and the cheapest way
|
|
95
|
+
// for it to be misread as one is to carry a deal_id.
|
|
96
|
+
if ('deal_id' in doc) {
|
|
97
|
+
errors.push(mdError('MD-005', 'A market-data document MUST NOT carry deal_id — it is not an underwriting record.', 'deal_id'));
|
|
98
|
+
}
|
|
99
|
+
if (!Array.isArray(doc.observations)) {
|
|
100
|
+
errors.push(mdError('MD-006', 'observations must be an array.', 'observations'));
|
|
101
|
+
return errors;
|
|
102
|
+
}
|
|
103
|
+
if (doc.observations.length === 0) {
|
|
104
|
+
errors.push(mdError('MD-007', 'observations must not be empty.', 'observations'));
|
|
105
|
+
}
|
|
106
|
+
const seen = new Set();
|
|
107
|
+
doc.observations.forEach((raw, i) => {
|
|
108
|
+
const at = `observations[${i}]`;
|
|
109
|
+
if (!isRecord(raw)) {
|
|
110
|
+
errors.push(mdError('MD-008', 'Observation must be an object.', at));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const obs = raw;
|
|
114
|
+
if (!nonEmptyString(obs.field_path)) {
|
|
115
|
+
errors.push(mdError('MD-009', 'field_path is required.', `${at}.field_path`));
|
|
116
|
+
}
|
|
117
|
+
else if (!isDealFieldPath(obs.field_path)) {
|
|
118
|
+
errors.push(mdError('MD-010', `field_path '${obs.field_path}' is not a path a deal record could carry. It must be <section>.<field> where the section is registered by FORMAT_SPEC Part IV or is an x_ extension section.`, `${at}.field_path`));
|
|
119
|
+
}
|
|
120
|
+
else if (seen.has(obs.field_path)) {
|
|
121
|
+
// Two observations for one path make resolution order-dependent, which is
|
|
122
|
+
// the one thing a deterministic resolver must never be.
|
|
123
|
+
errors.push(mdError('MD-011', `Duplicate observation for field_path '${obs.field_path}'.`, `${at}.field_path`));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
seen.add(obs.field_path);
|
|
127
|
+
}
|
|
128
|
+
if (!('value' in obs)) {
|
|
129
|
+
errors.push(mdError('MD-012', 'value is required.', `${at}.value`));
|
|
130
|
+
}
|
|
131
|
+
if (!nonEmptyString(obs.unit)) {
|
|
132
|
+
errors.push(mdError('MD-013', 'unit is required.', `${at}.unit`));
|
|
133
|
+
}
|
|
134
|
+
if (!nonEmptyString(obs.basis)) {
|
|
135
|
+
errors.push(mdError('MD-014', 'basis is required and must not be empty — a number with no stated basis is an assertion, not an observation.', `${at}.basis`));
|
|
136
|
+
}
|
|
137
|
+
if (obs.range !== undefined) {
|
|
138
|
+
const r = obs.range;
|
|
139
|
+
if (!isRecord(r) || !['low', 'central', 'high'].every((k) => typeof r[k] === 'number')) {
|
|
140
|
+
errors.push(mdError('MD-015', 'range must carry numeric low, central, and high.', `${at}.range`));
|
|
141
|
+
}
|
|
142
|
+
else if (!(r.low <= r.central && r.central <= r.high)) {
|
|
143
|
+
errors.push(mdError('MD-016', `range must satisfy low <= central <= high; got ${r.low}, ${r.central}, ${r.high}.`, `${at}.range`));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
return errors;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Read a market-data document out of a parsed UW file, refusing rather than
|
|
151
|
+
* repairing. Throws `MarketDataError` naming the first problem.
|
|
152
|
+
*/
|
|
153
|
+
export function parseMarketDataDocument(parsed) {
|
|
154
|
+
const frontmatter = parsed.frontmatter;
|
|
155
|
+
const profile = frontmatter.document_profile;
|
|
156
|
+
if (profile !== MARKET_DATA_PROFILE_ID) {
|
|
157
|
+
throw new MarketDataError('MD-017', `Expected document_profile '${MARKET_DATA_PROFILE_ID}'; got ${profile === undefined ? 'none' : `'${String(profile)}'`}.`);
|
|
158
|
+
}
|
|
159
|
+
const entry = parsed.sections[MARKET_OBSERVATIONS_SECTION];
|
|
160
|
+
if (!entry) {
|
|
161
|
+
throw new MarketDataError('MD-018', `A market-data document must carry a '${MARKET_OBSERVATIONS_SECTION}' section.`);
|
|
162
|
+
}
|
|
163
|
+
const block = 'annotation' in entry
|
|
164
|
+
? entry
|
|
165
|
+
: Object.values(entry)[0];
|
|
166
|
+
const content = block.content;
|
|
167
|
+
const candidate = {
|
|
168
|
+
document_id: frontmatter.document_id,
|
|
169
|
+
as_of: frontmatter.as_of,
|
|
170
|
+
provider: frontmatter.provider,
|
|
171
|
+
geo: frontmatter.geo,
|
|
172
|
+
...(frontmatter.asset_class !== undefined ? { asset_class: frontmatter.asset_class } : {}),
|
|
173
|
+
...('deal_id' in frontmatter ? { deal_id: frontmatter.deal_id } : {}),
|
|
174
|
+
observations: content?.observations,
|
|
175
|
+
};
|
|
176
|
+
const errors = validateMarketDataDocument(candidate);
|
|
177
|
+
if (errors.length > 0) {
|
|
178
|
+
throw new MarketDataError(errors[0].code, errors.map((e) => e.message).join('; '));
|
|
179
|
+
}
|
|
180
|
+
return candidate;
|
|
181
|
+
}
|
|
182
|
+
/** 90 days. */
|
|
183
|
+
export const DEFAULT_MARKET_DATA_STALENESS_SECONDS = 90 * 24 * 60 * 60;
|
|
184
|
+
/**
|
|
185
|
+
* Wrap a market-data document as a `MarketDataLookup`, so it drops into the
|
|
186
|
+
* existing cascade with no change to `resolveValue`.
|
|
187
|
+
*
|
|
188
|
+
* Staleness is measured from the document's `as_of`, not from a wall-clock
|
|
189
|
+
* guess about when the file was written. A stale observation resolves to
|
|
190
|
+
* `null`, so the cascade falls through to `asset_class_default` — the value is
|
|
191
|
+
* not silently used past its vintage.
|
|
192
|
+
*/
|
|
193
|
+
export function createDocumentMarketData(doc, opts = {}) {
|
|
194
|
+
const staleness = opts.staleness_seconds ?? DEFAULT_MARKET_DATA_STALENESS_SECONDS;
|
|
195
|
+
const byPath = new Map(doc.observations.map((o) => [o.field_path, o]));
|
|
196
|
+
return {
|
|
197
|
+
staleness_seconds: staleness,
|
|
198
|
+
resolve(field_path, context) {
|
|
199
|
+
if (doc.asset_class !== undefined && doc.asset_class !== context.asset_class)
|
|
200
|
+
return null;
|
|
201
|
+
// `context.geo` is the caller's; `opts.geo` lets a host pin one without
|
|
202
|
+
// threading it through every cascade call. Either mismatching is a miss.
|
|
203
|
+
const wantedGeo = context.geo ?? opts.geo;
|
|
204
|
+
if (wantedGeo !== undefined && wantedGeo !== doc.geo)
|
|
205
|
+
return null;
|
|
206
|
+
const observation = byPath.get(field_path);
|
|
207
|
+
if (!observation)
|
|
208
|
+
return null;
|
|
209
|
+
const now = opts.now ?? new Date();
|
|
210
|
+
const asOfMs = new Date(`${doc.as_of}T00:00:00Z`).getTime();
|
|
211
|
+
const ageSeconds = (now.getTime() - asOfMs) / 1000;
|
|
212
|
+
if (ageSeconds > staleness)
|
|
213
|
+
return null;
|
|
214
|
+
return {
|
|
215
|
+
value: observation.value,
|
|
216
|
+
...(observation.range ? { range: observation.range } : {}),
|
|
217
|
+
source_id: doc.document_id,
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
const DIGEST_PATTERN = /^sha256:[0-9a-f]{64}$/;
|
|
223
|
+
/**
|
|
224
|
+
* Build the value and provenance for promoting one observation to an input of
|
|
225
|
+
* record.
|
|
226
|
+
*
|
|
227
|
+
* This deliberately returns a payload rather than editing a document. Promotion
|
|
228
|
+
* is an explicit Tier-2 edit by a named actor, never automatic and never a side
|
|
229
|
+
* effect of resolution — so the host applies it through `applyEdit` with its own
|
|
230
|
+
* actor and timestamp, and this function cannot promote anything by itself.
|
|
231
|
+
*
|
|
232
|
+
* The result is always tagged `market_data_accepted`, never `user_input`. That
|
|
233
|
+
* is the crux of §4: a value accepted for lack of better evidence and a value
|
|
234
|
+
* established by diligence are different claims, and a file that renders them
|
|
235
|
+
* identically has destroyed something a credit reviewer needs.
|
|
236
|
+
*/
|
|
237
|
+
export function promoteMarketObservation(opts) {
|
|
238
|
+
const { document, field_path, digest, rationale } = opts;
|
|
239
|
+
if (!DIGEST_PATTERN.test(digest)) {
|
|
240
|
+
throw new MarketDataError('MD-021', `Promotion requires the observation set's digest as 'sha256:<64 lowercase hex>'; got '${digest}'.`);
|
|
241
|
+
}
|
|
242
|
+
const observation = document.observations.find((o) => o.field_path === field_path);
|
|
243
|
+
if (!observation) {
|
|
244
|
+
throw new MarketDataError('MD-022', `Observation set '${document.document_id}' carries no observation for '${field_path}'.`);
|
|
245
|
+
}
|
|
246
|
+
const dot = field_path.indexOf('.');
|
|
247
|
+
return {
|
|
248
|
+
section: field_path.slice(0, dot),
|
|
249
|
+
field: field_path.slice(dot + 1),
|
|
250
|
+
value: observation.value,
|
|
251
|
+
unit: observation.unit,
|
|
252
|
+
source: 'market_data_accepted',
|
|
253
|
+
...(observation.confidence ? { confidence: observation.confidence } : {}),
|
|
254
|
+
market_data_ref: {
|
|
255
|
+
document_id: document.document_id,
|
|
256
|
+
as_of: document.as_of,
|
|
257
|
+
digest,
|
|
258
|
+
...(rationale ? { rationale } : {}),
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Pick the observation set to use when several are in scope: the most recent
|
|
264
|
+
* `as_of` wins.
|
|
265
|
+
*
|
|
266
|
+
* A tie is an error rather than a silent pick, on the same reasoning as RFC
|
|
267
|
+
* 0021's ambiguous-inheritance rule — two same-dated sets from different
|
|
268
|
+
* providers genuinely disagree about which is authoritative, and choosing by
|
|
269
|
+
* array order would make the answer depend on directory listing.
|
|
270
|
+
*/
|
|
271
|
+
export function selectCurrentMarketData(docs) {
|
|
272
|
+
if (docs.length === 0) {
|
|
273
|
+
throw new MarketDataError('MD-019', 'No market-data documents to select from.');
|
|
274
|
+
}
|
|
275
|
+
let best = docs[0];
|
|
276
|
+
let tied = [];
|
|
277
|
+
for (const doc of docs.slice(1)) {
|
|
278
|
+
if (doc.as_of > best.as_of) {
|
|
279
|
+
best = doc;
|
|
280
|
+
tied = [];
|
|
281
|
+
}
|
|
282
|
+
else if (doc.as_of === best.as_of && doc.document_id !== best.document_id) {
|
|
283
|
+
tied.push(doc);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (tied.length > 0) {
|
|
287
|
+
const ids = [best, ...tied].map((d) => d.document_id).sort().join(', ');
|
|
288
|
+
throw new MarketDataError('MD-020', `Ambiguous market data: ${tied.length + 1} documents share as_of '${best.as_of}' (${ids}). Resolve which is authoritative rather than letting order decide.`);
|
|
289
|
+
}
|
|
290
|
+
return best;
|
|
291
|
+
}
|
|
292
|
+
//# sourceMappingURL=market-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"market-data.js","sourceRoot":"","sources":["../src/market-data.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,6EAA6E;AAC7E,qCAAqC;AACrC,EAAE;AACF,0EAA0E;AAC1E,YAAY;AACZ,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,0EAA0E;AAC1E,uDAAuD;AACvD,+EAA+E;AAC/E,wDAAwD;AACxD,EAAE;AACF,yEAAyE;AACzE,6EAA6E;AAC7E,0EAA0E;AAC1E,WAAW;AAGX,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,eAAe,CAAC;AAGvB,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,sEAAsE;AACtE,MAAM,CAAC,MAAM,2BAA2B,GAAG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AAQ,EACR,0BAA0B,IAAI,CAAC,MAAM,GAAG,CAAC,2BAA2B,IAAI,CAAC,KAAK,MAAM,GAAG,qEAAqE,CAC7J,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AssetClass, ConfidenceLevel, DealStage, FinancialThresholds, ParsedUWFile, PipelineStatus, UWBlock, UWMeta, ValidationMessage, ValidationSeverity } from './types.js';
|
|
2
2
|
/** Semver of this protocol. Bumped independently of @uwmd/core's npm version. */
|
|
3
|
-
export declare const PROTOCOL_VERSION: "1.
|
|
3
|
+
export declare const PROTOCOL_VERSION: "1.5.0";
|
|
4
4
|
/** Format spec version this protocol pairs with. */
|
|
5
5
|
export declare const FORMAT_VERSION: "1.1";
|
|
6
6
|
/** The four conformance tiers defined in UW_PROTOCOL_v1.md Part II. */
|
|
@@ -141,17 +141,40 @@ export type ViewModelRegistry = Readonly<Record<string, SectionViewModel>>;
|
|
|
141
141
|
* Step 0 (`user_override`) and step 1 (`user_input`) are detected by
|
|
142
142
|
* walking the parsed file for an existing block at the field path
|
|
143
143
|
* whose `_meta.source` matches; the remaining steps are looked up in
|
|
144
|
-
* external tables (investor profile, market data)
|
|
145
|
-
* (asset class, global, system).
|
|
144
|
+
* external tables (inherited assumptions, investor profile, market data)
|
|
145
|
+
* or built-in tables (asset class, global, system).
|
|
146
|
+
*
|
|
147
|
+
* **`inherited_assumption` was added by RFC 0021 §5 (protocol 1.5.0),**
|
|
148
|
+
* taking the cascade from seven steps to eight. It sits directly below
|
|
149
|
+
* `user_input`, so a value someone entered on the deal always beats one
|
|
150
|
+
* inherited from an ancestor — inheritance supplies defaults, it never
|
|
151
|
+
* overrides.
|
|
152
|
+
*
|
|
153
|
+
* It sits *above* `investor_profile`, which the RFC's own diagram is silent
|
|
154
|
+
* on because that diagram omits `investor_profile` entirely. Resolved on the
|
|
155
|
+
* merits: an inherited assumption comes from a named ancestor in this deal's
|
|
156
|
+
* composition DAG, so it is more specific to this deal than an
|
|
157
|
+
* institution-wide preference set, and the more specific source should win.
|
|
158
|
+
*
|
|
159
|
+
* Inheritance resolves along the composition DAG **only**. A document not
|
|
160
|
+
* reachable as an ancestor contributes nothing, and there is no ambient or
|
|
161
|
+
* global assumption scope — so a standalone record, which is every record
|
|
162
|
+
* that existed before RFC 0021, can never resolve at this step and no
|
|
163
|
+
* existing digest moves.
|
|
146
164
|
*/
|
|
147
|
-
export type CascadeStep = 'user_override' | 'user_input' | 'investor_profile' | 'market_data' | 'asset_class_default' | 'global_default' | 'system_default';
|
|
165
|
+
export type CascadeStep = 'user_override' | 'user_input' | 'inherited_assumption' | 'investor_profile' | 'market_data' | 'asset_class_default' | 'global_default' | 'system_default';
|
|
148
166
|
/** Ordered cascade as a runtime value (frozen). Index === precedence. */
|
|
149
167
|
export declare const CASCADE_ORDER: readonly CascadeStep[];
|
|
150
168
|
/**
|
|
151
169
|
* The full set of canonical short-form source tags producers stamp into
|
|
152
|
-
* `_meta.source`.
|
|
153
|
-
*
|
|
154
|
-
*
|
|
170
|
+
* `_meta.source`. Eight of these match `CascadeStep` 1:1; the rest are
|
|
171
|
+
* non-cascade tags — `manual`, `ai_extracted`, `agent_computed`,
|
|
172
|
+
* `scenario_default`, and `market_data_accepted`.
|
|
173
|
+
*
|
|
174
|
+
* `market_data_accepted` (RFC 0022 §4) is deliberately *not* a cascade step:
|
|
175
|
+
* it is an in-file value of record that resolves at the `user_input` step
|
|
176
|
+
* while keeping its own tag, because a value accepted for lack of better
|
|
177
|
+
* evidence must stay distinguishable from one someone typed in.
|
|
155
178
|
*
|
|
156
179
|
* `scenario_default` is retained but its meaning is sharpened to mean
|
|
157
180
|
* "value derived from a named scenario in the file or institution
|
|
@@ -162,7 +185,7 @@ export declare const CASCADE_ORDER: readonly CascadeStep[];
|
|
|
162
185
|
* `import:filename.pdf`) remain valid; this constant enumerates the
|
|
163
186
|
* canonical short forms only.
|
|
164
187
|
*/
|
|
165
|
-
export declare const SOURCE_TAGS: readonly ["user_input", "user_override", "manual", "investor_profile", "market_data", "ai_extracted", "agent_computed", "asset_class_default", "scenario_default", "global_default", "system_default"];
|
|
188
|
+
export declare const SOURCE_TAGS: readonly ["user_input", "user_override", "manual", "inherited_assumption", "investor_profile", "market_data", "market_data_accepted", "ai_extracted", "agent_computed", "asset_class_default", "scenario_default", "global_default", "system_default"];
|
|
166
189
|
export type CanonicalSourceTag = (typeof SOURCE_TAGS)[number];
|
|
167
190
|
/**
|
|
168
191
|
* What a producer should do when an incomplete-data condition (missing or
|
|
@@ -371,6 +394,31 @@ export interface ModuleLoadResult {
|
|
|
371
394
|
manifest?: ModuleManifest;
|
|
372
395
|
errors: ProtocolError[];
|
|
373
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* The section ids the format registers in `UW_FORMAT_SPEC_v1.md` Part IV: the
|
|
399
|
+
* 21 standard data sections (§ 4.0 – § 4.20) plus `gaps` (§ 4.22). Each entry is
|
|
400
|
+
* the `**ID:**` that subsection declares. § 4.21 is the `x_` extension
|
|
401
|
+
* meta-spec, which registers a namespace rather than a section, so it has no id
|
|
402
|
+
* here.
|
|
403
|
+
*
|
|
404
|
+
* This exists because "is this a section the format knows about?" had no single
|
|
405
|
+
* answer in the library. `BUILTIN_VIEW_MODELS` claims to be that list and is
|
|
406
|
+
* not — it omits eight of these (including `operating_statement`) and adds
|
|
407
|
+
* eight ids Part IV never registers — and `lite-bridge.ts` keeps a third,
|
|
408
|
+
* different list. Rather than pick one of two wrong answers, RFC 0022 reads the
|
|
409
|
+
* spec, which is the authority. Reconciling the other two is tracked separately;
|
|
410
|
+
* `protocol.test.ts` pins this list so it cannot drift from Part IV silently.
|
|
411
|
+
*
|
|
412
|
+
* Extension sections (`x_`-prefixed, § 4.21) are valid but deliberately absent:
|
|
413
|
+
* they are institution-defined, so membership here would be a category error.
|
|
414
|
+
* Use `isStandardSectionId` for registry membership and check the `x_` prefix
|
|
415
|
+
* separately when extensions are permitted.
|
|
416
|
+
*/
|
|
417
|
+
export declare const STANDARD_SECTION_IDS: readonly string[];
|
|
418
|
+
/** True when `id` is a section registered by FORMAT_SPEC Part IV. */
|
|
419
|
+
export declare function isStandardSectionId(id: string): boolean;
|
|
420
|
+
/** The `x_` namespace FORMAT_SPEC § 4.21 reserves for non-standard content. */
|
|
421
|
+
export declare const EXTENSION_SECTION_PREFIX: "x_";
|
|
374
422
|
/**
|
|
375
423
|
* A profile is a versioned contract for the *purpose and permitted sections* of
|
|
376
424
|
* one document. It is not a filename extension, an asset class, a pipeline
|
|
@@ -388,6 +436,7 @@ export interface DocumentProfile {
|
|
|
388
436
|
export declare const DEAL_UNDERWRITING_PROFILE: "deal-underwriting-v1";
|
|
389
437
|
export declare const LEASE_ABSTRACT_PROFILE: "lease-abstract-v1";
|
|
390
438
|
export declare const SOURCE_NOTE_PROFILE: "source-note-v1";
|
|
439
|
+
export declare const MARKET_DATA_PROFILE: "market-data-v1";
|
|
391
440
|
export declare const BUILTIN_DOCUMENT_PROFILES: readonly DocumentProfile[];
|
|
392
441
|
/**
|
|
393
442
|
* Profile identifiers are opaque lowercase ASCII tokens. An unknown profile is
|
package/dist/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAIpB,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD,oDAAoD;AACpD,eAAO,MAAM,cAAc,EAAG,KAAc,CAAC;AAI7C,uEAAuE;AACvE,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,mBAA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11,7 @@
|
|
|
11
11
|
// operations are a layer over JSON Schema.
|
|
12
12
|
// ─── Versioning ───────────────────────────────────────────────────────────────
|
|
13
13
|
/** Semver of this protocol. Bumped independently of @uwmd/core's npm version. */
|
|
14
|
-
export const PROTOCOL_VERSION = '1.
|
|
14
|
+
export const PROTOCOL_VERSION = '1.5.0';
|
|
15
15
|
/** Format spec version this protocol pairs with. */
|
|
16
16
|
export const FORMAT_VERSION = '1.1';
|
|
17
17
|
/** Default number-formatting table referenced by Part III §3.1. */
|
|
@@ -31,6 +31,7 @@ export const DEFAULT_DATE_FORMAT = {
|
|
|
31
31
|
export const CASCADE_ORDER = Object.freeze([
|
|
32
32
|
'user_override',
|
|
33
33
|
'user_input',
|
|
34
|
+
'inherited_assumption',
|
|
34
35
|
'investor_profile',
|
|
35
36
|
'market_data',
|
|
36
37
|
'asset_class_default',
|
|
@@ -39,9 +40,14 @@ export const CASCADE_ORDER = Object.freeze([
|
|
|
39
40
|
]);
|
|
40
41
|
/**
|
|
41
42
|
* The full set of canonical short-form source tags producers stamp into
|
|
42
|
-
* `_meta.source`.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* `_meta.source`. Eight of these match `CascadeStep` 1:1; the rest are
|
|
44
|
+
* non-cascade tags — `manual`, `ai_extracted`, `agent_computed`,
|
|
45
|
+
* `scenario_default`, and `market_data_accepted`.
|
|
46
|
+
*
|
|
47
|
+
* `market_data_accepted` (RFC 0022 §4) is deliberately *not* a cascade step:
|
|
48
|
+
* it is an in-file value of record that resolves at the `user_input` step
|
|
49
|
+
* while keeping its own tag, because a value accepted for lack of better
|
|
50
|
+
* evidence must stay distinguishable from one someone typed in.
|
|
45
51
|
*
|
|
46
52
|
* `scenario_default` is retained but its meaning is sharpened to mean
|
|
47
53
|
* "value derived from a named scenario in the file or institution
|
|
@@ -56,8 +62,10 @@ export const SOURCE_TAGS = Object.freeze([
|
|
|
56
62
|
'user_input',
|
|
57
63
|
'user_override',
|
|
58
64
|
'manual',
|
|
65
|
+
'inherited_assumption',
|
|
59
66
|
'investor_profile',
|
|
60
67
|
'market_data',
|
|
68
|
+
'market_data_accepted',
|
|
61
69
|
'ai_extracted',
|
|
62
70
|
'agent_computed',
|
|
63
71
|
'asset_class_default',
|
|
@@ -203,9 +211,62 @@ export function lookupIncompleteDataPolicy(section, field_path, stage, policies
|
|
|
203
211
|
}
|
|
204
212
|
return best;
|
|
205
213
|
}
|
|
214
|
+
// ─── Standard section registry (FORMAT_SPEC Part IV) ─────────────────────────
|
|
215
|
+
/**
|
|
216
|
+
* The section ids the format registers in `UW_FORMAT_SPEC_v1.md` Part IV: the
|
|
217
|
+
* 21 standard data sections (§ 4.0 – § 4.20) plus `gaps` (§ 4.22). Each entry is
|
|
218
|
+
* the `**ID:**` that subsection declares. § 4.21 is the `x_` extension
|
|
219
|
+
* meta-spec, which registers a namespace rather than a section, so it has no id
|
|
220
|
+
* here.
|
|
221
|
+
*
|
|
222
|
+
* This exists because "is this a section the format knows about?" had no single
|
|
223
|
+
* answer in the library. `BUILTIN_VIEW_MODELS` claims to be that list and is
|
|
224
|
+
* not — it omits eight of these (including `operating_statement`) and adds
|
|
225
|
+
* eight ids Part IV never registers — and `lite-bridge.ts` keeps a third,
|
|
226
|
+
* different list. Rather than pick one of two wrong answers, RFC 0022 reads the
|
|
227
|
+
* spec, which is the authority. Reconciling the other two is tracked separately;
|
|
228
|
+
* `protocol.test.ts` pins this list so it cannot drift from Part IV silently.
|
|
229
|
+
*
|
|
230
|
+
* Extension sections (`x_`-prefixed, § 4.21) are valid but deliberately absent:
|
|
231
|
+
* they are institution-defined, so membership here would be a category error.
|
|
232
|
+
* Use `isStandardSectionId` for registry membership and check the `x_` prefix
|
|
233
|
+
* separately when extensions are permitted.
|
|
234
|
+
*/
|
|
235
|
+
export const STANDARD_SECTION_IDS = Object.freeze([
|
|
236
|
+
'deal_context',
|
|
237
|
+
'property',
|
|
238
|
+
'ownership',
|
|
239
|
+
'rent_roll',
|
|
240
|
+
'operating_statement',
|
|
241
|
+
'noi_model',
|
|
242
|
+
'valuation',
|
|
243
|
+
'debt_structure',
|
|
244
|
+
'sources_uses',
|
|
245
|
+
'dcf',
|
|
246
|
+
'stress_tests',
|
|
247
|
+
'market_analysis',
|
|
248
|
+
'borrower_sponsor',
|
|
249
|
+
'due_diligence',
|
|
250
|
+
'risk_assessment',
|
|
251
|
+
'compliance',
|
|
252
|
+
'assumptions',
|
|
253
|
+
'validation',
|
|
254
|
+
'pipeline_log',
|
|
255
|
+
'custom_calculations',
|
|
256
|
+
'custom_scenarios',
|
|
257
|
+
'gaps',
|
|
258
|
+
]);
|
|
259
|
+
const STANDARD_SECTION_ID_SET = new Set(STANDARD_SECTION_IDS);
|
|
260
|
+
/** True when `id` is a section registered by FORMAT_SPEC Part IV. */
|
|
261
|
+
export function isStandardSectionId(id) {
|
|
262
|
+
return STANDARD_SECTION_ID_SET.has(id);
|
|
263
|
+
}
|
|
264
|
+
/** The `x_` namespace FORMAT_SPEC § 4.21 reserves for non-standard content. */
|
|
265
|
+
export const EXTENSION_SECTION_PREFIX = 'x_';
|
|
206
266
|
export const DEAL_UNDERWRITING_PROFILE = 'deal-underwriting-v1';
|
|
207
267
|
export const LEASE_ABSTRACT_PROFILE = 'lease-abstract-v1';
|
|
208
268
|
export const SOURCE_NOTE_PROFILE = 'source-note-v1';
|
|
269
|
+
export const MARKET_DATA_PROFILE = 'market-data-v1';
|
|
209
270
|
export const BUILTIN_DOCUMENT_PROFILES = Object.freeze([
|
|
210
271
|
Object.freeze({
|
|
211
272
|
id: DEAL_UNDERWRITING_PROFILE,
|
|
@@ -225,6 +286,15 @@ export const BUILTIN_DOCUMENT_PROFILES = Object.freeze([
|
|
|
225
286
|
required_identity: Object.freeze(['document_id']),
|
|
226
287
|
financial_role: 'evidence',
|
|
227
288
|
}),
|
|
289
|
+
Object.freeze({
|
|
290
|
+
// RFC 0022. `evidence`, not `underwriting`: a market-data document carries
|
|
291
|
+
// observations, contains no calculations, and no pack applies to it. It has
|
|
292
|
+
// no `deal_id` and must never be read as an underwriting record.
|
|
293
|
+
id: MARKET_DATA_PROFILE,
|
|
294
|
+
purpose: 'Dated, attributable market observations for one geography and asset class.',
|
|
295
|
+
required_identity: Object.freeze(['document_id', 'as_of', 'provider', 'geo']),
|
|
296
|
+
financial_role: 'evidence',
|
|
297
|
+
}),
|
|
228
298
|
]);
|
|
229
299
|
const PROFILE_BY_ID = new Map(BUILTIN_DOCUMENT_PROFILES.map((p) => [p.id, p]));
|
|
230
300
|
/**
|