@htilabs/platform-common-models 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +65 -0
  2. package/dist/{index-Dr6GBCoY.d.ts → index-ClTjjJ_S.d.ts} +1 -1
  3. package/dist/{index-BTqHP4DM.d.cts → index-Pt82NxQg.d.cts} +1 -1
  4. package/dist/index.cjs +457 -2
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +5 -3
  7. package/dist/index.d.ts +5 -3
  8. package/dist/index.js +437 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/information-scope/index.d.cts +3 -350
  11. package/dist/information-scope/index.d.ts +3 -350
  12. package/dist/informationScopeResolver-BzYu97DE.d.cts +351 -0
  13. package/dist/informationScopeResolver-BzYu97DE.d.ts +351 -0
  14. package/dist/models/index.d.cts +2 -2
  15. package/dist/models/index.d.ts +2 -2
  16. package/dist/schemas/index.d.cts +25 -25
  17. package/dist/schemas/index.d.ts +25 -25
  18. package/dist/services/index.d.cts +2 -1
  19. package/dist/services/index.d.ts +2 -1
  20. package/dist/sharing-ceiling/index.cjs +497 -0
  21. package/dist/sharing-ceiling/index.cjs.map +1 -0
  22. package/dist/sharing-ceiling/index.d.cts +318 -0
  23. package/dist/sharing-ceiling/index.d.ts +318 -0
  24. package/dist/sharing-ceiling/index.js +451 -0
  25. package/dist/sharing-ceiling/index.js.map +1 -0
  26. package/package.json +7 -1
  27. package/src/__sot__/README.md +1 -0
  28. package/src/__sot__/sharingStarter.pin.json +229 -0
  29. package/src/__tests__/sharing-starter-canon.test.ts +178 -0
  30. package/src/generated/sharingPlatformStarter.ts +165 -0
  31. package/src/index.ts +5 -0
  32. package/src/sharingCeiling/__tests__/sharingCeiling.test.ts +678 -0
  33. package/src/sharingCeiling/chain.ts +269 -0
  34. package/src/sharingCeiling/coverage.ts +346 -0
  35. package/src/sharingCeiling/index.ts +14 -0
  36. package/src/sharingCeiling/starter.ts +89 -0
  37. package/dist/{cvcEntry-BqAGctqK.d.cts → cvcEntry-Asg7mxjB.d.cts} +8 -8
  38. package/dist/{cvcEntry-BqAGctqK.d.ts → cvcEntry-Asg7mxjB.d.ts} +8 -8
@@ -0,0 +1,89 @@
1
+ /**
2
+ * The platform sharing starter — what governs a share before an account has
3
+ * authored anything (co-2sx).
4
+ *
5
+ * The data is GENERATED from canon (`scripts/gen-sharing-starter.py` →
6
+ * `src/generated/sharingPlatformStarter.ts`) and held equal to canon by GATE M
7
+ * (`src/__tests__/sharing-starter-canon.test.ts`, against
8
+ * `src/__sot__/sharingStarter.pin.json`). This module types it and freezes it.
9
+ *
10
+ * Canon: prototype `HTI-LEADS-PAVE-Thread-prototype.html` @ d85f05b7
11
+ * `HTI_SHARE_PLATFORM_STARTER` L326475-L326543 (scopeVersion ·
12
+ * scopeByPurpose · counterpartyOverrides); platform-prototype `src/data.js`
13
+ * @ a6f1f3a `data.sharing.scopeByPurpose` / `counterpartyOverrides`
14
+ * L38170-L38190 (the contract of record, GDR § 5.79) and the platform
15
+ * purpose rows `sharing.purposes[].enabled` L32450-L32531 (`records_request`
16
+ * ships `enabled: false`, L32527); prototype
17
+ * `docs/share-roi/information_scope_v4.fields.csv` @ d85f05b7 (where each
18
+ * field is homed, `row_v4`).
19
+ */
20
+
21
+ import {
22
+ SHARING_PLATFORM_STARTER_DATA,
23
+ SHARING_PLATFORM_STARTER_SOURCE,
24
+ } from "../generated/sharingPlatformStarter.js";
25
+
26
+ /** The tree version every starter list and every stored ceiling list is stamped with. */
27
+ export const SHARING_CEILING_SCOPE_VERSION = 4 as const;
28
+
29
+ /** purpose code (CVC-84 key) → v4 information-scope row codes. */
30
+ export type SharingPurposeLists = Readonly<Record<string, readonly string[]>>;
31
+
32
+ export interface SharingPlatformStarter {
33
+ readonly scopeVersion: typeof SHARING_CEILING_SCOPE_VERSION;
34
+ /** The platform per-purpose default — canon's last rung. A purpose with no row has no platform ceiling. */
35
+ readonly scopeByPurpose: SharingPurposeLists;
36
+ /** Platform-seeded partner rules: partner id → purpose → v4 row codes. */
37
+ readonly counterpartyOverrides: Readonly<Record<string, SharingPurposeLists>>;
38
+ }
39
+
40
+ function freezeLists(lists: Readonly<Record<string, readonly string[]>>): SharingPurposeLists {
41
+ const out: Record<string, readonly string[]> = {};
42
+ for (const [purpose, codes] of Object.entries(lists)) out[purpose] = Object.freeze([...codes]);
43
+ return Object.freeze(out);
44
+ }
45
+
46
+ /**
47
+ * The platform's own sharing rules (canon's `HTI_SHARE_PLATFORM_STARTER`,
48
+ * minus the demo-agency relationship / policy seeds). Deep-frozen.
49
+ *
50
+ * CANON GAP: `counterpartyOverrides` is keyed by canon's DEMONSTRATION partner
51
+ * ids (`palomar`, `okcpd`, `legal_aid_ok`). No registry agency carries them,
52
+ * so the seeded-partner rung binds on no real data until the platform maps
53
+ * them. They ship as canon has them.
54
+ */
55
+ export const HTI_SHARE_PLATFORM_STARTER: SharingPlatformStarter = Object.freeze({
56
+ scopeVersion: SHARING_CEILING_SCOPE_VERSION,
57
+ scopeByPurpose: freezeLists(SHARING_PLATFORM_STARTER_DATA.scopeByPurpose),
58
+ counterpartyOverrides: Object.freeze(
59
+ Object.fromEntries(
60
+ Object.entries(SHARING_PLATFORM_STARTER_DATA.counterpartyOverrides).map(([cp, lists]) => [
61
+ cp,
62
+ freezeLists(lists),
63
+ ]),
64
+ ),
65
+ ),
66
+ });
67
+
68
+ /**
69
+ * The platform purpose rows' `enabled` flag (data.js `sharing.purposes`). The
70
+ * contract of record disables a purpose whose platform row is `enabled:
71
+ * false` unless the account overrides it `true` (data.js clamp 1,
72
+ * L51352-L51354). `records_request` ships disabled.
73
+ */
74
+ export const HTI_SHARE_PLATFORM_PURPOSE_ENABLED: Readonly<Record<string, boolean>> = Object.freeze({
75
+ ...SHARING_PLATFORM_STARTER_DATA.purposeEnabled,
76
+ });
77
+
78
+ /**
79
+ * The v4 rows at least one field is HOMED on (canon's field placements,
80
+ * `information_scope_v4.fields.csv` `row_v4`). The ceiling coverage rule
81
+ * reads it: a row with fields homed directly on it and no rest row is within
82
+ * a ceiling only when it or an ancestor is listed.
83
+ */
84
+ export const INFORMATION_SCOPE_FIELD_HOME_ROWS: ReadonlySet<string> = new Set(
85
+ SHARING_PLATFORM_STARTER_DATA.fieldHomeRows,
86
+ );
87
+
88
+ /** Where the starter data was taken from (canon repo, file, SHA, line ranges). */
89
+ export const HTI_SHARE_PLATFORM_STARTER_SOURCE = SHARING_PLATFORM_STARTER_SOURCE;
@@ -233,18 +233,18 @@ type SectionQuestionRef = InferRawDocType<typeof sectionQuestionRefSchema>;
233
233
  declare const guidanceSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
234
234
  _id: false;
235
235
  }, {
236
- type: "tip" | "warning" | "prompt";
237
236
  text: string;
238
- }, mongoose.Document<unknown, {}, {
239
237
  type: "tip" | "warning" | "prompt";
238
+ }, mongoose.Document<unknown, {}, {
240
239
  text: string;
240
+ type: "tip" | "warning" | "prompt";
241
241
  }, {
242
242
  id: string;
243
243
  }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
244
244
  _id: false;
245
245
  }> & Omit<{
246
- type: "tip" | "warning" | "prompt";
247
246
  text: string;
247
+ type: "tip" | "warning" | "prompt";
248
248
  } & {
249
249
  _id: mongoose.Types.ObjectId;
250
250
  } & {
@@ -252,8 +252,8 @@ declare const guidanceSchema: Schema<any, mongoose.Model<any, any, any, any, any
252
252
  }, "id"> & {
253
253
  id: string;
254
254
  }, unknown, {
255
- type: "tip" | "warning" | "prompt";
256
255
  text: string;
256
+ type: "tip" | "warning" | "prompt";
257
257
  } & {
258
258
  _id: mongoose.Types.ObjectId;
259
259
  } & {
@@ -294,18 +294,18 @@ declare const sectionSchemaDefinition: {
294
294
  type: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
295
295
  _id: false;
296
296
  }, {
297
- type: "tip" | "warning" | "prompt";
298
297
  text: string;
299
- }, mongoose.Document<unknown, {}, {
300
298
  type: "tip" | "warning" | "prompt";
299
+ }, mongoose.Document<unknown, {}, {
301
300
  text: string;
301
+ type: "tip" | "warning" | "prompt";
302
302
  }, {
303
303
  id: string;
304
304
  }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
305
305
  _id: false;
306
306
  }> & Omit<{
307
- type: "tip" | "warning" | "prompt";
308
307
  text: string;
308
+ type: "tip" | "warning" | "prompt";
309
309
  } & {
310
310
  _id: mongoose.Types.ObjectId;
311
311
  } & {
@@ -313,8 +313,8 @@ declare const sectionSchemaDefinition: {
313
313
  }, "id"> & {
314
314
  id: string;
315
315
  }, unknown, {
316
- type: "tip" | "warning" | "prompt";
317
316
  text: string;
317
+ type: "tip" | "warning" | "prompt";
318
318
  } & {
319
319
  _id: mongoose.Types.ObjectId;
320
320
  } & {
@@ -233,18 +233,18 @@ type SectionQuestionRef = InferRawDocType<typeof sectionQuestionRefSchema>;
233
233
  declare const guidanceSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
234
234
  _id: false;
235
235
  }, {
236
- type: "tip" | "warning" | "prompt";
237
236
  text: string;
238
- }, mongoose.Document<unknown, {}, {
239
237
  type: "tip" | "warning" | "prompt";
238
+ }, mongoose.Document<unknown, {}, {
240
239
  text: string;
240
+ type: "tip" | "warning" | "prompt";
241
241
  }, {
242
242
  id: string;
243
243
  }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
244
244
  _id: false;
245
245
  }> & Omit<{
246
- type: "tip" | "warning" | "prompt";
247
246
  text: string;
247
+ type: "tip" | "warning" | "prompt";
248
248
  } & {
249
249
  _id: mongoose.Types.ObjectId;
250
250
  } & {
@@ -252,8 +252,8 @@ declare const guidanceSchema: Schema<any, mongoose.Model<any, any, any, any, any
252
252
  }, "id"> & {
253
253
  id: string;
254
254
  }, unknown, {
255
- type: "tip" | "warning" | "prompt";
256
255
  text: string;
256
+ type: "tip" | "warning" | "prompt";
257
257
  } & {
258
258
  _id: mongoose.Types.ObjectId;
259
259
  } & {
@@ -294,18 +294,18 @@ declare const sectionSchemaDefinition: {
294
294
  type: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
295
295
  _id: false;
296
296
  }, {
297
- type: "tip" | "warning" | "prompt";
298
297
  text: string;
299
- }, mongoose.Document<unknown, {}, {
300
298
  type: "tip" | "warning" | "prompt";
299
+ }, mongoose.Document<unknown, {}, {
301
300
  text: string;
301
+ type: "tip" | "warning" | "prompt";
302
302
  }, {
303
303
  id: string;
304
304
  }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
305
305
  _id: false;
306
306
  }> & Omit<{
307
- type: "tip" | "warning" | "prompt";
308
307
  text: string;
308
+ type: "tip" | "warning" | "prompt";
309
309
  } & {
310
310
  _id: mongoose.Types.ObjectId;
311
311
  } & {
@@ -313,8 +313,8 @@ declare const sectionSchemaDefinition: {
313
313
  }, "id"> & {
314
314
  id: string;
315
315
  }, unknown, {
316
- type: "tip" | "warning" | "prompt";
317
316
  text: string;
317
+ type: "tip" | "warning" | "prompt";
318
318
  } & {
319
319
  _id: mongoose.Types.ObjectId;
320
320
  } & {