@htilabs/platform-common-models 0.30.0 → 0.32.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/README.md CHANGED
@@ -16,6 +16,107 @@ Package exports are organized into a public root API and a small number of
16
16
  dedicated subpaths (`/validation`, `/cvcs`) — consult `package.json` for the
17
17
  authoritative `exports` map.
18
18
 
19
+ ## points-of-contact / 0.32.0
20
+
21
+ 0.32.0 (pl-iza) is additive: confidential Referrals (magic link) holders
22
+ receive magic links, and the sender sees only how many. Canon: CVC-338
23
+ `REFERRALS_MAGIC_LINK` (prototype `data/cvcs/core_contact_purpose.yaml` @
24
+ 184893b6 L95), "A confidential holder still receives it; the sender never
25
+ sees the address."; HANDOFF.md @ 184893b6 L569, L575 (POC-PROFILE-ALIGNMENTS
26
+ D(ii)). Ruling: Nate, 2026-10-15. (0.31.0 is claimed by PR #219.)
27
+
28
+ - **The network view is unchanged.** A confidential row is still absent from
29
+ every view another organization sees (`toNetworkView`, `getContact`,
30
+ `listContactsForSubject`, the referral `recipients` and `unreachable`).
31
+ - **`listReferralContactsForPartner`** keeps its signature. Its result gains
32
+ `confidentialCount: number`, the number of distinct confidential holder
33
+ addresses, for the sender's "+ 1 confidential recipient" / "N confidential
34
+ recipients" line. `unreachable` is unchanged: ids of VISIBLE contacts only,
35
+ safe to show a sender.
36
+ - **`resolveMagicLinkRecipients(db, partner, opts)`** (send-only, same
37
+ options) returns `MagicLinkSendList`: `{ recipients, unreachable,
38
+ confidential, confidentialUnreachableCount }`, where `confidential` is a
39
+ `ConfidentialReferralRecipients` (an interface, exported as a type only).
40
+ The implementation is not exported: obtain values only via
41
+ `resolveMagicLinkRecipients`. `confidentialUnreachableCount` is a
42
+ SERVER-SIDE diagnostic, never returned to a sender: confidential holder rows
43
+ that cannot be sent to (no email, a seat with none or not found), plus
44
+ skipped rows that do not match the contract and may be confidential.
45
+ - **`ConfidentialReferralRecipients`**: its implementation carries the
46
+ addresses in a private field. Public: `count`; `toJSON()` → `{ count }`;
47
+ `util.inspect` →
48
+ `ConfidentialReferralRecipients(n)`; and `deliver(sendOne, { capacity? })`
49
+ → `{ count, delivered, failed, overflow, firstErrorName }`. `deliver` sends
50
+ to the first `capacity` holders (all when omitted), one at a time;
51
+ `overflow` is `max(0, count - capacity)`. It catches every `sendOne` error,
52
+ keeping only its `name` ("Error" when the name is not a plain identifier or
53
+ cannot be read), and never rejects for a failed send. `sendOne` is
54
+ `(address: string) => void | Promise<void>` and must THROW (or reject) on
55
+ failure: returning normally counts as delivered.
56
+ - **What a sender may see.** Only `count` (or `confidentialCount`), or one
57
+ all-or-nothing status. `delivered`, `failed`, `overflow` and
58
+ `firstErrorName` are server-side, for audit only.
59
+ - **Has a holder.** A partner has a magic-link holder when
60
+ `recipients.length + confidentialCount > 0`. Canon D(ii): a confidential
61
+ holder is a holder, so the listing-contact fallback does not fire over it,
62
+ and the send must not refuse a partner whose only holders are confidential.
63
+ - **Which rows count.** Active, `confirmed`, `is_confidential: true`, tagged
64
+ Referrals (magic link), on the same rollup (the partner's agency and its
65
+ programs, teams and locations, its service listings, and its org), at the
66
+ preferred email (the seat's for a seat-linked holder). A separate query; the
67
+ visible and own-pending queries are unchanged, and no index changes. Seats
68
+ are resolved once per read, over the visible and confidential rows
69
+ together. A pending confidential row is not routed until it is confirmed;
70
+ an inactive or untagged one never is. A row that does not match the
71
+ contract and may be confidential (in the confidential query, or a visible
72
+ or pending row whose stored `is_confidential` is malformed, e.g. `"true"`
73
+ or `1`, which matches `{ $ne: true }`) is skipped and counted in
74
+ `confidentialUnreachableCount`, never thrown (its error would name its id),
75
+ so it never blocks the visible sends. Any other corrupt row still throws.
76
+ - **De-duplication is oracle-safe.** Confidential addresses are deduped
77
+ among THEMSELVES only: `confidentialCount` is the number of distinct
78
+ confidential addresses, and no visible, pending, typed or added address
79
+ moves it. `deliver` takes no caller addresses at all. Otherwise an advocate
80
+ could learn an address by watching a number change: adding or typing it,
81
+ or seeing their pending add confirmed by a steward or a visible seat's
82
+ email edited to match. An overlap with any other recipient is simply sent
83
+ twice: the holder gets a duplicate link, which the advocate cannot observe.
84
+ - **Store counts only.** A share, receipt, event or log carries
85
+ `confidential.count` (or `confidentialCount`), never an id or an address.
86
+ - **The transport must not log `to`.** Every address `sendOne` receives is a
87
+ confidential one. Thread's SES dev transport logs the recipient
88
+ (`apps/api/src/services/ses/client.ts` @ 029d91a95 L122-L140, `to:
89
+ args.to` at L128): a confidential send must not go through it as is.
90
+ - **Lower tiers.** On a lower-tier deployment, confidential holders redirect
91
+ to the advocate like every other recipient (the caller's existing redirect
92
+ applies to the address `sendOne` receives). A redirected message must not
93
+ name the address it was meant for: a redirect banner or header that lists
94
+ the original recipients shows "1 confidential recipient" instead.
95
+
96
+ ```ts
97
+ import { resolveMagicLinkRecipients } from "@htilabs/platform-common-models/points-of-contact";
98
+
99
+ const send = await resolveMagicLinkRecipients(platformDb, partner, {
100
+ resolveSeats,
101
+ includeOwnPendingFor: verifiedToken.sub, // the advocate's own pending adds, marked `pending`
102
+ });
103
+ if (send.recipients.length + send.confidential.count === 0) {
104
+ // no magic-link holder: the listing-contact fallback applies
105
+ }
106
+ // The visible picks (pre-filled, own-pending, typed), deduped among themselves.
107
+ const visible = [...new Set([...pickedRecipients.map((r) => r.email), ...typedAddresses])];
108
+ for (const to of visible) await mailer.sendMagicLink(to); // throws on failure
109
+ // The confidential holders: the same mailer, which must throw on failure and never log `to`.
110
+ const audit = await send.confidential.deliver((to) => mailer.sendMagicLink(to), {
111
+ capacity: Math.max(0, MAX_SENDS - visible.length),
112
+ });
113
+ share.magic_link_confidential = send.confidential.count; // a count, never an address
114
+ log.info(
115
+ { confidential: audit, confidentialUnreachable: send.confidentialUnreachableCount },
116
+ "magic link sent",
117
+ ); // server-side audit numbers only, never returned to the sender
118
+ ```
119
+
19
120
  ## points-of-contact / 0.30.0 (BREAKING)
20
121
 
21
122
  0.30.0 (pl-e98, pl-f4c) reshapes the Point of contact contract. There is no
@@ -231,6 +332,11 @@ check for you):
231
332
  `listReferralContactsForPartner(db, partner, { resolveSeats,
232
333
  includeOwnPendingFor: verifiedToken.sub })` (the same `sub` as the
233
334
  writer's `actor.id`). See below.
335
+ - **Confidential holders (pl-iza, 0.32.0).** Never return, persist, or log
336
+ a confidential address; use `confidentialCount` / `confidential.count`;
337
+ only `deliver` touches addresses. A sender sees the count (or one
338
+ all-or-nothing status), never `deliver`'s per-holder numbers. The
339
+ `sendOne` transport must not log `to`.
234
340
  - **Logging.** On a thrown error log only its `name` and `code`: a
235
341
  `PointOfContactShapeError` lists a stored row's issues and a driver error
236
342
  can echo a stored value. Refusals carry no stored value.
@@ -249,7 +355,7 @@ Referrals (magic link) recipients as before, then the asking advocate's OWN
249
355
  pending in-app adds on that partner (active, `origin: in_app`, `createdBy`
250
356
  = `sub`, tagged Referrals (magic link)), each marked `pending: true`
251
357
  (`ReferralRecipient.pending`) so a UI can label it. Nobody else's pending add
252
- is ever returned; confidential rows stay excluded (pl-iza is separate); an
358
+ is ever returned; confidential rows stay excluded (counted only, see 0.32.0); an
253
359
  email a confirmed recipient already has is not repeated. `sub` is the
254
360
  advocate's Auth0 `sub` from the verified token, the same pinning as the
255
361
  writer's `actor.id`. Without the option the read is unchanged.
@@ -1,4 +1,4 @@
1
- import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-Asg7mxjB.cjs';
1
+ import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-BqAGctqK.cjs';
2
2
  import * as mongoose from 'mongoose';
3
3
  import { HydratedDocument, Connection, Model } from 'mongoose';
4
4
 
@@ -1,4 +1,4 @@
1
- import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-Asg7mxjB.js';
1
+ import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-BqAGctqK.js';
2
2
  import * as mongoose from 'mongoose';
3
3
  import { HydratedDocument, Connection, Model } from 'mongoose';
4
4
 
package/dist/index.d.cts CHANGED
@@ -3,9 +3,9 @@ export { ActiveServiceStateKey, DeprecatedServiceStateKey, IC48Catalog, IC48Cata
3
3
  export { D as DEFAULT_BOUND_STATE, a as DEFAULT_BOUND_STATE_DISPLAY, b as DEFAULT_BOUND_STATE_LABELS, c as DEFAULT_BOUND_STATE_VALUES, d as DefaultBoundStateValue, F as FUNCTION_STATUS, e as FUNCTION_STATUS_LABELS, f as FUNCTION_STATUS_VALUES, g as FunctionStatusValue, P as PERMISSION_STATE, h as PERMISSION_STATE_DISPLAY, i as PERMISSION_STATE_LABELS, j as PERMISSION_STATE_VALUES, k as PLATFORM_TOOL, l as PLATFORM_TOOL_LABELS, m as PLATFORM_TOOL_VALUES, n as PermissionStateValue, o as PlatformToolValue, R as ROLE_LEVEL, p as ROLE_LEVEL_LABELS, q as ROLE_LEVEL_VALUES, r as RoleLevelValue, S as SHARE_VIEW, s as SHARE_VIEW_LABELS, t as SHARE_VIEW_VALUES, u as ShareViewValue } from './platform-auth-DJO-r9Pf.cjs';
4
4
  export { A as AGENCY_TYPE_KEYS, a as AgencyTypeKey, H as HEALTHCARE_ORG_TYPE_KEYS, L as LAW_ENFORCEMENT_ORG_TYPE_KEYS, b as LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY, c as LEGAL_ORG_TYPE_KEYS, d as LegacyNumericReferralEntity, N as NO_SECTOR_ORG_TYPE_KEYS, O as ORG_TYPE_HEADING_KEYS, e as ORG_TYPE_KEYS, f as ORG_TYPE_NONPICKABLE_LEAF_KEYS, g as ORG_TYPE_PARENT_KEY, h as ORG_TYPE_SELECTABLE_KEYS, i as OrgTypeHeadingKey, j as OrgTypeKey, k as OrgTypeSelectableKey, R as REPORT_AUTHORITY_ORG_TYPE_KEYS, V as VICTIM_SERVING_ORG_TYPE_KEYS, l as isAgencyTypeKey, m as isHealthcareOrgType, n as isLawEnforcementOrgType, o as isLegalOrgType, p as isOrgTypeKey, q as isReportAuthorityOrgType, r as isVictimServingOrgType, s as orgTypeAncestry, t as orgTypeCanonicalCode, u as orgTypeDefaultSessionRole, v as orgTypeDefaultSessionRoleOrNull, w as orgTypeDefaultVsp, x as orgTypeEnumConstant, y as orgTypeLabel, z as orgTypeSector, B as resolveAgencyTypeKey, C as resolveOrgTypeKey, D as resolveOrgTypeKeyFromLegacyNumeric, E as resolveReferralEntityKeyFromLegacyNumeric } from './org-type-D_FG4KdN.cjs';
5
5
  export { AddOrganizationProgramsFieldOptions, Address, Demographics, Email, ORGANIZATION_PROGRAM_VALIDATED_UPDATE_OPS, OrganizationProgram, PersonName, Phone, TEAM_MODEL_NAME, TeamDirectoryFields, addOrganizationProgramsField, addTeamDirectoryFields, addressSchema, buildOrganizationProgramSchema, buildOrganizationProgramsFieldDefinition, demographicsSchema, emailSchema, organizationProgramSchemaDefinition, personNameSchema, phoneSchema, teamDirectorySchemaDefinition } from './schemas/index.cjs';
6
- 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-Asg7mxjB.cjs';
6
+ 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-BqAGctqK.cjs';
7
7
  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-DYCv839V.cjs';
8
- export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, e as compileCvcEntryModel, f as compileCvcRegistryModel, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from './index-Pt82NxQg.cjs';
8
+ export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, e as compileCvcEntryModel, f as compileCvcRegistryModel, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from './index-BTqHP4DM.cjs';
9
9
  export { AccommodationTypeKey, AccommodationTypeKeys, ActionStepCompletionStatusKey, ActionStepCompletionStatusKeys, ActionStepTypeKey, ActionStepTypeKeys, ActivityTypeKey, ActivityTypeKeys, AdminRoleKey, AdminRoleKeys, AdministeringJurisdictionKey, AdministeringJurisdictionKeys, AgeBinReportingKey, AgeBinReportingKeys, AnnouncementAudienceScopeKey, AnnouncementAudienceScopeKeys, AnnouncementResponseTypeKey, AnnouncementResponseTypeKeys, AssertionDomainKey, AssertionDomainKeys, AssertionStatusKey, AssertionStatusKeys, BasisQuickPicksKey, BasisQuickPicksKeys, CarCorrectionReasonKey, CarCorrectionReasonKeys, CaseShareStateKey, CaseShareStateKeys, CheckInActivityKey, CheckInActivityKeys, CheckInPhaseKey, CheckInPhaseKeys, ChildBehavioralConcernsKey, ChildBehavioralConcernsKeys, ChildChangeTypeKey, ChildChangeTypeKeys, ChildCustodyArrangementKey, ChildCustodyArrangementKeys, CitizenshipKey, CitizenshipKeys, CollectionContextKey, CollectionContextKeys, ContactInfoTypeKey, ContactInfoTypeKeys, ContactInfoUseTypeKey, ContactInfoUseTypeKeys, ContactLinkTypeKey, ContactLinkTypeKeys, ContactSafetyStatusKey, ContactSafetyStatusKeys, CoreFunctionsKey, CoreFunctionsKeys, CoreIndicatorKey, CoreIndicatorKeys, CoreInformationScopeKey, CoreInformationScopeKeys, CoreReferralOutcomeKey, CoreReferralOutcomeKeys, CountryKey, CountryKeys, CreatedBySystemKey, CreatedBySystemKeys, CriminalOrgCategoryKey, CriminalOrgCategoryKeys, DaIncidentArchiveReasonKey, DaIncidentArchiveReasonKeys, DaIncidentConfidenceKey, DaIncidentConfidenceKeys, DaIncidentDayApproxKey, DaIncidentDayApproxKeys, DaIncidentSeverityKey, DaIncidentSeverityKeys, DeterminationHelperCategoryKey, DeterminationHelperCategoryKeys, DeterminationLevelKey, DeterminationLevelKeys, DhStateKey, DhStateKeys, DisabilitySubtypeKey, DisabilitySubtypeKeys, DiscretionLevelKey, DiscretionLevelKeys, EmergencyContactCallReasonKey, EmergencyContactCallReasonKeys, EmergencyContactPermissionsKey, EmergencyContactPermissionsKeys, EmergencyExitCascadeKey, EmergencyExitCascadeKeys, EmploymentStatusKey, EmploymentStatusKeys, EnrollmentApplicationStatusKey, EnrollmentApplicationStatusKeys, ExitProcessChecklistItemKey, ExitProcessChecklistItemKeys, ExitReasonsKey, ExitReasonsKeys, ExploitationTypeKey, ExploitationTypeKeys, EyeColorKey, EyeColorKeys, FacialHairKey, FacialHairKeys, FacilitatorEntityTypeKey, FacilitatorEntityTypeKeys, FacilitatorLabelUsedInSourceKey, FacilitatorLabelUsedInSourceKeys, FacilitatorSubroleKey, FacilitatorSubroleKeys, FrequencyCadenceKey, FrequencyCadenceKeys, FunderKey, FunderKeys, GenderIdentityKey, GenderIdentityKeys, GoalCategoryKey, GoalCategoryKeys, GoalPriorityKey, GoalPriorityKeys, GoalStatusKey, GoalStatusKeys, GoalWithdrawalReasonKey, GoalWithdrawalReasonKeys, HairColorKey, HairColorKeys, HasTattoosKey, HasTattoosKeys, HighestEducationLevelCompletedKey, HighestEducationLevelCompletedKeys, HivStatusKey, HivStatusKeys, HmisCurrentLivingSituationKey, HmisCurrentLivingSituationKeys, HmisProjectTypeKey, HmisProjectTypeKeys, HmisRelationshipToHohKey, HmisRelationshipToHohKeys, HomelessStatusKey, HomelessStatusKeys, HopeScaleCaptureContextKey, HopeScaleCaptureContextKeys, HopeScaleResponseOptionsKey, HopeScaleResponseOptionsKeys, HopeScaleTierKey, HopeScaleTierKeys, HousingSubsidyTypesKey, HousingSubsidyTypesKeys, HtTypeKey, HtTypeKeys, IdentificationStatusKey, IdentificationStatusKeys, ImmigrationLegalStatusChangeTypeKey, ImmigrationLegalStatusChangeTypeKeys, IncarcerationEpisodeTypeKey, IncarcerationEpisodeTypeKeys, IncidentInvolvementRoleKey, IncidentInvolvementRoleKeys, IncidentParticipationRoleKey, IncidentParticipationRoleKeys, IncomeBenefitsSourcesKey, IncomeBenefitsSourcesKeys, InferenceTypeKey, InferenceTypeKeys, InvestigativeRequestTypeKey, InvestigativeRequestTypeKeys, JuvenileJusticeEpisodeTypeKey, JuvenileJusticeEpisodeTypeKeys, JuvenileJusticeInvolvementStatusKey, JuvenileJusticeInvolvementStatusKeys, LanguagesKey, LanguagesKeys, LeReportStatusKey, LeReportStatusKeys, LegalActionTypeKey, LegalActionTypeKeys, LivingSituationKey, LivingSituationKeys, LocationTypeKey, LocationTypeKeys, MaritalStatusLegalKey, MaritalStatusLegalKeys, MentalHealthStatusKey, MentalHealthStatusKeys, MessageReportReasonKey, MessageReportReasonKeys, MidStayEventTypeKey, MidStayEventTypeKeys, MilestoneTypeKey, MilestoneTypeKeys, MilitaryBranchKey, MilitaryBranchKeys, MilitaryStatusKey, MilitaryStatusKeys, MinorAdultStatusKey, MinorAdultStatusKeys, NameTypeKey, NameTypeKeys, NeedsAssessmentChangeTypeKey, NeedsAssessmentChangeTypeKeys, NeedsResidentialAgainKey, NeedsResidentialAgainKeys, OffenderStatusFamilyKey, OffenderStatusFamilyKeys, OffenderStatusKey, OffenderStatusKeys, OrientationIdentityKey, OrientationIdentityKeys, PersonRelationshipsKey, PersonRelationshipsKeys, PetExitReasonKey, PetExitReasonKeys, PetRelationshipBasisKey, PetRelationshipBasisKeys, PoPetitionBasisKey, PoPetitionBasisKeys, PoStatusKey, PoStatusKeys, PoViolationStatusKey, PoViolationStatusKeys, PreferredContactMethodKey, PreferredContactMethodKeys, PrimaryLanguageKey, PrimaryLanguageKeys, ProgramEnrollmentChangeTypeKey, ProgramEnrollmentChangeTypeKeys, ProgramSpecificCodeKey, ProgramSpecificCodeKeys, PronounsKey, PronounsKeys, ProofOfIdTypeKey, ProofOfIdTypeKeys, ProvenanceSourceIdKey, ProvenanceSourceIdKeys, QualityFlagsKey, QualityFlagsKeys, RaceEthnicityKey, RaceEthnicityKeys, RadiusBucketKey, RadiusBucketKeys, RecencyBandKey, RecencyBandKeys, ReferenceLinkTypeKey, ReferenceLinkTypeKeys, ReferralEntityCategoryKey, ReferralEntityCategoryKeys, ReferralOriginKey, ReferralOriginKeys, RelationshipConcernKey, RelationshipConcernKeys, RelationshipDynamicsKey, RelationshipDynamicsKeys, RelationshipStatusCurrentKey, RelationshipStatusCurrentKeys, RelationshipTiesKey, RelationshipTiesKeys, ReturnedToAbuserStatusKey, ReturnedToAbuserStatusKeys, RiskCategoryKey, RiskCategoryKeys, RiskIdentificationMilestoneKey, RiskIdentificationMilestoneKeys, RiskSeverityBandKey, RiskSeverityBandKeys, RoiMethodKey, RoiMethodKeys, RoiScopeKey, RoiScopeKeys, RoiStatusKey, RoiStatusKeys, RoleContextKey, RoleContextKeys, RomanticRelationshipChangeTypeKey, RomanticRelationshipChangeTypeKeys, RsvpResponseKey, RsvpResponseKeys, ServiceAudienceKey, ServiceAudienceKeys, ServiceCategoryKey, ServiceCategoryKeys, ServiceDeliveryChannelKey, ServiceDeliveryChannelKeys, ServiceMechanismKey, ServiceMechanismKeys, ServicePlanClosureReasonKey, ServicePlanClosureReasonKeys, ServicePlanReviewSnoozeReasonKey, ServicePlanReviewSnoozeReasonKeys, ServiceSourceKey, ServiceSourceKeys, ServiceStateKey, ServiceStateKeys, SessionNoteVisibilityKey, SessionNoteVisibilityKeys, SessionStateKey, SessionStateKeys, SessionTemplateKey, SessionTemplateKeys, SeverityFollowUpKey, SeverityFollowUpKeys, SexProviderSubroleKey, SexProviderSubroleKeys, SharePurposeKey, SharePurposeKeys, ShareResponseReasonKey, ShareResponseReasonKeys, SignatureMethodKey, SignatureMethodKeys, SignatureTypeKey, SignatureTypeKeys, SmtBodyLocationKey, SmtBodyLocationKeys, SmtNameRelationKey, SmtNameRelationKeys, SmtSignificanceFlagsKey, SmtSignificanceFlagsKeys, SmtTypeKey, SmtTypeKeys, SourceCategoryKey, SourceCategoryKeys, SourceInstrumentKey, SourceInstrumentKeys, SourceSubtypeKey, SourceSubtypeKeys, SourceSystemKey, SourceSystemKeys, SpecialNeedsDisabilitiesKey, SpecialNeedsDisabilitiesKeys, SubjectTypeKey, SubjectTypeKeys, SubstanceUseStatusKey, SubstanceUseStatusKeys, SuggestionSourceKey, SuggestionSourceKeys, SupportStrengthKey, SupportStrengthKeys, SupportTopicKey, SupportTopicKeys, ThreadStatusKey, ThreadStatusKeys, ThreadTypeKey, ThreadTypeKeys, TimeScopeKey, TimeScopeKeys, TraffickingRelevantRoleKey, TraffickingRelevantRoleKeys, TribesKey, TribesKeys, UserRoleKey, UserRoleKeys, VerificationMethodKey, VerificationMethodKeys, VerificationStatusKey, VerificationStatusKeys, VictimAbuseTypesKey, VictimAbuseTypesKeys, VictimStatusFamilyKey, VictimStatusFamilyKeys, VisaTypeKey, VisaTypeKeys, WhyNotKey, WhyNotKeys } from './enums/index.cjs';
10
10
  export { CvcRegistryService, CvcRegistryServiceOptions, EntryLoader, ICvcEntry, ICvcRegistry, RegistryLoader, RegistryScope, applyEntryOverrides, cascadeExclusions, cvcVersionsToRecord, resolveRegistryWithInheritance } from './services/index.cjs';
11
11
  export { C as CreateInformationScopeResolverInput, I as INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE, a as INFORMATION_SCOPE_READABLE_VERSIONS, b as INFORMATION_SCOPE_SYSTEM_INFO, c as INFORMATION_SCOPE_VERSION, d as InformationScopeResolver, S as ScopeApp, e as ScopeApps, f as ScopeCodeReading, g as ScopeKindBranch, h as ScopeMigration, i as ScopeMigrationRule, j as ScopePersonKind, k as ScopeReadOptions, l as ScopeReading, m as ScopeReadingRule, n as ScopeReadingSubject, o as ScopeRetainedReading, p as ScopeRow, q as ScopeRowStatus, r as ScopeRowType, s as ScopeShareOptions, t as ScopeShareReason, u as ScopeShareVerdict, v as ScopeSpecialDataType, w as ScopeSubjectKind, x as StoredScopeList, y as createInformationScopeResolver, z as isScopeInstrumentRow, A as isScopeRestRow, B as isSelectableScopeRow, D as kindForPerson } from './informationScopeResolver-BzYu97DE.cjs';
package/dist/index.d.ts CHANGED
@@ -3,9 +3,9 @@ export { ActiveServiceStateKey, DeprecatedServiceStateKey, IC48Catalog, IC48Cata
3
3
  export { D as DEFAULT_BOUND_STATE, a as DEFAULT_BOUND_STATE_DISPLAY, b as DEFAULT_BOUND_STATE_LABELS, c as DEFAULT_BOUND_STATE_VALUES, d as DefaultBoundStateValue, F as FUNCTION_STATUS, e as FUNCTION_STATUS_LABELS, f as FUNCTION_STATUS_VALUES, g as FunctionStatusValue, P as PERMISSION_STATE, h as PERMISSION_STATE_DISPLAY, i as PERMISSION_STATE_LABELS, j as PERMISSION_STATE_VALUES, k as PLATFORM_TOOL, l as PLATFORM_TOOL_LABELS, m as PLATFORM_TOOL_VALUES, n as PermissionStateValue, o as PlatformToolValue, R as ROLE_LEVEL, p as ROLE_LEVEL_LABELS, q as ROLE_LEVEL_VALUES, r as RoleLevelValue, S as SHARE_VIEW, s as SHARE_VIEW_LABELS, t as SHARE_VIEW_VALUES, u as ShareViewValue } from './platform-auth-DJO-r9Pf.js';
4
4
  export { A as AGENCY_TYPE_KEYS, a as AgencyTypeKey, H as HEALTHCARE_ORG_TYPE_KEYS, L as LAW_ENFORCEMENT_ORG_TYPE_KEYS, b as LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY, c as LEGAL_ORG_TYPE_KEYS, d as LegacyNumericReferralEntity, N as NO_SECTOR_ORG_TYPE_KEYS, O as ORG_TYPE_HEADING_KEYS, e as ORG_TYPE_KEYS, f as ORG_TYPE_NONPICKABLE_LEAF_KEYS, g as ORG_TYPE_PARENT_KEY, h as ORG_TYPE_SELECTABLE_KEYS, i as OrgTypeHeadingKey, j as OrgTypeKey, k as OrgTypeSelectableKey, R as REPORT_AUTHORITY_ORG_TYPE_KEYS, V as VICTIM_SERVING_ORG_TYPE_KEYS, l as isAgencyTypeKey, m as isHealthcareOrgType, n as isLawEnforcementOrgType, o as isLegalOrgType, p as isOrgTypeKey, q as isReportAuthorityOrgType, r as isVictimServingOrgType, s as orgTypeAncestry, t as orgTypeCanonicalCode, u as orgTypeDefaultSessionRole, v as orgTypeDefaultSessionRoleOrNull, w as orgTypeDefaultVsp, x as orgTypeEnumConstant, y as orgTypeLabel, z as orgTypeSector, B as resolveAgencyTypeKey, C as resolveOrgTypeKey, D as resolveOrgTypeKeyFromLegacyNumeric, E as resolveReferralEntityKeyFromLegacyNumeric } from './org-type-BYQb9Qzq.js';
5
5
  export { AddOrganizationProgramsFieldOptions, Address, Demographics, Email, ORGANIZATION_PROGRAM_VALIDATED_UPDATE_OPS, OrganizationProgram, PersonName, Phone, TEAM_MODEL_NAME, TeamDirectoryFields, addOrganizationProgramsField, addTeamDirectoryFields, addressSchema, buildOrganizationProgramSchema, buildOrganizationProgramsFieldDefinition, demographicsSchema, emailSchema, organizationProgramSchemaDefinition, personNameSchema, phoneSchema, teamDirectorySchemaDefinition } from './schemas/index.js';
6
- 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-Asg7mxjB.js';
6
+ 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-BqAGctqK.js';
7
7
  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';
8
- export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, e as compileCvcEntryModel, f as compileCvcRegistryModel, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from './index-ClTjjJ_S.js';
8
+ export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, e as compileCvcEntryModel, f as compileCvcRegistryModel, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from './index-Dr6GBCoY.js';
9
9
  export { AccommodationTypeKey, AccommodationTypeKeys, ActionStepCompletionStatusKey, ActionStepCompletionStatusKeys, ActionStepTypeKey, ActionStepTypeKeys, ActivityTypeKey, ActivityTypeKeys, AdminRoleKey, AdminRoleKeys, AdministeringJurisdictionKey, AdministeringJurisdictionKeys, AgeBinReportingKey, AgeBinReportingKeys, AnnouncementAudienceScopeKey, AnnouncementAudienceScopeKeys, AnnouncementResponseTypeKey, AnnouncementResponseTypeKeys, AssertionDomainKey, AssertionDomainKeys, AssertionStatusKey, AssertionStatusKeys, BasisQuickPicksKey, BasisQuickPicksKeys, CarCorrectionReasonKey, CarCorrectionReasonKeys, CaseShareStateKey, CaseShareStateKeys, CheckInActivityKey, CheckInActivityKeys, CheckInPhaseKey, CheckInPhaseKeys, ChildBehavioralConcernsKey, ChildBehavioralConcernsKeys, ChildChangeTypeKey, ChildChangeTypeKeys, ChildCustodyArrangementKey, ChildCustodyArrangementKeys, CitizenshipKey, CitizenshipKeys, CollectionContextKey, CollectionContextKeys, ContactInfoTypeKey, ContactInfoTypeKeys, ContactInfoUseTypeKey, ContactInfoUseTypeKeys, ContactLinkTypeKey, ContactLinkTypeKeys, ContactSafetyStatusKey, ContactSafetyStatusKeys, CoreFunctionsKey, CoreFunctionsKeys, CoreIndicatorKey, CoreIndicatorKeys, CoreInformationScopeKey, CoreInformationScopeKeys, CoreReferralOutcomeKey, CoreReferralOutcomeKeys, CountryKey, CountryKeys, CreatedBySystemKey, CreatedBySystemKeys, CriminalOrgCategoryKey, CriminalOrgCategoryKeys, DaIncidentArchiveReasonKey, DaIncidentArchiveReasonKeys, DaIncidentConfidenceKey, DaIncidentConfidenceKeys, DaIncidentDayApproxKey, DaIncidentDayApproxKeys, DaIncidentSeverityKey, DaIncidentSeverityKeys, DeterminationHelperCategoryKey, DeterminationHelperCategoryKeys, DeterminationLevelKey, DeterminationLevelKeys, DhStateKey, DhStateKeys, DisabilitySubtypeKey, DisabilitySubtypeKeys, DiscretionLevelKey, DiscretionLevelKeys, EmergencyContactCallReasonKey, EmergencyContactCallReasonKeys, EmergencyContactPermissionsKey, EmergencyContactPermissionsKeys, EmergencyExitCascadeKey, EmergencyExitCascadeKeys, EmploymentStatusKey, EmploymentStatusKeys, EnrollmentApplicationStatusKey, EnrollmentApplicationStatusKeys, ExitProcessChecklistItemKey, ExitProcessChecklistItemKeys, ExitReasonsKey, ExitReasonsKeys, ExploitationTypeKey, ExploitationTypeKeys, EyeColorKey, EyeColorKeys, FacialHairKey, FacialHairKeys, FacilitatorEntityTypeKey, FacilitatorEntityTypeKeys, FacilitatorLabelUsedInSourceKey, FacilitatorLabelUsedInSourceKeys, FacilitatorSubroleKey, FacilitatorSubroleKeys, FrequencyCadenceKey, FrequencyCadenceKeys, FunderKey, FunderKeys, GenderIdentityKey, GenderIdentityKeys, GoalCategoryKey, GoalCategoryKeys, GoalPriorityKey, GoalPriorityKeys, GoalStatusKey, GoalStatusKeys, GoalWithdrawalReasonKey, GoalWithdrawalReasonKeys, HairColorKey, HairColorKeys, HasTattoosKey, HasTattoosKeys, HighestEducationLevelCompletedKey, HighestEducationLevelCompletedKeys, HivStatusKey, HivStatusKeys, HmisCurrentLivingSituationKey, HmisCurrentLivingSituationKeys, HmisProjectTypeKey, HmisProjectTypeKeys, HmisRelationshipToHohKey, HmisRelationshipToHohKeys, HomelessStatusKey, HomelessStatusKeys, HopeScaleCaptureContextKey, HopeScaleCaptureContextKeys, HopeScaleResponseOptionsKey, HopeScaleResponseOptionsKeys, HopeScaleTierKey, HopeScaleTierKeys, HousingSubsidyTypesKey, HousingSubsidyTypesKeys, HtTypeKey, HtTypeKeys, IdentificationStatusKey, IdentificationStatusKeys, ImmigrationLegalStatusChangeTypeKey, ImmigrationLegalStatusChangeTypeKeys, IncarcerationEpisodeTypeKey, IncarcerationEpisodeTypeKeys, IncidentInvolvementRoleKey, IncidentInvolvementRoleKeys, IncidentParticipationRoleKey, IncidentParticipationRoleKeys, IncomeBenefitsSourcesKey, IncomeBenefitsSourcesKeys, InferenceTypeKey, InferenceTypeKeys, InvestigativeRequestTypeKey, InvestigativeRequestTypeKeys, JuvenileJusticeEpisodeTypeKey, JuvenileJusticeEpisodeTypeKeys, JuvenileJusticeInvolvementStatusKey, JuvenileJusticeInvolvementStatusKeys, LanguagesKey, LanguagesKeys, LeReportStatusKey, LeReportStatusKeys, LegalActionTypeKey, LegalActionTypeKeys, LivingSituationKey, LivingSituationKeys, LocationTypeKey, LocationTypeKeys, MaritalStatusLegalKey, MaritalStatusLegalKeys, MentalHealthStatusKey, MentalHealthStatusKeys, MessageReportReasonKey, MessageReportReasonKeys, MidStayEventTypeKey, MidStayEventTypeKeys, MilestoneTypeKey, MilestoneTypeKeys, MilitaryBranchKey, MilitaryBranchKeys, MilitaryStatusKey, MilitaryStatusKeys, MinorAdultStatusKey, MinorAdultStatusKeys, NameTypeKey, NameTypeKeys, NeedsAssessmentChangeTypeKey, NeedsAssessmentChangeTypeKeys, NeedsResidentialAgainKey, NeedsResidentialAgainKeys, OffenderStatusFamilyKey, OffenderStatusFamilyKeys, OffenderStatusKey, OffenderStatusKeys, OrientationIdentityKey, OrientationIdentityKeys, PersonRelationshipsKey, PersonRelationshipsKeys, PetExitReasonKey, PetExitReasonKeys, PetRelationshipBasisKey, PetRelationshipBasisKeys, PoPetitionBasisKey, PoPetitionBasisKeys, PoStatusKey, PoStatusKeys, PoViolationStatusKey, PoViolationStatusKeys, PreferredContactMethodKey, PreferredContactMethodKeys, PrimaryLanguageKey, PrimaryLanguageKeys, ProgramEnrollmentChangeTypeKey, ProgramEnrollmentChangeTypeKeys, ProgramSpecificCodeKey, ProgramSpecificCodeKeys, PronounsKey, PronounsKeys, ProofOfIdTypeKey, ProofOfIdTypeKeys, ProvenanceSourceIdKey, ProvenanceSourceIdKeys, QualityFlagsKey, QualityFlagsKeys, RaceEthnicityKey, RaceEthnicityKeys, RadiusBucketKey, RadiusBucketKeys, RecencyBandKey, RecencyBandKeys, ReferenceLinkTypeKey, ReferenceLinkTypeKeys, ReferralEntityCategoryKey, ReferralEntityCategoryKeys, ReferralOriginKey, ReferralOriginKeys, RelationshipConcernKey, RelationshipConcernKeys, RelationshipDynamicsKey, RelationshipDynamicsKeys, RelationshipStatusCurrentKey, RelationshipStatusCurrentKeys, RelationshipTiesKey, RelationshipTiesKeys, ReturnedToAbuserStatusKey, ReturnedToAbuserStatusKeys, RiskCategoryKey, RiskCategoryKeys, RiskIdentificationMilestoneKey, RiskIdentificationMilestoneKeys, RiskSeverityBandKey, RiskSeverityBandKeys, RoiMethodKey, RoiMethodKeys, RoiScopeKey, RoiScopeKeys, RoiStatusKey, RoiStatusKeys, RoleContextKey, RoleContextKeys, RomanticRelationshipChangeTypeKey, RomanticRelationshipChangeTypeKeys, RsvpResponseKey, RsvpResponseKeys, ServiceAudienceKey, ServiceAudienceKeys, ServiceCategoryKey, ServiceCategoryKeys, ServiceDeliveryChannelKey, ServiceDeliveryChannelKeys, ServiceMechanismKey, ServiceMechanismKeys, ServicePlanClosureReasonKey, ServicePlanClosureReasonKeys, ServicePlanReviewSnoozeReasonKey, ServicePlanReviewSnoozeReasonKeys, ServiceSourceKey, ServiceSourceKeys, ServiceStateKey, ServiceStateKeys, SessionNoteVisibilityKey, SessionNoteVisibilityKeys, SessionStateKey, SessionStateKeys, SessionTemplateKey, SessionTemplateKeys, SeverityFollowUpKey, SeverityFollowUpKeys, SexProviderSubroleKey, SexProviderSubroleKeys, SharePurposeKey, SharePurposeKeys, ShareResponseReasonKey, ShareResponseReasonKeys, SignatureMethodKey, SignatureMethodKeys, SignatureTypeKey, SignatureTypeKeys, SmtBodyLocationKey, SmtBodyLocationKeys, SmtNameRelationKey, SmtNameRelationKeys, SmtSignificanceFlagsKey, SmtSignificanceFlagsKeys, SmtTypeKey, SmtTypeKeys, SourceCategoryKey, SourceCategoryKeys, SourceInstrumentKey, SourceInstrumentKeys, SourceSubtypeKey, SourceSubtypeKeys, SourceSystemKey, SourceSystemKeys, SpecialNeedsDisabilitiesKey, SpecialNeedsDisabilitiesKeys, SubjectTypeKey, SubjectTypeKeys, SubstanceUseStatusKey, SubstanceUseStatusKeys, SuggestionSourceKey, SuggestionSourceKeys, SupportStrengthKey, SupportStrengthKeys, SupportTopicKey, SupportTopicKeys, ThreadStatusKey, ThreadStatusKeys, ThreadTypeKey, ThreadTypeKeys, TimeScopeKey, TimeScopeKeys, TraffickingRelevantRoleKey, TraffickingRelevantRoleKeys, TribesKey, TribesKeys, UserRoleKey, UserRoleKeys, VerificationMethodKey, VerificationMethodKeys, VerificationStatusKey, VerificationStatusKeys, VictimAbuseTypesKey, VictimAbuseTypesKeys, VictimStatusFamilyKey, VictimStatusFamilyKeys, VisaTypeKey, VisaTypeKeys, WhyNotKey, WhyNotKeys } from './enums/index.js';
10
10
  export { CvcRegistryService, CvcRegistryServiceOptions, EntryLoader, ICvcEntry, ICvcRegistry, RegistryLoader, RegistryScope, applyEntryOverrides, cascadeExclusions, cvcVersionsToRecord, resolveRegistryWithInheritance } from './services/index.js';
11
11
  export { C as CreateInformationScopeResolverInput, I as INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE, a as INFORMATION_SCOPE_READABLE_VERSIONS, b as INFORMATION_SCOPE_SYSTEM_INFO, c as INFORMATION_SCOPE_VERSION, d as InformationScopeResolver, S as ScopeApp, e as ScopeApps, f as ScopeCodeReading, g as ScopeKindBranch, h as ScopeMigration, i as ScopeMigrationRule, j as ScopePersonKind, k as ScopeReadOptions, l as ScopeReading, m as ScopeReadingRule, n as ScopeReadingSubject, o as ScopeRetainedReading, p as ScopeRow, q as ScopeRowStatus, r as ScopeRowType, s as ScopeShareOptions, t as ScopeShareReason, u as ScopeShareVerdict, v as ScopeSpecialDataType, w as ScopeSubjectKind, x as StoredScopeList, y as createInformationScopeResolver, z as isScopeInstrumentRow, A as isScopeRestRow, B as isSelectableScopeRow, D as kindForPerson } from './informationScopeResolver-BzYu97DE.js';
@@ -1,3 +1,3 @@
1
- export { a as CvcEntry, b as CvcRegistry, F as Form, P as PlatformFunction, d as PlatformRole, Q as Question, f as ScoringRule, h as Section } from '../cvcEntry-Asg7mxjB.cjs';
1
+ export { a as CvcEntry, b as CvcRegistry, F as Form, P as PlatformFunction, d as PlatformRole, Q as Question, f as ScoringRule, h as Section } from '../cvcEntry-BqAGctqK.cjs';
2
2
  import 'mongoose';
3
- export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from '../index-Pt82NxQg.cjs';
3
+ export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from '../index-BTqHP4DM.cjs';
@@ -1,3 +1,3 @@
1
- export { a as CvcEntry, b as CvcRegistry, F as Form, P as PlatformFunction, d as PlatformRole, Q as Question, f as ScoringRule, h as Section } from '../cvcEntry-Asg7mxjB.js';
1
+ export { a as CvcEntry, b as CvcRegistry, F as Form, P as PlatformFunction, d as PlatformRole, Q as Question, f as ScoringRule, h as Section } from '../cvcEntry-BqAGctqK.js';
2
2
  import 'mongoose';
3
- export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from '../index-ClTjjJ_S.js';
3
+ export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from '../index-Dr6GBCoY.js';
@@ -86,6 +86,7 @@ __export(pointsOfContact_exports, {
86
86
  preferredContactEntry: () => preferredContactEntry,
87
87
  preferredEmail: () => preferredEmail,
88
88
  preferredPhone: () => preferredPhone,
89
+ resolveMagicLinkRecipients: () => resolveMagicLinkRecipients,
89
90
  toNetworkView: () => toNetworkView,
90
91
  toOwnerView: () => toOwnerView,
91
92
  toStewardView: () => toStewardView
@@ -594,7 +595,7 @@ async function listContactsForSubject(db, subject, opts = {}) {
594
595
  const docs = await findDocs(db, { ...subjectFilter(subject), ...NETWORK_VISIBLE });
595
596
  return networkViews(docs, await seatsFor(docs, opts.resolveSeats));
596
597
  }
597
- async function listReferralContactsForPartner(db, partner, opts) {
598
+ function partnerKeys(partner) {
598
599
  const keys = [];
599
600
  if (partner.agency_id !== void 0 && partner.agency_id !== null) {
600
601
  keys.push({ agency_id: requireId("agency_id", partner.agency_id) });
@@ -603,17 +604,53 @@ async function listReferralContactsForPartner(db, partner, opts) {
603
604
  keys.push({ org_id: requireId("org_id", partner.org_id) });
604
605
  }
605
606
  if (keys.length === 0) throw new TypeError("points-of-contact: select a partner by agency_id, org_id or both");
607
+ return keys;
608
+ }
609
+ var mayBeConfidential = (raw) => raw.is_confidential !== false && raw.is_confidential !== void 0;
610
+ async function findHolderDocs(db, filter, confidentialLeg) {
611
+ const raw = await db.collection(POINTS_OF_CONTACT_COLLECTION).find(filter).toArray();
612
+ const docs = [];
613
+ let skipped = 0;
614
+ for (const r of raw) {
615
+ const row = rowOf(r);
616
+ try {
617
+ docs.push(normalizePointOfContact(row));
618
+ } catch (err) {
619
+ if (!confidentialLeg && !mayBeConfidential(row)) throw err;
620
+ skipped++;
621
+ }
622
+ }
623
+ return { docs: docs.sort(byContactReadingOrder), skipped };
624
+ }
625
+ async function readReferralHolders(db, partner, opts) {
626
+ const keys = partnerKeys(partner);
606
627
  const pendingFor = opts.includeOwnPendingFor === void 0 ? null : requireId("includeOwnPendingFor", opts.includeOwnPendingFor);
607
- const docs = await findDocs(db, {
608
- $or: keys,
609
- purposes: REFERRALS_MAGIC_LINK_PURPOSE,
610
- ...NETWORK_VISIBLE
611
- });
612
- const views = networkViews(docs, await seatsFor(docs, opts.resolveSeats));
628
+ const visible = await findHolderDocs(
629
+ db,
630
+ { $or: keys, purposes: REFERRALS_MAGIC_LINK_PURPOSE, ...NETWORK_VISIBLE },
631
+ false
632
+ );
633
+ const pending = pendingFor === null ? { docs: [], skipped: 0 } : await findHolderDocs(
634
+ db,
635
+ {
636
+ $or: keys,
637
+ purposes: REFERRALS_MAGIC_LINK_PURPOSE,
638
+ ...OWN_PENDING_IN_APP,
639
+ createdBy: pendingFor
640
+ },
641
+ false
642
+ );
643
+ const confidential = await findHolderDocs(
644
+ db,
645
+ { $or: keys, purposes: REFERRALS_MAGIC_LINK_PURPOSE, ...CONFIDENTIAL_CONFIRMED },
646
+ true
647
+ );
648
+ const docs = visible.docs;
649
+ const seats = await seatsFor([...docs, ...confidential.docs], opts.resolveSeats);
613
650
  const recipients = [];
614
651
  const unreachable = [];
615
652
  const seen = /* @__PURE__ */ new Set();
616
- for (const v of views) {
653
+ for (const v of networkViews(docs, seats)) {
617
654
  if (!v.purposes.includes(REFERRALS_MAGIC_LINK_PURPOSE)) continue;
618
655
  const email = v.email;
619
656
  if (!email) {
@@ -625,13 +662,7 @@ async function listReferralContactsForPartner(db, partner, opts) {
625
662
  recipients.push({ ...v, email });
626
663
  }
627
664
  if (pendingFor !== null) {
628
- const pending = await findDocs(db, {
629
- $or: keys,
630
- purposes: REFERRALS_MAGIC_LINK_PURPOSE,
631
- ...OWN_PENDING_IN_APP,
632
- createdBy: pendingFor
633
- });
634
- for (const d of pending) {
665
+ for (const d of pending.docs) {
635
666
  if (!isOwnPendingInApp(d, pendingFor)) continue;
636
667
  const v = toNetworkView({ ...d, status: "confirmed" });
637
668
  const email = v?.email;
@@ -640,8 +671,93 @@ async function listReferralContactsForPartner(db, partner, opts) {
640
671
  recipients.push({ ...v, email, pending: true });
641
672
  }
642
673
  }
643
- return { recipients, unreachable };
674
+ const confidentialAddresses = [];
675
+ const confidentialSeen = /* @__PURE__ */ new Set();
676
+ let confidentialUnreachableCount = visible.skipped + pending.skipped + confidential.skipped;
677
+ for (const d of confidential.docs) {
678
+ if (!isConfidentialHolder(d)) continue;
679
+ const email = toStewardView(d, seatOf(d, seats)).email;
680
+ if (!email) {
681
+ confidentialUnreachableCount++;
682
+ continue;
683
+ }
684
+ if (confidentialSeen.has(email)) continue;
685
+ confidentialSeen.add(email);
686
+ confidentialAddresses.push(email);
687
+ }
688
+ return { recipients, unreachable, confidentialAddresses, confidentialUnreachableCount };
689
+ }
690
+ async function listReferralContactsForPartner(db, partner, opts) {
691
+ const holders = await readReferralHolders(db, partner, opts);
692
+ return {
693
+ recipients: holders.recipients,
694
+ unreachable: holders.unreachable,
695
+ confidentialCount: holders.confidentialAddresses.length
696
+ };
697
+ }
698
+ async function resolveMagicLinkRecipients(db, partner, opts) {
699
+ const holders = await readReferralHolders(db, partner, opts);
700
+ return {
701
+ recipients: holders.recipients,
702
+ unreachable: holders.unreachable,
703
+ confidential: new ConfidentialHolders(holders.confidentialAddresses),
704
+ confidentialUnreachableCount: holders.confidentialUnreachableCount
705
+ };
706
+ }
707
+ var SAFE_ERROR_NAME = /^[A-Za-z_$][\w$.-]{0,63}$/;
708
+ function errorName(err) {
709
+ try {
710
+ if (err === null || typeof err !== "object" && typeof err !== "function") return "Error";
711
+ const name = err.name;
712
+ return typeof name === "string" && SAFE_ERROR_NAME.test(name) ? name : "Error";
713
+ } catch {
714
+ return "Error";
715
+ }
644
716
  }
717
+ var ConfidentialHolders = class {
718
+ count;
719
+ #addresses;
720
+ constructor(addresses) {
721
+ this.#addresses = Object.freeze([...addresses]);
722
+ this.count = this.#addresses.length;
723
+ Object.freeze(this);
724
+ }
725
+ /** See {@link ConfidentialReferralRecipients.deliver}. */
726
+ async deliver(sendOne, opts = {}) {
727
+ const { capacity } = opts;
728
+ if (capacity !== void 0 && !(Number.isInteger(capacity) && capacity >= 0)) {
729
+ throw new TypeError("points-of-contact: capacity must be a non-negative integer");
730
+ }
731
+ const toSend = capacity === void 0 ? this.#addresses : this.#addresses.slice(0, capacity);
732
+ const out = {
733
+ count: this.count,
734
+ delivered: 0,
735
+ failed: 0,
736
+ overflow: this.count - toSend.length,
737
+ firstErrorName: null
738
+ };
739
+ for (const address of toSend) {
740
+ try {
741
+ await sendOne(address);
742
+ out.delivered++;
743
+ } catch (err) {
744
+ out.failed++;
745
+ out.firstErrorName ??= errorName(err);
746
+ }
747
+ }
748
+ return out;
749
+ }
750
+ /** `{ count }`: what a response, a record or an event may carry. */
751
+ toJSON() {
752
+ return { count: this.count };
753
+ }
754
+ toString() {
755
+ return `ConfidentialReferralRecipients(${this.count})`;
756
+ }
757
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
758
+ return this.toString();
759
+ }
760
+ };
645
761
  var OWN_PENDING_IN_APP = {
646
762
  active: true,
647
763
  status: "pending",
@@ -649,6 +765,8 @@ var OWN_PENDING_IN_APP = {
649
765
  is_confidential: { $ne: true }
650
766
  };
651
767
  var isOwnPendingInApp = (d, sub) => d.active && d.status === "pending" && d.origin === "in_app" && !d.is_confidential && !d.user_id && d.createdBy === sub && d.purposes.includes(REFERRALS_MAGIC_LINK_PURPOSE);
768
+ var CONFIDENTIAL_CONFIRMED = { active: true, status: "confirmed", is_confidential: true };
769
+ var isConfidentialHolder = (d) => d.active && d.status === "confirmed" && d.is_confidential && d.purposes.includes(REFERRALS_MAGIC_LINK_PURPOSE);
652
770
  async function getContact(db, id, opts = {}) {
653
771
  const raw = await db.collection(POINTS_OF_CONTACT_COLLECTION).findOne({ id: requireId("id", id) });
654
772
  if (!raw) return null;
@@ -1333,6 +1451,7 @@ async function mintPartnerContact(db, args, driver) {
1333
1451
  preferredContactEntry,
1334
1452
  preferredEmail,
1335
1453
  preferredPhone,
1454
+ resolveMagicLinkRecipients,
1336
1455
  toNetworkView,
1337
1456
  toOwnerView,
1338
1457
  toStewardView