@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-
|
|
1
|
+
import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-BLeRivoF.cjs';
|
|
2
2
|
import * as mongoose from 'mongoose';
|
|
3
3
|
import { HydratedDocument, Connection, Model } from 'mongoose';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-
|
|
1
|
+
import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-BLeRivoF.js';
|
|
2
2
|
import * as mongoose from 'mongoose';
|
|
3
3
|
import { HydratedDocument, Connection, Model } from 'mongoose';
|
|
4
4
|
|
package/dist/index.cjs
CHANGED
|
@@ -611,6 +611,7 @@ __export(src_exports, {
|
|
|
611
611
|
WHY_NOT_REPORTING_AXES: () => WHY_NOT_REPORTING_AXES,
|
|
612
612
|
WhyNotKeys: () => WhyNotKeys,
|
|
613
613
|
accommodationTypeSot: () => accommodationType_v1_0_0_default,
|
|
614
|
+
accountAppGrant: () => accountAppGrant,
|
|
614
615
|
accountSharePurposePolicy: () => accountSharePurposePolicy,
|
|
615
616
|
actionStepCompletionStatusSot: () => actionStepCompletionStatus_v1_0_0_default,
|
|
616
617
|
actionStepTypeSot: () => actionStepType_v1_0_0_default,
|
|
@@ -979,6 +980,8 @@ __export(src_exports, {
|
|
|
979
980
|
scoringRuleSchemaDefinition: () => scoringRuleSchemaDefinition,
|
|
980
981
|
scoringRuleSchemaOptions: () => scoringRuleSchemaOptions,
|
|
981
982
|
scoringThresholdSchema: () => scoringThresholdSchema,
|
|
983
|
+
seatAppAccess: () => seatAppAccess,
|
|
984
|
+
seatTeamApps: () => seatTeamApps,
|
|
982
985
|
sectionModel: () => sectionModel_exports,
|
|
983
986
|
sectionQuestionRefSchema: () => sectionQuestionRefSchema,
|
|
984
987
|
sectionSchemaDefinition: () => sectionSchemaDefinition,
|
|
@@ -27754,8 +27757,8 @@ function governingRowOf(rows) {
|
|
|
27754
27757
|
if (rows.length === 1 && only !== void 0) return { row: only };
|
|
27755
27758
|
const family = idText(rows[0]?.familyId);
|
|
27756
27759
|
const versions = rows.map((r) => positiveIntOrNull(r.version));
|
|
27757
|
-
const
|
|
27758
|
-
if (!
|
|
27760
|
+
const ordered2 = family !== null && rows.every((r) => idText(r.familyId) === family) && versions.every((v) => typeof v === "number") && new Set(versions).size === versions.length;
|
|
27761
|
+
if (!ordered2) {
|
|
27759
27762
|
return unavailableViewingPolicy("ambiguous_rows", policyIdOf(rows[0] ?? {}));
|
|
27760
27763
|
}
|
|
27761
27764
|
let best = rows[0];
|
|
@@ -28013,6 +28016,91 @@ function viewingComponentOpen(access, homeRow, scope) {
|
|
|
28013
28016
|
return scope.isCovered(access.visibleScope, homeRow);
|
|
28014
28017
|
}
|
|
28015
28018
|
|
|
28019
|
+
// src/authz/seatAppAccess.ts
|
|
28020
|
+
var UNIVERSAL = new Set(UNIVERSAL_APP_IDS);
|
|
28021
|
+
var TRAIL = "trail";
|
|
28022
|
+
function toolCode(id) {
|
|
28023
|
+
return id.toUpperCase();
|
|
28024
|
+
}
|
|
28025
|
+
function asWritten(v) {
|
|
28026
|
+
if (typeof v === "string") return v;
|
|
28027
|
+
try {
|
|
28028
|
+
const json = JSON.stringify(v);
|
|
28029
|
+
return json === void 0 ? String(v) : json;
|
|
28030
|
+
} catch {
|
|
28031
|
+
return String(v);
|
|
28032
|
+
}
|
|
28033
|
+
}
|
|
28034
|
+
function listOf(value, unrecognized) {
|
|
28035
|
+
if (value === null || value === void 0) return [];
|
|
28036
|
+
if (typeof value === "string") return [value];
|
|
28037
|
+
if (Array.isArray(value)) return value;
|
|
28038
|
+
unrecognized.push(asWritten(value));
|
|
28039
|
+
return [];
|
|
28040
|
+
}
|
|
28041
|
+
function readApps(value, unrecognized) {
|
|
28042
|
+
const out = /* @__PURE__ */ new Set();
|
|
28043
|
+
for (const v of listOf(value, unrecognized)) {
|
|
28044
|
+
const app = platformAppById(v);
|
|
28045
|
+
if (app) out.add(app.id);
|
|
28046
|
+
else unrecognized.push(asWritten(v));
|
|
28047
|
+
}
|
|
28048
|
+
return out;
|
|
28049
|
+
}
|
|
28050
|
+
function ordered(ids) {
|
|
28051
|
+
return PLATFORM_APP_IDS.filter((id) => ids.has(id)).map(toolCode);
|
|
28052
|
+
}
|
|
28053
|
+
function readGrant(value, unrecognized) {
|
|
28054
|
+
if (value === null || value === void 0) return null;
|
|
28055
|
+
return readApps(value, unrecognized);
|
|
28056
|
+
}
|
|
28057
|
+
function accountAppGrant(account) {
|
|
28058
|
+
if (!account || typeof account !== "object") return null;
|
|
28059
|
+
const grant = account.apps_subscribed;
|
|
28060
|
+
return grant === null || grant === void 0 ? null : grant;
|
|
28061
|
+
}
|
|
28062
|
+
function teamSide(teams, accountGrant, accountPreLaunch) {
|
|
28063
|
+
const unrecognized = [];
|
|
28064
|
+
const grant = readGrant(accountGrant, unrecognized);
|
|
28065
|
+
const union = /* @__PURE__ */ new Set();
|
|
28066
|
+
for (const team of Array.isArray(teams) ? teams : []) {
|
|
28067
|
+
if (!team || typeof team !== "object") continue;
|
|
28068
|
+
const t = team;
|
|
28069
|
+
if (t.active === false) continue;
|
|
28070
|
+
for (const id of readApps(t.apps, unrecognized)) union.add(id);
|
|
28071
|
+
}
|
|
28072
|
+
const granted = /* @__PURE__ */ new Set();
|
|
28073
|
+
if (accountPreLaunch === true) {
|
|
28074
|
+
granted.add(TRAIL);
|
|
28075
|
+
return { granted, union, grant, unrecognized };
|
|
28076
|
+
}
|
|
28077
|
+
for (const id of UNIVERSAL) granted.add(id);
|
|
28078
|
+
for (const id of CASEWORK_APP_IDS) {
|
|
28079
|
+
if (union.has(id) && (grant === null || grant.has(id))) granted.add(id);
|
|
28080
|
+
}
|
|
28081
|
+
return { granted, union, grant, unrecognized };
|
|
28082
|
+
}
|
|
28083
|
+
function seatTeamApps(input) {
|
|
28084
|
+
return ordered(teamSide(input.teams, input.accountGrant, input.accountPreLaunch).granted);
|
|
28085
|
+
}
|
|
28086
|
+
function seatAppAccess(input) {
|
|
28087
|
+
const side = teamSide(input.teams, input.accountGrant, input.accountPreLaunch);
|
|
28088
|
+
const app = platformAppById(input.app);
|
|
28089
|
+
const teamAllows = app !== null && side.granted.has(app.id);
|
|
28090
|
+
const auth0Allows = input.auth0Allows === true;
|
|
28091
|
+
const via = auth0Allows && teamAllows ? "both" : auth0Allows ? "auth0" : teamAllows ? "teams" : "none";
|
|
28092
|
+
return {
|
|
28093
|
+
allowed: auth0Allows || teamAllows,
|
|
28094
|
+
via,
|
|
28095
|
+
app: app ? toolCode(app.id) : null,
|
|
28096
|
+
teamAllows,
|
|
28097
|
+
teamApps: ordered(side.granted),
|
|
28098
|
+
teamUnion: ordered(side.union),
|
|
28099
|
+
accountGrant: side.grant ? ordered(side.grant) : null,
|
|
28100
|
+
unrecognized: side.unrecognized
|
|
28101
|
+
};
|
|
28102
|
+
}
|
|
28103
|
+
|
|
28016
28104
|
// src/generated/sharingPlatformStarter.ts
|
|
28017
28105
|
var SHARING_PLATFORM_STARTER_SOURCE = {
|
|
28018
28106
|
"monolith": {
|
|
@@ -77381,6 +77469,7 @@ var CVC_197_VALUES = selectableCodes(
|
|
|
77381
77469
|
WHY_NOT_REPORTING_AXES,
|
|
77382
77470
|
WhyNotKeys,
|
|
77383
77471
|
accommodationTypeSot,
|
|
77472
|
+
accountAppGrant,
|
|
77384
77473
|
accountSharePurposePolicy,
|
|
77385
77474
|
actionStepCompletionStatusSot,
|
|
77386
77475
|
actionStepTypeSot,
|
|
@@ -77749,6 +77838,8 @@ var CVC_197_VALUES = selectableCodes(
|
|
|
77749
77838
|
scoringRuleSchemaDefinition,
|
|
77750
77839
|
scoringRuleSchemaOptions,
|
|
77751
77840
|
scoringThresholdSchema,
|
|
77841
|
+
seatAppAccess,
|
|
77842
|
+
seatTeamApps,
|
|
77752
77843
|
sectionModel,
|
|
77753
77844
|
sectionQuestionRefSchema,
|
|
77754
77845
|
sectionSchemaDefinition,
|