@htilabs/platform-common-models 0.1.0-beta.3 → 0.2.0-beta.2

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 (43) hide show
  1. package/dist/constants/index.cjs +437 -153
  2. package/dist/constants/index.cjs.map +1 -1
  3. package/dist/constants/index.d.cts +1 -1
  4. package/dist/constants/index.d.ts +1 -1
  5. package/dist/constants/index.js +414 -153
  6. package/dist/constants/index.js.map +1 -1
  7. package/dist/index.cjs +610 -154
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +3 -3
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +579 -154
  12. package/dist/index.js.map +1 -1
  13. package/dist/models/index.cjs +306 -1
  14. package/dist/models/index.cjs.map +1 -1
  15. package/dist/models/index.d.cts +99 -11
  16. package/dist/models/index.d.ts +99 -11
  17. package/dist/models/index.js +304 -1
  18. package/dist/models/index.js.map +1 -1
  19. package/dist/{index-Cww9rH3H.d.cts → platform-auth-C-G2qeGM.d.cts} +167 -56
  20. package/dist/{index-Cww9rH3H.d.ts → platform-auth-C-G2qeGM.d.ts} +167 -56
  21. package/dist/{scoring-rule-liZlPytD.d.cts → platform-role-AHv1l5Og.d.cts} +177 -1
  22. package/dist/{scoring-rule-liZlPytD.d.ts → platform-role-AHv1l5Og.d.ts} +177 -1
  23. package/dist/schemas/index.cjs +539 -153
  24. package/dist/schemas/index.cjs.map +1 -1
  25. package/dist/schemas/index.d.cts +1 -1
  26. package/dist/schemas/index.d.ts +1 -1
  27. package/dist/schemas/index.js +533 -153
  28. package/dist/schemas/index.js.map +1 -1
  29. package/dist/types/index.cjs.map +1 -1
  30. package/dist/types/index.d.cts +45 -1
  31. package/dist/types/index.d.ts +45 -1
  32. package/package.json +1 -1
  33. package/src/constants/ic.ts +254 -153
  34. package/src/constants/index.ts +1 -0
  35. package/src/constants/platform-auth.ts +189 -0
  36. package/src/models/index.ts +18 -1
  37. package/src/models/platformFunctionModel.ts +33 -0
  38. package/src/models/platformRoleModel.ts +33 -0
  39. package/src/schemas/index.ts +16 -0
  40. package/src/schemas/platform-function.ts +97 -0
  41. package/src/schemas/platform-role.ts +100 -0
  42. package/src/types/index.ts +14 -0
  43. package/src/types/platform-auth.ts +49 -0
@@ -1,4 +1,4 @@
1
- import { F as Form, g as buildFormSchema, e as Section, j as buildSectionSchema, Q as Question, h as buildQuestionSchema, c as ScoringRule, i as buildScoringRuleSchema } from '../scoring-rule-liZlPytD.cjs';
1
+ import { F as Form, h as buildFormSchema, f as Section, m as buildSectionSchema, Q as Question, k as buildQuestionSchema, d as ScoringRule, l as buildScoringRuleSchema, P as PlatformFunction, i as buildPlatformFunctionSchema, b as PlatformRole, j as buildPlatformRoleSchema } from '../platform-role-AHv1l5Og.cjs';
2
2
  import * as mongoose from 'mongoose';
3
3
  import { HydratedDocument, Connection, Model } from 'mongoose';
4
4
 
@@ -10,7 +10,7 @@ type FormDoc = HydratedDocument<Form>;
10
10
  * @param schema - Optional pre-built schema (uses buildFormSchema() if not provided)
11
11
  * @returns Mongoose Model for Form
12
12
  */
13
- declare function compileModel$3(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
13
+ declare function compileModel$5(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
14
14
  [x: number]: unknown;
15
15
  [x: symbol]: unknown;
16
16
  [x: string]: unknown;
@@ -42,7 +42,7 @@ declare function compileModel$3(connection: Connection, schema?: mongoose.Schema
42
42
 
43
43
  type formModel_FormDoc = FormDoc;
44
44
  declare namespace formModel {
45
- export { type formModel_FormDoc as FormDoc, buildFormSchema as buildSchema, compileModel$3 as compileModel };
45
+ export { type formModel_FormDoc as FormDoc, buildFormSchema as buildSchema, compileModel$5 as compileModel };
46
46
  }
47
47
 
48
48
  type SectionDoc = HydratedDocument<Section>;
@@ -53,7 +53,7 @@ type SectionDoc = HydratedDocument<Section>;
53
53
  * @param schema - Optional pre-built schema (uses buildSectionSchema() if not provided)
54
54
  * @returns Mongoose Model for Section
55
55
  */
56
- declare function compileModel$2(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
56
+ declare function compileModel$4(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
57
57
  [x: number]: unknown;
58
58
  [x: symbol]: unknown;
59
59
  [x: string]: unknown;
@@ -85,7 +85,7 @@ declare function compileModel$2(connection: Connection, schema?: mongoose.Schema
85
85
 
86
86
  type sectionModel_SectionDoc = SectionDoc;
87
87
  declare namespace sectionModel {
88
- export { type sectionModel_SectionDoc as SectionDoc, buildSectionSchema as buildSchema, compileModel$2 as compileModel };
88
+ export { type sectionModel_SectionDoc as SectionDoc, buildSectionSchema as buildSchema, compileModel$4 as compileModel };
89
89
  }
90
90
 
91
91
  type QuestionDoc = HydratedDocument<Question>;
@@ -96,7 +96,7 @@ type QuestionDoc = HydratedDocument<Question>;
96
96
  * @param schema - Optional pre-built schema (uses buildQuestionSchema() if not provided)
97
97
  * @returns Mongoose Model for Question
98
98
  */
99
- declare function compileModel$1(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
99
+ declare function compileModel$3(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
100
100
  [x: number]: unknown;
101
101
  [x: symbol]: unknown;
102
102
  [x: string]: unknown;
@@ -128,7 +128,7 @@ declare function compileModel$1(connection: Connection, schema?: mongoose.Schema
128
128
 
129
129
  type questionModel_QuestionDoc = QuestionDoc;
130
130
  declare namespace questionModel {
131
- export { type questionModel_QuestionDoc as QuestionDoc, buildQuestionSchema as buildSchema, compileModel$1 as compileModel };
131
+ export { type questionModel_QuestionDoc as QuestionDoc, buildQuestionSchema as buildSchema, compileModel$3 as compileModel };
132
132
  }
133
133
 
134
134
  type ScoringRuleDoc = HydratedDocument<ScoringRule>;
@@ -139,7 +139,7 @@ type ScoringRuleDoc = HydratedDocument<ScoringRule>;
139
139
  * @param schema - Optional pre-built schema (uses buildScoringRuleSchema() if not provided)
140
140
  * @returns Mongoose Model for ScoringRule
141
141
  */
142
- declare function compileModel(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
142
+ declare function compileModel$2(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
143
143
  [x: number]: unknown;
144
144
  [x: symbol]: unknown;
145
145
  [x: string]: unknown;
@@ -170,9 +170,95 @@ declare function compileModel(connection: Connection, schema?: mongoose.Schema<a
170
170
  }>): Model<ScoringRule>;
171
171
 
172
172
  type scoringRuleModel_ScoringRuleDoc = ScoringRuleDoc;
173
- declare const scoringRuleModel_compileModel: typeof compileModel;
174
173
  declare namespace scoringRuleModel {
175
- export { type scoringRuleModel_ScoringRuleDoc as ScoringRuleDoc, buildScoringRuleSchema as buildSchema, scoringRuleModel_compileModel as compileModel };
174
+ export { type scoringRuleModel_ScoringRuleDoc as ScoringRuleDoc, buildScoringRuleSchema as buildSchema, compileModel$2 as compileModel };
175
+ }
176
+
177
+ type PlatformFunctionDoc = HydratedDocument<PlatformFunction>;
178
+
179
+ /**
180
+ * Compile the PlatformFunction model on a specific connection.
181
+ * @param connection - Mongoose connection to bind the model to
182
+ * @param schema - Optional pre-built schema (uses buildPlatformFunctionSchema() if not provided)
183
+ * @returns Mongoose Model for PlatformFunction
184
+ */
185
+ declare function compileModel$1(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
186
+ [x: number]: unknown;
187
+ [x: symbol]: unknown;
188
+ [x: string]: unknown;
189
+ }, mongoose.Document<unknown, {}, {
190
+ [x: number]: unknown;
191
+ [x: symbol]: unknown;
192
+ [x: string]: unknown;
193
+ }, {
194
+ id: string;
195
+ }, mongoose.DefaultSchemaOptions> & Omit<{
196
+ [x: number]: unknown;
197
+ [x: symbol]: unknown;
198
+ [x: string]: unknown;
199
+ } & Required<{
200
+ _id: unknown;
201
+ }> & {
202
+ __v: number;
203
+ }, "id"> & {
204
+ id: string;
205
+ }, unknown, {
206
+ [x: number]: {};
207
+ [x: symbol]: {};
208
+ [x: string]: {};
209
+ } & Required<{
210
+ _id: unknown;
211
+ }> & {
212
+ __v: number;
213
+ }>): Model<PlatformFunction>;
214
+
215
+ type platformFunctionModel_PlatformFunctionDoc = PlatformFunctionDoc;
216
+ declare namespace platformFunctionModel {
217
+ export { type platformFunctionModel_PlatformFunctionDoc as PlatformFunctionDoc, buildPlatformFunctionSchema as buildSchema, compileModel$1 as compileModel };
218
+ }
219
+
220
+ type PlatformRoleDoc = HydratedDocument<PlatformRole>;
221
+
222
+ /**
223
+ * Compile the PlatformRole model on a specific connection.
224
+ * @param connection - Mongoose connection to bind the model to
225
+ * @param schema - Optional pre-built schema (uses buildPlatformRoleSchema() if not provided)
226
+ * @returns Mongoose Model for PlatformRole
227
+ */
228
+ declare function compileModel(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
229
+ [x: number]: unknown;
230
+ [x: symbol]: unknown;
231
+ [x: string]: unknown;
232
+ }, mongoose.Document<unknown, {}, {
233
+ [x: number]: unknown;
234
+ [x: symbol]: unknown;
235
+ [x: string]: unknown;
236
+ }, {
237
+ id: string;
238
+ }, mongoose.DefaultSchemaOptions> & Omit<{
239
+ [x: number]: unknown;
240
+ [x: symbol]: unknown;
241
+ [x: string]: unknown;
242
+ } & Required<{
243
+ _id: unknown;
244
+ }> & {
245
+ __v: number;
246
+ }, "id"> & {
247
+ id: string;
248
+ }, unknown, {
249
+ [x: number]: {};
250
+ [x: symbol]: {};
251
+ [x: string]: {};
252
+ } & Required<{
253
+ _id: unknown;
254
+ }> & {
255
+ __v: number;
256
+ }>): Model<PlatformRole>;
257
+
258
+ type platformRoleModel_PlatformRoleDoc = PlatformRoleDoc;
259
+ declare const platformRoleModel_compileModel: typeof compileModel;
260
+ declare namespace platformRoleModel {
261
+ export { type platformRoleModel_PlatformRoleDoc as PlatformRoleDoc, buildPlatformRoleSchema as buildSchema, platformRoleModel_compileModel as compileModel };
176
262
  }
177
263
 
178
264
  /**
@@ -183,6 +269,8 @@ interface PlatformModels {
183
269
  SectionModel: Model<Section>;
184
270
  QuestionModel: Model<Question>;
185
271
  ScoringRuleModel: Model<ScoringRule>;
272
+ PlatformFunctionModel: Model<PlatformFunction>;
273
+ PlatformRoleModel: Model<PlatformRole>;
186
274
  }
187
275
  /**
188
276
  * Create all platform models bound to a single connection.
@@ -201,4 +289,4 @@ interface PlatformModels {
201
289
  */
202
290
  declare function createPlatformModels(connection: Connection): PlatformModels;
203
291
 
204
- export { Form, type FormDoc, type PlatformModels, Question, type QuestionDoc, ScoringRule, type ScoringRuleDoc, Section, type SectionDoc, createPlatformModels, formModel, questionModel, scoringRuleModel, sectionModel };
292
+ export { Form, type FormDoc, PlatformFunction, type PlatformFunctionDoc, type PlatformModels, PlatformRole, type PlatformRoleDoc, Question, type QuestionDoc, ScoringRule, type ScoringRuleDoc, Section, type SectionDoc, createPlatformModels, formModel, platformFunctionModel, platformRoleModel, questionModel, scoringRuleModel, sectionModel };
@@ -1,4 +1,4 @@
1
- import { F as Form, g as buildFormSchema, e as Section, j as buildSectionSchema, Q as Question, h as buildQuestionSchema, c as ScoringRule, i as buildScoringRuleSchema } from '../scoring-rule-liZlPytD.js';
1
+ import { F as Form, h as buildFormSchema, f as Section, m as buildSectionSchema, Q as Question, k as buildQuestionSchema, d as ScoringRule, l as buildScoringRuleSchema, P as PlatformFunction, i as buildPlatformFunctionSchema, b as PlatformRole, j as buildPlatformRoleSchema } from '../platform-role-AHv1l5Og.js';
2
2
  import * as mongoose from 'mongoose';
3
3
  import { HydratedDocument, Connection, Model } from 'mongoose';
4
4
 
@@ -10,7 +10,7 @@ type FormDoc = HydratedDocument<Form>;
10
10
  * @param schema - Optional pre-built schema (uses buildFormSchema() if not provided)
11
11
  * @returns Mongoose Model for Form
12
12
  */
13
- declare function compileModel$3(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
13
+ declare function compileModel$5(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
14
14
  [x: number]: unknown;
15
15
  [x: symbol]: unknown;
16
16
  [x: string]: unknown;
@@ -42,7 +42,7 @@ declare function compileModel$3(connection: Connection, schema?: mongoose.Schema
42
42
 
43
43
  type formModel_FormDoc = FormDoc;
44
44
  declare namespace formModel {
45
- export { type formModel_FormDoc as FormDoc, buildFormSchema as buildSchema, compileModel$3 as compileModel };
45
+ export { type formModel_FormDoc as FormDoc, buildFormSchema as buildSchema, compileModel$5 as compileModel };
46
46
  }
47
47
 
48
48
  type SectionDoc = HydratedDocument<Section>;
@@ -53,7 +53,7 @@ type SectionDoc = HydratedDocument<Section>;
53
53
  * @param schema - Optional pre-built schema (uses buildSectionSchema() if not provided)
54
54
  * @returns Mongoose Model for Section
55
55
  */
56
- declare function compileModel$2(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
56
+ declare function compileModel$4(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
57
57
  [x: number]: unknown;
58
58
  [x: symbol]: unknown;
59
59
  [x: string]: unknown;
@@ -85,7 +85,7 @@ declare function compileModel$2(connection: Connection, schema?: mongoose.Schema
85
85
 
86
86
  type sectionModel_SectionDoc = SectionDoc;
87
87
  declare namespace sectionModel {
88
- export { type sectionModel_SectionDoc as SectionDoc, buildSectionSchema as buildSchema, compileModel$2 as compileModel };
88
+ export { type sectionModel_SectionDoc as SectionDoc, buildSectionSchema as buildSchema, compileModel$4 as compileModel };
89
89
  }
90
90
 
91
91
  type QuestionDoc = HydratedDocument<Question>;
@@ -96,7 +96,7 @@ type QuestionDoc = HydratedDocument<Question>;
96
96
  * @param schema - Optional pre-built schema (uses buildQuestionSchema() if not provided)
97
97
  * @returns Mongoose Model for Question
98
98
  */
99
- declare function compileModel$1(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
99
+ declare function compileModel$3(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
100
100
  [x: number]: unknown;
101
101
  [x: symbol]: unknown;
102
102
  [x: string]: unknown;
@@ -128,7 +128,7 @@ declare function compileModel$1(connection: Connection, schema?: mongoose.Schema
128
128
 
129
129
  type questionModel_QuestionDoc = QuestionDoc;
130
130
  declare namespace questionModel {
131
- export { type questionModel_QuestionDoc as QuestionDoc, buildQuestionSchema as buildSchema, compileModel$1 as compileModel };
131
+ export { type questionModel_QuestionDoc as QuestionDoc, buildQuestionSchema as buildSchema, compileModel$3 as compileModel };
132
132
  }
133
133
 
134
134
  type ScoringRuleDoc = HydratedDocument<ScoringRule>;
@@ -139,7 +139,7 @@ type ScoringRuleDoc = HydratedDocument<ScoringRule>;
139
139
  * @param schema - Optional pre-built schema (uses buildScoringRuleSchema() if not provided)
140
140
  * @returns Mongoose Model for ScoringRule
141
141
  */
142
- declare function compileModel(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
142
+ declare function compileModel$2(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
143
143
  [x: number]: unknown;
144
144
  [x: symbol]: unknown;
145
145
  [x: string]: unknown;
@@ -170,9 +170,95 @@ declare function compileModel(connection: Connection, schema?: mongoose.Schema<a
170
170
  }>): Model<ScoringRule>;
171
171
 
172
172
  type scoringRuleModel_ScoringRuleDoc = ScoringRuleDoc;
173
- declare const scoringRuleModel_compileModel: typeof compileModel;
174
173
  declare namespace scoringRuleModel {
175
- export { type scoringRuleModel_ScoringRuleDoc as ScoringRuleDoc, buildScoringRuleSchema as buildSchema, scoringRuleModel_compileModel as compileModel };
174
+ export { type scoringRuleModel_ScoringRuleDoc as ScoringRuleDoc, buildScoringRuleSchema as buildSchema, compileModel$2 as compileModel };
175
+ }
176
+
177
+ type PlatformFunctionDoc = HydratedDocument<PlatformFunction>;
178
+
179
+ /**
180
+ * Compile the PlatformFunction model on a specific connection.
181
+ * @param connection - Mongoose connection to bind the model to
182
+ * @param schema - Optional pre-built schema (uses buildPlatformFunctionSchema() if not provided)
183
+ * @returns Mongoose Model for PlatformFunction
184
+ */
185
+ declare function compileModel$1(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
186
+ [x: number]: unknown;
187
+ [x: symbol]: unknown;
188
+ [x: string]: unknown;
189
+ }, mongoose.Document<unknown, {}, {
190
+ [x: number]: unknown;
191
+ [x: symbol]: unknown;
192
+ [x: string]: unknown;
193
+ }, {
194
+ id: string;
195
+ }, mongoose.DefaultSchemaOptions> & Omit<{
196
+ [x: number]: unknown;
197
+ [x: symbol]: unknown;
198
+ [x: string]: unknown;
199
+ } & Required<{
200
+ _id: unknown;
201
+ }> & {
202
+ __v: number;
203
+ }, "id"> & {
204
+ id: string;
205
+ }, unknown, {
206
+ [x: number]: {};
207
+ [x: symbol]: {};
208
+ [x: string]: {};
209
+ } & Required<{
210
+ _id: unknown;
211
+ }> & {
212
+ __v: number;
213
+ }>): Model<PlatformFunction>;
214
+
215
+ type platformFunctionModel_PlatformFunctionDoc = PlatformFunctionDoc;
216
+ declare namespace platformFunctionModel {
217
+ export { type platformFunctionModel_PlatformFunctionDoc as PlatformFunctionDoc, buildPlatformFunctionSchema as buildSchema, compileModel$1 as compileModel };
218
+ }
219
+
220
+ type PlatformRoleDoc = HydratedDocument<PlatformRole>;
221
+
222
+ /**
223
+ * Compile the PlatformRole model on a specific connection.
224
+ * @param connection - Mongoose connection to bind the model to
225
+ * @param schema - Optional pre-built schema (uses buildPlatformRoleSchema() if not provided)
226
+ * @returns Mongoose Model for PlatformRole
227
+ */
228
+ declare function compileModel(connection: Connection, schema?: mongoose.Schema<any, Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
229
+ [x: number]: unknown;
230
+ [x: symbol]: unknown;
231
+ [x: string]: unknown;
232
+ }, mongoose.Document<unknown, {}, {
233
+ [x: number]: unknown;
234
+ [x: symbol]: unknown;
235
+ [x: string]: unknown;
236
+ }, {
237
+ id: string;
238
+ }, mongoose.DefaultSchemaOptions> & Omit<{
239
+ [x: number]: unknown;
240
+ [x: symbol]: unknown;
241
+ [x: string]: unknown;
242
+ } & Required<{
243
+ _id: unknown;
244
+ }> & {
245
+ __v: number;
246
+ }, "id"> & {
247
+ id: string;
248
+ }, unknown, {
249
+ [x: number]: {};
250
+ [x: symbol]: {};
251
+ [x: string]: {};
252
+ } & Required<{
253
+ _id: unknown;
254
+ }> & {
255
+ __v: number;
256
+ }>): Model<PlatformRole>;
257
+
258
+ type platformRoleModel_PlatformRoleDoc = PlatformRoleDoc;
259
+ declare const platformRoleModel_compileModel: typeof compileModel;
260
+ declare namespace platformRoleModel {
261
+ export { type platformRoleModel_PlatformRoleDoc as PlatformRoleDoc, buildPlatformRoleSchema as buildSchema, platformRoleModel_compileModel as compileModel };
176
262
  }
177
263
 
178
264
  /**
@@ -183,6 +269,8 @@ interface PlatformModels {
183
269
  SectionModel: Model<Section>;
184
270
  QuestionModel: Model<Question>;
185
271
  ScoringRuleModel: Model<ScoringRule>;
272
+ PlatformFunctionModel: Model<PlatformFunction>;
273
+ PlatformRoleModel: Model<PlatformRole>;
186
274
  }
187
275
  /**
188
276
  * Create all platform models bound to a single connection.
@@ -201,4 +289,4 @@ interface PlatformModels {
201
289
  */
202
290
  declare function createPlatformModels(connection: Connection): PlatformModels;
203
291
 
204
- export { Form, type FormDoc, type PlatformModels, Question, type QuestionDoc, ScoringRule, type ScoringRuleDoc, Section, type SectionDoc, createPlatformModels, formModel, questionModel, scoringRuleModel, sectionModel };
292
+ export { Form, type FormDoc, PlatformFunction, type PlatformFunctionDoc, type PlatformModels, PlatformRole, type PlatformRoleDoc, Question, type QuestionDoc, ScoringRule, type ScoringRuleDoc, Section, type SectionDoc, createPlatformModels, formModel, platformFunctionModel, platformRoleModel, questionModel, scoringRuleModel, sectionModel };
@@ -617,18 +617,321 @@ function compileModel4(connection, schema = buildScoringRuleSchema()) {
617
617
  return connection.model("ScoringRule", schema);
618
618
  }
619
619
 
620
+ // src/models/platformFunctionModel.ts
621
+ var platformFunctionModel_exports = {};
622
+ __export(platformFunctionModel_exports, {
623
+ buildSchema: () => buildPlatformFunctionSchema,
624
+ compileModel: () => compileModel5
625
+ });
626
+
627
+ // src/schemas/platform-function.ts
628
+ import { Schema as Schema5 } from "mongoose";
629
+
630
+ // src/constants/platform-auth.ts
631
+ var PERMISSION_STATE = {
632
+ /** Role can always perform this function (mandatory, cannot disable). */
633
+ ALWAYS: "ALWAYS",
634
+ /** Default On — user can opt off. */
635
+ PREF_YES: "PREF_YES",
636
+ /** Default Off — user can opt in. */
637
+ PREF_NO: "PREF_NO",
638
+ /** Role is explicitly barred from this function. */
639
+ NEVER: "NEVER"
640
+ };
641
+ var PERMISSION_STATE_VALUES = [
642
+ PERMISSION_STATE.ALWAYS,
643
+ PERMISSION_STATE.PREF_YES,
644
+ PERMISSION_STATE.PREF_NO,
645
+ PERMISSION_STATE.NEVER
646
+ ];
647
+ var PERMISSION_STATE_LABELS = {
648
+ [PERMISSION_STATE.ALWAYS]: "Always",
649
+ [PERMISSION_STATE.PREF_YES]: "Default On",
650
+ [PERMISSION_STATE.PREF_NO]: "Default Off",
651
+ [PERMISSION_STATE.NEVER]: "Never"
652
+ };
653
+ var PERMISSION_STATE_DISPLAY = {
654
+ [PERMISSION_STATE.ALWAYS]: {
655
+ label: "Always",
656
+ color: "#2e7d32",
657
+ bgColor: "#e8f5e9",
658
+ icon: "\u{1F512}"
659
+ },
660
+ [PERMISSION_STATE.PREF_YES]: {
661
+ label: "Default On",
662
+ color: "#1565c0",
663
+ bgColor: "#e3f2fd",
664
+ icon: "\u{1F513}"
665
+ },
666
+ [PERMISSION_STATE.PREF_NO]: {
667
+ label: "Default Off",
668
+ color: "#e65100",
669
+ bgColor: "#fff3e0",
670
+ icon: "\u{1F513}"
671
+ },
672
+ [PERMISSION_STATE.NEVER]: {
673
+ label: "Never",
674
+ color: "#c62828",
675
+ bgColor: "#ffebee",
676
+ icon: "\u{1F512}"
677
+ }
678
+ };
679
+ var SHARE_VIEW = {
680
+ /** System metadata only (partial access). */
681
+ SYS_INFO: "sys_info",
682
+ /** Full case/record content. */
683
+ ALL: "all",
684
+ /** No data access. */
685
+ NONE: "none"
686
+ };
687
+ var SHARE_VIEW_VALUES = [
688
+ SHARE_VIEW.SYS_INFO,
689
+ SHARE_VIEW.ALL,
690
+ SHARE_VIEW.NONE
691
+ ];
692
+ var SHARE_VIEW_LABELS = {
693
+ [SHARE_VIEW.SYS_INFO]: "System Info Only",
694
+ [SHARE_VIEW.ALL]: "Full Content",
695
+ [SHARE_VIEW.NONE]: "No Data Access"
696
+ };
697
+ var PLATFORM_TOOL = {
698
+ PAVE: "PAVE",
699
+ ECHO: "ECHO",
700
+ LEADS: "LEADS",
701
+ THREAD: "THREAD",
702
+ TRAIL: "TRAIL",
703
+ PLATFORM: "PLATFORM"
704
+ };
705
+ var PLATFORM_TOOL_VALUES = [
706
+ PLATFORM_TOOL.PAVE,
707
+ PLATFORM_TOOL.ECHO,
708
+ PLATFORM_TOOL.LEADS,
709
+ PLATFORM_TOOL.THREAD,
710
+ PLATFORM_TOOL.TRAIL,
711
+ PLATFORM_TOOL.PLATFORM
712
+ ];
713
+ var PLATFORM_TOOL_LABELS = {
714
+ [PLATFORM_TOOL.PAVE]: "PAVE",
715
+ [PLATFORM_TOOL.ECHO]: "Echo",
716
+ [PLATFORM_TOOL.LEADS]: "LEADS",
717
+ [PLATFORM_TOOL.THREAD]: "Thread",
718
+ [PLATFORM_TOOL.TRAIL]: "Trail",
719
+ [PLATFORM_TOOL.PLATFORM]: "Platform"
720
+ };
721
+ var ROLE_LEVEL = {
722
+ /** User-facing roles (staff, volunteers, practitioners). */
723
+ OPERATIONAL: "operational",
724
+ /** Agency-level admin roles. */
725
+ AGENCY: "agency",
726
+ /** Team-level admin roles. */
727
+ TEAM: "team",
728
+ /** HTI-wide platform admin. */
729
+ PLATFORM: "platform",
730
+ /** External governance/oversight roles. */
731
+ OVERSIGHT: "oversight"
732
+ };
733
+ var ROLE_LEVEL_VALUES = [
734
+ ROLE_LEVEL.OPERATIONAL,
735
+ ROLE_LEVEL.AGENCY,
736
+ ROLE_LEVEL.TEAM,
737
+ ROLE_LEVEL.PLATFORM,
738
+ ROLE_LEVEL.OVERSIGHT
739
+ ];
740
+ var ROLE_LEVEL_LABELS = {
741
+ [ROLE_LEVEL.OPERATIONAL]: "Operational",
742
+ [ROLE_LEVEL.AGENCY]: "Agency",
743
+ [ROLE_LEVEL.TEAM]: "Team",
744
+ [ROLE_LEVEL.PLATFORM]: "Platform",
745
+ [ROLE_LEVEL.OVERSIGHT]: "Oversight"
746
+ };
747
+ var FUNCTION_STATUS = {
748
+ NOT_STARTED: "Not started",
749
+ DEFINED_NEW: "Defined; new function",
750
+ DEFINED_EXISTING: "Defined; existing PAVE function",
751
+ FUNCTIONAL: "Functional on all apps",
752
+ FUTURE: "Future function (not v1)"
753
+ };
754
+ var FUNCTION_STATUS_VALUES = [
755
+ FUNCTION_STATUS.NOT_STARTED,
756
+ FUNCTION_STATUS.DEFINED_NEW,
757
+ FUNCTION_STATUS.DEFINED_EXISTING,
758
+ FUNCTION_STATUS.FUNCTIONAL,
759
+ FUNCTION_STATUS.FUTURE
760
+ ];
761
+ var FUNCTION_STATUS_LABELS = {
762
+ [FUNCTION_STATUS.NOT_STARTED]: "Not Started",
763
+ [FUNCTION_STATUS.DEFINED_NEW]: "Defined (New)",
764
+ [FUNCTION_STATUS.DEFINED_EXISTING]: "Defined (Existing PAVE)",
765
+ [FUNCTION_STATUS.FUNCTIONAL]: "Functional",
766
+ [FUNCTION_STATUS.FUTURE]: "Future (Not v1)"
767
+ };
768
+
769
+ // src/schemas/platform-function.ts
770
+ var platformFunctionSchemaDefinition = {
771
+ code: {
772
+ type: String,
773
+ required: true
774
+ },
775
+ label: {
776
+ type: String,
777
+ required: true
778
+ },
779
+ description: {
780
+ type: String,
781
+ default: ""
782
+ },
783
+ category: {
784
+ type: String,
785
+ default: ""
786
+ },
787
+ tools: {
788
+ type: [String],
789
+ enum: [...PLATFORM_TOOL_VALUES],
790
+ default: []
791
+ },
792
+ isAdminRelevant: {
793
+ type: Boolean,
794
+ default: false
795
+ },
796
+ isUserRelevant: {
797
+ type: Boolean,
798
+ default: false
799
+ },
800
+ isHtiOnly: {
801
+ type: Boolean,
802
+ default: false
803
+ },
804
+ status: {
805
+ type: String,
806
+ enum: [...FUNCTION_STATUS_VALUES],
807
+ default: "Not started"
808
+ },
809
+ sortOrder: {
810
+ type: Number,
811
+ default: 0
812
+ }
813
+ };
814
+ var platformFunctionSchemaOptions = {
815
+ timestamps: {
816
+ createdAt: "createdTime",
817
+ updatedAt: "updatedTime"
818
+ },
819
+ collection: "platformFunctions"
820
+ };
821
+ function buildPlatformFunctionSchema() {
822
+ const schema = new Schema5(
823
+ platformFunctionSchemaDefinition,
824
+ platformFunctionSchemaOptions
825
+ );
826
+ schema.index({ code: 1 }, { unique: true });
827
+ schema.index({ tools: 1 });
828
+ schema.index({ category: 1 });
829
+ schema.index({ sortOrder: 1 });
830
+ return schema;
831
+ }
832
+ var _platformFunctionSchema = buildPlatformFunctionSchema();
833
+
834
+ // src/models/platformFunctionModel.ts
835
+ function compileModel5(connection, schema = buildPlatformFunctionSchema()) {
836
+ return connection.model("PlatformFunction", schema);
837
+ }
838
+
839
+ // src/models/platformRoleModel.ts
840
+ var platformRoleModel_exports = {};
841
+ __export(platformRoleModel_exports, {
842
+ buildSchema: () => buildPlatformRoleSchema,
843
+ compileModel: () => compileModel6
844
+ });
845
+
846
+ // src/schemas/platform-role.ts
847
+ import { Schema as Schema6 } from "mongoose";
848
+ var platformRoleSchemaDefinition = {
849
+ code: {
850
+ type: String,
851
+ required: true
852
+ },
853
+ label: {
854
+ type: String,
855
+ required: true
856
+ },
857
+ description: {
858
+ type: String,
859
+ default: ""
860
+ },
861
+ level: {
862
+ type: String,
863
+ enum: [...ROLE_LEVEL_VALUES],
864
+ required: true
865
+ },
866
+ tools: {
867
+ type: [String],
868
+ enum: [...PLATFORM_TOOL_VALUES],
869
+ default: []
870
+ },
871
+ shareView: {
872
+ type: String,
873
+ enum: [...SHARE_VIEW_VALUES, null],
874
+ default: null
875
+ },
876
+ trainingRequirements: {
877
+ type: String,
878
+ default: null
879
+ },
880
+ isHtiOnly: {
881
+ type: Boolean,
882
+ default: false
883
+ },
884
+ /** Dynamic map of functionCode → PermissionStateValue. */
885
+ functions: {
886
+ type: Schema6.Types.Mixed,
887
+ default: {}
888
+ },
889
+ sortOrder: {
890
+ type: Number,
891
+ default: 0
892
+ }
893
+ };
894
+ var platformRoleSchemaOptions = {
895
+ timestamps: {
896
+ createdAt: "createdTime",
897
+ updatedAt: "updatedTime"
898
+ },
899
+ collection: "platformRoles"
900
+ };
901
+ function buildPlatformRoleSchema() {
902
+ const schema = new Schema6(
903
+ platformRoleSchemaDefinition,
904
+ platformRoleSchemaOptions
905
+ );
906
+ schema.index({ code: 1 }, { unique: true });
907
+ schema.index({ level: 1 });
908
+ schema.index({ tools: 1 });
909
+ schema.index({ isHtiOnly: 1 });
910
+ return schema;
911
+ }
912
+ var _platformRoleSchema = buildPlatformRoleSchema();
913
+
914
+ // src/models/platformRoleModel.ts
915
+ function compileModel6(connection, schema = buildPlatformRoleSchema()) {
916
+ return connection.model("PlatformRole", schema);
917
+ }
918
+
620
919
  // src/models/index.ts
621
920
  function createPlatformModels(connection) {
622
921
  return {
623
922
  FormModel: compileModel(connection),
624
923
  SectionModel: compileModel2(connection),
625
924
  QuestionModel: compileModel3(connection),
626
- ScoringRuleModel: compileModel4(connection)
925
+ ScoringRuleModel: compileModel4(connection),
926
+ PlatformFunctionModel: compileModel5(connection),
927
+ PlatformRoleModel: compileModel6(connection)
627
928
  };
628
929
  }
629
930
  export {
630
931
  createPlatformModels,
631
932
  formModel_exports as formModel,
933
+ platformFunctionModel_exports as platformFunctionModel,
934
+ platformRoleModel_exports as platformRoleModel,
632
935
  questionModel_exports as questionModel,
633
936
  scoringRuleModel_exports as scoringRuleModel,
634
937
  sectionModel_exports as sectionModel