@htilabs/platform-common-models 0.20.0 → 0.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.
Files changed (53) hide show
  1. package/dist/cvcs/index.cjs +222 -120
  2. package/dist/cvcs/index.cjs.map +1 -1
  3. package/dist/cvcs/index.d.cts +223 -117
  4. package/dist/cvcs/index.d.ts +223 -117
  5. package/dist/cvcs/index.js +222 -120
  6. package/dist/cvcs/index.js.map +1 -1
  7. package/dist/enums/index.cjs.map +1 -1
  8. package/dist/enums/index.d.cts +4 -4
  9. package/dist/enums/index.d.ts +4 -4
  10. package/dist/enums/index.js.map +1 -1
  11. package/dist/{index-I-DiX9eQ.d.ts → index-CDoqrfc1.d.ts} +1 -1
  12. package/dist/{index-CoVr1jIV.d.cts → index-Zu_mOJRn.d.cts} +1 -1
  13. package/dist/index.cjs +320 -137
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +3 -3
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.js +319 -137
  18. package/dist/index.js.map +1 -1
  19. package/dist/information-scope/index.cjs +98 -17
  20. package/dist/information-scope/index.cjs.map +1 -1
  21. package/dist/information-scope/index.d.cts +142 -13
  22. package/dist/information-scope/index.d.ts +142 -13
  23. package/dist/information-scope/index.js +97 -17
  24. package/dist/information-scope/index.js.map +1 -1
  25. package/dist/models/index.d.cts +2 -2
  26. package/dist/models/index.d.ts +2 -2
  27. package/dist/schemas/index.d.cts +25 -25
  28. package/dist/schemas/index.d.ts +25 -25
  29. package/dist/services/index.cjs +98 -17
  30. package/dist/services/index.cjs.map +1 -1
  31. package/dist/services/index.d.cts +1 -1
  32. package/dist/services/index.d.ts +1 -1
  33. package/dist/services/index.js +97 -17
  34. package/dist/services/index.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/__tests__/__snapshots__/cvc-sot.snap +2 -2
  37. package/src/__tests__/core-information-scope-invariant.test.ts +141 -15
  38. package/src/__tests__/cvc-sot-snapshot.test.ts +4 -3
  39. package/src/__tests__/cvc-structural.test.ts +2 -2
  40. package/src/__tests__/location-type-routing-invariant.test.ts +1 -1
  41. package/src/cvcs/{coreInformationScope.v2.0.0.json → coreInformationScope.v2.1.0.json} +190 -88
  42. package/src/cvcs/index.ts +2 -2
  43. package/src/cvcs/{roiScope.v1.3.0.json → roiScope.v1.4.0.json} +26 -26
  44. package/src/generated/cvc-enums.ts +4 -4
  45. package/src/services/__tests__/fixtures/infoscope-v4/information_scope_v3_placements.projection.csv +12 -0
  46. package/src/services/__tests__/fixtures/infoscope-v4/information_scope_v4.migrations.csv +27 -27
  47. package/src/services/__tests__/fixtures/infoscope-v4/information_scope_v4.rows.csv +1 -1
  48. package/src/services/__tests__/fixtures/infoscope-v4/loadInfoscopeV4Fixtures.ts +85 -14
  49. package/src/services/__tests__/informationScopeResolver.test.ts +336 -22
  50. package/src/services/informationScopeResolver.ts +226 -19
  51. package/src/services/informationScopeSot.ts +50 -8
  52. package/dist/{cvcEntry-BCj1OWqL.d.cts → cvcEntry-0BIB9sen.d.cts} +8 -8
  53. package/dist/{cvcEntry-BCj1OWqL.d.ts → cvcEntry-0BIB9sen.d.ts} +8 -8
@@ -1,6 +1,6 @@
1
1
  import * as mongoose from 'mongoose';
2
2
  import { InferRawDocType, Schema } from 'mongoose';
3
- export { C as Choice, a as CvcEntry, b as CvcRegistry, F as Form, c as FormSectionRef, G as Guidance, L as Layout, P as PlatformFunction, d as PlatformRole, Q as Question, S as ScoringCondition, e as ScoringRecommendation, f as ScoringRule, g as ScoringThreshold, h as Section, i as SectionQuestionRef, V as VisibilityRule, j as buildCvcEntrySchema, k as buildCvcRegistrySchema, l as buildFormSchema, m as buildPlatformFunctionSchema, n as buildPlatformRoleSchema, o as buildQuestionSchema, p as buildScoringRuleSchema, q as buildSectionSchema, r as choiceSchema, s as cvcEntrySchemaDefinition, t as cvcEntrySchemaOptions, u as cvcRegistrySchemaDefinition, v as cvcRegistrySchemaOptions, w as formSchemaDefinition, x as formSchemaOptions, y as formSectionRefSchema, z as guidanceSchema, A as layoutSchema, B as platformFunctionSchemaDefinition, D as platformFunctionSchemaOptions, E as platformRoleSchemaDefinition, H as platformRoleSchemaOptions, I as questionSchemaDefinition, J as questionSchemaOptions, K as scoringConditionSchema, M as scoringRecommendationSchema, N as scoringRuleSchemaDefinition, O as scoringRuleSchemaOptions, R as scoringThresholdSchema, T as sectionQuestionRefSchema, U as sectionSchemaDefinition, W as sectionSchemaOptions, X as visibilityRuleSchema } from '../cvcEntry-BCj1OWqL.js';
3
+ export { C as Choice, a as CvcEntry, b as CvcRegistry, F as Form, c as FormSectionRef, G as Guidance, L as Layout, P as PlatformFunction, d as PlatformRole, Q as Question, S as ScoringCondition, e as ScoringRecommendation, f as ScoringRule, g as ScoringThreshold, h as Section, i as SectionQuestionRef, V as VisibilityRule, j as buildCvcEntrySchema, k as buildCvcRegistrySchema, l as buildFormSchema, m as buildPlatformFunctionSchema, n as buildPlatformRoleSchema, o as buildQuestionSchema, p as buildScoringRuleSchema, q as buildSectionSchema, r as choiceSchema, s as cvcEntrySchemaDefinition, t as cvcEntrySchemaOptions, u as cvcRegistrySchemaDefinition, v as cvcRegistrySchemaOptions, w as formSchemaDefinition, x as formSchemaOptions, y as formSectionRefSchema, z as guidanceSchema, A as layoutSchema, B as platformFunctionSchemaDefinition, D as platformFunctionSchemaOptions, E as platformRoleSchemaDefinition, H as platformRoleSchemaOptions, I as questionSchemaDefinition, J as questionSchemaOptions, K as scoringConditionSchema, M as scoringRecommendationSchema, N as scoringRuleSchemaDefinition, O as scoringRuleSchemaOptions, R as scoringThresholdSchema, T as sectionQuestionRefSchema, U as sectionSchemaDefinition, W as sectionSchemaOptions, X as visibilityRuleSchema } from '../cvcEntry-0BIB9sen.js';
4
4
  export { A as AGENCY_ORG_TYPE_VALIDATED_UPDATE_OPS, a as AddAgencyOrgTypeFieldsOptions, b as AgencyOrgTypeFields, O as ORG_TYPE_FIELD_NAMES, c as OrgTypeFieldName, d as OrgTypeFields, e as OrgTypeFieldsHolder, V as VSP_TWO_STEP_ISSUE, f as addAgencyOrgTypeFields, g as addOrgTypeFields, h as agencyOrgTypeSchemaDefinition, i as applyRunValidatorsIfUnset, m as mirrorOrgTypeFields, o as orgTypeFieldsDiffer, j as orgTypeSchemaDefinition, r as resolveEffectiveOrgType, k as resolveEffectiveOrgTypeFields, v as vspTwoStepHolds, l as vspTwoStepHoldsOnUpdate } from '../agency-Ca4pCOOf.js';
5
5
  import '../org-type-BYQb9Qzq.js';
6
6
  import '../enums/index.js';
@@ -135,12 +135,12 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
135
135
  number?: string | null | undefined;
136
136
  type?: string | null | undefined;
137
137
  safeToContact?: boolean | null | undefined;
138
- dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
138
+ dataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
139
139
  }, mongoose.Document<unknown, {}, {
140
140
  number?: string | null | undefined;
141
141
  type?: string | null | undefined;
142
142
  safeToContact?: boolean | null | undefined;
143
- dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
143
+ dataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
144
144
  }, {
145
145
  id: string;
146
146
  }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
@@ -149,7 +149,7 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
149
149
  number?: string | null | undefined;
150
150
  type?: string | null | undefined;
151
151
  safeToContact?: boolean | null | undefined;
152
- dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
152
+ dataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
153
153
  } & {
154
154
  _id: mongoose.Types.ObjectId;
155
155
  } & {
@@ -160,7 +160,7 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
160
160
  number?: string | null | undefined;
161
161
  type?: string | null | undefined;
162
162
  safeToContact?: boolean | null | undefined;
163
- dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
163
+ dataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
164
164
  } & {
165
165
  _id: mongoose.Types.ObjectId;
166
166
  } & {
@@ -222,11 +222,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
222
222
  raceOtherText?: string | null | undefined;
223
223
  genderOtherText?: string | null | undefined;
224
224
  accommodationOtherText?: string | null | undefined;
225
- ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
226
- sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
227
- genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
228
- raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
229
- ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
225
+ ageDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
226
+ sexDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
227
+ genderDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
228
+ raceDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
229
+ ethnicityDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
230
230
  }, mongoose.Document<unknown, {}, {
231
231
  race: number[];
232
232
  ethnicity: number[];
@@ -246,11 +246,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
246
246
  raceOtherText?: string | null | undefined;
247
247
  genderOtherText?: string | null | undefined;
248
248
  accommodationOtherText?: string | null | undefined;
249
- ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
250
- sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
251
- genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
252
- raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
253
- ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
249
+ ageDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
250
+ sexDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
251
+ genderDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
252
+ raceDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
253
+ ethnicityDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
254
254
  }, {
255
255
  id: string;
256
256
  }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
@@ -274,11 +274,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
274
274
  raceOtherText?: string | null | undefined;
275
275
  genderOtherText?: string | null | undefined;
276
276
  accommodationOtherText?: string | null | undefined;
277
- ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
278
- sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
279
- genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
280
- raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
281
- ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
277
+ ageDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
278
+ sexDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
279
+ genderDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
280
+ raceDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
281
+ ethnicityDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
282
282
  } & {
283
283
  _id: mongoose.Types.ObjectId;
284
284
  } & {
@@ -304,11 +304,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
304
304
  raceOtherText?: string | null | undefined;
305
305
  genderOtherText?: string | null | undefined;
306
306
  accommodationOtherText?: string | null | undefined;
307
- ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
308
- sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
309
- genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
310
- raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
311
- ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
307
+ ageDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
308
+ sexDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
309
+ genderDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
310
+ raceDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
311
+ ethnicityDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
312
312
  } & {
313
313
  _id: mongoose.Types.ObjectId;
314
314
  } & {
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var services_exports = {};
22
22
  __export(services_exports, {
23
23
  CvcRegistryService: () => CvcRegistryService,
24
+ INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE: () => INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE,
24
25
  INFORMATION_SCOPE_READABLE_VERSIONS: () => INFORMATION_SCOPE_READABLE_VERSIONS,
25
26
  INFORMATION_SCOPE_SYSTEM_INFO: () => INFORMATION_SCOPE_SYSTEM_INFO,
26
27
  INFORMATION_SCOPE_VERSION: () => INFORMATION_SCOPE_VERSION,
@@ -1481,6 +1482,12 @@ var RESTRICTION_PRECEDENCE = [
1481
1482
  "subtract",
1482
1483
  ...SELECTION_PRECEDENCE
1483
1484
  ];
1485
+ var READING_SUBJECTS = /* @__PURE__ */ new Set([
1486
+ "release",
1487
+ "share",
1488
+ "policy"
1489
+ ]);
1490
+ var INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE = "Handoff \xA7 3: a policy is migrated with a new version row on the record, dated, so a Member Admin sees a change in history, not a silent rewrite. Write that row before acting on this reading; the stored list itself is never rewritten.";
1484
1491
  var asList = (list) => Array.isArray(list) ? list : [];
1485
1492
  function createInformationScopeResolver(input) {
1486
1493
  const rows = Object.freeze([...input.rows]);
@@ -1575,16 +1582,34 @@ function createInformationScopeResolver(input) {
1575
1582
  );
1576
1583
  }
1577
1584
  }
1585
+ if (m.releaseReading !== void 0 && m.releaseReading !== "retain" && m.releaseReading !== "successor") {
1586
+ throw new Error(`information scope: "${m.from}" has releaseReading "${String(m.releaseReading)}"`);
1587
+ }
1588
+ if (m.policyReading !== void 0 && m.policyReading !== "successor") {
1589
+ throw new Error(`information scope: "${m.from}" has policyReading "${String(m.policyReading)}"`);
1590
+ }
1591
+ if (m.releaseReading === "retain" && (m.to.length !== 1 || !Array.isArray(m.v3Fields) || !Array.isArray(m.v3Domains))) {
1592
+ throw new Error(
1593
+ `information scope: retained line "${m.from}" needs one successor and its v3Fields / v3Domains`
1594
+ );
1595
+ }
1578
1596
  const perCode = migrations.get(m.from) ?? /* @__PURE__ */ new Map();
1579
1597
  const prior = perCode.get(m.rule);
1580
1598
  if (prior && prior.to.join(" ") !== m.to.join(" ")) {
1581
1599
  throw new Error(`information scope: two "${m.rule}" readings for "${m.from}"`);
1582
1600
  }
1601
+ const retain = m.releaseReading === "retain" ? m : prior?.releaseReading === "retain" ? prior : null;
1583
1602
  perCode.set(m.rule, {
1584
1603
  from: m.from,
1585
1604
  rule: m.rule,
1586
1605
  to: Object.freeze([...m.to]),
1587
- widens: m.widens === true || prior?.widens === true
1606
+ widens: m.widens === true || prior?.widens === true,
1607
+ ...retain === null ? {} : {
1608
+ releaseReading: "retain",
1609
+ v3Fields: Object.freeze([...retain.v3Fields ?? []]),
1610
+ v3Domains: Object.freeze([...retain.v3Domains ?? []]),
1611
+ ...retain.v3FieldsNote === void 0 ? {} : { v3FieldsNote: retain.v3FieldsNote }
1612
+ }
1588
1613
  });
1589
1614
  migrations.set(m.from, perCode);
1590
1615
  }
@@ -1651,9 +1676,9 @@ function createInformationScopeResolver(input) {
1651
1676
  for (const d of descendantsOf(childCode)) sel.delete(d);
1652
1677
  return normalize(sel);
1653
1678
  };
1654
- const readOne = (from, scopeVersion, precedence) => {
1679
+ const readOne = (from, scopeVersion, precedence, keepsGrain) => {
1655
1680
  if (scopeVersion === INFORMATION_SCOPE_VERSION && isLive(from)) {
1656
- return { from, rule: "identity", reads: [from], widens: false };
1681
+ return { from, rule: "identity", reads: [from], widens: false, retained: false };
1657
1682
  }
1658
1683
  const lines = migrations.get(from);
1659
1684
  if (lines) {
@@ -1662,21 +1687,39 @@ function createInformationScopeResolver(input) {
1662
1687
  continue;
1663
1688
  }
1664
1689
  const line = lines.get(rule);
1665
- if (line) return { from, rule, reads: [...line.to], widens: line.widens === true };
1690
+ if (!line) continue;
1691
+ if (keepsGrain && line.releaseReading === "retain") {
1692
+ return scopeVersion === 3 ? { from, rule, reads: [], widens: false, retained: true } : { from, rule, reads: [], widens: false, retained: false };
1693
+ }
1694
+ return { from, rule, reads: [...line.to], widens: line.widens === true, retained: false };
1666
1695
  }
1667
1696
  }
1668
- return { from, rule: "unknown", reads: [], widens: false };
1697
+ return { from, rule: "unknown", reads: [], widens: false, retained: false };
1698
+ };
1699
+ const retainedOf = (c) => {
1700
+ const line = migrations.get(c.from)?.get(c.rule);
1701
+ return {
1702
+ code: c.from,
1703
+ v3Fields: [...line.v3Fields ?? []],
1704
+ v3Domains: [...line.v3Domains ?? []],
1705
+ successor: line.to[0],
1706
+ ...line.v3FieldsNote === void 0 ? {} : { note: line.v3FieldsNote }
1707
+ };
1669
1708
  };
1670
- const read = (list, scopeVersion, precedence, isRestriction) => {
1709
+ const read = (list, scopeVersion, precedence, subject) => {
1710
+ const isRestriction = subject === null;
1711
+ const keepsGrain = subject === "release" || subject === "share";
1712
+ const isPolicyLike = subject === "policy" || isRestriction;
1671
1713
  const stored = [...asList(list)];
1672
1714
  const supported = typeof scopeVersion === "number" && INFORMATION_SCOPE_READABLE_VERSIONS.includes(scopeVersion);
1715
+ const versionRowRequired = isPolicyLike && supported && scopeVersion !== INFORMATION_SCOPE_VERSION;
1673
1716
  const codes = [];
1674
1717
  const seen = /* @__PURE__ */ new Set();
1675
1718
  for (const from of stored) {
1676
1719
  if (seen.has(from)) continue;
1677
1720
  seen.add(from);
1678
1721
  codes.push(
1679
- supported ? readOne(from, scopeVersion, precedence) : { from, rule: "unknown", reads: [], widens: false }
1722
+ supported ? readOne(from, scopeVersion, precedence, keepsGrain) : { from, rule: "unknown", reads: [], widens: false, retained: false }
1680
1723
  );
1681
1724
  }
1682
1725
  return {
@@ -1691,9 +1734,22 @@ function createInformationScopeResolver(input) {
1691
1734
  codes,
1692
1735
  retired: codes.filter((c) => RETIRED_RULES.has(c.rule)).map((c) => c.from),
1693
1736
  unknown: codes.filter((c) => c.rule === "unknown").map((c) => c.from),
1694
- widened: codes.filter((c) => c.widens).map((c) => c.from)
1737
+ widened: codes.filter((c) => c.widens).map((c) => c.from),
1738
+ subject,
1739
+ retained: codes.filter((c) => c.retained).map(retainedOf),
1740
+ versionRowRequired,
1741
+ note: versionRowRequired ? INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE : null
1695
1742
  };
1696
1743
  };
1744
+ const readSelection = (list, scopeVersion, options) => {
1745
+ const subject = options?.subject;
1746
+ if (subject === void 0 || !READING_SUBJECTS.has(subject)) {
1747
+ throw new TypeError(
1748
+ `information scope readSelection: options.subject must be "release", "share" or "policy" (got ${JSON.stringify(subject)}) \u2014 there is no default`
1749
+ );
1750
+ }
1751
+ return read(list, scopeVersion, SELECTION_PRECEDENCE, subject);
1752
+ };
1697
1753
  const rowForSubject = (homeRow, kind) => {
1698
1754
  const home = byCode.get(homeRow);
1699
1755
  if (!home) throw new RangeError(`information scope rowForSubject: unknown home "${homeRow}"`);
@@ -1747,8 +1803,8 @@ function createInformationScopeResolver(input) {
1747
1803
  expandSelectAll,
1748
1804
  selectAll,
1749
1805
  deselectChild,
1750
- readSelection: (list, scopeVersion) => read(list, scopeVersion, SELECTION_PRECEDENCE, false),
1751
- readRestriction: (list, scopeVersion) => read(list, scopeVersion, RESTRICTION_PRECEDENCE, true),
1806
+ readSelection,
1807
+ readRestriction: (list, scopeVersion) => read(list, scopeVersion, RESTRICTION_PRECEDENCE, null),
1752
1808
  rowForSubject,
1753
1809
  expandBranchPickToGrain,
1754
1810
  clampToCeiling
@@ -1823,17 +1879,42 @@ function scopeRowsFromSot(sot) {
1823
1879
  }
1824
1880
  function scopeMigrationsFromSot(sot) {
1825
1881
  const code = keyReader(sot);
1826
- return (sot.migrations?.table ?? []).map((l) => ({
1827
- from: code(l.from),
1828
- to: l.to.map(code),
1829
- rule: l.rule,
1830
- ...l.note === void 0 ? {} : { note: l.note },
1831
- ...l.widens === void 0 ? {} : { widens: l.widens }
1832
- }));
1882
+ const byKey = new Map(sot.entries.map((e) => [e.key, e]));
1883
+ return (sot.migrations?.table ?? []).map((l) => {
1884
+ const m = {
1885
+ from: code(l.from),
1886
+ to: l.to.map(code),
1887
+ rule: l.rule,
1888
+ ...l.note === void 0 ? {} : { note: l.note },
1889
+ ...l.widens === void 0 ? {} : { widens: l.widens },
1890
+ ...l.informational === void 0 ? {} : { informational: l.informational },
1891
+ ...l.policyReading === void 0 ? {} : { policyReading: l.policyReading }
1892
+ };
1893
+ if (l.releaseReading === void 0) return m;
1894
+ if (l.releaseReading !== "retain") {
1895
+ return {
1896
+ ...m,
1897
+ releaseReading: l.releaseReading,
1898
+ ...l.releaseReadingNote === void 0 ? {} : { releaseReadingNote: l.releaseReadingNote }
1899
+ };
1900
+ }
1901
+ const e = byKey.get(l.from);
1902
+ if (e?.v3Fields === void 0 || e.v3Domains === void 0) {
1903
+ fail(l.from, "v3Fields / v3Domains (its line is releaseReading retain)", e?.v3Fields);
1904
+ }
1905
+ return {
1906
+ ...m,
1907
+ releaseReading: l.releaseReading,
1908
+ v3Fields: [...e.v3Fields],
1909
+ v3Domains: [...e.v3Domains],
1910
+ ...e.v3FieldsNote === void 0 ? {} : { v3FieldsNote: e.v3FieldsNote }
1911
+ };
1912
+ });
1833
1913
  }
1834
1914
  // Annotate the CommonJS export names for ESM import in node:
1835
1915
  0 && (module.exports = {
1836
1916
  CvcRegistryService,
1917
+ INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE,
1837
1918
  INFORMATION_SCOPE_READABLE_VERSIONS,
1838
1919
  INFORMATION_SCOPE_SYSTEM_INFO,
1839
1920
  INFORMATION_SCOPE_VERSION,