@htilabs/platform-common-models 0.12.2 → 0.12.3

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 (45) hide show
  1. package/dist/cvcs/index.cjs +21 -4
  2. package/dist/cvcs/index.cjs.map +1 -1
  3. package/dist/cvcs/index.d.cts +22 -4
  4. package/dist/cvcs/index.d.ts +22 -4
  5. package/dist/cvcs/index.js +21 -4
  6. package/dist/cvcs/index.js.map +1 -1
  7. package/dist/enums/index.cjs +1 -0
  8. package/dist/enums/index.cjs.map +1 -1
  9. package/dist/enums/index.d.cts +3 -2
  10. package/dist/enums/index.d.ts +3 -2
  11. package/dist/enums/index.js +1 -0
  12. package/dist/enums/index.js.map +1 -1
  13. package/dist/index.cjs +77 -11
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +2 -2
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.js +72 -11
  18. package/dist/index.js.map +1 -1
  19. package/dist/schemas/index.cjs +41 -7
  20. package/dist/schemas/index.cjs.map +1 -1
  21. package/dist/schemas/index.d.cts +105 -1
  22. package/dist/schemas/index.d.ts +105 -1
  23. package/dist/schemas/index.js +38 -7
  24. package/dist/schemas/index.js.map +1 -1
  25. package/dist/{cvc-Cp4uWnAa.d.cts → team-C4LJ5Tex.d.cts} +36 -1
  26. package/dist/{cvc-Cp4uWnAa.d.ts → team-C4LJ5Tex.d.ts} +36 -1
  27. package/dist/validation/index.cjs +155 -0
  28. package/dist/validation/index.cjs.map +1 -1
  29. package/dist/validation/index.d.cts +1 -1
  30. package/dist/validation/index.d.ts +1 -1
  31. package/dist/validation/index.js +153 -0
  32. package/dist/validation/index.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/__tests__/__snapshots__/cvc-sot.snap +4 -0
  35. package/src/__tests__/core-information-scope-invariant.test.ts +125 -2
  36. package/src/__tests__/cvc-sot-snapshot.test.ts +9 -0
  37. package/src/__tests__/cvc-structural.test.ts +3 -0
  38. package/src/__tests__/team-directory-fields.test.ts +252 -0
  39. package/src/cvcs/coreInformationScope.v1.0.0.json +21 -4
  40. package/src/generated/cvc-enums.ts +3 -2
  41. package/src/index.ts +7 -0
  42. package/src/schemas/index.ts +8 -0
  43. package/src/schemas/team.ts +118 -0
  44. package/src/validation/index.ts +1 -0
  45. package/src/validation/team.ts +48 -0
package/dist/index.cjs CHANGED
@@ -457,7 +457,10 @@ __export(src_exports, {
457
457
  SuggestionSourceKeys: () => SuggestionSourceKeys,
458
458
  SupportStrengthKeys: () => SupportStrengthKeys,
459
459
  SupportTopicKeys: () => SupportTopicKeys,
460
+ TEAM_MODEL_NAME: () => TEAM_MODEL_NAME,
460
461
  THREAD_INVOLVEMENT_ROLES: () => THREAD_INVOLVEMENT_ROLES,
462
+ TeamAppSchema: () => TeamAppSchema,
463
+ TeamDirectoryFieldsSchema: () => TeamDirectoryFieldsSchema,
461
464
  ThreadStatusKeys: () => ThreadStatusKeys,
462
465
  ThreadTypeKeys: () => ThreadTypeKeys,
463
466
  TimeScopeKeys: () => TimeScopeKeys,
@@ -478,6 +481,7 @@ __export(src_exports, {
478
481
  actionStepCompletionStatusSot: () => actionStepCompletionStatus_v1_0_0_default,
479
482
  actionStepTypeSot: () => actionStepType_v1_0_0_default,
480
483
  activityTypeSot: () => activityType_v1_0_0_default,
484
+ addTeamDirectoryFields: () => addTeamDirectoryFields,
481
485
  addressSchema: () => addressSchema,
482
486
  adminRolesSot: () => adminRoles_v1_0_0_default,
483
487
  administeringJurisdictionSot: () => administeringJurisdiction_v1_0_0_default,
@@ -715,6 +719,7 @@ __export(src_exports, {
715
719
  suggestionSourceSot: () => suggestionSource_v1_0_0_default,
716
720
  supportStrengthSot: () => supportStrength_v1_0_0_default,
717
721
  supportTopicSot: () => supportTopic_v1_0_0_default,
722
+ teamDirectorySchemaDefinition: () => teamDirectorySchemaDefinition,
718
723
  threadStatusSot: () => threadStatus_v1_0_0_default,
719
724
  threadTypeSot: () => threadType_v1_0_0_default,
720
725
  timeScopeSot: () => timeScope_v1_0_0_default,
@@ -7442,8 +7447,36 @@ function buildPlatformRoleSchema() {
7442
7447
  }
7443
7448
  var _platformRoleSchema = buildPlatformRoleSchema();
7444
7449
 
7445
- // src/schemas/cvcRegistry.ts
7450
+ // src/schemas/team.ts
7446
7451
  var import_mongoose8 = require("mongoose");
7452
+ var TEAM_MODEL_NAME = "Team";
7453
+ var teamDirectorySchemaDefinition = {
7454
+ /**
7455
+ * The platform apps this team works in, as {@link PLATFORM_TOOL} codes
7456
+ * (`"PAVE"`, `"THREAD"`, `"LEADS"`, ...). The referral preset only resolves
7457
+ * to a team whose `apps` includes `"PAVE"`.
7458
+ */
7459
+ apps: {
7460
+ type: [String],
7461
+ enum: [...PLATFORM_TOOL_VALUES],
7462
+ default: void 0
7463
+ },
7464
+ /**
7465
+ * The teams this team refers to, in priority order. The resolver takes the
7466
+ * first active target that works in PAVE and is not the sending team itself.
7467
+ */
7468
+ canReferTo: {
7469
+ type: [{ type: import_mongoose8.Schema.Types.ObjectId, ref: TEAM_MODEL_NAME }],
7470
+ default: void 0
7471
+ }
7472
+ };
7473
+ function addTeamDirectoryFields(schema) {
7474
+ schema.add(teamDirectorySchemaDefinition);
7475
+ return schema;
7476
+ }
7477
+
7478
+ // src/schemas/cvcRegistry.ts
7479
+ var import_mongoose9 = require("mongoose");
7447
7480
  var cvcRegistrySchemaDefinition = {
7448
7481
  // Versioning — semantic version of this registry bundle
7449
7482
  version: {
@@ -7463,7 +7496,7 @@ var cvcRegistrySchemaDefinition = {
7463
7496
  default: null
7464
7497
  },
7465
7498
  agencyId: {
7466
- type: import_mongoose8.Schema.Types.ObjectId,
7499
+ type: import_mongoose9.Schema.Types.ObjectId,
7467
7500
  default: null
7468
7501
  },
7469
7502
  // Lifecycle
@@ -7505,7 +7538,7 @@ var cvcRegistrySchemaDefinition = {
7505
7538
  // include / exclude lists from its base before applying its own overrides.
7506
7539
  // Indexed below so a base-version bump can find every dependent registry.
7507
7540
  basedOn: {
7508
- type: import_mongoose8.Schema.Types.ObjectId,
7541
+ type: import_mongoose9.Schema.Types.ObjectId,
7509
7542
  default: null
7510
7543
  }
7511
7544
  };
@@ -7514,7 +7547,7 @@ var cvcRegistrySchemaOptions = {
7514
7547
  collection: "cvc_registries"
7515
7548
  };
7516
7549
  function buildCvcRegistrySchema() {
7517
- const schema = new import_mongoose8.Schema(
7550
+ const schema = new import_mongoose9.Schema(
7518
7551
  cvcRegistrySchemaDefinition,
7519
7552
  cvcRegistrySchemaOptions
7520
7553
  );
@@ -7535,7 +7568,7 @@ function buildCvcRegistrySchema() {
7535
7568
  var _cvcRegistrySchema = buildCvcRegistrySchema();
7536
7569
 
7537
7570
  // src/schemas/cvcEntry.ts
7538
- var import_mongoose9 = require("mongoose");
7571
+ var import_mongoose10 = require("mongoose");
7539
7572
  var CVC_CODE_PATTERN = /^\d{3}(-\d{3}){6}$/;
7540
7573
  var CVC_KEY_PATTERN = /^[a-z][a-z0-9_]*$/;
7541
7574
  var cvcEntrySchemaDefinition = {
@@ -7601,7 +7634,7 @@ var cvcEntrySchemaDefinition = {
7601
7634
  // particular CVC family — e.g. `relevantMechanisms` on service_categories
7602
7635
  // entries (a cross-CVC reference into service_mechanisms by key).
7603
7636
  meta: {
7604
- type: import_mongoose9.Schema.Types.Mixed
7637
+ type: import_mongoose10.Schema.Types.Mixed
7605
7638
  }
7606
7639
  };
7607
7640
  var cvcEntrySchemaOptions = {
@@ -7612,7 +7645,7 @@ var cvcEntrySchemaOptions = {
7612
7645
  minimize: false
7613
7646
  };
7614
7647
  function buildCvcEntrySchema() {
7615
- const schema = new import_mongoose9.Schema(cvcEntrySchemaDefinition, cvcEntrySchemaOptions);
7648
+ const schema = new import_mongoose10.Schema(cvcEntrySchemaDefinition, cvcEntrySchemaOptions);
7616
7649
  schema.index(
7617
7650
  { domain: 1, version: 1, code: 1 },
7618
7651
  { unique: true }
@@ -10642,6 +10675,7 @@ var CoreInformationScopeKeys = {
10642
10675
  contact: "236-003-000-000-000-000-000",
10643
10676
  contact_info: "236-003-001-000-000-000-000",
10644
10677
  safe_locations: "236-003-002-000-000-000-000",
10678
+ priorities_safety: "236-003-003-000-000-000-000",
10645
10679
  services: "236-004-000-000-000-000-000",
10646
10680
  contact_history: "236-004-001-000-000-000-000",
10647
10681
  service_history: "236-004-002-000-000-000-000",
@@ -12287,6 +12321,16 @@ var CvcEnvelopeSchema = import_zod.z.object({
12287
12321
  entries: import_zod.z.array(CvcEntrySchema)
12288
12322
  });
12289
12323
 
12324
+ // src/validation/team.ts
12325
+ var import_zod2 = require("zod");
12326
+ var ObjectIdHexSchema = import_zod2.z.string().regex(/^[0-9a-fA-F]{24}$/, "must be a 24-character hex ObjectId");
12327
+ var hasNoDuplicates = (values) => new Set(values.map((v) => v.toLowerCase())).size === values.length;
12328
+ var TeamAppSchema = import_zod2.z.enum(PLATFORM_TOOL_VALUES);
12329
+ var TeamDirectoryFieldsSchema = import_zod2.z.object({
12330
+ apps: import_zod2.z.array(TeamAppSchema).refine(hasNoDuplicates, "apps must not repeat an app").optional(),
12331
+ canReferTo: import_zod2.z.array(ObjectIdHexSchema).refine(hasNoDuplicates, "canReferTo must not repeat a team").optional()
12332
+ });
12333
+
12290
12334
  // src/cvcs/serviceCategories.v1.0.0.json
12291
12335
  var serviceCategories_v1_0_0_default = {
12292
12336
  domain: "service_categories",
@@ -38625,8 +38669,8 @@ var coreInformationScope_v1_0_0_default = {
38625
38669
  domain: "core_information_scope",
38626
38670
  name: "Core Information Scope",
38627
38671
  version: "1.0.0",
38628
- _status: "DRAFT: canonical number 236, self-declared by the source YAML (`cvc_id: CVC-236`); CVC_INDEX.md carries no row for it yet, so the drift gate classifies it INDEX_ABSENT. Sourced from canonical CVC-236 `core_information_scope` v2 (authored 2026-08-13, restructured 2026-08-14): 12 categories / 54 units. TWO GRAINS, deliberately modelled as hierarchy: L1 categories are the POLICY grain and are NOT selectable; L2 units are the AUTHORIZATION grain and are what an ROI or a share actually authorizes. This is the axis the sibling `roi_scope` domain deliberately omits \u2014 `roi_scope` is the flat item vocabulary, and its 27 substantive keys are a strict SUBSET of the 54 units here, with no renames and no collisions. That subset relationship is what makes adopting this domain additive: every stored ROI keeps its exact recorded meaning. `safe_locations` is PROVISIONAL and may be re-keyed by the Notion steward batch \u2014 pin the id with the product owner before any consumer treats it as stable. PENDING canonical Notion authoring + steward ratification.",
38629
- _source: "htilabstech/prototype data/cvcs/core_information_scope.yaml (CVC-236 v2, restructured 2026-08-14)",
38672
+ _status: "DRAFT: canonical number 236, self-declared by the source YAML (`cvc_id: CVC-236`); CVC_INDEX.md carries no row for it yet, so the drift gate classifies it INDEX_ABSENT. Sourced from canonical CVC-236 `core_information_scope` v2 (authored 2026-08-13, restructured 2026-08-14): 12 categories / 55 units. TWO GRAINS, deliberately modelled as hierarchy: L1 categories are the POLICY grain and are NOT selectable; L2 units are the AUTHORIZATION grain and are what an ROI or a share actually authorizes. This is the axis the sibling `roi_scope` domain deliberately omits \u2014 `roi_scope` is the flat item vocabulary, and its 27 substantive keys are a strict SUBSET of the 55 units here, with no renames and no collisions. That subset relationship is what makes adopting this domain additive: every stored ROI keeps its exact recorded meaning. `safe_locations` is PROVISIONAL and may be re-keyed by the Notion steward batch \u2014 pin the id with the product owner before any consumer treats it as stable. PENDING canonical Notion authoring + steward ratification.",
38673
+ _source: "htilabstech/prototype/data/cvcs/core_information_scope.yaml @ 285a9f1d (CVC-236 v2, restructured 2026-08-14, amended 2026-09-29; read from origin/main; structural columns cross-checked against htilabstech/prototype/Final CVCs/System Roles, Permissions, & Account Management (IC-66)/core-information_scope \u2014 codebook.csv @ 285a9f1d)",
38630
38674
  levels: {
38631
38675
  "0": "Unknown or Missing",
38632
38676
  "1": "Category (policy grain, not selectable)",
@@ -39093,9 +39137,10 @@ var coreInformationScope_v1_0_0_default = {
39093
39137
  parentCode: null,
39094
39138
  childCodes: [
39095
39139
  "236-003-001-000-000-000-000",
39096
- "236-003-002-000-000-000-000"
39140
+ "236-003-002-000-000-000-000",
39141
+ "236-003-003-000-000-000-000"
39097
39142
  ],
39098
- definition: "Contact & safety \u2014 policy-grain category. Units under it are the authorization grain. NARROWED 2026-08-14 (restructure ruling 2): contact/service history moved to the NEW services category. SUPERSEDES the 2026-08-13 deliberate-merge note; legacy `contact` grants resolve via the alias layer (CVC-69 precedent). LEADS flag dropped (no LEADS units \u2014 was an empty shell).",
39143
+ definition: "Contact & safety \u2014 policy-grain category. Units under it are the authorization grain. NARROWED 2026-08-14 (restructure ruling 2): contact/service history moved to the NEW services category. SUPERSEDES the 2026-08-13 deliberate-merge note; legacy `contact` grants resolve via the alias layer (CVC-69 precedent). LEADS flag dropped (no LEADS units \u2014 was an empty shell). | 2026-09-29 (PRIORITIES-SAFETY-SCOPE-UNIT, Crysta R1): third unit priorities_safety \u2014 the immediate-needs triage answers, one disclosure decision.",
39099
39144
  levelFloor: 3,
39100
39145
  appRelevance: [
39101
39146
  "PAVE",
@@ -39137,6 +39182,22 @@ var coreInformationScope_v1_0_0_default = {
39137
39182
  specialDataType: "survivor_confidential",
39138
39183
  platformFloor: true
39139
39184
  },
39185
+ {
39186
+ code: "236-003-003-000-000-000-000",
39187
+ key: "priorities_safety",
39188
+ title: "Priorities & Safety (immediate needs triage)",
39189
+ selectable: true,
39190
+ parentCode: "236-003-000-000-000-000-000",
39191
+ childCodes: [],
39192
+ definition: "Priorities & Safety (immediate needs triage). Category `contact`. NEW 2026-09-29 (PRIORITIES-SAFETY-SCOPE-UNIT, Crysta R1): the completed Immediate Priorities / Priorities & Safety triage, authorized as ONE disclosure decision \u2014 Q1 immediate danger + source of the danger + harm-doer nearby + safe place to go \xB7 Q2 health needs \xB7 Q3 interpreter \xB7 Q4 urgent basic needs \xB7 Q5 transportation (method / time / pickup location) \xB7 Q6 emergency shelter \xB7 Q7 dependents at risk \xB7 Q8 other. Instrument-grain unit on the initial_screen / lap precedent (ruling 1, 2026-08-13), homed under Contact & safety because the answers that had no home are safety facts; the service instances the step derives ride services/service_history on their own. Bidirectional Thread Signal \u2194 PAVE mirror on Q1 (GDR \xA7 6.9.7) \u2014 one unit, both apps. domain_map: priorities_safety \u2192 this unit (R3 EXECUTED later the same day, PRIORITIES-SAFETY-RECORD): CVC-159 domain priorities_safety (Level 1) + monolith emitter emitPrioritiesAnswerCAR (one CAR per answered question) + UDD row capture.priorities_safety; production persistence of the answers stays with Nate under RWT-NEW-priorities-safety-record-and-udd-2026-09-29. Minted in the Notion codebook the same day; codebook row re-synced to the record 2026-09-29.",
39193
+ levelFloor: 3,
39194
+ appRelevance: [
39195
+ "PAVE",
39196
+ "Thread"
39197
+ ],
39198
+ shareableDefault: true,
39199
+ specialDataType: "survivor_confidential"
39200
+ },
39140
39201
  {
39141
39202
  code: "236-004-000-000-000-000-000",
39142
39203
  key: "services",
@@ -56356,7 +56417,10 @@ var CVC_197_VALUES = selectableCodes(
56356
56417
  SuggestionSourceKeys,
56357
56418
  SupportStrengthKeys,
56358
56419
  SupportTopicKeys,
56420
+ TEAM_MODEL_NAME,
56359
56421
  THREAD_INVOLVEMENT_ROLES,
56422
+ TeamAppSchema,
56423
+ TeamDirectoryFieldsSchema,
56360
56424
  ThreadStatusKeys,
56361
56425
  ThreadTypeKeys,
56362
56426
  TimeScopeKeys,
@@ -56377,6 +56441,7 @@ var CVC_197_VALUES = selectableCodes(
56377
56441
  actionStepCompletionStatusSot,
56378
56442
  actionStepTypeSot,
56379
56443
  activityTypeSot,
56444
+ addTeamDirectoryFields,
56380
56445
  addressSchema,
56381
56446
  adminRolesSot,
56382
56447
  administeringJurisdictionSot,
@@ -56614,6 +56679,7 @@ var CVC_197_VALUES = selectableCodes(
56614
56679
  suggestionSourceSot,
56615
56680
  supportStrengthSot,
56616
56681
  supportTopicSot,
56682
+ teamDirectorySchemaDefinition,
56617
56683
  threadStatusSot,
56618
56684
  threadTypeSot,
56619
56685
  timeScopeSot,