@htilabs/platform-common-models 0.79.0 → 0.80.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 +38 -0
- package/dist/authz/index.cjs +154 -2
- package/dist/authz/index.cjs.map +1 -1
- package/dist/authz/index.d.cts +174 -2
- package/dist/authz/index.d.ts +174 -2
- package/dist/authz/index.js +151 -2
- package/dist/authz/index.js.map +1 -1
- package/dist/{index-XWSYon40.d.cts → index-Bj-s0nZy.d.cts} +1 -1
- package/dist/{index-Bh1zO_Vu.d.ts → index-DvAypMJV.d.ts} +1 -1
- package/dist/index.cjs +93 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +90 -2
- 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.d.cts +25 -25
- package/dist/schemas/index.d.ts +25 -25
- package/package.json +2 -1
- package/src/__tests__/authz-resolve.test.ts +3 -0
- package/src/__tests__/authz-seat-app-access.test.ts +304 -0
- package/src/authz/index.ts +1 -0
- package/src/authz/seatAppAccess.ts +304 -0
- package/dist/{cvcEntry-D787utvP.d.cts → cvcEntry-BLeRivoF.d.cts} +8 -8
- package/dist/{cvcEntry-D787utvP.d.ts → cvcEntry-BLeRivoF.d.ts} +8 -8
package/dist/models/index.d.cts
CHANGED
|
@@ -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-
|
|
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-BLeRivoF.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-
|
|
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-Bj-s0nZy.cjs';
|
package/dist/models/index.d.ts
CHANGED
|
@@ -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-
|
|
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-BLeRivoF.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-
|
|
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-DvAypMJV.js';
|
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-BLeRivoF.cjs';
|
|
4
4
|
import { a as AddAgencyOrgTypeFieldsOptions } from '../agency-BXvE4yWu.cjs';
|
|
5
5
|
export { A as AGENCY_ORG_TYPE_VALIDATED_UPDATE_OPS, 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, j as installVspTwoStepHooks, m as mirrorOrgTypeFields, o as orgTypeFieldsDiffer, k as orgTypeSchemaDefinition, r as resolveEffectiveOrgType, l as resolveEffectiveOrgTypeFields, v as vspTwoStepHolds, n as vspTwoStepHoldsOnUpdate } from '../agency-BXvE4yWu.cjs';
|
|
6
6
|
export { P as PROGRAM_REVIEW_STATUS, a as PROGRAM_REVIEW_STATUS_VALUES, b as ProgramReviewStatus, i as isLiveOrganizationProgram, c as isProgramReviewStatus } from '../vocabulary-Cxhi9EGt.cjs';
|
|
@@ -137,12 +137,12 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
137
137
|
number?: string | null | undefined;
|
|
138
138
|
type?: string | null | undefined;
|
|
139
139
|
safeToContact?: boolean | null | undefined;
|
|
140
|
-
dataQuality?: "
|
|
140
|
+
dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
141
141
|
}, mongoose.Document<unknown, {}, {
|
|
142
142
|
number?: string | null | undefined;
|
|
143
143
|
type?: string | null | undefined;
|
|
144
144
|
safeToContact?: boolean | null | undefined;
|
|
145
|
-
dataQuality?: "
|
|
145
|
+
dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
146
146
|
}, {
|
|
147
147
|
id: string;
|
|
148
148
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
@@ -151,7 +151,7 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
151
151
|
number?: string | null | undefined;
|
|
152
152
|
type?: string | null | undefined;
|
|
153
153
|
safeToContact?: boolean | null | undefined;
|
|
154
|
-
dataQuality?: "
|
|
154
|
+
dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
155
155
|
} & {
|
|
156
156
|
_id: mongoose.Types.ObjectId;
|
|
157
157
|
} & {
|
|
@@ -162,7 +162,7 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
162
162
|
number?: string | null | undefined;
|
|
163
163
|
type?: string | null | undefined;
|
|
164
164
|
safeToContact?: boolean | null | undefined;
|
|
165
|
-
dataQuality?: "
|
|
165
|
+
dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
166
166
|
} & {
|
|
167
167
|
_id: mongoose.Types.ObjectId;
|
|
168
168
|
} & {
|
|
@@ -224,11 +224,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
224
224
|
raceOtherText?: string | null | undefined;
|
|
225
225
|
genderOtherText?: string | null | undefined;
|
|
226
226
|
accommodationOtherText?: string | null | undefined;
|
|
227
|
-
ageDataQuality?: "
|
|
228
|
-
sexDataQuality?: "
|
|
229
|
-
genderDataQuality?: "
|
|
230
|
-
raceDataQuality?: "
|
|
231
|
-
ethnicityDataQuality?: "
|
|
227
|
+
ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
228
|
+
sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
229
|
+
genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
230
|
+
raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
231
|
+
ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
232
232
|
}, mongoose.Document<unknown, {}, {
|
|
233
233
|
race: number[];
|
|
234
234
|
ethnicity: number[];
|
|
@@ -248,11 +248,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
248
248
|
raceOtherText?: string | null | undefined;
|
|
249
249
|
genderOtherText?: string | null | undefined;
|
|
250
250
|
accommodationOtherText?: string | null | undefined;
|
|
251
|
-
ageDataQuality?: "
|
|
252
|
-
sexDataQuality?: "
|
|
253
|
-
genderDataQuality?: "
|
|
254
|
-
raceDataQuality?: "
|
|
255
|
-
ethnicityDataQuality?: "
|
|
251
|
+
ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
252
|
+
sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
253
|
+
genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
254
|
+
raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
255
|
+
ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
256
256
|
}, {
|
|
257
257
|
id: string;
|
|
258
258
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
@@ -276,11 +276,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
276
276
|
raceOtherText?: string | null | undefined;
|
|
277
277
|
genderOtherText?: string | null | undefined;
|
|
278
278
|
accommodationOtherText?: string | null | undefined;
|
|
279
|
-
ageDataQuality?: "
|
|
280
|
-
sexDataQuality?: "
|
|
281
|
-
genderDataQuality?: "
|
|
282
|
-
raceDataQuality?: "
|
|
283
|
-
ethnicityDataQuality?: "
|
|
279
|
+
ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
280
|
+
sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
281
|
+
genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
282
|
+
raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
283
|
+
ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
284
284
|
} & {
|
|
285
285
|
_id: mongoose.Types.ObjectId;
|
|
286
286
|
} & {
|
|
@@ -306,11 +306,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
306
306
|
raceOtherText?: string | null | undefined;
|
|
307
307
|
genderOtherText?: string | null | undefined;
|
|
308
308
|
accommodationOtherText?: string | null | undefined;
|
|
309
|
-
ageDataQuality?: "
|
|
310
|
-
sexDataQuality?: "
|
|
311
|
-
genderDataQuality?: "
|
|
312
|
-
raceDataQuality?: "
|
|
313
|
-
ethnicityDataQuality?: "
|
|
309
|
+
ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
310
|
+
sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
311
|
+
genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
312
|
+
raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
313
|
+
ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
314
314
|
} & {
|
|
315
315
|
_id: mongoose.Types.ObjectId;
|
|
316
316
|
} & {
|
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-BLeRivoF.js';
|
|
4
4
|
import { a as AddAgencyOrgTypeFieldsOptions } from '../agency-NEW6NOGD.js';
|
|
5
5
|
export { A as AGENCY_ORG_TYPE_VALIDATED_UPDATE_OPS, 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, j as installVspTwoStepHooks, m as mirrorOrgTypeFields, o as orgTypeFieldsDiffer, k as orgTypeSchemaDefinition, r as resolveEffectiveOrgType, l as resolveEffectiveOrgTypeFields, v as vspTwoStepHolds, n as vspTwoStepHoldsOnUpdate } from '../agency-NEW6NOGD.js';
|
|
6
6
|
export { P as PROGRAM_REVIEW_STATUS, a as PROGRAM_REVIEW_STATUS_VALUES, b as ProgramReviewStatus, i as isLiveOrganizationProgram, c as isProgramReviewStatus } from '../vocabulary-Cxhi9EGt.js';
|
|
@@ -137,12 +137,12 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
137
137
|
number?: string | null | undefined;
|
|
138
138
|
type?: string | null | undefined;
|
|
139
139
|
safeToContact?: boolean | null | undefined;
|
|
140
|
-
dataQuality?: "
|
|
140
|
+
dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
141
141
|
}, mongoose.Document<unknown, {}, {
|
|
142
142
|
number?: string | null | undefined;
|
|
143
143
|
type?: string | null | undefined;
|
|
144
144
|
safeToContact?: boolean | null | undefined;
|
|
145
|
-
dataQuality?: "
|
|
145
|
+
dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
146
146
|
}, {
|
|
147
147
|
id: string;
|
|
148
148
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
@@ -151,7 +151,7 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
151
151
|
number?: string | null | undefined;
|
|
152
152
|
type?: string | null | undefined;
|
|
153
153
|
safeToContact?: boolean | null | undefined;
|
|
154
|
-
dataQuality?: "
|
|
154
|
+
dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
155
155
|
} & {
|
|
156
156
|
_id: mongoose.Types.ObjectId;
|
|
157
157
|
} & {
|
|
@@ -162,7 +162,7 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
162
162
|
number?: string | null | undefined;
|
|
163
163
|
type?: string | null | undefined;
|
|
164
164
|
safeToContact?: boolean | null | undefined;
|
|
165
|
-
dataQuality?: "
|
|
165
|
+
dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
166
166
|
} & {
|
|
167
167
|
_id: mongoose.Types.ObjectId;
|
|
168
168
|
} & {
|
|
@@ -224,11 +224,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
224
224
|
raceOtherText?: string | null | undefined;
|
|
225
225
|
genderOtherText?: string | null | undefined;
|
|
226
226
|
accommodationOtherText?: string | null | undefined;
|
|
227
|
-
ageDataQuality?: "
|
|
228
|
-
sexDataQuality?: "
|
|
229
|
-
genderDataQuality?: "
|
|
230
|
-
raceDataQuality?: "
|
|
231
|
-
ethnicityDataQuality?: "
|
|
227
|
+
ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
228
|
+
sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
229
|
+
genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
230
|
+
raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
231
|
+
ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
232
232
|
}, mongoose.Document<unknown, {}, {
|
|
233
233
|
race: number[];
|
|
234
234
|
ethnicity: number[];
|
|
@@ -248,11 +248,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
248
248
|
raceOtherText?: string | null | undefined;
|
|
249
249
|
genderOtherText?: string | null | undefined;
|
|
250
250
|
accommodationOtherText?: string | null | undefined;
|
|
251
|
-
ageDataQuality?: "
|
|
252
|
-
sexDataQuality?: "
|
|
253
|
-
genderDataQuality?: "
|
|
254
|
-
raceDataQuality?: "
|
|
255
|
-
ethnicityDataQuality?: "
|
|
251
|
+
ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
252
|
+
sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
253
|
+
genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
254
|
+
raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
255
|
+
ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
256
256
|
}, {
|
|
257
257
|
id: string;
|
|
258
258
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
@@ -276,11 +276,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
276
276
|
raceOtherText?: string | null | undefined;
|
|
277
277
|
genderOtherText?: string | null | undefined;
|
|
278
278
|
accommodationOtherText?: string | null | undefined;
|
|
279
|
-
ageDataQuality?: "
|
|
280
|
-
sexDataQuality?: "
|
|
281
|
-
genderDataQuality?: "
|
|
282
|
-
raceDataQuality?: "
|
|
283
|
-
ethnicityDataQuality?: "
|
|
279
|
+
ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
280
|
+
sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
281
|
+
genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
282
|
+
raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
283
|
+
ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
284
284
|
} & {
|
|
285
285
|
_id: mongoose.Types.ObjectId;
|
|
286
286
|
} & {
|
|
@@ -306,11 +306,11 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
306
306
|
raceOtherText?: string | null | undefined;
|
|
307
307
|
genderOtherText?: string | null | undefined;
|
|
308
308
|
accommodationOtherText?: string | null | undefined;
|
|
309
|
-
ageDataQuality?: "
|
|
310
|
-
sexDataQuality?: "
|
|
311
|
-
genderDataQuality?: "
|
|
312
|
-
raceDataQuality?: "
|
|
313
|
-
ethnicityDataQuality?: "
|
|
309
|
+
ageDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
310
|
+
sexDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
311
|
+
genderDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
312
|
+
raceDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
313
|
+
ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
|
|
314
314
|
} & {
|
|
315
315
|
_id: mongoose.Types.ObjectId;
|
|
316
316
|
} & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@htilabs/platform-common-models",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.0",
|
|
4
4
|
"description": "Shared constants, types, and models for HTI Labs applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -150,6 +150,7 @@
|
|
|
150
150
|
"seed:cvc": "tsx scripts/seed-cvc.ts",
|
|
151
151
|
"seed:cvc:all": "tsx scripts/seed-all-cvcs.ts",
|
|
152
152
|
"test:seed": "node --import tsx --test scripts/seed-cvc.test.ts",
|
|
153
|
+
"test:seed-all": "node --import tsx --test scripts/seed-all-cvcs.test.ts",
|
|
153
154
|
"test:guard": "node --import tsx --test scripts/lib/confirmTargetDb.test.ts",
|
|
154
155
|
"test:js-literal": "node --import tsx --test scripts/lib/jsLiteral.test.ts",
|
|
155
156
|
"migrate:org-type-keys": "tsx scripts/migrate-org-type-keys.ts",
|
|
@@ -552,6 +552,9 @@ describe("§ 4.1 extras", () => {
|
|
|
552
552
|
// CVC-133 Guidance and Logic notes (0.62.0): generated, read-only vocabulary.
|
|
553
553
|
"./functionNotes.js",
|
|
554
554
|
"../generated/coreFunctionNotes.js",
|
|
555
|
+
// A seat's app access (0.80.0): the shared app list, pure (no mongoose).
|
|
556
|
+
"./seatAppAccess.js",
|
|
557
|
+
"../constants/platform-apps.js",
|
|
555
558
|
]),
|
|
556
559
|
);
|
|
557
560
|
});
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A seat's app access (`src/authz/seatAppAccess.ts`): the platform side is
|
|
3
|
+
* Echo + Trail for every seat (2026-08-20 Ruling 2) plus the casework apps its
|
|
4
|
+
* active teams carry inside the account grant (2026-11-12), Trail only before
|
|
5
|
+
* launch; the Auth0 decision is OR'd on top for the transition.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { describe, expect, it } from "vitest";
|
|
9
|
+
|
|
10
|
+
import { accountAppGrant, seatAppAccess, seatTeamApps } from "../authz/seatAppAccess.js";
|
|
11
|
+
import * as authz from "../authz/index.js";
|
|
12
|
+
import * as root from "../index.js";
|
|
13
|
+
|
|
14
|
+
const PAVE_TEAM = { apps: ["PAVE"] };
|
|
15
|
+
const THREAD_TEAM = { apps: ["THREAD"] };
|
|
16
|
+
const UNIVERSAL_ONLY = ["TRAIL", "ECHO"];
|
|
17
|
+
|
|
18
|
+
describe("seatAppAccess — no teams", () => {
|
|
19
|
+
it("a seat on no team gets no casework app from the platform side; Auth0 alone decides", () => {
|
|
20
|
+
const no = seatAppAccess({ app: "THREAD", auth0Allows: false, accountGrant: ["THREAD"] });
|
|
21
|
+
expect(no).toMatchObject({ allowed: false, via: "none", teamAllows: false, teamApps: UNIVERSAL_ONLY });
|
|
22
|
+
const yes = seatAppAccess({ app: "THREAD", auth0Allows: true, teams: [], accountGrant: ["THREAD"] });
|
|
23
|
+
expect(yes).toMatchObject({ allowed: true, via: "auth0", teamAllows: false });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("null, undefined and non-list team inputs are no teams, never a throw", () => {
|
|
27
|
+
for (const teams of [null, undefined, [null, undefined], { apps: ["PAVE"] }, "PAVE", 7]) {
|
|
28
|
+
const r = seatAppAccess({ app: "PAVE", auth0Allows: false, teams: teams as never });
|
|
29
|
+
expect(r).toMatchObject({ allowed: false, teamUnion: [], teamApps: UNIVERSAL_ONLY });
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe("seatAppAccess — a team with no apps", () => {
|
|
35
|
+
it("grants no casework app, whether apps is absent, empty or not a list", () => {
|
|
36
|
+
for (const team of [{}, { apps: [] }, { apps: null }, { apps: 3 }]) {
|
|
37
|
+
const r = seatAppAccess({ app: "PAVE", auth0Allows: false, teams: [team] });
|
|
38
|
+
expect(r).toMatchObject({ allowed: false, via: "none", teamUnion: [], teamApps: UNIVERSAL_ONLY });
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("a team apps value that is neither a list nor a string is reported", () => {
|
|
43
|
+
const r = seatAppAccess({ app: "PAVE", auth0Allows: false, teams: [{ apps: 3 }, { apps: { PAVE: true } }] });
|
|
44
|
+
expect(r.unrecognized).toEqual(["3", '{"PAVE":true}']);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe("seatAppAccess — the account grant", () => {
|
|
49
|
+
it("absent (null / undefined): no ceiling on casework apps", () => {
|
|
50
|
+
for (const accountGrant of [null, undefined]) {
|
|
51
|
+
const r = seatAppAccess({ app: "THREAD", auth0Allows: false, teams: [THREAD_TEAM], accountGrant });
|
|
52
|
+
expect(r).toMatchObject({
|
|
53
|
+
allowed: true,
|
|
54
|
+
via: "teams",
|
|
55
|
+
accountGrant: null,
|
|
56
|
+
teamApps: ["TRAIL", "THREAD", "ECHO"],
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("present and including the app: the team's app is granted", () => {
|
|
62
|
+
const r = seatAppAccess({
|
|
63
|
+
app: "THREAD",
|
|
64
|
+
auth0Allows: false,
|
|
65
|
+
teams: [THREAD_TEAM],
|
|
66
|
+
accountGrant: ["PAVE", "THREAD"],
|
|
67
|
+
});
|
|
68
|
+
expect(r).toMatchObject({ allowed: true, via: "teams", accountGrant: ["THREAD", "PAVE"] });
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("present and excluding the app: the team cannot exceed the account", () => {
|
|
72
|
+
const r = seatAppAccess({
|
|
73
|
+
app: "THREAD",
|
|
74
|
+
auth0Allows: false,
|
|
75
|
+
teams: [THREAD_TEAM, PAVE_TEAM],
|
|
76
|
+
accountGrant: ["PAVE"],
|
|
77
|
+
});
|
|
78
|
+
expect(r).toMatchObject({
|
|
79
|
+
allowed: false,
|
|
80
|
+
via: "none",
|
|
81
|
+
teamUnion: ["THREAD", "PAVE"],
|
|
82
|
+
teamApps: ["TRAIL", "PAVE", "ECHO"],
|
|
83
|
+
accountGrant: ["PAVE"],
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("an empty list is a known grant of no casework app", () => {
|
|
88
|
+
const r = seatAppAccess({ app: "PAVE", auth0Allows: false, teams: [PAVE_TEAM], accountGrant: [] });
|
|
89
|
+
expect(r).toMatchObject({ allowed: false, accountGrant: [], teamApps: UNIVERSAL_ONLY });
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("a value that is neither a list nor a string is a known grant of nothing, and is reported", () => {
|
|
93
|
+
const r = seatAppAccess({ app: "PAVE", auth0Allows: false, teams: [PAVE_TEAM], accountGrant: { PAVE: true } });
|
|
94
|
+
expect(r).toMatchObject({ allowed: false, accountGrant: [], unrecognized: ['{"PAVE":true}'] });
|
|
95
|
+
const n = seatAppAccess({ app: "PAVE", auth0Allows: false, teams: [PAVE_TEAM], accountGrant: 5 });
|
|
96
|
+
expect(n).toMatchObject({ allowed: false, accountGrant: [], unrecognized: ["5"] });
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("a bare string grant is one app", () => {
|
|
100
|
+
const r = seatAppAccess({ app: "PAVE", auth0Allows: false, teams: [PAVE_TEAM], accountGrant: "pave" });
|
|
101
|
+
expect(r).toMatchObject({ allowed: true, accountGrant: ["PAVE"] });
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe("accountAppGrant — which account field is the grant", () => {
|
|
106
|
+
it("reads the account's apps_subscribed (Apps the contract grants)", () => {
|
|
107
|
+
expect(accountAppGrant({ apps_subscribed: ["THREAD"] })).toEqual(["THREAD"]);
|
|
108
|
+
expect(accountAppGrant({ apps_subscribed: [] })).toEqual([]);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("never reads apps_declared", () => {
|
|
112
|
+
expect(accountAppGrant({ apps_declared: ["PAVE"], apps_subscribed: ["THREAD"] } as never)).toEqual(["THREAD"]);
|
|
113
|
+
expect(accountAppGrant({ apps_declared: ["PAVE"] } as never)).toBeNull();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("is not known when absent, or for no account; never reads the legacy apps", () => {
|
|
117
|
+
expect(accountAppGrant({})).toBeNull();
|
|
118
|
+
expect(accountAppGrant({ apps_subscribed: null })).toBeNull();
|
|
119
|
+
expect(accountAppGrant(null)).toBeNull();
|
|
120
|
+
expect(accountAppGrant(undefined)).toBeNull();
|
|
121
|
+
expect(accountAppGrant({ apps: ["PAVE"] } as never)).toBeNull();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
describe("seatAppAccess — via", () => {
|
|
126
|
+
it("Auth0 only", () => {
|
|
127
|
+
const r = seatAppAccess({ app: "THREAD", auth0Allows: true, teams: [PAVE_TEAM] });
|
|
128
|
+
expect(r).toMatchObject({ allowed: true, via: "auth0", teamAllows: false });
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("teams only (the person gains access Auth0 did not give)", () => {
|
|
132
|
+
const r = seatAppAccess({ app: "PAVE", auth0Allows: false, teams: [PAVE_TEAM] });
|
|
133
|
+
expect(r).toMatchObject({ allowed: true, via: "teams", teamAllows: true });
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("both", () => {
|
|
137
|
+
const r = seatAppAccess({ app: "PAVE", auth0Allows: true, teams: [PAVE_TEAM] });
|
|
138
|
+
expect(r).toMatchObject({ allowed: true, via: "both", teamAllows: true });
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("neither", () => {
|
|
142
|
+
const r = seatAppAccess({ app: "LEADS", auth0Allows: false, teams: [PAVE_TEAM] });
|
|
143
|
+
expect(r).toMatchObject({ allowed: false, via: "none" });
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("additive: the platform side never takes away an Auth0 yes", () => {
|
|
147
|
+
const r = seatAppAccess({ app: "THREAD", auth0Allows: true, teams: [PAVE_TEAM], accountGrant: [] });
|
|
148
|
+
expect(r.allowed).toBe(true);
|
|
149
|
+
const pre = seatAppAccess({ app: "THREAD", auth0Allows: true, teams: [THREAD_TEAM], accountPreLaunch: true });
|
|
150
|
+
expect(pre).toMatchObject({ allowed: true, via: "auth0" });
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("only a literal true counts as an Auth0 yes", () => {
|
|
154
|
+
const r = seatAppAccess({ app: "THREAD", auth0Allows: "true" as unknown as boolean });
|
|
155
|
+
expect(r).toMatchObject({ allowed: false, via: "none" });
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
describe("seatAppAccess — the union of teams", () => {
|
|
160
|
+
it("apps from several teams add up", () => {
|
|
161
|
+
const teams = [PAVE_TEAM, THREAD_TEAM];
|
|
162
|
+
expect(seatAppAccess({ app: "PAVE", auth0Allows: false, teams }).allowed).toBe(true);
|
|
163
|
+
expect(seatAppAccess({ app: "THREAD", auth0Allows: false, teams }).allowed).toBe(true);
|
|
164
|
+
expect(seatTeamApps({ teams })).toEqual(["TRAIL", "THREAD", "PAVE", "ECHO"]);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it("an inactive team grants nothing; active absent, true or null counts", () => {
|
|
168
|
+
const off = seatAppAccess({ app: "THREAD", auth0Allows: false, teams: [{ apps: ["THREAD"], active: false }] });
|
|
169
|
+
expect(off).toMatchObject({ allowed: false, teamUnion: [] });
|
|
170
|
+
for (const active of [true, null, undefined]) {
|
|
171
|
+
const on = seatAppAccess({ app: "THREAD", auth0Allows: false, teams: [{ apps: ["THREAD"], active }] });
|
|
172
|
+
expect(on.allowed).toBe(true);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
describe("seatAppAccess — universal apps (Echo, Trail), Ruling 2", () => {
|
|
178
|
+
it("every seat gets them, whatever the grant", () => {
|
|
179
|
+
for (const accountGrant of [null, undefined, [], ["PAVE"], { bad: true }]) {
|
|
180
|
+
for (const app of ["ECHO", "TRAIL"]) {
|
|
181
|
+
const r = seatAppAccess({ app, auth0Allows: false, teams: [PAVE_TEAM], accountGrant });
|
|
182
|
+
expect(r).toMatchObject({ allowed: true, via: "teams", teamAllows: true });
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it("every seat gets them, whatever its teams (none, inactive, with no apps)", () => {
|
|
188
|
+
for (const teams of [[], null, [{ apps: [], active: false }], [{}]]) {
|
|
189
|
+
expect(seatAppAccess({ app: "ECHO", auth0Allows: false, teams }).allowed).toBe(true);
|
|
190
|
+
expect(seatAppAccess({ app: "TRAIL", auth0Allows: false, teams }).allowed).toBe(true);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it("a team listing Echo shows in the union but changes nothing", () => {
|
|
195
|
+
const r = seatAppAccess({ app: "ECHO", auth0Allows: false, teams: [{ apps: ["ECHO"] }] });
|
|
196
|
+
expect(r).toMatchObject({ allowed: true, teamUnion: ["ECHO"], teamApps: UNIVERSAL_ONLY });
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
describe("seatAppAccess — account not launched (Trail only)", () => {
|
|
201
|
+
it("only Trail; no casework app, no Echo", () => {
|
|
202
|
+
const base = {
|
|
203
|
+
auth0Allows: false,
|
|
204
|
+
teams: [PAVE_TEAM, THREAD_TEAM],
|
|
205
|
+
accountGrant: ["PAVE", "THREAD", "ECHO"],
|
|
206
|
+
accountPreLaunch: true,
|
|
207
|
+
};
|
|
208
|
+
expect(seatAppAccess({ ...base, app: "TRAIL" })).toMatchObject({
|
|
209
|
+
allowed: true,
|
|
210
|
+
via: "teams",
|
|
211
|
+
teamApps: ["TRAIL"],
|
|
212
|
+
});
|
|
213
|
+
for (const app of ["ECHO", "PAVE", "THREAD"]) {
|
|
214
|
+
expect(seatAppAccess({ ...base, app })).toMatchObject({ allowed: false, via: "none" });
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it("only a literal true clamps", () => {
|
|
219
|
+
for (const accountPreLaunch of [false, null, undefined]) {
|
|
220
|
+
expect(seatAppAccess({ app: "ECHO", auth0Allows: false, teams: [], accountPreLaunch }).allowed).toBe(true);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
describe("seatTeamApps — directly", () => {
|
|
226
|
+
it("grant unknown: the teams' casework apps plus Echo and Trail", () => {
|
|
227
|
+
expect(seatTeamApps({ teams: [THREAD_TEAM] })).toEqual(["TRAIL", "THREAD", "ECHO"]);
|
|
228
|
+
expect(seatTeamApps({ teams: [THREAD_TEAM], accountGrant: null })).toEqual(["TRAIL", "THREAD", "ECHO"]);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it("grant empty: Echo and Trail only", () => {
|
|
232
|
+
const teams = [THREAD_TEAM, PAVE_TEAM];
|
|
233
|
+
expect(seatTeamApps({ teams, accountGrant: [] })).toEqual(UNIVERSAL_ONLY);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it("no teams: Echo and Trail only; pre-launch: Trail only", () => {
|
|
237
|
+
expect(seatTeamApps({})).toEqual(UNIVERSAL_ONLY);
|
|
238
|
+
expect(seatTeamApps({ teams: [THREAD_TEAM], accountPreLaunch: true })).toEqual(["TRAIL"]);
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
describe("seatAppAccess — unknown app codes", () => {
|
|
243
|
+
it("an app that names no platform app is never granted by the platform side", () => {
|
|
244
|
+
for (const app of ["PLATFORM", "thread_test", "", null, 7]) {
|
|
245
|
+
const r = seatAppAccess({ app, auth0Allows: false, teams: [THREAD_TEAM, { apps: ["PLATFORM"] }] });
|
|
246
|
+
expect(r).toMatchObject({ allowed: false, via: "none", app: null, teamAllows: false });
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it("the Auth0 decision still stands for an unknown app", () => {
|
|
251
|
+
const r = seatAppAccess({ app: "toby", auth0Allows: true });
|
|
252
|
+
expect(r).toMatchObject({ allowed: true, via: "auth0", app: null });
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it("stored values that name no app are dropped and reported as written", () => {
|
|
256
|
+
const r = seatAppAccess({
|
|
257
|
+
app: "PAVE",
|
|
258
|
+
auth0Allows: false,
|
|
259
|
+
teams: [{ apps: ["PAVE", "PLATFORM", "thread_test", ""] }],
|
|
260
|
+
accountGrant: ["PAVE", "pave_train"],
|
|
261
|
+
});
|
|
262
|
+
expect(r).toMatchObject({ allowed: true, teamUnion: ["PAVE"], accountGrant: ["PAVE"] });
|
|
263
|
+
expect([...r.unrecognized].sort()).toEqual(["", "PLATFORM", "pave_train", "thread_test"].sort());
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
describe("seatAppAccess — case and alias normalisation", () => {
|
|
268
|
+
it("the asked app matches in any case and with surrounding spaces", () => {
|
|
269
|
+
for (const app of ["THREAD", "thread", "Thread", " thread "]) {
|
|
270
|
+
const r = seatAppAccess({ app, auth0Allows: false, teams: [THREAD_TEAM] });
|
|
271
|
+
expect(r).toMatchObject({ allowed: true, app: "THREAD" });
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it("stored team and account apps match in any case (production PAVE, canon pave)", () => {
|
|
276
|
+
const r = seatAppAccess({
|
|
277
|
+
app: "PAVE",
|
|
278
|
+
auth0Allows: false,
|
|
279
|
+
teams: [{ apps: ["pave"] }, { apps: " Thread " }],
|
|
280
|
+
accountGrant: ["Pave", "THREAD"],
|
|
281
|
+
});
|
|
282
|
+
expect(r).toMatchObject({ allowed: true, teamUnion: ["THREAD", "PAVE"], accountGrant: ["THREAD", "PAVE"] });
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it("an Auth0 tier role name is not an app here: thread_test names no app", () => {
|
|
286
|
+
const r = seatAppAccess({ app: "thread_test", auth0Allows: false, teams: [THREAD_TEAM] });
|
|
287
|
+
expect(r.app).toBeNull();
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it("lists come back once each, in the canonical order", () => {
|
|
291
|
+
expect(
|
|
292
|
+
seatTeamApps({ teams: [{ apps: ["LEADS", "PAVE", "THREAD", "pave"] }], accountGrant: ["LEADS", "PAVE", "THREAD"] }),
|
|
293
|
+
).toEqual(["TRAIL", "THREAD", "PAVE", "LEADS", "ECHO"]);
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
describe("seatAppAccess — exports", () => {
|
|
298
|
+
it("is exported from the authz subpath and the package root", () => {
|
|
299
|
+
expect(authz.seatAppAccess).toBe(seatAppAccess);
|
|
300
|
+
expect(authz.seatTeamApps).toBe(seatTeamApps);
|
|
301
|
+
expect(authz.accountAppGrant).toBe(accountAppGrant);
|
|
302
|
+
expect(root.seatAppAccess).toBe(seatAppAccess);
|
|
303
|
+
});
|
|
304
|
+
});
|
package/src/authz/index.ts
CHANGED