@opengeni/core 2.7.5-canary.2 → 2.7.5-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/index.d.ts +7 -0
- package/dist/application/session-commands.d.ts +1 -0
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/access/index.ts +30 -0
- package/src/application/session-commands.ts +32 -0
package/dist/access/index.d.ts
CHANGED
|
@@ -91,6 +91,13 @@ export declare function requireCanonicalLocalAccountAdministrator(c: Context, de
|
|
|
91
91
|
authorization: AccessGrantAuthorization;
|
|
92
92
|
}>;
|
|
93
93
|
export declare function requireAccessGrantAuthorization(c: Context, deps: AccessDeps, workspaceId: string, permission?: Permission): Promise<AccessGrantAuthorization>;
|
|
94
|
+
/**
|
|
95
|
+
* Settings administration is narrower than workspace administration. The
|
|
96
|
+
* canonical managed-cookie owner may configure their Personal workspace, but
|
|
97
|
+
* never acquires the admin wildcard (and its membership/delegation powers).
|
|
98
|
+
* Only use this boundary for workspace configuration, not access management.
|
|
99
|
+
*/
|
|
100
|
+
export declare function requireWorkspaceSettingsGrant(c: Context, deps: AccessDeps, workspaceId: string): Promise<AccessGrant>;
|
|
94
101
|
export declare function requirePermission(grant: AccessGrant, permission: Permission): void;
|
|
95
102
|
/**
|
|
96
103
|
* Require a permission to be present literally on the grant. This deliberately
|
|
@@ -124,4 +124,5 @@ export declare function controlHumanWorkspace(deps: {
|
|
|
124
124
|
} & SessionCommandPostCommitDeps, context: Omit<HumanSessionCommandContext, "sessionId">, input: WorkspaceInferenceControlRequest): Promise<WorkspaceInferenceControlResponse>;
|
|
125
125
|
export declare function getHumanComposerDraft(deps: SessionAuthorizationCommandDeps, context: HumanSessionCommandContext): Promise<ComposerDraft>;
|
|
126
126
|
export declare function saveHumanComposerDraft(deps: SessionAuthorizationCommandDeps, context: HumanSessionCommandContext, input: SaveComposerDraftRequest): Promise<ComposerDraft>;
|
|
127
|
+
export declare function controlHumanWorkspaceTimer(deps: Parameters<typeof controlHumanWorkspace>[0], context: Parameters<typeof controlHumanWorkspace>[1], input: import("@opengeni/contracts").WorkspacePauseTimerRequest): Promise<void>;
|
|
127
128
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1988,7 +1988,8 @@ import {
|
|
|
1988
1988
|
ensureManagedAccessForUser,
|
|
1989
1989
|
findActiveApiKeyByHash,
|
|
1990
1990
|
getWorkspaceGrant,
|
|
1991
|
-
requireWorkspace
|
|
1991
|
+
requireWorkspace,
|
|
1992
|
+
resolveNamedManagedPersonalWorkspaceGrant
|
|
1992
1993
|
} from "@opengeni/db";
|
|
1993
1994
|
import { HTTPException } from "hono/http-exception";
|
|
1994
1995
|
var bearerPrefix = "Bearer ";
|
|
@@ -2110,6 +2111,21 @@ async function requireAccessGrantAuthorization(c, deps, workspaceId, permission)
|
|
|
2110
2111
|
const context = await requireAccessContext(c, deps);
|
|
2111
2112
|
return await accessGrantAuthorization(context, deps, workspaceId, permission);
|
|
2112
2113
|
}
|
|
2114
|
+
async function requireWorkspaceSettingsGrant(c, deps, workspaceId) {
|
|
2115
|
+
const authorization = await requireAccessGrantAuthorization(c, deps, workspaceId);
|
|
2116
|
+
const grant = requireResolvedAccessGrantAuthorization(authorization, workspaceId);
|
|
2117
|
+
if (hasPermission(grant.permissions, "workspace:admin")) return grant;
|
|
2118
|
+
if (authorization.canonicalManagedHumanSession && await resolveNamedManagedPersonalWorkspaceGrant(deps.db, {
|
|
2119
|
+
accountId: grant.accountId,
|
|
2120
|
+
workspaceId,
|
|
2121
|
+
subjectId: authorization.authenticatedSubjectId
|
|
2122
|
+
})) {
|
|
2123
|
+
return grant;
|
|
2124
|
+
}
|
|
2125
|
+
throw new HTTPException(403, {
|
|
2126
|
+
message: "workspace settings require a workspace administrator or Personal workspace owner"
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2113
2129
|
async function accessGrantAuthorization(context, deps, workspaceId, permission) {
|
|
2114
2130
|
const principalKind = hostedHumanSessionPrincipalKind(context);
|
|
2115
2131
|
let grant = context.workspaceGrants.find((candidate) => candidate.workspaceId === workspaceId) ?? await getWorkspaceGrant(
|
|
@@ -15285,6 +15301,7 @@ import {
|
|
|
15285
15301
|
moveQueuedTurnInTransaction,
|
|
15286
15302
|
mutateSessionControlInTransaction,
|
|
15287
15303
|
mutateWorkspaceControlInTransaction,
|
|
15304
|
+
setWorkspacePauseTimerInTransaction,
|
|
15288
15305
|
projectEffectiveControlForRelatedAccess,
|
|
15289
15306
|
runIdempotentPersistenceTransaction as runIdempotentPersistenceTransaction2,
|
|
15290
15307
|
saveComposerDraftInTransaction,
|
|
@@ -16015,6 +16032,31 @@ async function saveHumanComposerDraft(deps, context, input) {
|
|
|
16015
16032
|
);
|
|
16016
16033
|
return composerDraft(row);
|
|
16017
16034
|
}
|
|
16035
|
+
async function controlHumanWorkspaceTimer(deps, context, input) {
|
|
16036
|
+
const result = await withWorkspaceRls2(
|
|
16037
|
+
deps.db,
|
|
16038
|
+
context.workspaceId,
|
|
16039
|
+
(scoped) => scoped.transaction(
|
|
16040
|
+
(tx) => setWorkspacePauseTimerInTransaction(tx, {
|
|
16041
|
+
...input,
|
|
16042
|
+
...context
|
|
16043
|
+
})
|
|
16044
|
+
)
|
|
16045
|
+
);
|
|
16046
|
+
scheduleSessionCommandPostCommit(deps, "human_workspace_timer", [
|
|
16047
|
+
...result.workspaceControlEventId ? [
|
|
16048
|
+
{
|
|
16049
|
+
kind: "workspace_control_fanout",
|
|
16050
|
+
run: async () => await publishWorkspaceControlEvent(
|
|
16051
|
+
deps,
|
|
16052
|
+
context.workspaceId,
|
|
16053
|
+
result.workspaceControlEventId
|
|
16054
|
+
)
|
|
16055
|
+
}
|
|
16056
|
+
] : [],
|
|
16057
|
+
{ kind: "workflow_wake", run: async () => await requestControlWakeDispatch(deps, 1) }
|
|
16058
|
+
]);
|
|
16059
|
+
}
|
|
16018
16060
|
|
|
16019
16061
|
// src/application/user-resource-grants.ts
|
|
16020
16062
|
import {
|
|
@@ -16442,6 +16484,7 @@ export {
|
|
|
16442
16484
|
controlHumanSessionWorkstream,
|
|
16443
16485
|
controlHumanSessionWorkstreamWithOutcome,
|
|
16444
16486
|
controlHumanWorkspace,
|
|
16487
|
+
controlHumanWorkspaceTimer,
|
|
16445
16488
|
conversationDeliveryNextAction,
|
|
16446
16489
|
correctWorkspaceMemoryWithSlackPublication,
|
|
16447
16490
|
createAndStartSession,
|
|
@@ -16661,6 +16704,7 @@ export {
|
|
|
16661
16704
|
requireSessionAuthorizationListScope,
|
|
16662
16705
|
requireVariableSetEncryption,
|
|
16663
16706
|
requireVariableSetForApi,
|
|
16707
|
+
requireWorkspaceSettingsGrant,
|
|
16664
16708
|
resolveCapabilityPack,
|
|
16665
16709
|
resolveCatalogSettings,
|
|
16666
16710
|
resolveChildGoalFromAcceptedSnapshot,
|