@inkeep/agents-core 0.0.0-dev-20260219033751 → 0.0.0-dev-20260219045007
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/auth/auth.d.ts +53 -53
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/client-exports.d.ts +3 -3
- package/dist/data-access/manage/agents.d.ts +21 -21
- package/dist/data-access/manage/artifactComponents.d.ts +8 -8
- package/dist/data-access/manage/contextConfigs.d.ts +8 -8
- package/dist/data-access/manage/dataComponents.d.ts +4 -4
- package/dist/data-access/manage/functionTools.d.ts +12 -12
- package/dist/data-access/manage/skills.d.ts +13 -13
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentRelations.d.ts +26 -26
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgents.d.ts +15 -15
- package/dist/data-access/manage/tools.d.ts +21 -21
- package/dist/data-access/manage/triggers.d.ts +2 -2
- package/dist/data-access/runtime/apiKeys.d.ts +12 -12
- package/dist/data-access/runtime/conversations.d.ts +20 -20
- package/dist/data-access/runtime/messages.d.ts +9 -9
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
- package/dist/data-access/runtime/tasks.d.ts +4 -4
- package/dist/db/manage/manage-schema.d.ts +4 -4
- package/dist/db/runtime/runtime-schema.d.ts +2 -2
- package/dist/middleware/authz-meta.d.ts +15 -0
- package/dist/middleware/authz-meta.js +11 -0
- package/dist/middleware/create-protected-route.d.ts +30 -0
- package/dist/middleware/create-protected-route.js +20 -0
- package/dist/middleware/index.d.ts +5 -0
- package/dist/middleware/index.js +6 -0
- package/dist/middleware/inherited-auth.d.ts +43 -0
- package/dist/middleware/inherited-auth.js +50 -0
- package/dist/middleware/no-auth.d.ts +6 -0
- package/dist/middleware/no-auth.js +11 -0
- package/dist/setup/index.d.ts +2 -0
- package/dist/setup/index.js +3 -0
- package/dist/setup/setup.d.ts +24 -0
- package/dist/setup/setup.js +506 -0
- package/dist/validation/schemas.d.ts +282 -282
- package/package.json +9 -1
|
@@ -16,19 +16,19 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
16
16
|
}>;
|
|
17
17
|
declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
18
18
|
id: string;
|
|
19
|
-
tenantId: string;
|
|
20
|
-
projectId: string;
|
|
21
|
-
agentId: string | null;
|
|
22
|
-
title: string | null;
|
|
23
19
|
createdAt: string;
|
|
24
20
|
updatedAt: string;
|
|
25
|
-
metadata: ConversationMetadata | null;
|
|
26
21
|
ref: {
|
|
27
22
|
type: "commit" | "tag" | "branch";
|
|
28
23
|
name: string;
|
|
29
24
|
hash: string;
|
|
30
25
|
} | null;
|
|
31
26
|
userId: string | null;
|
|
27
|
+
metadata: ConversationMetadata | null;
|
|
28
|
+
title: string | null;
|
|
29
|
+
tenantId: string;
|
|
30
|
+
projectId: string;
|
|
31
|
+
agentId: string | null;
|
|
32
32
|
activeSubAgentId: string;
|
|
33
33
|
lastContextResolution: string | null;
|
|
34
34
|
}>;
|
|
@@ -85,19 +85,19 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
85
85
|
conversationId: string;
|
|
86
86
|
}) => Promise<{
|
|
87
87
|
id: string;
|
|
88
|
-
tenantId: string;
|
|
89
|
-
projectId: string;
|
|
90
|
-
agentId: string | null;
|
|
91
|
-
title: string | null;
|
|
92
88
|
createdAt: string;
|
|
93
89
|
updatedAt: string;
|
|
94
|
-
metadata: ConversationMetadata | null;
|
|
95
90
|
ref: {
|
|
96
91
|
type: "commit" | "tag" | "branch";
|
|
97
92
|
name: string;
|
|
98
93
|
hash: string;
|
|
99
94
|
} | null;
|
|
100
95
|
userId: string | null;
|
|
96
|
+
metadata: ConversationMetadata | null;
|
|
97
|
+
title: string | null;
|
|
98
|
+
tenantId: string;
|
|
99
|
+
projectId: string;
|
|
100
|
+
agentId: string | null;
|
|
101
101
|
activeSubAgentId: string;
|
|
102
102
|
lastContextResolution: string | null;
|
|
103
103
|
} | undefined>;
|
|
@@ -121,19 +121,19 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
121
121
|
contextConfigId?: string | undefined;
|
|
122
122
|
} | {
|
|
123
123
|
id: string;
|
|
124
|
-
tenantId: string;
|
|
125
|
-
projectId: string;
|
|
126
|
-
agentId: string | null;
|
|
127
|
-
title: string | null;
|
|
128
124
|
createdAt: string;
|
|
129
125
|
updatedAt: string;
|
|
130
|
-
metadata: ConversationMetadata | null;
|
|
131
126
|
ref: {
|
|
132
127
|
type: "commit" | "tag" | "branch";
|
|
133
128
|
name: string;
|
|
134
129
|
hash: string;
|
|
135
130
|
} | null;
|
|
136
131
|
userId: string | null;
|
|
132
|
+
metadata: ConversationMetadata | null;
|
|
133
|
+
title: string | null;
|
|
134
|
+
tenantId: string;
|
|
135
|
+
projectId: string;
|
|
136
|
+
agentId: string | null;
|
|
137
137
|
activeSubAgentId: string;
|
|
138
138
|
lastContextResolution: string | null;
|
|
139
139
|
}>;
|
|
@@ -153,19 +153,19 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
153
153
|
conversationId: string;
|
|
154
154
|
}) => Promise<{
|
|
155
155
|
id: string;
|
|
156
|
-
tenantId: string;
|
|
157
|
-
projectId: string;
|
|
158
|
-
agentId: string | null;
|
|
159
|
-
title: string | null;
|
|
160
156
|
createdAt: string;
|
|
161
157
|
updatedAt: string;
|
|
162
|
-
metadata: ConversationMetadata | null;
|
|
163
158
|
ref: {
|
|
164
159
|
type: "commit" | "tag" | "branch";
|
|
165
160
|
name: string;
|
|
166
161
|
hash: string;
|
|
167
162
|
} | null;
|
|
168
163
|
userId: string | null;
|
|
164
|
+
metadata: ConversationMetadata | null;
|
|
165
|
+
title: string | null;
|
|
166
|
+
tenantId: string;
|
|
167
|
+
projectId: string;
|
|
168
|
+
agentId: string | null;
|
|
169
169
|
activeSubAgentId: string;
|
|
170
170
|
lastContextResolution: string | null;
|
|
171
171
|
} | undefined>;
|
|
@@ -10,13 +10,13 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
10
10
|
messageId: string;
|
|
11
11
|
}) => Promise<{
|
|
12
12
|
id: string;
|
|
13
|
-
tenantId: string;
|
|
14
|
-
projectId: string;
|
|
15
13
|
createdAt: string;
|
|
16
14
|
updatedAt: string;
|
|
17
15
|
metadata: MessageMetadata | null;
|
|
18
|
-
content: MessageContent;
|
|
19
16
|
role: string;
|
|
17
|
+
content: MessageContent;
|
|
18
|
+
tenantId: string;
|
|
19
|
+
projectId: string;
|
|
20
20
|
fromSubAgentId: string | null;
|
|
21
21
|
toSubAgentId: string | null;
|
|
22
22
|
fromExternalAgentId: string | null;
|
|
@@ -141,13 +141,13 @@ declare const getVisibleMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
141
141
|
}[]>;
|
|
142
142
|
declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageInsert) => Promise<{
|
|
143
143
|
id: string;
|
|
144
|
-
tenantId: string;
|
|
145
|
-
projectId: string;
|
|
146
144
|
createdAt: string;
|
|
147
145
|
updatedAt: string;
|
|
148
146
|
metadata: MessageMetadata | null;
|
|
149
|
-
content: MessageContent;
|
|
150
147
|
role: string;
|
|
148
|
+
content: MessageContent;
|
|
149
|
+
tenantId: string;
|
|
150
|
+
projectId: string;
|
|
151
151
|
fromSubAgentId: string | null;
|
|
152
152
|
toSubAgentId: string | null;
|
|
153
153
|
fromExternalAgentId: string | null;
|
|
@@ -194,13 +194,13 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
194
194
|
messageId: string;
|
|
195
195
|
}) => Promise<{
|
|
196
196
|
id: string;
|
|
197
|
-
tenantId: string;
|
|
198
|
-
projectId: string;
|
|
199
197
|
createdAt: string;
|
|
200
198
|
updatedAt: string;
|
|
201
199
|
metadata: MessageMetadata | null;
|
|
202
|
-
content: MessageContent;
|
|
203
200
|
role: string;
|
|
201
|
+
content: MessageContent;
|
|
202
|
+
tenantId: string;
|
|
203
|
+
projectId: string;
|
|
204
204
|
fromSubAgentId: string | null;
|
|
205
205
|
toSubAgentId: string | null;
|
|
206
206
|
fromExternalAgentId: string | null;
|
|
@@ -34,7 +34,7 @@ declare const listScheduledTriggerInvocationsPaginated: (db: AgentsRunDatabaseCl
|
|
|
34
34
|
}) => Promise<{
|
|
35
35
|
data: {
|
|
36
36
|
scheduledTriggerId: string;
|
|
37
|
-
status: "pending" | "
|
|
37
|
+
status: "pending" | "failed" | "running" | "completed" | "cancelled";
|
|
38
38
|
scheduledFor: string;
|
|
39
39
|
startedAt: string | null;
|
|
40
40
|
completedAt: string | null;
|
|
@@ -174,7 +174,7 @@ declare const listUpcomingInvocationsForAgentPaginated: (db: AgentsRunDatabaseCl
|
|
|
174
174
|
}) => Promise<{
|
|
175
175
|
data: {
|
|
176
176
|
scheduledTriggerId: string;
|
|
177
|
-
status: "pending" | "
|
|
177
|
+
status: "pending" | "failed" | "running" | "completed" | "cancelled";
|
|
178
178
|
scheduledFor: string;
|
|
179
179
|
startedAt: string | null;
|
|
180
180
|
completedAt: string | null;
|
|
@@ -208,7 +208,7 @@ declare const listProjectScheduledTriggerInvocationsPaginated: (db: AgentsRunDat
|
|
|
208
208
|
}) => Promise<{
|
|
209
209
|
data: {
|
|
210
210
|
scheduledTriggerId: string;
|
|
211
|
-
status: "pending" | "
|
|
211
|
+
status: "pending" | "failed" | "running" | "completed" | "cancelled";
|
|
212
212
|
scheduledFor: string;
|
|
213
213
|
startedAt: string | null;
|
|
214
214
|
completedAt: string | null;
|
|
@@ -7,19 +7,19 @@ import { TaskInsert, TaskSelect } from "../../types/entities.js";
|
|
|
7
7
|
//#region src/data-access/runtime/tasks.d.ts
|
|
8
8
|
declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
|
|
9
9
|
id: string;
|
|
10
|
-
tenantId: string;
|
|
11
|
-
projectId: string;
|
|
12
|
-
agentId: string;
|
|
13
10
|
createdAt: string;
|
|
14
11
|
updatedAt: string;
|
|
15
|
-
metadata: TaskMetadataConfig | null;
|
|
16
12
|
ref: {
|
|
17
13
|
type: "commit" | "tag" | "branch";
|
|
18
14
|
name: string;
|
|
19
15
|
hash: string;
|
|
20
16
|
} | null;
|
|
17
|
+
metadata: TaskMetadataConfig | null;
|
|
21
18
|
status: string;
|
|
19
|
+
tenantId: string;
|
|
20
|
+
projectId: string;
|
|
22
21
|
subAgentId: string;
|
|
22
|
+
agentId: string;
|
|
23
23
|
contextId: string;
|
|
24
24
|
}>;
|
|
25
25
|
declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -814,13 +814,13 @@ declare const triggers: drizzle_orm_pg_core1479.PgTableWithColumns<{
|
|
|
814
814
|
algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
|
|
815
815
|
encoding: "hex" | "base64";
|
|
816
816
|
signature: {
|
|
817
|
-
source: "query" | "
|
|
817
|
+
source: "query" | "body" | "header";
|
|
818
818
|
key: string;
|
|
819
819
|
prefix?: string | undefined;
|
|
820
820
|
regex?: string | undefined;
|
|
821
821
|
};
|
|
822
822
|
signedComponents: {
|
|
823
|
-
source: "literal" | "
|
|
823
|
+
source: "literal" | "body" | "header";
|
|
824
824
|
required: boolean;
|
|
825
825
|
key?: string | undefined;
|
|
826
826
|
value?: string | undefined;
|
|
@@ -851,13 +851,13 @@ declare const triggers: drizzle_orm_pg_core1479.PgTableWithColumns<{
|
|
|
851
851
|
algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
|
|
852
852
|
encoding: "hex" | "base64";
|
|
853
853
|
signature: {
|
|
854
|
-
source: "query" | "
|
|
854
|
+
source: "query" | "body" | "header";
|
|
855
855
|
key: string;
|
|
856
856
|
prefix?: string | undefined;
|
|
857
857
|
regex?: string | undefined;
|
|
858
858
|
};
|
|
859
859
|
signedComponents: {
|
|
860
|
-
source: "literal" | "
|
|
860
|
+
source: "literal" | "body" | "header";
|
|
861
861
|
required: boolean;
|
|
862
862
|
key?: string | undefined;
|
|
863
863
|
value?: string | undefined;
|
|
@@ -1778,7 +1778,7 @@ declare const scheduledTriggerInvocations: drizzle_orm_pg_core1831.PgTableWithCo
|
|
|
1778
1778
|
tableName: "scheduled_trigger_invocations";
|
|
1779
1779
|
dataType: "string";
|
|
1780
1780
|
columnType: "PgVarchar";
|
|
1781
|
-
data: "pending" | "
|
|
1781
|
+
data: "pending" | "failed" | "running" | "completed" | "cancelled";
|
|
1782
1782
|
driverParam: string;
|
|
1783
1783
|
notNull: true;
|
|
1784
1784
|
hasDefault: false;
|
|
@@ -1791,7 +1791,7 @@ declare const scheduledTriggerInvocations: drizzle_orm_pg_core1831.PgTableWithCo
|
|
|
1791
1791
|
generated: undefined;
|
|
1792
1792
|
}, {}, {
|
|
1793
1793
|
length: 50;
|
|
1794
|
-
$type: "pending" | "
|
|
1794
|
+
$type: "pending" | "failed" | "running" | "completed" | "cancelled";
|
|
1795
1795
|
}>;
|
|
1796
1796
|
scheduledFor: drizzle_orm_pg_core1831.PgColumn<{
|
|
1797
1797
|
name: "scheduled_for";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MiddlewareHandler } from "hono";
|
|
2
|
+
|
|
3
|
+
//#region src/middleware/authz-meta.d.ts
|
|
4
|
+
type AuthzMeta = {
|
|
5
|
+
resource?: string;
|
|
6
|
+
permission?: string;
|
|
7
|
+
description: string;
|
|
8
|
+
};
|
|
9
|
+
type ProjectScopedMiddleware = MiddlewareHandler & {
|
|
10
|
+
readonly __projectScoped: true;
|
|
11
|
+
};
|
|
12
|
+
declare function getAuthzMeta(mw: unknown): AuthzMeta | undefined;
|
|
13
|
+
declare function registerAuthzMeta(mw: object, meta: AuthzMeta): void;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AuthzMeta, ProjectScopedMiddleware, getAuthzMeta, registerAuthzMeta };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/middleware/authz-meta.ts
|
|
2
|
+
const authzMeta = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function getAuthzMeta(mw) {
|
|
4
|
+
return typeof mw === "function" ? authzMeta.get(mw) : void 0;
|
|
5
|
+
}
|
|
6
|
+
function registerAuthzMeta(mw, meta) {
|
|
7
|
+
authzMeta.set(mw, meta);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { getAuthzMeta, registerAuthzMeta };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ProjectScopedMiddleware } from "./authz-meta.js";
|
|
2
|
+
import { createRoute } from "@hono/zod-openapi";
|
|
3
|
+
import { ZodType } from "zod";
|
|
4
|
+
import { MiddlewareHandler } from "hono";
|
|
5
|
+
|
|
6
|
+
//#region src/middleware/create-protected-route.d.ts
|
|
7
|
+
type CreateRouteParams = Parameters<typeof createRoute>[0];
|
|
8
|
+
declare function createProtectedRoute<T extends CreateRouteParams>(config: T & {
|
|
9
|
+
permission: ProjectScopedMiddleware;
|
|
10
|
+
request: {
|
|
11
|
+
params: ZodType<{
|
|
12
|
+
projectId: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
}): T;
|
|
16
|
+
declare function createProtectedRoute<T extends CreateRouteParams>(config: T & {
|
|
17
|
+
permission: ProjectScopedMiddleware;
|
|
18
|
+
request: {
|
|
19
|
+
params: ZodType<{
|
|
20
|
+
id: string;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
}): T;
|
|
24
|
+
declare function createProtectedRoute<T extends CreateRouteParams>(config: T & {
|
|
25
|
+
permission: MiddlewareHandler & {
|
|
26
|
+
__projectScoped?: never;
|
|
27
|
+
};
|
|
28
|
+
}): T;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { createProtectedRoute };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getAuthzMeta } from "./authz-meta.js";
|
|
2
|
+
|
|
3
|
+
//#region src/middleware/create-protected-route.ts
|
|
4
|
+
function toArray(value) {
|
|
5
|
+
if (!value) return [];
|
|
6
|
+
return Array.isArray(value) ? value : [value];
|
|
7
|
+
}
|
|
8
|
+
function createProtectedRoute(config) {
|
|
9
|
+
const { permission, ...routeConfig } = config;
|
|
10
|
+
const meta = getAuthzMeta(permission);
|
|
11
|
+
return {
|
|
12
|
+
...routeConfig,
|
|
13
|
+
middleware: [permission, ...toArray(routeConfig.middleware)],
|
|
14
|
+
...meta && { "x-authz": meta },
|
|
15
|
+
...!meta && !("security" in config) && { security: [] }
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { createProtectedRoute };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AuthzMeta, ProjectScopedMiddleware, getAuthzMeta, registerAuthzMeta } from "./authz-meta.js";
|
|
2
|
+
import { createProtectedRoute } from "./create-protected-route.js";
|
|
3
|
+
import { inheritedAuth, inheritedManageTenantAuth, inheritedRunApiKeyAuth, inheritedWorkAppsAuth } from "./inherited-auth.js";
|
|
4
|
+
import { noAuth } from "./no-auth.js";
|
|
5
|
+
export { type AuthzMeta, type ProjectScopedMiddleware, createProtectedRoute, getAuthzMeta, inheritedAuth, inheritedManageTenantAuth, inheritedRunApiKeyAuth, inheritedWorkAppsAuth, noAuth, registerAuthzMeta };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { getAuthzMeta, registerAuthzMeta } from "./authz-meta.js";
|
|
2
|
+
import { createProtectedRoute } from "./create-protected-route.js";
|
|
3
|
+
import { inheritedAuth, inheritedManageTenantAuth, inheritedRunApiKeyAuth, inheritedWorkAppsAuth } from "./inherited-auth.js";
|
|
4
|
+
import { noAuth } from "./no-auth.js";
|
|
5
|
+
|
|
6
|
+
export { createProtectedRoute, getAuthzMeta, inheritedAuth, inheritedManageTenantAuth, inheritedRunApiKeyAuth, inheritedWorkAppsAuth, noAuth, registerAuthzMeta };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as hono0 from "hono";
|
|
2
|
+
|
|
3
|
+
//#region src/middleware/inherited-auth.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Documentation-only permission marker for routes whose authentication
|
|
7
|
+
* is already enforced by a parent `app.use()` in createApp.ts.
|
|
8
|
+
*
|
|
9
|
+
* This does NOT perform any auth check itself — it only registers
|
|
10
|
+
* x-authz metadata so the OpenAPI spec accurately reflects the
|
|
11
|
+
* auth requirement.
|
|
12
|
+
*
|
|
13
|
+
* Use this when the route lives under a path that already has
|
|
14
|
+
* middleware applied (e.g. `/manage/tenants/*` has `manageApiKeyOrSessionAuth`).
|
|
15
|
+
*/
|
|
16
|
+
declare const inheritedAuth: (meta: {
|
|
17
|
+
resource?: string;
|
|
18
|
+
permission?: string;
|
|
19
|
+
description: string;
|
|
20
|
+
}) => hono0.MiddlewareHandler<any, string, {}, Response>;
|
|
21
|
+
/**
|
|
22
|
+
* Marker for routes under `/manage/tenants/*` whose auth is handled
|
|
23
|
+
* by `manageApiKeyOrSessionAuth()` in createApp.ts.
|
|
24
|
+
*
|
|
25
|
+
* No auth check runs at the route level — this is purely for OpenAPI documentation.
|
|
26
|
+
*/
|
|
27
|
+
declare const inheritedManageTenantAuth: () => hono0.MiddlewareHandler<any, string, {}, Response>;
|
|
28
|
+
/**
|
|
29
|
+
* Marker for routes under `/run/*` whose auth is handled
|
|
30
|
+
* by `runApiKeyAuth()` in createApp.ts.
|
|
31
|
+
*
|
|
32
|
+
* No auth check runs at the route level — this is purely for OpenAPI documentation.
|
|
33
|
+
*/
|
|
34
|
+
declare const inheritedRunApiKeyAuth: () => hono0.MiddlewareHandler<any, string, {}, Response>;
|
|
35
|
+
/**
|
|
36
|
+
* Marker for routes under `/work-apps/*` whose auth is handled
|
|
37
|
+
* by `workAppsAuth()` in createApp.ts.
|
|
38
|
+
*
|
|
39
|
+
* No auth check runs at the route level — this is purely for OpenAPI documentation.
|
|
40
|
+
*/
|
|
41
|
+
declare const inheritedWorkAppsAuth: () => hono0.MiddlewareHandler<any, string, {}, Response>;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { inheritedAuth, inheritedManageTenantAuth, inheritedRunApiKeyAuth, inheritedWorkAppsAuth };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { registerAuthzMeta } from "./authz-meta.js";
|
|
2
|
+
import { createMiddleware } from "hono/factory";
|
|
3
|
+
|
|
4
|
+
//#region src/middleware/inherited-auth.ts
|
|
5
|
+
/**
|
|
6
|
+
* Documentation-only permission marker for routes whose authentication
|
|
7
|
+
* is already enforced by a parent `app.use()` in createApp.ts.
|
|
8
|
+
*
|
|
9
|
+
* This does NOT perform any auth check itself — it only registers
|
|
10
|
+
* x-authz metadata so the OpenAPI spec accurately reflects the
|
|
11
|
+
* auth requirement.
|
|
12
|
+
*
|
|
13
|
+
* Use this when the route lives under a path that already has
|
|
14
|
+
* middleware applied (e.g. `/manage/tenants/*` has `manageApiKeyOrSessionAuth`).
|
|
15
|
+
*/
|
|
16
|
+
const inheritedAuth = (meta) => {
|
|
17
|
+
const mw = createMiddleware(async (_c, next) => {
|
|
18
|
+
await next();
|
|
19
|
+
});
|
|
20
|
+
registerAuthzMeta(mw, meta);
|
|
21
|
+
return mw;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Marker for routes under `/manage/tenants/*` whose auth is handled
|
|
25
|
+
* by `manageApiKeyOrSessionAuth()` in createApp.ts.
|
|
26
|
+
*
|
|
27
|
+
* No auth check runs at the route level — this is purely for OpenAPI documentation.
|
|
28
|
+
*/
|
|
29
|
+
const inheritedManageTenantAuth = () => inheritedAuth({
|
|
30
|
+
resource: "organization",
|
|
31
|
+
permission: "member",
|
|
32
|
+
description: "Requires organization membership. Auth is enforced by the manageApiKeyOrSessionAuth middleware in createApp.ts."
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Marker for routes under `/run/*` whose auth is handled
|
|
36
|
+
* by `runApiKeyAuth()` in createApp.ts.
|
|
37
|
+
*
|
|
38
|
+
* No auth check runs at the route level — this is purely for OpenAPI documentation.
|
|
39
|
+
*/
|
|
40
|
+
const inheritedRunApiKeyAuth = () => inheritedAuth({ description: "Requires a valid API key (Bearer token). Auth is enforced by runApiKeyAuth middleware in createApp.ts." });
|
|
41
|
+
/**
|
|
42
|
+
* Marker for routes under `/work-apps/*` whose auth is handled
|
|
43
|
+
* by `workAppsAuth()` in createApp.ts.
|
|
44
|
+
*
|
|
45
|
+
* No auth check runs at the route level — this is purely for OpenAPI documentation.
|
|
46
|
+
*/
|
|
47
|
+
const inheritedWorkAppsAuth = () => inheritedAuth({ description: "Requires work-apps authentication (OIDC token or Slack signature). Auth is enforced by workAppsAuth middleware in createApp.ts." });
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { inheritedAuth, inheritedManageTenantAuth, inheritedRunApiKeyAuth, inheritedWorkAppsAuth };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/setup/setup.d.ts
|
|
2
|
+
interface SetupPushConfig {
|
|
3
|
+
projectPath: string;
|
|
4
|
+
configPath: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
}
|
|
7
|
+
interface SetupConfig {
|
|
8
|
+
dockerComposeFile: string;
|
|
9
|
+
manageMigrateCommand: string;
|
|
10
|
+
runMigrateCommand: string;
|
|
11
|
+
authInitCommand: string;
|
|
12
|
+
pushProject?: SetupPushConfig;
|
|
13
|
+
devApiCommand?: string;
|
|
14
|
+
devUiCommand?: string;
|
|
15
|
+
apiHealthUrl?: string;
|
|
16
|
+
uiHealthUrl?: string;
|
|
17
|
+
isCloud?: boolean;
|
|
18
|
+
skipPush?: boolean;
|
|
19
|
+
/** If set, upgrades packages instead of just migrating on subsequent runs */
|
|
20
|
+
upgradeCommand?: string;
|
|
21
|
+
}
|
|
22
|
+
declare function runSetup(config: SetupConfig): Promise<void>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { SetupConfig, SetupPushConfig, runSetup };
|