@opengeni/api-router 1.0.2 → 1.1.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/dist/app.js +1 -1
- package/dist/artifact-catalog-cursor.d.ts +1 -0
- package/dist/{chunk-6TZ5LG3O.js → chunk-A4J3LBH6.js} +169 -69
- package/dist/{chunk-6TZ5LG3O.js.map → chunk-A4J3LBH6.js.map} +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/package.json +20 -20
- package/src/app.ts +8 -2
- package/src/artifact-catalog-cursor.ts +1 -0
- package/src/index.ts +0 -2
- package/src/mcp/action-catalog.gen.ts +11 -0
- package/src/mcp/server.ts +3 -0
- package/src/mcp-oauth.ts +8 -2
- package/src/routes/artifact-catalog.ts +92 -0
- package/src/routes/organization-memberships.ts +0 -5
- package/src/routes/sessions.ts +11 -1
package/dist/app.js
CHANGED
|
@@ -9756,6 +9756,7 @@ import {
|
|
|
9756
9756
|
setSessionChannel
|
|
9757
9757
|
} from "@opengeni/db";
|
|
9758
9758
|
import { createHash as createHash15, randomUUID as randomUUID5 } from "crypto";
|
|
9759
|
+
import { assertGoalResumeAllowed } from "@opengeni/core";
|
|
9759
9760
|
|
|
9760
9761
|
// src/sandbox/enrollment.ts
|
|
9761
9762
|
import { createPublicKey, randomBytes as randomBytes3, verify } from "crypto";
|
|
@@ -14802,7 +14803,7 @@ var PKCE_CHALLENGE = /^[A-Za-z0-9_-]{43}$/u;
|
|
|
14802
14803
|
var WORKSPACE_MCP_PATH = /^\/v1\/workspaces\/([0-9a-f-]{36})\/mcp(?:\/(docs|files))?$/u;
|
|
14803
14804
|
var ORGANIZATION_MCP_PATH = "/v1/mcp";
|
|
14804
14805
|
function registerMcpOAuthRoutes(app, deps) {
|
|
14805
|
-
|
|
14806
|
+
const authorizationServerMetadata = (c) => {
|
|
14806
14807
|
requireMcpOAuthEnabled(deps);
|
|
14807
14808
|
const issuer = mcpOAuthIssuer(deps);
|
|
14808
14809
|
c.header("cache-control", "public, max-age=300");
|
|
@@ -14820,7 +14821,9 @@ function registerMcpOAuthRoutes(app, deps) {
|
|
|
14820
14821
|
authorization_response_iss_parameter_supported: true
|
|
14821
14822
|
})
|
|
14822
14823
|
);
|
|
14823
|
-
}
|
|
14824
|
+
};
|
|
14825
|
+
app.get("/.well-known/oauth-authorization-server", authorizationServerMetadata);
|
|
14826
|
+
app.get("/.well-known/oauth-authorization-server/*", authorizationServerMetadata);
|
|
14824
14827
|
app.get("/.well-known/oauth-protected-resource/*", (c) => {
|
|
14825
14828
|
requireMcpOAuthEnabled(deps);
|
|
14826
14829
|
const pathname = new URL(c.req.url).pathname.replace(
|
|
@@ -15242,7 +15245,7 @@ function mcpOAuthConsentToolIdentities(catalog) {
|
|
|
15242
15245
|
return catalog.entries.map((entry2) => entry2.identity);
|
|
15243
15246
|
}
|
|
15244
15247
|
function isMcpOAuthPublicProtocolPath(pathname) {
|
|
15245
|
-
return pathname === "/.well-known/oauth-authorization-server" || pathname.startsWith("/.well-known/oauth-protected-resource/") || pathname === "/oauth/register" || pathname === "/oauth/authorize" || pathname === "/oauth/token";
|
|
15248
|
+
return pathname === "/.well-known/oauth-authorization-server" || pathname.startsWith("/.well-known/oauth-authorization-server/") || pathname.startsWith("/.well-known/oauth-protected-resource/") || pathname === "/oauth/register" || pathname === "/oauth/authorize" || pathname === "/oauth/token";
|
|
15246
15249
|
}
|
|
15247
15250
|
function mcpOAuthAuthenticateHeader(deps, pathname) {
|
|
15248
15251
|
return `Bearer resource_metadata="${mcpOAuthIssuer(deps)}/.well-known/oauth-protected-resource${pathname}", scope="${MCP_OAUTH_SCOPE}"`;
|
|
@@ -33429,6 +33432,7 @@ function registerGoalTools(server, deps, grant, sessionId, json2) {
|
|
|
33429
33432
|
sessionId,
|
|
33430
33433
|
{
|
|
33431
33434
|
status: "active",
|
|
33435
|
+
beforeResume: (tx, session, causalTurn) => assertGoalResumeAllowed({ ...deps, db: tx }, session, causalTurn),
|
|
33432
33436
|
event: { type: "goal.resumed", actor: "agent" }
|
|
33433
33437
|
}
|
|
33434
33438
|
);
|
|
@@ -42907,6 +42911,17 @@ var ACTION_CATALOG = [
|
|
|
42907
42911
|
"PrReviewAppRegistration"
|
|
42908
42912
|
]
|
|
42909
42913
|
},
|
|
42914
|
+
{
|
|
42915
|
+
"id": "updateArtifactPin",
|
|
42916
|
+
"method": "PUT",
|
|
42917
|
+
"path": "/v1/workspaces/:workspaceId/artifact-catalog/:kind/:artifactId/pin",
|
|
42918
|
+
"request": [
|
|
42919
|
+
"ArtifactCatalogKind"
|
|
42920
|
+
],
|
|
42921
|
+
"response": [
|
|
42922
|
+
"ArtifactPinResponse"
|
|
42923
|
+
]
|
|
42924
|
+
},
|
|
42910
42925
|
{
|
|
42911
42926
|
"id": "updateBrowserIdentity",
|
|
42912
42927
|
"method": "PATCH",
|
|
@@ -99677,6 +99692,7 @@ function registerScheduledTaskRoutes(app, deps) {
|
|
|
99677
99692
|
|
|
99678
99693
|
// src/routes/sessions.ts
|
|
99679
99694
|
import { getRetainedProviderCommand } from "@opengeni/db/retained-provider-commands";
|
|
99695
|
+
import { assertGoalResumeAllowed as assertGoalResumeAllowed2, GoalResumeBlockedError } from "@opengeni/core";
|
|
99680
99696
|
import { UnsupportedLatencyModeError } from "@opengeni/config";
|
|
99681
99697
|
import { searchSessionMessagesForSubject, SessionMessageSearchCursorError } from "@opengeni/db";
|
|
99682
99698
|
import { listSessionEventSlices } from "@opengeni/db/session-event-slices";
|
|
@@ -103151,6 +103167,14 @@ function registerSessionRoutes(app, deps) {
|
|
|
103151
103167
|
sessionId,
|
|
103152
103168
|
{
|
|
103153
103169
|
status: "active",
|
|
103170
|
+
beforeResume: (tx, session, causalTurn) => assertGoalResumeAllowed2({ ...deps, db: tx }, session, causalTurn).catch(
|
|
103171
|
+
(error) => {
|
|
103172
|
+
if (error instanceof GoalResumeBlockedError) {
|
|
103173
|
+
throw new HTTPException88(422, { message: error.message, cause: error });
|
|
103174
|
+
}
|
|
103175
|
+
throw error;
|
|
103176
|
+
}
|
|
103177
|
+
),
|
|
103154
103178
|
event: { type: "goal.resumed", actor: "api" }
|
|
103155
103179
|
}
|
|
103156
103180
|
);
|
|
@@ -105149,7 +105173,7 @@ function sessionTenancyHttpError(error) {
|
|
|
105149
105173
|
if (error instanceof SessionTenancyNotActivatedError) {
|
|
105150
105174
|
return new ApiHttpError(409, {
|
|
105151
105175
|
code: "conflict",
|
|
105152
|
-
message: "
|
|
105176
|
+
message: "Only-me chats are not enabled for this organization.",
|
|
105153
105177
|
retryable: false,
|
|
105154
105178
|
details: { reason: "not_activated" }
|
|
105155
105179
|
});
|
|
@@ -110062,6 +110086,8 @@ import {
|
|
|
110062
110086
|
ArtifactCatalogKind as ArtifactCatalogKind2,
|
|
110063
110087
|
ArtifactCatalogListQuery,
|
|
110064
110088
|
ArtifactCatalogListResponse,
|
|
110089
|
+
ArtifactPinResponse,
|
|
110090
|
+
UpdateArtifactPinRequest,
|
|
110065
110091
|
retainedArtifactReferenceFromFile as retainedArtifactReferenceFromFile3,
|
|
110066
110092
|
retainedGeneratedImageReferenceFromFile as retainedGeneratedImageReferenceFromFile2
|
|
110067
110093
|
} from "@opengeni/contracts";
|
|
@@ -110082,9 +110108,12 @@ import {
|
|
|
110082
110108
|
getGeneratedImageArtifact as getGeneratedImageArtifact2,
|
|
110083
110109
|
getSessionAuthorityProjection as getSessionAuthorityProjection3,
|
|
110084
110110
|
listArtifactCatalogCandidates,
|
|
110111
|
+
nestedPostgresSqlState as nestedPostgresSqlState14,
|
|
110112
|
+
updateArtifactPin,
|
|
110085
110113
|
withSessionRlsActorContext as withSessionRlsActorContext9
|
|
110086
110114
|
} from "@opengeni/db";
|
|
110087
110115
|
import { HTTPException as HTTPException102 } from "hono/http-exception";
|
|
110116
|
+
import { z as z53 } from "zod";
|
|
110088
110117
|
|
|
110089
110118
|
// src/artifact-catalog-cursor.ts
|
|
110090
110119
|
import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, createHash as createHash29, randomBytes as randomBytes12 } from "crypto";
|
|
@@ -110098,7 +110127,8 @@ var Cursor = z52.object({
|
|
|
110098
110127
|
after: z52.object({
|
|
110099
110128
|
key: z52.string().max(4096),
|
|
110100
110129
|
kind: ArtifactCatalogKind,
|
|
110101
|
-
id: z52.string().min(1).max(128)
|
|
110130
|
+
id: z52.string().min(1).max(128),
|
|
110131
|
+
pinned: z52.boolean().optional()
|
|
110102
110132
|
}).strict()
|
|
110103
110133
|
}).strict();
|
|
110104
110134
|
function artifactCatalogCursorCodec(secret, binding) {
|
|
@@ -110146,9 +110176,82 @@ var iso2 = (value) => new Date(value).toISOString();
|
|
|
110146
110176
|
var position = (row) => ({
|
|
110147
110177
|
key: row.sort_key,
|
|
110148
110178
|
kind: row.kind,
|
|
110149
|
-
id: row.id
|
|
110179
|
+
id: row.id,
|
|
110180
|
+
pinned: row.pinned ?? false
|
|
110150
110181
|
});
|
|
110151
110182
|
function registerArtifactCatalogRoutes(app, deps) {
|
|
110183
|
+
app.put("/v1/workspaces/:workspaceId/artifact-catalog/:kind/:artifactId/pin", async (context) => {
|
|
110184
|
+
const workspaceId = context.req.param("workspaceId");
|
|
110185
|
+
const authorization = await requireAccessGrantAuthorization36(
|
|
110186
|
+
context,
|
|
110187
|
+
deps,
|
|
110188
|
+
workspaceId,
|
|
110189
|
+
"artifacts:publish"
|
|
110190
|
+
);
|
|
110191
|
+
const grant = authorization.grant;
|
|
110192
|
+
if (!hasPermission27(grant.permissions, "artifacts:publish"))
|
|
110193
|
+
throw new HTTPException102(403, { message: "Artifact publish access required" });
|
|
110194
|
+
const kind = ArtifactCatalogKind2.safeParse(context.req.param("kind"));
|
|
110195
|
+
const body3 = UpdateArtifactPinRequest.safeParse(await context.req.json().catch(() => null));
|
|
110196
|
+
const requestedId = context.req.param("artifactId");
|
|
110197
|
+
if (!kind.success || !body3.success || !(editableKinds.has(kind.data) ? /^[0-9a-f]{32}$/.test(requestedId) : z53.string().uuid().safeParse(requestedId).success))
|
|
110198
|
+
throw new HTTPException102(422, { message: "Invalid artifact pin request" });
|
|
110199
|
+
const artifactId2 = editableKinds.has(kind.data) ? requestedId : requestedId.toLowerCase();
|
|
110200
|
+
const fileKind = kind.data === "file" || kind.data === "image";
|
|
110201
|
+
if (!hasPermission27(grant.permissions, fileKind ? "files:read" : "artifacts:read"))
|
|
110202
|
+
throw new HTTPException102(403, { message: "Artifact read access required" });
|
|
110203
|
+
const actor = fileKind ? await fileOwnerContextForAccess5(deps, authorization, "files:read") : { subjectId: grant.subjectId, privateFileOwnerSubjectId: null };
|
|
110204
|
+
context.header("cache-control", "private, no-store");
|
|
110205
|
+
return withSessionRlsActorContext9(actor, async () => {
|
|
110206
|
+
if (editableKinds.has(kind.data)) {
|
|
110207
|
+
if (!deps.editableArtifacts)
|
|
110208
|
+
throw new HTTPException102(503, { message: "Editable artifacts are unavailable" });
|
|
110209
|
+
try {
|
|
110210
|
+
const scope = editableArtifactScope2({ accountId: grant.accountId, workspaceId });
|
|
110211
|
+
const artifact = await deps.editableArtifacts.readArtifact({
|
|
110212
|
+
scope,
|
|
110213
|
+
actor: editableArtifactActorForGrant(grant, "0000000000000001"),
|
|
110214
|
+
artifactId: editableArtifactId3(artifactId2)
|
|
110215
|
+
});
|
|
110216
|
+
if (artifact.scope.accountId !== scope.accountId || artifact.scope.workspaceId !== scope.workspaceId || artifact.id !== artifactId2 || artifact.modality !== kind.data)
|
|
110217
|
+
throw new HTTPException102(404, { message: "Artifact not found" });
|
|
110218
|
+
} catch (error) {
|
|
110219
|
+
if (isInvisibleListCandidate(error))
|
|
110220
|
+
throw new HTTPException102(404, { message: "Artifact not found" });
|
|
110221
|
+
throw editableArtifactHttpError(error);
|
|
110222
|
+
}
|
|
110223
|
+
}
|
|
110224
|
+
if (fileKind) {
|
|
110225
|
+
const subjectId = await fileAuthoritySubjectIdForGrant(deps, grant);
|
|
110226
|
+
const [file] = await getFilesForSubject3(deps.db, {
|
|
110227
|
+
accountId: grant.accountId,
|
|
110228
|
+
workspaceId,
|
|
110229
|
+
subjectId,
|
|
110230
|
+
fileIds: [artifactId2]
|
|
110231
|
+
});
|
|
110232
|
+
if (!file || file.status !== "ready")
|
|
110233
|
+
throw new HTTPException102(404, { message: "Artifact not found" });
|
|
110234
|
+
}
|
|
110235
|
+
try {
|
|
110236
|
+
await updateArtifactPin(
|
|
110237
|
+
deps.db,
|
|
110238
|
+
{ accountId: grant.accountId, workspaceId },
|
|
110239
|
+
{
|
|
110240
|
+
kind: kind.data,
|
|
110241
|
+
artifactId: artifactId2,
|
|
110242
|
+
pinned: body3.data.pinned
|
|
110243
|
+
}
|
|
110244
|
+
);
|
|
110245
|
+
} catch (error) {
|
|
110246
|
+
if (nestedPostgresSqlState14(error) === "42501")
|
|
110247
|
+
throw new HTTPException102(404, { message: "Artifact not found" });
|
|
110248
|
+
throw error;
|
|
110249
|
+
}
|
|
110250
|
+
return context.json(
|
|
110251
|
+
ArtifactPinResponse.parse({ kind: kind.data, artifactId: artifactId2, pinned: body3.data.pinned })
|
|
110252
|
+
);
|
|
110253
|
+
});
|
|
110254
|
+
});
|
|
110152
110255
|
app.get("/v1/workspaces/:workspaceId/artifact-catalog", async (context) => {
|
|
110153
110256
|
const workspaceId = context.req.param("workspaceId");
|
|
110154
110257
|
const authorization = await requireAccessGrantAuthorization36(context, deps, workspaceId);
|
|
@@ -110282,7 +110385,8 @@ async function projectCandidate(deps, grant, row, fileSubject) {
|
|
|
110282
110385
|
title: row.title,
|
|
110283
110386
|
status: row.status,
|
|
110284
110387
|
createdAt: iso2(row.created_at),
|
|
110285
|
-
updatedAt: iso2(row.updated_at)
|
|
110388
|
+
updatedAt: iso2(row.updated_at),
|
|
110389
|
+
...row.pinned !== void 0 ? { pinned: row.pinned } : {}
|
|
110286
110390
|
};
|
|
110287
110391
|
if (row.version_id) item.versionId = row.version_id;
|
|
110288
110392
|
if (editableKinds.has(row.kind)) {
|
|
@@ -111873,9 +111977,9 @@ import {
|
|
|
111873
111977
|
withRlsContext as withRlsContext2
|
|
111874
111978
|
} from "@opengeni/db";
|
|
111875
111979
|
import { HTTPException as HTTPException106 } from "hono/http-exception";
|
|
111876
|
-
import { z as
|
|
111877
|
-
var SessionId2 =
|
|
111878
|
-
var EditableArtifactId =
|
|
111980
|
+
import { z as z54 } from "zod";
|
|
111981
|
+
var SessionId2 = z54.string().uuid();
|
|
111982
|
+
var EditableArtifactId = z54.string().regex(/^(?!0{32}$)[0-9a-f]{32}$/u);
|
|
111879
111983
|
function registerSessionArtifactAssociationRoutes(app, deps) {
|
|
111880
111984
|
app.get(
|
|
111881
111985
|
"/v1/workspaces/:workspaceId/sessions/:sessionId/artifact-associations/:artifactId",
|
|
@@ -112099,7 +112203,7 @@ import {
|
|
|
112099
112203
|
getCanonicalHumanIdentityProjection as getCanonicalHumanIdentityProjection3
|
|
112100
112204
|
} from "@opengeni/db/canonical-human-identities";
|
|
112101
112205
|
import { HTTPException as HTTPException110 } from "hono/http-exception";
|
|
112102
|
-
import { z as
|
|
112206
|
+
import { z as z57 } from "zod";
|
|
112103
112207
|
|
|
112104
112208
|
// src/routes/managed-sign-in-methods.ts
|
|
112105
112209
|
import {
|
|
@@ -112123,7 +112227,7 @@ import { getManagedAuthSessionSetSnapshot as getManagedAuthSessionSetSnapshot2 }
|
|
|
112123
112227
|
import { getCanonicalHumanIdentityProjection as getCanonicalHumanIdentityProjection2 } from "@opengeni/db/canonical-human-identities";
|
|
112124
112228
|
import { getCookie as getCookie2 } from "hono/cookie";
|
|
112125
112229
|
import { HTTPException as HTTPException109 } from "hono/http-exception";
|
|
112126
|
-
import { z as
|
|
112230
|
+
import { z as z56 } from "zod";
|
|
112127
112231
|
|
|
112128
112232
|
// src/routes/managed-auth-session-sets.ts
|
|
112129
112233
|
import { assertManagedUserAdmission as assertManagedUserAdmission2, getManagedSession as getManagedSession3 } from "@opengeni/core";
|
|
@@ -112189,12 +112293,12 @@ import {
|
|
|
112189
112293
|
import { ensureManagedAccessForUser as ensureManagedAccessForUser2, getSession as getSession10 } from "@opengeni/db";
|
|
112190
112294
|
import { deleteCookie as deleteCookie3, getCookie, setCookie as setCookie3 } from "hono/cookie";
|
|
112191
112295
|
import { HTTPException as HTTPException108 } from "hono/http-exception";
|
|
112192
|
-
import { z as
|
|
112193
|
-
var ManagedAuthSocialStartReceipt =
|
|
112194
|
-
version:
|
|
112195
|
-
requestDigest:
|
|
112196
|
-
url:
|
|
112197
|
-
stateCookie:
|
|
112296
|
+
import { z as z55 } from "zod";
|
|
112297
|
+
var ManagedAuthSocialStartReceipt = z55.object({
|
|
112298
|
+
version: z55.literal(1),
|
|
112299
|
+
requestDigest: z55.string().regex(/^[0-9a-f]{64}$/u),
|
|
112300
|
+
url: z55.string().url().max(4096),
|
|
112301
|
+
stateCookie: z55.string().min(1).max(4096)
|
|
112198
112302
|
}).strict();
|
|
112199
112303
|
function registerManagedAuthSessionSetRoutes(app, deps) {
|
|
112200
112304
|
const noStore = async (context, next) => {
|
|
@@ -113130,23 +113234,23 @@ function setCookieHeaders(headers) {
|
|
|
113130
113234
|
}
|
|
113131
113235
|
|
|
113132
113236
|
// src/routes/managed-sign-in-methods.ts
|
|
113133
|
-
var ConnectState =
|
|
113134
|
-
opengeniSignInMethod:
|
|
113135
|
-
intentId:
|
|
113136
|
-
provider:
|
|
113237
|
+
var ConnectState = z56.object({
|
|
113238
|
+
opengeniSignInMethod: z56.object({
|
|
113239
|
+
intentId: z56.string().uuid(),
|
|
113240
|
+
provider: z56.enum(["google", "github"])
|
|
113137
113241
|
}),
|
|
113138
|
-
link:
|
|
113139
|
-
callbackURL:
|
|
113140
|
-
errorURL:
|
|
113242
|
+
link: z56.object({ userId: z56.string().min(1), email: z56.string().email() }),
|
|
113243
|
+
callbackURL: z56.string().url(),
|
|
113244
|
+
errorURL: z56.string().url()
|
|
113141
113245
|
});
|
|
113142
|
-
var ConnectIntent =
|
|
113143
|
-
authUserId:
|
|
113144
|
-
authSessionId:
|
|
113145
|
-
expectedIdentityId:
|
|
113146
|
-
actorFence:
|
|
113147
|
-
authorityHash:
|
|
113148
|
-
actorEpoch:
|
|
113149
|
-
requestId:
|
|
113246
|
+
var ConnectIntent = z56.object({
|
|
113247
|
+
authUserId: z56.string().min(1),
|
|
113248
|
+
authSessionId: z56.string().min(1),
|
|
113249
|
+
expectedIdentityId: z56.string().uuid(),
|
|
113250
|
+
actorFence: z56.object({
|
|
113251
|
+
authorityHash: z56.string().regex(/^[0-9a-f]{64}$/),
|
|
113252
|
+
actorEpoch: z56.string().regex(/^[1-9][0-9]*$/),
|
|
113253
|
+
requestId: z56.string().uuid()
|
|
113150
113254
|
}).optional()
|
|
113151
113255
|
});
|
|
113152
113256
|
async function rows(deps, query) {
|
|
@@ -113466,7 +113570,7 @@ async function handleManagedSignInConnectCallback(context, deps, provider) {
|
|
|
113466
113570
|
|
|
113467
113571
|
// src/routes/canonical-human-identities.ts
|
|
113468
113572
|
import { managedAuthSecretRequestDigest as managedAuthSecretRequestDigest3 } from "@opengeni/core/managed-auth-session-sets";
|
|
113469
|
-
var BindingId =
|
|
113573
|
+
var BindingId = z57.string().uuid();
|
|
113470
113574
|
async function requestIdentity(context, deps) {
|
|
113471
113575
|
return await requireCanonicalHumanRequestIdentity2(context, {
|
|
113472
113576
|
db: deps.db,
|
|
@@ -113702,7 +113806,7 @@ import {
|
|
|
113702
113806
|
listOrganizationAdministrationMembers,
|
|
113703
113807
|
listOrganizationInvitations,
|
|
113704
113808
|
listSelfOrganizationInvitations,
|
|
113705
|
-
nestedPostgresSqlState as
|
|
113809
|
+
nestedPostgresSqlState as nestedPostgresSqlState15,
|
|
113706
113810
|
prepareOrganizationUserSetupDelivery,
|
|
113707
113811
|
revokeOrganizationInvitation,
|
|
113708
113812
|
settleOrganizationUserSetupDelivery,
|
|
@@ -113716,11 +113820,11 @@ import {
|
|
|
113716
113820
|
updateOrganizationRetentionPolicy
|
|
113717
113821
|
} from "@opengeni/db";
|
|
113718
113822
|
import { HTTPException as HTTPException111 } from "hono/http-exception";
|
|
113719
|
-
import { z as
|
|
113720
|
-
var OrganizationId2 =
|
|
113721
|
-
var WorkspaceId =
|
|
113722
|
-
var MembershipId =
|
|
113723
|
-
var InvitationId =
|
|
113823
|
+
import { z as z58 } from "zod";
|
|
113824
|
+
var OrganizationId2 = z58.string().uuid();
|
|
113825
|
+
var WorkspaceId = z58.string().uuid();
|
|
113826
|
+
var MembershipId = z58.string().uuid();
|
|
113827
|
+
var InvitationId = z58.string().uuid();
|
|
113724
113828
|
async function requirePrivateSessionAdministrator(context, deps, organizationId2) {
|
|
113725
113829
|
const agent = agentActingAsPerson(
|
|
113726
113830
|
context,
|
|
@@ -113819,7 +113923,7 @@ function parseId(schema, value, label) {
|
|
|
113819
113923
|
return parsed.data;
|
|
113820
113924
|
}
|
|
113821
113925
|
function rethrowMembershipError(error, resourceLimitMessage) {
|
|
113822
|
-
const sqlState =
|
|
113926
|
+
const sqlState = nestedPostgresSqlState15(error);
|
|
113823
113927
|
if (sqlState === "54000" && resourceLimitMessage) {
|
|
113824
113928
|
throw new HTTPException111(409, {
|
|
113825
113929
|
message: resourceLimitMessage
|
|
@@ -113924,7 +114028,7 @@ function registerOrganizationMembershipRoutes(app, deps) {
|
|
|
113924
114028
|
})
|
|
113925
114029
|
);
|
|
113926
114030
|
} catch (error) {
|
|
113927
|
-
if (
|
|
114031
|
+
if (nestedPostgresSqlState15(error) === "42501") {
|
|
113928
114032
|
throw new HTTPException111(403, {
|
|
113929
114033
|
message: "organization membership is not active"
|
|
113930
114034
|
});
|
|
@@ -114232,11 +114336,6 @@ function registerOrganizationMembershipRoutes(app, deps) {
|
|
|
114232
114336
|
)
|
|
114233
114337
|
);
|
|
114234
114338
|
} catch (error) {
|
|
114235
|
-
if (nestedPostgresSqlState14(error) === "55000") {
|
|
114236
|
-
throw new HTTPException111(409, {
|
|
114237
|
-
message: "private-session readiness is not activated for this organization"
|
|
114238
|
-
});
|
|
114239
|
-
}
|
|
114240
114339
|
rethrowMembershipError(error);
|
|
114241
114340
|
}
|
|
114242
114341
|
});
|
|
@@ -114584,13 +114683,13 @@ import {
|
|
|
114584
114683
|
SessionListCursorExpiredError as SessionListCursorExpiredError2
|
|
114585
114684
|
} from "@opengeni/db";
|
|
114586
114685
|
import { HTTPException as HTTPException112 } from "hono/http-exception";
|
|
114587
|
-
import { z as
|
|
114686
|
+
import { z as z59 } from "zod";
|
|
114588
114687
|
var ORGANIZATION_SESSION_LIST_MAX_WORKSPACE_READS = 25;
|
|
114589
|
-
var OrganizationId3 =
|
|
114590
|
-
var OrganizationSessionListCursorEnvelope =
|
|
114591
|
-
workspaceId:
|
|
114592
|
-
cursor:
|
|
114593
|
-
pinnedOffset:
|
|
114688
|
+
var OrganizationId3 = z59.string().uuid();
|
|
114689
|
+
var OrganizationSessionListCursorEnvelope = z59.object({
|
|
114690
|
+
workspaceId: z59.string().uuid(),
|
|
114691
|
+
cursor: z59.string().min(1).nullable(),
|
|
114692
|
+
pinnedOffset: z59.number().int().nonnegative().max(1e4).optional()
|
|
114594
114693
|
}).strict();
|
|
114595
114694
|
function encodeOrganizationSessionListCursor(cursor) {
|
|
114596
114695
|
return Buffer.from(JSON.stringify(cursor)).toString("base64url");
|
|
@@ -114818,9 +114917,9 @@ import {
|
|
|
114818
114917
|
startOrganizationRecoveryOperation
|
|
114819
114918
|
} from "@opengeni/db";
|
|
114820
114919
|
import { HTTPException as HTTPException113 } from "hono/http-exception";
|
|
114821
|
-
import { z as
|
|
114822
|
-
var OrganizationId4 =
|
|
114823
|
-
var RecoveryOperationId =
|
|
114920
|
+
import { z as z60 } from "zod";
|
|
114921
|
+
var OrganizationId4 = z60.string().uuid();
|
|
114922
|
+
var RecoveryOperationId = z60.string().uuid();
|
|
114824
114923
|
var productionServices = {
|
|
114825
114924
|
requireCanonicalHumanRequestIdentity: requireCanonicalHumanRequestIdentity3,
|
|
114826
114925
|
getManagedAuthRequestActorAdmissionStamp,
|
|
@@ -115071,7 +115170,7 @@ import {
|
|
|
115071
115170
|
completeSelfServiceOrganizationSetup,
|
|
115072
115171
|
completeOrganizationUserSetup,
|
|
115073
115172
|
getSelfServiceOrganizationOnboardingState,
|
|
115074
|
-
nestedPostgresSqlState as
|
|
115173
|
+
nestedPostgresSqlState as nestedPostgresSqlState16,
|
|
115075
115174
|
preflightOrganizationUserSetup,
|
|
115076
115175
|
previewOrganizationUserSetup,
|
|
115077
115176
|
recordOrganizationSignupUseCase
|
|
@@ -115128,14 +115227,14 @@ function registerManagedOnboardingRoutes(app, deps, options = {}) {
|
|
|
115128
115227
|
useCase: parsed.data.useCase
|
|
115129
115228
|
}).catch((error) => {
|
|
115130
115229
|
console.warn("[api] could not record the signup use case", {
|
|
115131
|
-
sqlState:
|
|
115230
|
+
sqlState: nestedPostgresSqlState16(error) ?? null
|
|
115132
115231
|
});
|
|
115133
115232
|
});
|
|
115134
115233
|
}
|
|
115135
115234
|
return context.json(completed);
|
|
115136
115235
|
} catch (error) {
|
|
115137
115236
|
recordOrganizationSetupOutcome(deps.observability, "failed");
|
|
115138
|
-
const sqlState =
|
|
115237
|
+
const sqlState = nestedPostgresSqlState16(error);
|
|
115139
115238
|
if (sqlState === "22023") {
|
|
115140
115239
|
throw new HTTPException114(422, {
|
|
115141
115240
|
message: "invalid organization setup request"
|
|
@@ -115215,7 +115314,7 @@ function registerManagedOnboardingRoutes(app, deps, options = {}) {
|
|
|
115215
115314
|
)
|
|
115216
115315
|
);
|
|
115217
115316
|
} catch (error) {
|
|
115218
|
-
const sqlState =
|
|
115317
|
+
const sqlState = nestedPostgresSqlState16(error);
|
|
115219
115318
|
if (sqlState === "22023") {
|
|
115220
115319
|
throw new HTTPException114(422, {
|
|
115221
115320
|
message: "invalid account setup request"
|
|
@@ -115336,9 +115435,9 @@ import {
|
|
|
115336
115435
|
SessionAuthorizationUnavailableError as SessionAuthorizationUnavailableError15,
|
|
115337
115436
|
SessionTenancyManagedHumanRequiredError as SessionTenancyManagedHumanRequiredError3
|
|
115338
115437
|
} from "@opengeni/core";
|
|
115339
|
-
import { nestedPostgresSqlState as
|
|
115438
|
+
import { nestedPostgresSqlState as nestedPostgresSqlState17, SessionTenancyNotActivatedError as SessionTenancyNotActivatedError3 } from "@opengeni/db";
|
|
115340
115439
|
import { HTTPException as HTTPException115 } from "hono/http-exception";
|
|
115341
|
-
import { z as
|
|
115440
|
+
import { z as z61 } from "zod";
|
|
115342
115441
|
async function body2(context, schema) {
|
|
115343
115442
|
const parsed = schema.safeParse(await context.req.json().catch(() => null));
|
|
115344
115443
|
if (!parsed.success) throw new HTTPException115(422, { message: "invalid user-resource request" });
|
|
@@ -115351,10 +115450,10 @@ function lifecycleError(error) {
|
|
|
115351
115450
|
if (error instanceof SessionAuthorizationUnavailableError15) {
|
|
115352
115451
|
throw new HTTPException115(503, { message: "session authorization unavailable" });
|
|
115353
115452
|
}
|
|
115354
|
-
if (
|
|
115453
|
+
if (nestedPostgresSqlState17(error) === "42501") {
|
|
115355
115454
|
throw new HTTPException115(403, { message: "user-resource authority denied" });
|
|
115356
115455
|
}
|
|
115357
|
-
if (
|
|
115456
|
+
if (nestedPostgresSqlState17(error) === "22023") {
|
|
115358
115457
|
throw new HTTPException115(422, { message: "invalid user-resource request" });
|
|
115359
115458
|
}
|
|
115360
115459
|
throw error;
|
|
@@ -115395,7 +115494,7 @@ function registerUserResourceAuthorityRoutes(app, deps) {
|
|
|
115395
115494
|
});
|
|
115396
115495
|
app.post(`${base}/:authorityId/grants`, async (context) => {
|
|
115397
115496
|
const workspaceId = context.req.param("workspaceId");
|
|
115398
|
-
const authorityId =
|
|
115497
|
+
const authorityId = z61.string().uuid().safeParse(context.req.param("authorityId"));
|
|
115399
115498
|
if (!authorityId.success) throw new HTTPException115(422, { message: "invalid authority id" });
|
|
115400
115499
|
const request = await body2(context, IssueUserResourceGrantRequest);
|
|
115401
115500
|
const access = await requireAccessGrantAuthorization39(
|
|
@@ -115425,7 +115524,7 @@ function registerUserResourceAuthorityRoutes(app, deps) {
|
|
|
115425
115524
|
app.delete(`${base}/grants/:grantId`, async (context) => {
|
|
115426
115525
|
const query = RevokeUserResourceGrantQuery.safeParse({ scope: context.req.query("scope") });
|
|
115427
115526
|
if (!query.success) throw new HTTPException115(422, { message: "explicit scope=user required" });
|
|
115428
|
-
const grantId =
|
|
115527
|
+
const grantId = z61.string().uuid().safeParse(context.req.param("grantId"));
|
|
115429
115528
|
if (!grantId.success) throw new HTTPException115(422, { message: "invalid grant id" });
|
|
115430
115529
|
const workspaceId = context.req.param("workspaceId");
|
|
115431
115530
|
const access = await requireAccessGrantAuthorization39(
|
|
@@ -122068,7 +122167,8 @@ function createAppComposition(deps) {
|
|
|
122068
122167
|
await next();
|
|
122069
122168
|
return;
|
|
122070
122169
|
}
|
|
122071
|
-
const
|
|
122170
|
+
const permission = c.req.method === "PUT" && /^\/v1\/workspaces\/[^/]+\/artifact-catalog\/[^/]+\/[^/]+\/pin$/.test(c.req.path) ? "artifacts:publish" : void 0;
|
|
122171
|
+
const grant = await requireAccessGrant53(c, routeDeps, workspaceId, permission);
|
|
122072
122172
|
await withAccessGrantSessionRlsContext(routeDeps, grant, next);
|
|
122073
122173
|
});
|
|
122074
122174
|
app.all("/v1/workspaces/:workspaceId/mcp", async (c) => {
|
|
@@ -122938,7 +123038,7 @@ async function withTimeout(promise, timeoutMs) {
|
|
|
122938
123038
|
}
|
|
122939
123039
|
var routeLabelPatterns = [
|
|
122940
123040
|
{
|
|
122941
|
-
pattern: /^\/\.well-known\/oauth-authorization-server
|
|
123041
|
+
pattern: /^\/\.well-known\/oauth-authorization-server(?:\/.*)?$/,
|
|
122942
123042
|
label: "/.well-known/oauth-authorization-server"
|
|
122943
123043
|
},
|
|
122944
123044
|
{
|
|
@@ -123945,4 +124045,4 @@ export {
|
|
|
123945
124045
|
withDefaultEnabledCapabilityMcpTools,
|
|
123946
124046
|
workflowIdForSession4 as workflowIdForSession
|
|
123947
124047
|
};
|
|
123948
|
-
//# sourceMappingURL=chunk-
|
|
124048
|
+
//# sourceMappingURL=chunk-A4J3LBH6.js.map
|