@htilabs/platform-common-models 0.12.1 → 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.
- package/dist/{cvcEntry-0BIB9sen.d.cts → cvcEntry-ctHTp2df.d.cts} +36 -36
- package/dist/{cvcEntry-0BIB9sen.d.ts → cvcEntry-ctHTp2df.d.ts} +36 -36
- package/dist/cvcs/index.cjs +245 -4
- package/dist/cvcs/index.cjs.map +1 -1
- package/dist/cvcs/index.d.cts +533 -274
- package/dist/cvcs/index.d.ts +533 -274
- package/dist/cvcs/index.js +244 -4
- package/dist/cvcs/index.js.map +1 -1
- package/dist/enums/index.cjs +17 -0
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.cts +24 -3
- package/dist/enums/index.d.ts +24 -3
- package/dist/enums/index.js +16 -0
- package/dist/enums/index.js.map +1 -1
- package/dist/{index-CDoqrfc1.d.ts → index-4DiJrn7y.d.ts} +1 -1
- package/dist/{index-Zu_mOJRn.d.cts → index-qreOzXYS.d.cts} +1 -1
- package/dist/index.cjs +317 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +310 -11
- package/dist/index.js.map +1 -1
- package/dist/models/index.d.cts +2 -2
- package/dist/models/index.d.ts +2 -2
- package/dist/schemas/index.cjs +41 -7
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +116 -12
- package/dist/schemas/index.d.ts +116 -12
- package/dist/schemas/index.js +38 -7
- package/dist/schemas/index.js.map +1 -1
- package/dist/{cvc-Cp4uWnAa.d.cts → team-C4LJ5Tex.d.cts} +36 -1
- package/dist/{cvc-Cp4uWnAa.d.ts → team-C4LJ5Tex.d.ts} +36 -1
- package/dist/validation/index.cjs +155 -0
- package/dist/validation/index.cjs.map +1 -1
- package/dist/validation/index.d.cts +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +153 -0
- package/dist/validation/index.js.map +1 -1
- package/package.json +27 -26
- package/src/__tests__/__snapshots__/cvc-sot.snap +8 -0
- package/src/__tests__/core-information-scope-invariant.test.ts +125 -2
- package/src/__tests__/cvc-drift-gate.test.ts +18 -0
- package/src/__tests__/cvc-sot-snapshot.test.ts +17 -0
- package/src/__tests__/cvc-structural.test.ts +5 -0
- package/src/__tests__/share-response-reason-invariant.test.ts +167 -0
- package/src/__tests__/team-directory-fields.test.ts +252 -0
- package/src/cvcs/coreInformationScope.v1.0.0.json +21 -4
- package/src/cvcs/index.ts +4 -0
- package/src/cvcs/shareResponseReason.v1.0.0.json +220 -0
- package/src/generated/cvc-enums.ts +25 -2
- package/src/index.ts +7 -0
- package/src/schemas/index.ts +8 -0
- package/src/schemas/team.ts +118 -0
- package/src/validation/index.ts +1 -0
- package/src/validation/team.ts +48 -0
package/dist/schemas/index.d.cts
CHANGED
|
@@ -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-
|
|
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-ctHTp2df.cjs';
|
|
4
4
|
|
|
5
5
|
declare const addressSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
6
6
|
_id: false;
|
|
@@ -28,9 +28,9 @@ declare const addressSchema: Schema<any, mongoose.Model<any, any, any, any, any,
|
|
|
28
28
|
placeId?: string | null | undefined;
|
|
29
29
|
}, {
|
|
30
30
|
id: string;
|
|
31
|
-
},
|
|
31
|
+
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
32
32
|
_id: false;
|
|
33
|
-
}
|
|
33
|
+
}>> & Omit<{
|
|
34
34
|
formattedAddress?: string | null | undefined;
|
|
35
35
|
street?: string | null | undefined;
|
|
36
36
|
city?: string | null | undefined;
|
|
@@ -90,9 +90,9 @@ declare const personNameSchema: Schema<any, mongoose.Model<any, any, any, any, a
|
|
|
90
90
|
isMononym?: boolean | null | undefined;
|
|
91
91
|
}, {
|
|
92
92
|
id: string;
|
|
93
|
-
},
|
|
93
|
+
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
94
94
|
_id: false;
|
|
95
|
-
}
|
|
95
|
+
}>> & Omit<{
|
|
96
96
|
alias?: boolean | null | undefined;
|
|
97
97
|
firstName?: string | null | undefined;
|
|
98
98
|
lastName?: string | null | undefined;
|
|
@@ -140,9 +140,9 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
140
140
|
dataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
|
|
141
141
|
}, {
|
|
142
142
|
id: string;
|
|
143
|
-
},
|
|
143
|
+
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
144
144
|
_id: false;
|
|
145
|
-
}
|
|
145
|
+
}>> & Omit<{
|
|
146
146
|
number?: string | null | undefined;
|
|
147
147
|
type?: string | null | undefined;
|
|
148
148
|
safeToContact?: boolean | null | undefined;
|
|
@@ -176,9 +176,9 @@ declare const emailSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
176
176
|
address?: string | null | undefined;
|
|
177
177
|
}, {
|
|
178
178
|
id: string;
|
|
179
|
-
},
|
|
179
|
+
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
180
180
|
_id: false;
|
|
181
|
-
}
|
|
181
|
+
}>> & Omit<{
|
|
182
182
|
type?: string | null | undefined;
|
|
183
183
|
safeToContact?: boolean | null | undefined;
|
|
184
184
|
address?: string | null | undefined;
|
|
@@ -250,9 +250,9 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
250
250
|
ethnicityDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
|
|
251
251
|
}, {
|
|
252
252
|
id: string;
|
|
253
|
-
},
|
|
253
|
+
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
254
254
|
_id: false;
|
|
255
|
-
}
|
|
255
|
+
}>> & Omit<{
|
|
256
256
|
race: number[];
|
|
257
257
|
ethnicity: number[];
|
|
258
258
|
accommodations: string[];
|
|
@@ -313,4 +313,108 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
313
313
|
}>;
|
|
314
314
|
type Demographics = InferRawDocType<typeof demographicsSchema>;
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
/**
|
|
317
|
+
* @htilabs/platform-common-models — Team directory fields
|
|
318
|
+
*
|
|
319
|
+
* Shared, additive fields for the platform-db `teams` collection that the
|
|
320
|
+
* Thread→PAVE "Refer to intake" preset reads to resolve the own-agency PAVE
|
|
321
|
+
* intake team.
|
|
322
|
+
*
|
|
323
|
+
* ## This is a FRAGMENT, not a Team model
|
|
324
|
+
*
|
|
325
|
+
* No canonical Team schema exists in this package. The `teams` collection is
|
|
326
|
+
* defined by legacy PAVE (`screening-tools` `models/teamModel.js`,
|
|
327
|
+
* `agencyManagementDb`), mirrored by Thread
|
|
328
|
+
* (`packages/db/src/models/platform/Team.ts`), written by the platform Admin
|
|
329
|
+
* Hub and identity sync, and read raw by pave-2.0 (`lookups/teamGraph.ts`).
|
|
330
|
+
* Declaring the whole Team contract here would mean resolving those shapes,
|
|
331
|
+
* which is out of scope. This module only declares the fields the referral
|
|
332
|
+
* preset needs. Each consumer adds them to its own team schema with
|
|
333
|
+
* {@link addTeamDirectoryFields}, or spreads {@link teamDirectorySchemaDefinition}.
|
|
334
|
+
*
|
|
335
|
+
* ## Canon
|
|
336
|
+
*
|
|
337
|
+
* Prototype `origin/main` @ `c658d6f7`:
|
|
338
|
+
* - `KICKOFF_SHARE_EDGE_CONVERGENCE_2026-09-29.md` § 2.8 L254-257: the intake
|
|
339
|
+
* team is resolved from the sending program's `can_refer_to` targets
|
|
340
|
+
* first, then from the default-share-team ladder restricted to PAVE teams.
|
|
341
|
+
* A referral to intake never routes back to the sender.
|
|
342
|
+
* - Monolith `HTI-LEADS-PAVE-Thread-prototype.html` L323796-323832
|
|
343
|
+
* (`resolveIntakeTeamMono`), directory `programs[]` L142246-142431 and
|
|
344
|
+
* `teams[]` from L142584.
|
|
345
|
+
*
|
|
346
|
+
* Thread ADR: `docs/ADR-THREAD-PAVE-CASESHARE-CONVERGENCE.md` D1 and staging
|
|
347
|
+
* row .2 (consumer th-ng838.2). PAVE consumer: pv-p6share-thread-ingest-v4.
|
|
348
|
+
*
|
|
349
|
+
* ## Divergences from canon (deliberate)
|
|
350
|
+
*
|
|
351
|
+
* 1. **`apps`, not `apps_used`.** Canon's team rows carry lowercase
|
|
352
|
+
* `apps_used` (`"pave"`). The live platform-db writers already stamp
|
|
353
|
+
* `apps` with the uppercase {@link PLATFORM_TOOL} codes on agencies,
|
|
354
|
+
* accounts, users and teams (platform `lib/sync/upserts.ts`,
|
|
355
|
+
* `$addToSet: { apps: APP }` with `APP = source.toUpperCase()`). This
|
|
356
|
+
* field matches that convention exactly.
|
|
357
|
+
* 2. **`canReferTo` lives on the team.** Canon carries `can_refer_to` on a
|
|
358
|
+
* first-class PROGRAM row (`programs[]`, one `team_id` per program), and
|
|
359
|
+
* its targets are PROGRAM ids. No Program model exists in this package or
|
|
360
|
+
* in platform-db, so the targets are carried here as TEAM ids on the
|
|
361
|
+
* sending team. Canon's resolver maps each target program to its single
|
|
362
|
+
* team before using it, so the resolved team is the same. If a Program
|
|
363
|
+
* model lands later, `canReferTo` should move onto it.
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
/** Mongoose model name every app registers the `teams` collection under. */
|
|
367
|
+
declare const TEAM_MODEL_NAME: "Team";
|
|
368
|
+
/**
|
|
369
|
+
* The directory fields to add to a team schema.
|
|
370
|
+
*
|
|
371
|
+
* Both are OPTIONAL and default to `undefined`, not `[]`. A team document
|
|
372
|
+
* written before these fields existed hydrates and re-saves without gaining
|
|
373
|
+
* an `apps` or `canReferTo` key. That keeps "not declared" (absent) distinct
|
|
374
|
+
* from "declared empty" (`[]`).
|
|
375
|
+
*/
|
|
376
|
+
declare const teamDirectorySchemaDefinition: {
|
|
377
|
+
/**
|
|
378
|
+
* The platform apps this team works in, as {@link PLATFORM_TOOL} codes
|
|
379
|
+
* (`"PAVE"`, `"THREAD"`, `"LEADS"`, ...). The referral preset only resolves
|
|
380
|
+
* to a team whose `apps` includes `"PAVE"`.
|
|
381
|
+
*/
|
|
382
|
+
apps: {
|
|
383
|
+
type: StringConstructor[];
|
|
384
|
+
enum: ("THREAD" | "PAVE" | "ECHO" | "LEADS" | "TRAIL" | "PLATFORM")[];
|
|
385
|
+
default: undefined;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* The teams this team refers to, in priority order. The resolver takes the
|
|
389
|
+
* first active target that works in PAVE and is not the sending team itself.
|
|
390
|
+
*/
|
|
391
|
+
canReferTo: {
|
|
392
|
+
type: {
|
|
393
|
+
type: typeof Schema.Types.ObjectId;
|
|
394
|
+
ref: "Team";
|
|
395
|
+
}[];
|
|
396
|
+
default: undefined;
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Add the team directory fields to an existing team schema.
|
|
401
|
+
*
|
|
402
|
+
* Adds no indexes and no hooks. Indexes on the shared `teams` collection
|
|
403
|
+
* stay with the collection's owner.
|
|
404
|
+
*
|
|
405
|
+
* @param schema - The consumer's team schema
|
|
406
|
+
* @returns The same schema, for chaining
|
|
407
|
+
*/
|
|
408
|
+
declare function addTeamDirectoryFields<S extends Schema>(schema: S): S;
|
|
409
|
+
/**
|
|
410
|
+
* Raw (persistence) shape of the team directory fields: `apps` as
|
|
411
|
+
* `PlatformToolValue[]`, `canReferTo` as `ObjectId[]`.
|
|
412
|
+
*
|
|
413
|
+
* Inferred from the DEFINITION, not from a compiled `Schema`: given a
|
|
414
|
+
* `Schema` instance, `InferRawDocType` resolves to the Schema object's own
|
|
415
|
+
* members rather than the document fields. Wrapped in `Partial` because both
|
|
416
|
+
* fields are absent on documents that predate them.
|
|
417
|
+
*/
|
|
418
|
+
type TeamDirectoryFields = Partial<InferRawDocType<typeof teamDirectorySchemaDefinition>>;
|
|
419
|
+
|
|
420
|
+
export { type Address, type Demographics, type Email, type PersonName, type Phone, TEAM_MODEL_NAME, type TeamDirectoryFields, addTeamDirectoryFields, addressSchema, demographicsSchema, emailSchema, personNameSchema, phoneSchema, teamDirectorySchemaDefinition };
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -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-
|
|
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-ctHTp2df.js';
|
|
4
4
|
|
|
5
5
|
declare const addressSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
6
6
|
_id: false;
|
|
@@ -28,9 +28,9 @@ declare const addressSchema: Schema<any, mongoose.Model<any, any, any, any, any,
|
|
|
28
28
|
placeId?: string | null | undefined;
|
|
29
29
|
}, {
|
|
30
30
|
id: string;
|
|
31
|
-
},
|
|
31
|
+
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
32
32
|
_id: false;
|
|
33
|
-
}
|
|
33
|
+
}>> & Omit<{
|
|
34
34
|
formattedAddress?: string | null | undefined;
|
|
35
35
|
street?: string | null | undefined;
|
|
36
36
|
city?: string | null | undefined;
|
|
@@ -90,9 +90,9 @@ declare const personNameSchema: Schema<any, mongoose.Model<any, any, any, any, a
|
|
|
90
90
|
isMononym?: boolean | null | undefined;
|
|
91
91
|
}, {
|
|
92
92
|
id: string;
|
|
93
|
-
},
|
|
93
|
+
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
94
94
|
_id: false;
|
|
95
|
-
}
|
|
95
|
+
}>> & Omit<{
|
|
96
96
|
alias?: boolean | null | undefined;
|
|
97
97
|
firstName?: string | null | undefined;
|
|
98
98
|
lastName?: string | null | undefined;
|
|
@@ -140,9 +140,9 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
140
140
|
dataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
|
|
141
141
|
}, {
|
|
142
142
|
id: string;
|
|
143
|
-
},
|
|
143
|
+
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
144
144
|
_id: false;
|
|
145
|
-
}
|
|
145
|
+
}>> & Omit<{
|
|
146
146
|
number?: string | null | undefined;
|
|
147
147
|
type?: string | null | undefined;
|
|
148
148
|
safeToContact?: boolean | null | undefined;
|
|
@@ -176,9 +176,9 @@ declare const emailSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
176
176
|
address?: string | null | undefined;
|
|
177
177
|
}, {
|
|
178
178
|
id: string;
|
|
179
|
-
},
|
|
179
|
+
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
180
180
|
_id: false;
|
|
181
|
-
}
|
|
181
|
+
}>> & Omit<{
|
|
182
182
|
type?: string | null | undefined;
|
|
183
183
|
safeToContact?: boolean | null | undefined;
|
|
184
184
|
address?: string | null | undefined;
|
|
@@ -250,9 +250,9 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
250
250
|
ethnicityDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
|
|
251
251
|
}, {
|
|
252
252
|
id: string;
|
|
253
|
-
},
|
|
253
|
+
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
254
254
|
_id: false;
|
|
255
|
-
}
|
|
255
|
+
}>> & Omit<{
|
|
256
256
|
race: number[];
|
|
257
257
|
ethnicity: number[];
|
|
258
258
|
accommodations: string[];
|
|
@@ -313,4 +313,108 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
313
313
|
}>;
|
|
314
314
|
type Demographics = InferRawDocType<typeof demographicsSchema>;
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
/**
|
|
317
|
+
* @htilabs/platform-common-models — Team directory fields
|
|
318
|
+
*
|
|
319
|
+
* Shared, additive fields for the platform-db `teams` collection that the
|
|
320
|
+
* Thread→PAVE "Refer to intake" preset reads to resolve the own-agency PAVE
|
|
321
|
+
* intake team.
|
|
322
|
+
*
|
|
323
|
+
* ## This is a FRAGMENT, not a Team model
|
|
324
|
+
*
|
|
325
|
+
* No canonical Team schema exists in this package. The `teams` collection is
|
|
326
|
+
* defined by legacy PAVE (`screening-tools` `models/teamModel.js`,
|
|
327
|
+
* `agencyManagementDb`), mirrored by Thread
|
|
328
|
+
* (`packages/db/src/models/platform/Team.ts`), written by the platform Admin
|
|
329
|
+
* Hub and identity sync, and read raw by pave-2.0 (`lookups/teamGraph.ts`).
|
|
330
|
+
* Declaring the whole Team contract here would mean resolving those shapes,
|
|
331
|
+
* which is out of scope. This module only declares the fields the referral
|
|
332
|
+
* preset needs. Each consumer adds them to its own team schema with
|
|
333
|
+
* {@link addTeamDirectoryFields}, or spreads {@link teamDirectorySchemaDefinition}.
|
|
334
|
+
*
|
|
335
|
+
* ## Canon
|
|
336
|
+
*
|
|
337
|
+
* Prototype `origin/main` @ `c658d6f7`:
|
|
338
|
+
* - `KICKOFF_SHARE_EDGE_CONVERGENCE_2026-09-29.md` § 2.8 L254-257: the intake
|
|
339
|
+
* team is resolved from the sending program's `can_refer_to` targets
|
|
340
|
+
* first, then from the default-share-team ladder restricted to PAVE teams.
|
|
341
|
+
* A referral to intake never routes back to the sender.
|
|
342
|
+
* - Monolith `HTI-LEADS-PAVE-Thread-prototype.html` L323796-323832
|
|
343
|
+
* (`resolveIntakeTeamMono`), directory `programs[]` L142246-142431 and
|
|
344
|
+
* `teams[]` from L142584.
|
|
345
|
+
*
|
|
346
|
+
* Thread ADR: `docs/ADR-THREAD-PAVE-CASESHARE-CONVERGENCE.md` D1 and staging
|
|
347
|
+
* row .2 (consumer th-ng838.2). PAVE consumer: pv-p6share-thread-ingest-v4.
|
|
348
|
+
*
|
|
349
|
+
* ## Divergences from canon (deliberate)
|
|
350
|
+
*
|
|
351
|
+
* 1. **`apps`, not `apps_used`.** Canon's team rows carry lowercase
|
|
352
|
+
* `apps_used` (`"pave"`). The live platform-db writers already stamp
|
|
353
|
+
* `apps` with the uppercase {@link PLATFORM_TOOL} codes on agencies,
|
|
354
|
+
* accounts, users and teams (platform `lib/sync/upserts.ts`,
|
|
355
|
+
* `$addToSet: { apps: APP }` with `APP = source.toUpperCase()`). This
|
|
356
|
+
* field matches that convention exactly.
|
|
357
|
+
* 2. **`canReferTo` lives on the team.** Canon carries `can_refer_to` on a
|
|
358
|
+
* first-class PROGRAM row (`programs[]`, one `team_id` per program), and
|
|
359
|
+
* its targets are PROGRAM ids. No Program model exists in this package or
|
|
360
|
+
* in platform-db, so the targets are carried here as TEAM ids on the
|
|
361
|
+
* sending team. Canon's resolver maps each target program to its single
|
|
362
|
+
* team before using it, so the resolved team is the same. If a Program
|
|
363
|
+
* model lands later, `canReferTo` should move onto it.
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
/** Mongoose model name every app registers the `teams` collection under. */
|
|
367
|
+
declare const TEAM_MODEL_NAME: "Team";
|
|
368
|
+
/**
|
|
369
|
+
* The directory fields to add to a team schema.
|
|
370
|
+
*
|
|
371
|
+
* Both are OPTIONAL and default to `undefined`, not `[]`. A team document
|
|
372
|
+
* written before these fields existed hydrates and re-saves without gaining
|
|
373
|
+
* an `apps` or `canReferTo` key. That keeps "not declared" (absent) distinct
|
|
374
|
+
* from "declared empty" (`[]`).
|
|
375
|
+
*/
|
|
376
|
+
declare const teamDirectorySchemaDefinition: {
|
|
377
|
+
/**
|
|
378
|
+
* The platform apps this team works in, as {@link PLATFORM_TOOL} codes
|
|
379
|
+
* (`"PAVE"`, `"THREAD"`, `"LEADS"`, ...). The referral preset only resolves
|
|
380
|
+
* to a team whose `apps` includes `"PAVE"`.
|
|
381
|
+
*/
|
|
382
|
+
apps: {
|
|
383
|
+
type: StringConstructor[];
|
|
384
|
+
enum: ("THREAD" | "PAVE" | "ECHO" | "LEADS" | "TRAIL" | "PLATFORM")[];
|
|
385
|
+
default: undefined;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* The teams this team refers to, in priority order. The resolver takes the
|
|
389
|
+
* first active target that works in PAVE and is not the sending team itself.
|
|
390
|
+
*/
|
|
391
|
+
canReferTo: {
|
|
392
|
+
type: {
|
|
393
|
+
type: typeof Schema.Types.ObjectId;
|
|
394
|
+
ref: "Team";
|
|
395
|
+
}[];
|
|
396
|
+
default: undefined;
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Add the team directory fields to an existing team schema.
|
|
401
|
+
*
|
|
402
|
+
* Adds no indexes and no hooks. Indexes on the shared `teams` collection
|
|
403
|
+
* stay with the collection's owner.
|
|
404
|
+
*
|
|
405
|
+
* @param schema - The consumer's team schema
|
|
406
|
+
* @returns The same schema, for chaining
|
|
407
|
+
*/
|
|
408
|
+
declare function addTeamDirectoryFields<S extends Schema>(schema: S): S;
|
|
409
|
+
/**
|
|
410
|
+
* Raw (persistence) shape of the team directory fields: `apps` as
|
|
411
|
+
* `PlatformToolValue[]`, `canReferTo` as `ObjectId[]`.
|
|
412
|
+
*
|
|
413
|
+
* Inferred from the DEFINITION, not from a compiled `Schema`: given a
|
|
414
|
+
* `Schema` instance, `InferRawDocType` resolves to the Schema object's own
|
|
415
|
+
* members rather than the document fields. Wrapped in `Partial` because both
|
|
416
|
+
* fields are absent on documents that predate them.
|
|
417
|
+
*/
|
|
418
|
+
type TeamDirectoryFields = Partial<InferRawDocType<typeof teamDirectorySchemaDefinition>>;
|
|
419
|
+
|
|
420
|
+
export { type Address, type Demographics, type Email, type PersonName, type Phone, TEAM_MODEL_NAME, type TeamDirectoryFields, addTeamDirectoryFields, addressSchema, demographicsSchema, emailSchema, personNameSchema, phoneSchema, teamDirectorySchemaDefinition };
|
package/dist/schemas/index.js
CHANGED
|
@@ -4328,8 +4328,36 @@ function buildPlatformRoleSchema() {
|
|
|
4328
4328
|
}
|
|
4329
4329
|
var _platformRoleSchema = buildPlatformRoleSchema();
|
|
4330
4330
|
|
|
4331
|
-
// src/schemas/
|
|
4331
|
+
// src/schemas/team.ts
|
|
4332
4332
|
import { Schema as Schema8 } from "mongoose";
|
|
4333
|
+
var TEAM_MODEL_NAME = "Team";
|
|
4334
|
+
var teamDirectorySchemaDefinition = {
|
|
4335
|
+
/**
|
|
4336
|
+
* The platform apps this team works in, as {@link PLATFORM_TOOL} codes
|
|
4337
|
+
* (`"PAVE"`, `"THREAD"`, `"LEADS"`, ...). The referral preset only resolves
|
|
4338
|
+
* to a team whose `apps` includes `"PAVE"`.
|
|
4339
|
+
*/
|
|
4340
|
+
apps: {
|
|
4341
|
+
type: [String],
|
|
4342
|
+
enum: [...PLATFORM_TOOL_VALUES],
|
|
4343
|
+
default: void 0
|
|
4344
|
+
},
|
|
4345
|
+
/**
|
|
4346
|
+
* The teams this team refers to, in priority order. The resolver takes the
|
|
4347
|
+
* first active target that works in PAVE and is not the sending team itself.
|
|
4348
|
+
*/
|
|
4349
|
+
canReferTo: {
|
|
4350
|
+
type: [{ type: Schema8.Types.ObjectId, ref: TEAM_MODEL_NAME }],
|
|
4351
|
+
default: void 0
|
|
4352
|
+
}
|
|
4353
|
+
};
|
|
4354
|
+
function addTeamDirectoryFields(schema) {
|
|
4355
|
+
schema.add(teamDirectorySchemaDefinition);
|
|
4356
|
+
return schema;
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4359
|
+
// src/schemas/cvcRegistry.ts
|
|
4360
|
+
import { Schema as Schema9 } from "mongoose";
|
|
4333
4361
|
var cvcRegistrySchemaDefinition = {
|
|
4334
4362
|
// Versioning — semantic version of this registry bundle
|
|
4335
4363
|
version: {
|
|
@@ -4349,7 +4377,7 @@ var cvcRegistrySchemaDefinition = {
|
|
|
4349
4377
|
default: null
|
|
4350
4378
|
},
|
|
4351
4379
|
agencyId: {
|
|
4352
|
-
type:
|
|
4380
|
+
type: Schema9.Types.ObjectId,
|
|
4353
4381
|
default: null
|
|
4354
4382
|
},
|
|
4355
4383
|
// Lifecycle
|
|
@@ -4391,7 +4419,7 @@ var cvcRegistrySchemaDefinition = {
|
|
|
4391
4419
|
// include / exclude lists from its base before applying its own overrides.
|
|
4392
4420
|
// Indexed below so a base-version bump can find every dependent registry.
|
|
4393
4421
|
basedOn: {
|
|
4394
|
-
type:
|
|
4422
|
+
type: Schema9.Types.ObjectId,
|
|
4395
4423
|
default: null
|
|
4396
4424
|
}
|
|
4397
4425
|
};
|
|
@@ -4400,7 +4428,7 @@ var cvcRegistrySchemaOptions = {
|
|
|
4400
4428
|
collection: "cvc_registries"
|
|
4401
4429
|
};
|
|
4402
4430
|
function buildCvcRegistrySchema() {
|
|
4403
|
-
const schema = new
|
|
4431
|
+
const schema = new Schema9(
|
|
4404
4432
|
cvcRegistrySchemaDefinition,
|
|
4405
4433
|
cvcRegistrySchemaOptions
|
|
4406
4434
|
);
|
|
@@ -4421,7 +4449,7 @@ function buildCvcRegistrySchema() {
|
|
|
4421
4449
|
var _cvcRegistrySchema = buildCvcRegistrySchema();
|
|
4422
4450
|
|
|
4423
4451
|
// src/schemas/cvcEntry.ts
|
|
4424
|
-
import { Schema as
|
|
4452
|
+
import { Schema as Schema10 } from "mongoose";
|
|
4425
4453
|
var CVC_CODE_PATTERN = /^\d{3}(-\d{3}){6}$/;
|
|
4426
4454
|
var CVC_KEY_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
4427
4455
|
var cvcEntrySchemaDefinition = {
|
|
@@ -4487,7 +4515,7 @@ var cvcEntrySchemaDefinition = {
|
|
|
4487
4515
|
// particular CVC family — e.g. `relevantMechanisms` on service_categories
|
|
4488
4516
|
// entries (a cross-CVC reference into service_mechanisms by key).
|
|
4489
4517
|
meta: {
|
|
4490
|
-
type:
|
|
4518
|
+
type: Schema10.Types.Mixed
|
|
4491
4519
|
}
|
|
4492
4520
|
};
|
|
4493
4521
|
var cvcEntrySchemaOptions = {
|
|
@@ -4498,7 +4526,7 @@ var cvcEntrySchemaOptions = {
|
|
|
4498
4526
|
minimize: false
|
|
4499
4527
|
};
|
|
4500
4528
|
function buildCvcEntrySchema() {
|
|
4501
|
-
const schema = new
|
|
4529
|
+
const schema = new Schema10(cvcEntrySchemaDefinition, cvcEntrySchemaOptions);
|
|
4502
4530
|
schema.index(
|
|
4503
4531
|
{ domain: 1, version: 1, code: 1 },
|
|
4504
4532
|
{ unique: true }
|
|
@@ -4512,6 +4540,8 @@ function buildCvcEntrySchema() {
|
|
|
4512
4540
|
}
|
|
4513
4541
|
var _cvcEntrySchema = buildCvcEntrySchema();
|
|
4514
4542
|
export {
|
|
4543
|
+
TEAM_MODEL_NAME,
|
|
4544
|
+
addTeamDirectoryFields,
|
|
4515
4545
|
addressSchema,
|
|
4516
4546
|
buildCvcEntrySchema,
|
|
4517
4547
|
buildCvcRegistrySchema,
|
|
@@ -4549,6 +4579,7 @@ export {
|
|
|
4549
4579
|
sectionQuestionRefSchema,
|
|
4550
4580
|
sectionSchemaDefinition,
|
|
4551
4581
|
sectionSchemaOptions,
|
|
4582
|
+
teamDirectorySchemaDefinition,
|
|
4552
4583
|
visibilityRuleSchema
|
|
4553
4584
|
};
|
|
4554
4585
|
//# sourceMappingURL=index.js.map
|