@braidhq/server 0.0.1 → 0.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/README.md +136 -0
- package/dist/app.d.ts +19 -2
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +121 -3
- package/dist/app.js.map +1 -1
- package/dist/composeFs.d.ts +41 -6
- package/dist/composeFs.d.ts.map +1 -1
- package/dist/composeFs.js +234 -52
- package/dist/composeFs.js.map +1 -1
- package/dist/composition.d.ts +86 -2
- package/dist/composition.d.ts.map +1 -1
- package/dist/composition.js +71 -1
- package/dist/composition.js.map +1 -1
- package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts +21 -0
- package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts.map +1 -1
- package/dist/infrastructure/agent/SubprocessSkillRunner.js +35 -3
- package/dist/infrastructure/agent/SubprocessSkillRunner.js.map +1 -1
- package/dist/infrastructure/agent/mcpConfig.d.ts +25 -5
- package/dist/infrastructure/agent/mcpConfig.d.ts.map +1 -1
- package/dist/infrastructure/agent/mcpConfig.js +22 -14
- package/dist/infrastructure/agent/mcpConfig.js.map +1 -1
- package/dist/infrastructure/auth/AccessPolicy.d.ts +112 -0
- package/dist/infrastructure/auth/AccessPolicy.d.ts.map +1 -0
- package/dist/infrastructure/auth/AccessPolicy.js +184 -0
- package/dist/infrastructure/auth/AccessPolicy.js.map +1 -0
- package/dist/infrastructure/auth/SessionStore.d.ts +40 -0
- package/dist/infrastructure/auth/SessionStore.d.ts.map +1 -0
- package/dist/infrastructure/auth/SessionStore.js +107 -0
- package/dist/infrastructure/auth/SessionStore.js.map +1 -0
- package/dist/infrastructure/auth/ensureApprovedEmails.d.ts +16 -0
- package/dist/infrastructure/auth/ensureApprovedEmails.d.ts.map +1 -0
- package/dist/infrastructure/auth/ensureApprovedEmails.js +20 -0
- package/dist/infrastructure/auth/ensureApprovedEmails.js.map +1 -0
- package/dist/infrastructure/env.d.ts +11 -0
- package/dist/infrastructure/env.d.ts.map +1 -0
- package/dist/infrastructure/env.js +20 -0
- package/dist/infrastructure/env.js.map +1 -0
- package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts +300 -0
- package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts.map +1 -0
- package/dist/infrastructure/fs/FsBatchPlanRepository.js +42 -0
- package/dist/infrastructure/fs/FsBatchPlanRepository.js.map +1 -0
- package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts.map +1 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.js +7 -1
- package/dist/infrastructure/fs/FsClarifyTicketRepository.js.map +1 -1
- package/dist/infrastructure/fs/FsGraphSerializer.d.ts +629 -0
- package/dist/infrastructure/fs/FsGraphSerializer.d.ts.map +1 -0
- package/dist/infrastructure/fs/FsGraphSerializer.js +60 -0
- package/dist/infrastructure/fs/FsGraphSerializer.js.map +1 -0
- package/dist/infrastructure/fs/FsProposalRepository.d.ts.map +1 -1
- package/dist/infrastructure/fs/FsProposalRepository.js +8 -0
- package/dist/infrastructure/fs/FsProposalRepository.js.map +1 -1
- package/dist/infrastructure/fs/FsRunRepository.d.ts +4 -1
- package/dist/infrastructure/fs/FsRunRepository.d.ts.map +1 -1
- package/dist/infrastructure/fs/FsRunRepository.js +75 -3
- package/dist/infrastructure/fs/FsRunRepository.js.map +1 -1
- package/dist/infrastructure/fs/FsSkillRegistry.d.ts.map +1 -1
- package/dist/infrastructure/fs/FsSkillRegistry.js +15 -3
- package/dist/infrastructure/fs/FsSkillRegistry.js.map +1 -1
- package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts +19 -0
- package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts.map +1 -0
- package/dist/infrastructure/fs/FsSourceUnitDigest.js +58 -0
- package/dist/infrastructure/fs/FsSourceUnitDigest.js.map +1 -0
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts +30 -0
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts.map +1 -0
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.js +87 -0
- package/dist/infrastructure/fs/FsSourceUnitStateRepository.js.map +1 -0
- package/dist/infrastructure/fs/FsWorkspaceRepository.d.ts.map +1 -1
- package/dist/infrastructure/fs/FsWorkspaceRepository.js +12 -3
- package/dist/infrastructure/fs/FsWorkspaceRepository.js.map +1 -1
- package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts +15 -0
- package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts.map +1 -0
- package/dist/infrastructure/fs/WorkspaceDiscovery.js +46 -0
- package/dist/infrastructure/fs/WorkspaceDiscovery.js.map +1 -0
- package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts +26 -2
- package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts.map +1 -1
- package/dist/infrastructure/fs/WorkspaceRegistryFile.js +109 -5
- package/dist/infrastructure/fs/WorkspaceRegistryFile.js.map +1 -1
- package/dist/infrastructure/fs/intentScan.d.ts +9 -0
- package/dist/infrastructure/fs/intentScan.d.ts.map +1 -0
- package/dist/infrastructure/fs/intentScan.js +135 -0
- package/dist/infrastructure/fs/intentScan.js.map +1 -0
- package/dist/infrastructure/fs/paths.d.ts +14 -0
- package/dist/infrastructure/fs/paths.d.ts.map +1 -1
- package/dist/infrastructure/fs/paths.js +43 -0
- package/dist/infrastructure/fs/paths.js.map +1 -1
- package/dist/infrastructure/fs/productManifestWriter.d.ts +1 -1
- package/dist/infrastructure/fs/productManifestWriter.d.ts.map +1 -1
- package/dist/infrastructure/fs/productManifestWriter.js +1 -3
- package/dist/infrastructure/fs/productManifestWriter.js.map +1 -1
- package/dist/infrastructure/git/GitWorkspaceHistory.d.ts +18 -0
- package/dist/infrastructure/git/GitWorkspaceHistory.d.ts.map +1 -0
- package/dist/infrastructure/git/GitWorkspaceHistory.js +303 -0
- package/dist/infrastructure/git/GitWorkspaceHistory.js.map +1 -0
- package/dist/infrastructure/git/commitMessage.d.ts +4 -0
- package/dist/infrastructure/git/commitMessage.d.ts.map +1 -0
- package/dist/infrastructure/git/commitMessage.js +71 -0
- package/dist/infrastructure/git/commitMessage.js.map +1 -0
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts +48 -1
- package/dist/infrastructure/oauth/GoogleOAuth.d.ts.map +1 -1
- package/dist/infrastructure/oauth/GoogleOAuth.js +68 -0
- package/dist/infrastructure/oauth/GoogleOAuth.js.map +1 -1
- package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts +14 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts.map +1 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.js +21 -0
- package/dist/infrastructure/users/UserDirectoryFromRegistry.js.map +1 -0
- package/dist/infrastructure/users/UserRegistryFile.d.ts +23 -0
- package/dist/infrastructure/users/UserRegistryFile.d.ts.map +1 -0
- package/dist/infrastructure/users/UserRegistryFile.js +91 -0
- package/dist/infrastructure/users/UserRegistryFile.js.map +1 -0
- package/dist/infrastructure/users/ensureLocalUser.d.ts +15 -0
- package/dist/infrastructure/users/ensureLocalUser.d.ts.map +1 -0
- package/dist/infrastructure/users/ensureLocalUser.js +38 -0
- package/dist/infrastructure/users/ensureLocalUser.js.map +1 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts +9 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts.map +1 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.js +22 -0
- package/dist/infrastructure/users/ensureWorkspaceOwners.js.map +1 -0
- package/dist/middleware/auth.d.ts +29 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +81 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/cors.js +1 -1
- package/dist/middleware/cors.js.map +1 -1
- package/dist/middleware/requireAdmin.d.ts +10 -0
- package/dist/middleware/requireAdmin.d.ts.map +1 -0
- package/dist/middleware/requireAdmin.js +24 -0
- package/dist/middleware/requireAdmin.js.map +1 -0
- package/dist/middleware/userId.d.ts +16 -0
- package/dist/middleware/userId.d.ts.map +1 -0
- package/dist/middleware/userId.js +27 -0
- package/dist/middleware/userId.js.map +1 -0
- package/dist/middleware/workspaceAccess.d.ts +47 -0
- package/dist/middleware/workspaceAccess.d.ts.map +1 -0
- package/dist/middleware/workspaceAccess.js +86 -0
- package/dist/middleware/workspaceAccess.js.map +1 -0
- package/dist/policy/Capability.d.ts +12 -0
- package/dist/policy/Capability.d.ts.map +1 -0
- package/dist/policy/Capability.js +31 -0
- package/dist/policy/Capability.js.map +1 -0
- package/dist/policy/CapabilityCheck.d.ts +14 -0
- package/dist/policy/CapabilityCheck.d.ts.map +1 -0
- package/dist/policy/CapabilityCheck.js +2 -0
- package/dist/policy/CapabilityCheck.js.map +1 -0
- package/dist/policy/PermissionRegistry.d.ts +23 -0
- package/dist/policy/PermissionRegistry.d.ts.map +1 -0
- package/dist/policy/PermissionRegistry.js +27 -0
- package/dist/policy/PermissionRegistry.js.map +1 -0
- package/dist/policy/ViewerContext.d.ts +27 -0
- package/dist/policy/ViewerContext.d.ts.map +1 -0
- package/dist/policy/ViewerContext.js +2 -0
- package/dist/policy/ViewerContext.js.map +1 -0
- package/dist/policy/checks.d.ts +15 -0
- package/dist/policy/checks.d.ts.map +1 -0
- package/dist/policy/checks.js +52 -0
- package/dist/policy/checks.js.map +1 -0
- package/dist/policy/defaultRegistry.d.ts +10 -0
- package/dist/policy/defaultRegistry.d.ts.map +1 -0
- package/dist/policy/defaultRegistry.js +16 -0
- package/dist/policy/defaultRegistry.js.map +1 -0
- package/dist/policy/index.d.ts +8 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +5 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/resolveViewer.d.ts +16 -0
- package/dist/policy/resolveViewer.d.ts.map +1 -0
- package/dist/policy/resolveViewer.js +37 -0
- package/dist/policy/resolveViewer.js.map +1 -0
- package/dist/routes/_shared.d.ts +198 -0
- package/dist/routes/_shared.d.ts.map +1 -0
- package/dist/routes/_shared.js +29 -0
- package/dist/routes/_shared.js.map +1 -0
- package/dist/routes/admin.d.ts +13 -0
- package/dist/routes/admin.d.ts.map +1 -0
- package/dist/routes/admin.js +227 -0
- package/dist/routes/admin.js.map +1 -0
- package/dist/routes/auth.d.ts +33 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +170 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/batch.d.ts +7 -0
- package/dist/routes/batch.d.ts.map +1 -0
- package/dist/routes/batch.js +47 -0
- package/dist/routes/batch.js.map +1 -0
- package/dist/routes/clarify.d.ts +4 -3
- package/dist/routes/clarify.d.ts.map +1 -1
- package/dist/routes/clarify.js +247 -57
- package/dist/routes/clarify.js.map +1 -1
- package/dist/routes/decisions.d.ts +2 -2
- package/dist/routes/decisions.d.ts.map +1 -1
- package/dist/routes/decisions.js +50 -12
- package/dist/routes/decisions.js.map +1 -1
- package/dist/routes/edges.d.ts +2 -2
- package/dist/routes/edges.d.ts.map +1 -1
- package/dist/routes/edges.js +35 -13
- package/dist/routes/edges.js.map +1 -1
- package/dist/routes/health.d.ts +2 -2
- package/dist/routes/health.d.ts.map +1 -1
- package/dist/routes/health.js +21 -3
- package/dist/routes/health.js.map +1 -1
- package/dist/routes/history.d.ts +7 -0
- package/dist/routes/history.d.ts.map +1 -0
- package/dist/routes/history.js +88 -0
- package/dist/routes/history.js.map +1 -0
- package/dist/routes/model.d.ts +2 -2
- package/dist/routes/model.d.ts.map +1 -1
- package/dist/routes/model.js +20 -4
- package/dist/routes/model.js.map +1 -1
- package/dist/routes/nodes.d.ts +2 -2
- package/dist/routes/nodes.d.ts.map +1 -1
- package/dist/routes/nodes.js +75 -19
- package/dist/routes/nodes.js.map +1 -1
- package/dist/routes/ontology.d.ts +2 -2
- package/dist/routes/ontology.d.ts.map +1 -1
- package/dist/routes/ontology.js +22 -5
- package/dist/routes/ontology.js.map +1 -1
- package/dist/routes/proposals.d.ts +4 -3
- package/dist/routes/proposals.d.ts.map +1 -1
- package/dist/routes/proposals.js +170 -41
- package/dist/routes/proposals.js.map +1 -1
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/runs.js +52 -1
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/skillInputOptions.d.ts +10 -0
- package/dist/routes/skillInputOptions.d.ts.map +1 -0
- package/dist/routes/skillInputOptions.js +161 -0
- package/dist/routes/skillInputOptions.js.map +1 -0
- package/dist/routes/skills.d.ts +2 -2
- package/dist/routes/skills.d.ts.map +1 -1
- package/dist/routes/skills.js +89 -19
- package/dist/routes/skills.js.map +1 -1
- package/dist/routes/sourceLoaders.d.ts +7 -0
- package/dist/routes/sourceLoaders.d.ts.map +1 -0
- package/dist/routes/sourceLoaders.js +29 -0
- package/dist/routes/sourceLoaders.js.map +1 -0
- package/dist/routes/sourceUnitStates.d.ts +7 -0
- package/dist/routes/sourceUnitStates.d.ts.map +1 -0
- package/dist/routes/sourceUnitStates.js +45 -0
- package/dist/routes/sourceUnitStates.js.map +1 -0
- package/dist/routes/users.d.ts +9 -0
- package/dist/routes/users.d.ts.map +1 -0
- package/dist/routes/users.js +127 -0
- package/dist/routes/users.js.map +1 -0
- package/dist/routes/workspaceMembers.d.ts +11 -0
- package/dist/routes/workspaceMembers.d.ts.map +1 -0
- package/dist/routes/workspaceMembers.js +81 -0
- package/dist/routes/workspaceMembers.js.map +1 -0
- package/dist/routes/workspaces.d.ts +19 -1
- package/dist/routes/workspaces.d.ts.map +1 -1
- package/dist/routes/workspaces.js +161 -45
- package/dist/routes/workspaces.js.map +1 -1
- package/dist/server.js +69 -25
- package/dist/server.js.map +1 -1
- package/package.json +48 -31
- package/LICENSE +0 -21
- package/dist/infrastructure/agent/ClaudeCodeAgentBinding.d.ts +0 -8
- package/dist/infrastructure/agent/ClaudeCodeAgentBinding.d.ts.map +0 -1
- package/dist/infrastructure/agent/ClaudeCodeAgentBinding.js +0 -62
- package/dist/infrastructure/agent/ClaudeCodeAgentBinding.js.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HistoryService } from '@braidhq/core';
|
|
2
|
+
import { Hono } from 'hono';
|
|
3
|
+
export interface HistoryRouterDeps {
|
|
4
|
+
historyService: HistoryService;
|
|
5
|
+
}
|
|
6
|
+
export declare function createHistoryRouter(deps: HistoryRouterDeps): Hono;
|
|
7
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/routes/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAInD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AA4B3B,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,cAAc,CAAA;CAC/B;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAoEjE"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { NotFoundError } from '@braidhq/core';
|
|
2
|
+
import { CommitSha, UserId } from '@braidhq/schema';
|
|
3
|
+
import { zValidator } from '@hono/zod-validator';
|
|
4
|
+
import { Hono } from 'hono';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { getUserId } from '../middleware/userId.js';
|
|
7
|
+
import { requirePermission } from '../middleware/workspaceAccess.js';
|
|
8
|
+
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
9
|
+
// `userId` accepted for backwards compat; the authoritative value
|
|
10
|
+
// comes from the request context (set by `userIdMiddleware`).
|
|
11
|
+
const RestoreBody = z.object({
|
|
12
|
+
userId: UserId.optional(),
|
|
13
|
+
});
|
|
14
|
+
const TagBody = z.object({
|
|
15
|
+
sha: CommitSha,
|
|
16
|
+
name: z.string().min(1).max(120),
|
|
17
|
+
note: z.string().max(2000).optional(),
|
|
18
|
+
});
|
|
19
|
+
const ListQuery = z.object({
|
|
20
|
+
since: CommitSha.optional(),
|
|
21
|
+
limit: z.coerce.number().int().positive().max(200).optional(),
|
|
22
|
+
});
|
|
23
|
+
const GraphDiffQuery = z.object({
|
|
24
|
+
from: CommitSha,
|
|
25
|
+
to: CommitSha,
|
|
26
|
+
});
|
|
27
|
+
export function createHistoryRouter(deps) {
|
|
28
|
+
const router = new Hono();
|
|
29
|
+
// Restore is destructive — Owner only. Tag CRUD is workspace
|
|
30
|
+
// metadata management; Owner only as well to keep ACL coherent.
|
|
31
|
+
router.use('/:sha/restore', requirePermission('history.write'));
|
|
32
|
+
router.use('/tags', requirePermission('history.write'));
|
|
33
|
+
router.use('/tags/*', requirePermission('history.write'));
|
|
34
|
+
router.get('/', zValidator('query', ListQuery), async (context) => {
|
|
35
|
+
const workspaceId = getWorkspaceId(context);
|
|
36
|
+
const { since, limit } = context.req.valid('query');
|
|
37
|
+
const items = await deps.historyService.listCommits(workspaceId, {
|
|
38
|
+
...(since ? { since } : {}),
|
|
39
|
+
...(limit ? { limit } : {}),
|
|
40
|
+
});
|
|
41
|
+
return context.json({ items });
|
|
42
|
+
});
|
|
43
|
+
// Must be registered before `/:sha` so `graph-diff` isn't matched as a sha.
|
|
44
|
+
router.get('/graph-diff', zValidator('query', GraphDiffQuery), async (context) => {
|
|
45
|
+
const workspaceId = getWorkspaceId(context);
|
|
46
|
+
const { from, to } = context.req.valid('query');
|
|
47
|
+
const envelope = await deps.historyService.getGraphDiff(workspaceId, from, to);
|
|
48
|
+
return context.json(envelope);
|
|
49
|
+
});
|
|
50
|
+
router.get('/tags', async (context) => {
|
|
51
|
+
const workspaceId = getWorkspaceId(context);
|
|
52
|
+
const items = await deps.historyService.listTags(workspaceId);
|
|
53
|
+
return context.json({ items });
|
|
54
|
+
});
|
|
55
|
+
router.post('/tags', zValidator('json', TagBody), async (context) => {
|
|
56
|
+
const workspaceId = getWorkspaceId(context);
|
|
57
|
+
const { sha, name, note } = context.req.valid('json');
|
|
58
|
+
const tag = await deps.historyService.createTag(workspaceId, sha, name, note);
|
|
59
|
+
return context.json(tag, 201);
|
|
60
|
+
});
|
|
61
|
+
router.delete('/tags/:name', async (context) => {
|
|
62
|
+
const workspaceId = getWorkspaceId(context);
|
|
63
|
+
const name = context.req.param('name');
|
|
64
|
+
if (!name)
|
|
65
|
+
throw new NotFoundError('tag name is required');
|
|
66
|
+
await deps.historyService.deleteTag(workspaceId, name);
|
|
67
|
+
return context.body(null, 204);
|
|
68
|
+
});
|
|
69
|
+
router.post('/:sha/restore', zValidator('json', RestoreBody), async (context) => {
|
|
70
|
+
const workspaceId = getWorkspaceId(context);
|
|
71
|
+
const sha = CommitSha.parse(context.req.param('sha'));
|
|
72
|
+
const { userId: bodyUserId } = context.req.valid('json');
|
|
73
|
+
const userId = bodyUserId ?? getUserId(context);
|
|
74
|
+
const newSha = await deps.historyService.restore(workspaceId, sha, userId);
|
|
75
|
+
return context.json({ newCommit: newSha, restoredTo: sha });
|
|
76
|
+
});
|
|
77
|
+
router.get('/:sha', async (context) => {
|
|
78
|
+
const workspaceId = getWorkspaceId(context);
|
|
79
|
+
const sha = CommitSha.parse(context.req.param('sha'));
|
|
80
|
+
const commit = await deps.historyService.getCommit(workspaceId, sha);
|
|
81
|
+
if (!commit)
|
|
82
|
+
throw new NotFoundError(`commit ${sha} not found in workspace ${workspaceId}`);
|
|
83
|
+
const diff = await deps.historyService.getCommitDiff(workspaceId, sha);
|
|
84
|
+
return context.json({ ...commit, diff });
|
|
85
|
+
});
|
|
86
|
+
return router;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/routes/history.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MA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AAW,EAAE,GAAG,CAAC,CAAA;QACtE,OAAO,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/routes/model.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModelService } from '@braidhq/core';
|
|
2
|
-
import {
|
|
2
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
3
|
export interface ModelRouterDeps {
|
|
4
4
|
modelService: ModelService;
|
|
5
5
|
}
|
|
6
|
-
export declare function createModelRouter(deps: ModelRouterDeps):
|
|
6
|
+
export declare function createModelRouter(deps: ModelRouterDeps): OpenAPIHono;
|
|
7
7
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/routes/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/routes/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAI5D,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,YAAY,CAAA;CAC3B;AAiBD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW,CAUpE"}
|
package/dist/routes/model.js
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModelSnapshot } from '@braidhq/schema';
|
|
2
|
+
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
2
3
|
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
4
|
+
import { WorkspaceIdParam } from './_shared.js';
|
|
5
|
+
const getSnapshotRoute = createRoute({
|
|
6
|
+
method: 'get',
|
|
7
|
+
path: '/snapshot',
|
|
8
|
+
operationId: 'getModelSnapshot',
|
|
9
|
+
summary: 'Return the full graph snapshot (nodes + edges) for a workspace.',
|
|
10
|
+
tags: ['model'],
|
|
11
|
+
request: { params: WorkspaceIdParam },
|
|
12
|
+
responses: {
|
|
13
|
+
200: {
|
|
14
|
+
description: 'The full graph snapshot.',
|
|
15
|
+
content: { 'application/json': { schema: ModelSnapshot } },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
3
19
|
export function createModelRouter(deps) {
|
|
4
|
-
const router = new
|
|
5
|
-
router.
|
|
20
|
+
const router = new OpenAPIHono();
|
|
21
|
+
router.openapi(getSnapshotRoute, async (context) => {
|
|
6
22
|
const workspaceId = getWorkspaceId(context);
|
|
7
23
|
const snapshot = await deps.modelService.getSnapshot(workspaceId);
|
|
8
|
-
return context.json(snapshot);
|
|
24
|
+
return context.json(snapshot, 200);
|
|
9
25
|
});
|
|
10
26
|
return router;
|
|
11
27
|
}
|
package/dist/routes/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/routes/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/routes/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAM/C,MAAM,gBAAgB,GAAG,WAAW,CAAC;IACnC,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,kBAAkB;IAC/B,OAAO,EAAE,iEAAiE;IAC1E,IAAI,EAAE,CAAC,OAAO,CAAC;IACf,OAAO,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE;IACrC,SAAS,EAAE;QACT,GAAG,EAAE;YACH,WAAW,EAAE,0BAA0B;YACvC,OAAO,EAAE,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE;SAC3D;KACF;CACF,CAAC,CAAA;AAEF,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAA;IAEhC,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACjD,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;QAC3C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;QACjE,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/routes/nodes.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModelService } from '@braidhq/core';
|
|
2
|
-
import {
|
|
2
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
3
|
export interface NodesRouterDeps {
|
|
4
4
|
modelService: ModelService;
|
|
5
5
|
}
|
|
6
|
-
export declare function createNodesRouter(deps: NodesRouterDeps):
|
|
6
|
+
export declare function createNodesRouter(deps: NodesRouterDeps): OpenAPIHono;
|
|
7
7
|
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/routes/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/routes/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAwB/D,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,YAAY,CAAA;CAC3B;AAwDD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW,CAkCpE"}
|
package/dist/routes/nodes.js
CHANGED
|
@@ -1,21 +1,77 @@
|
|
|
1
|
-
import { NodeId, NodeStatus, NodeTypeId } from '@braidhq/schema';
|
|
2
|
-
import {
|
|
3
|
-
import { Hono } from 'hono';
|
|
4
|
-
import { z } from 'zod';
|
|
1
|
+
import { GraphNode, ModelSnapshot, NodeId, NodeStatus, NodeTypeId } from '@braidhq/schema';
|
|
2
|
+
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
5
3
|
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { NotFoundResponse, ValidationFailureResponse, WorkspaceIdParam } from './_shared.js';
|
|
5
|
+
const ListQuery = z.object({
|
|
6
|
+
type: z.union([NodeTypeId, z.array(NodeTypeId)]).optional().openapi({ description: 'Filter by node type id; pass one or many.' }),
|
|
7
|
+
status: z.union([NodeStatus, z.array(NodeStatus)]).optional().openapi({ description: 'Filter by node status; pass one or many.' }),
|
|
8
|
+
q: z.string().optional().openapi({ description: 'Case-insensitive substring match against node name.' }),
|
|
10
9
|
limit: z.coerce.number().int().positive().optional(),
|
|
11
10
|
offset: z.coerce.number().int().nonnegative().optional(),
|
|
12
11
|
});
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
const NodeIdParam = WorkspaceIdParam.extend({
|
|
13
|
+
nodeId: NodeId.openapi({ param: { name: 'nodeId', in: 'path' } }),
|
|
14
|
+
});
|
|
15
|
+
const ScopeQuery = z.object({
|
|
16
|
+
depth: z.coerce.number().int().positive().default(2).openapi({ description: 'How many hops to traverse from the seed node.' }),
|
|
17
|
+
});
|
|
18
|
+
const NodeListResponse = z.object({
|
|
19
|
+
items: z.array(GraphNode),
|
|
20
|
+
}).openapi('NodeListResponse');
|
|
21
|
+
const listNodesRoute = createRoute({
|
|
22
|
+
method: 'get',
|
|
23
|
+
path: '/',
|
|
24
|
+
operationId: 'listNodes',
|
|
25
|
+
summary: 'Search graph nodes by type, status, name substring.',
|
|
26
|
+
tags: ['nodes'],
|
|
27
|
+
request: {
|
|
28
|
+
params: WorkspaceIdParam,
|
|
29
|
+
query: ListQuery,
|
|
30
|
+
},
|
|
31
|
+
responses: {
|
|
32
|
+
200: {
|
|
33
|
+
description: 'A page of matching nodes.',
|
|
34
|
+
content: { 'application/json': { schema: NodeListResponse } },
|
|
35
|
+
},
|
|
36
|
+
400: ValidationFailureResponse,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
const getNodeRoute = createRoute({
|
|
40
|
+
method: 'get',
|
|
41
|
+
path: '/{nodeId}',
|
|
42
|
+
operationId: 'getNode',
|
|
43
|
+
summary: 'Fetch a single node by id.',
|
|
44
|
+
tags: ['nodes'],
|
|
45
|
+
request: { params: NodeIdParam },
|
|
46
|
+
responses: {
|
|
47
|
+
200: {
|
|
48
|
+
description: 'The requested node.',
|
|
49
|
+
content: { 'application/json': { schema: GraphNode } },
|
|
50
|
+
},
|
|
51
|
+
404: NotFoundResponse,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
const scopeRoute = createRoute({
|
|
55
|
+
method: 'get',
|
|
56
|
+
path: '/{nodeId}/scope',
|
|
57
|
+
operationId: 'getNodeScope',
|
|
58
|
+
summary: 'Return the subgraph reachable from a node within a depth budget.',
|
|
59
|
+
tags: ['nodes'],
|
|
60
|
+
request: {
|
|
61
|
+
params: NodeIdParam,
|
|
62
|
+
query: ScopeQuery,
|
|
63
|
+
},
|
|
64
|
+
responses: {
|
|
65
|
+
200: {
|
|
66
|
+
description: 'A scoped subgraph (nodes + edges) around the seed node.',
|
|
67
|
+
content: { 'application/json': { schema: ModelSnapshot } },
|
|
68
|
+
},
|
|
69
|
+
404: NotFoundResponse,
|
|
70
|
+
},
|
|
15
71
|
});
|
|
16
72
|
export function createNodesRouter(deps) {
|
|
17
|
-
const router = new
|
|
18
|
-
router.
|
|
73
|
+
const router = new OpenAPIHono();
|
|
74
|
+
router.openapi(listNodesRoute, async (context) => {
|
|
19
75
|
const workspaceId = getWorkspaceId(context);
|
|
20
76
|
const { type, status, q, limit, offset } = context.req.valid('query');
|
|
21
77
|
const types = type === undefined ? undefined : Array.isArray(type) ? type : [type];
|
|
@@ -27,20 +83,20 @@ export function createNodesRouter(deps) {
|
|
|
27
83
|
limit,
|
|
28
84
|
offset,
|
|
29
85
|
});
|
|
30
|
-
return context.json({ items: nodes });
|
|
86
|
+
return context.json({ items: nodes }, 200);
|
|
31
87
|
});
|
|
32
|
-
router.
|
|
88
|
+
router.openapi(getNodeRoute, async (context) => {
|
|
33
89
|
const workspaceId = getWorkspaceId(context);
|
|
34
|
-
const nodeId =
|
|
90
|
+
const { nodeId } = context.req.valid('param');
|
|
35
91
|
const node = await deps.modelService.getNode(workspaceId, nodeId);
|
|
36
|
-
return context.json(node);
|
|
92
|
+
return context.json(node, 200);
|
|
37
93
|
});
|
|
38
|
-
router.
|
|
94
|
+
router.openapi(scopeRoute, async (context) => {
|
|
39
95
|
const workspaceId = getWorkspaceId(context);
|
|
40
|
-
const nodeId =
|
|
96
|
+
const { nodeId } = context.req.valid('param');
|
|
41
97
|
const { depth } = context.req.valid('query');
|
|
42
98
|
const snapshot = await deps.modelService.scopeOf(workspaceId, nodeId, depth);
|
|
43
|
-
return context.json(snapshot);
|
|
99
|
+
return context.json(snapshot, 200);
|
|
44
100
|
});
|
|
45
101
|
return router;
|
|
46
102
|
}
|
package/dist/routes/nodes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/routes/nodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/routes/nodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC1F,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE5F,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;IACjI,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;IAClI,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,qDAAqD,EAAE,CAAC;IACxG,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACpD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,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M,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;QAC5E,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { PluginRegistry, WorkspaceRepository } from '@braidhq/core';
|
|
2
|
-
import {
|
|
2
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
3
|
export interface OntologyRouterDeps {
|
|
4
4
|
workspaceRepository: WorkspaceRepository;
|
|
5
5
|
pluginRegistry: PluginRegistry;
|
|
6
6
|
}
|
|
7
|
-
export declare function createOntologyRouter(deps: OntologyRouterDeps):
|
|
7
|
+
export declare function createOntologyRouter(deps: OntologyRouterDeps): OpenAPIHono;
|
|
8
8
|
//# sourceMappingURL=ontology.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ontology.d.ts","sourceRoot":"","sources":["../../src/routes/ontology.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"ontology.d.ts","sourceRoot":"","sources":["../../src/routes/ontology.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAGxE,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAI5D,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,cAAc,EAAE,cAAc,CAAA;CAC/B;AAkBD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,WAAW,CAkB1E"}
|
package/dist/routes/ontology.js
CHANGED
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
import { NotFoundError } from '@braidhq/core';
|
|
2
|
-
import {
|
|
2
|
+
import { OntologyResponse } from '@braidhq/schema';
|
|
3
|
+
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
3
4
|
import { getWorkspaceId } from '../middleware/workspaceId.js';
|
|
5
|
+
import { NotFoundResponse, WorkspaceIdParam } from './_shared.js';
|
|
6
|
+
const getOntologyRoute = createRoute({
|
|
7
|
+
method: 'get',
|
|
8
|
+
path: '/',
|
|
9
|
+
operationId: 'getOntology',
|
|
10
|
+
summary: 'Return the active ontology (node types + edge types) for a workspace.',
|
|
11
|
+
tags: ['ontology'],
|
|
12
|
+
request: { params: WorkspaceIdParam },
|
|
13
|
+
responses: {
|
|
14
|
+
200: {
|
|
15
|
+
description: 'The active ontology for the workspace.',
|
|
16
|
+
content: { 'application/json': { schema: OntologyResponse } },
|
|
17
|
+
},
|
|
18
|
+
404: NotFoundResponse,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
4
21
|
export function createOntologyRouter(deps) {
|
|
5
|
-
const router = new
|
|
6
|
-
router.
|
|
22
|
+
const router = new OpenAPIHono();
|
|
23
|
+
router.openapi(getOntologyRoute, async (context) => {
|
|
7
24
|
const workspaceId = getWorkspaceId(context);
|
|
8
25
|
const workspaces = await deps.workspaceRepository.list();
|
|
9
26
|
const workspace = workspaces.find(ws => ws.id === workspaceId);
|
|
10
27
|
if (!workspace)
|
|
11
28
|
throw new NotFoundError(`Workspace "${workspaceId}" not registered`);
|
|
12
29
|
const ontology = deps.pluginRegistry.requireOntology(workspace.productManifest.ontologyId);
|
|
13
|
-
return context.json({
|
|
30
|
+
return context.json(OntologyResponse.parse({
|
|
14
31
|
ontologyId: ontology.ontologyId,
|
|
15
32
|
nodeTypes: ontology.nodeTypes,
|
|
16
33
|
edgeTypes: ontology.edgeTypes,
|
|
17
|
-
});
|
|
34
|
+
}), 200);
|
|
18
35
|
});
|
|
19
36
|
return router;
|
|
20
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ontology.js","sourceRoot":"","sources":["../../src/routes/ontology.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ontology.js","sourceRoot":"","sources":["../../src/routes/ontology.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAOjE,MAAM,gBAAgB,GAAG,WAAW,CAAC;IACnC,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,GAAG;IACT,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,uEAAuE;IAChF,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,OAAO,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE;IACrC,SAAS,EAAE;QACT,GAAG,EAAE;YACH,WAAW,EAAE,wCAAwC;YACrD,OAAO,EAAE,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE;SAC9D;QACD,GAAG,EAAE,gBAAgB;KACtB;CACF,CAAC,CAAA;AAEF,MAAM,UAAU,oBAAoB,CAAC,IAAwB;IAC3D,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAA;IAEhC,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACjD,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;QAC3C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAA;QACxD,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,WAAW,CAAC,CAAA;QAC9D,IAAI,CAAC,SAAS;YACZ,MAAM,IAAI,aAAa,CAAC,cAAc,WAAW,kBAAkB,CAAC,CAAA;QACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;QAC1F,OAAO,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;YACzC,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,SAAS,EAAE,QAAQ,CAAC,SAAS;SAC9B,CAAC,EAAE,GAAG,CAAC,CAAA;IACV,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { HITLService, ModelRepository, ProposalRepository, ValidationService } from '@braidhq/core';
|
|
2
|
-
import {
|
|
1
|
+
import type { HITLService, ModelRepository, ProposalRepository, ValidationService, WorkspaceService } from '@braidhq/core';
|
|
2
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
3
|
export interface ProposalsRouterDeps {
|
|
4
4
|
hitlService: HITLService;
|
|
5
5
|
proposalRepository: ProposalRepository;
|
|
6
6
|
modelRepository: ModelRepository;
|
|
7
7
|
validationService: ValidationService;
|
|
8
|
+
workspaceService: WorkspaceService;
|
|
8
9
|
}
|
|
9
|
-
export declare function createProposalsRouter(deps: ProposalsRouterDeps):
|
|
10
|
+
export declare function createProposalsRouter(deps: ProposalsRouterDeps): OpenAPIHono;
|
|
10
11
|
//# sourceMappingURL=proposals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposals.d.ts","sourceRoot":"","sources":["../../src/routes/proposals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"proposals.d.ts","sourceRoot":"","sources":["../../src/routes/proposals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAE1H,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAyC/D,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,WAAW,CAAA;IACxB,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,eAAe,EAAE,eAAe,CAAA;IAChC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,gBAAgB,EAAE,gBAAgB,CAAA;CACnC;AA8GD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,WAAW,CA6E5E"}
|