@inkeep/agents-manage-api 0.1.1 → 0.1.6

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.
Files changed (114) hide show
  1. package/LICENSE.md +29 -17
  2. package/README.md +1 -1
  3. package/SUPPLEMENTAL_TERMS.md +40 -0
  4. package/dist/index.cjs +5083 -0
  5. package/dist/index.d.cts +15 -0
  6. package/dist/index.d.ts +15 -4
  7. package/dist/index.js +5046 -35
  8. package/package.json +15 -13
  9. package/dist/ManagementServer.d.ts +0 -28
  10. package/dist/ManagementServer.d.ts.map +0 -1
  11. package/dist/ManagementServer.js +0 -41
  12. package/dist/__tests__/setup.d.ts +0 -2
  13. package/dist/__tests__/setup.d.ts.map +0 -1
  14. package/dist/__tests__/setup.js +0 -26
  15. package/dist/__tests__/utils/testProject.d.ts +0 -18
  16. package/dist/__tests__/utils/testProject.d.ts.map +0 -1
  17. package/dist/__tests__/utils/testProject.js +0 -26
  18. package/dist/__tests__/utils/testRequest.d.ts +0 -2
  19. package/dist/__tests__/utils/testRequest.d.ts.map +0 -1
  20. package/dist/__tests__/utils/testRequest.js +0 -11
  21. package/dist/__tests__/utils/testTenant.d.ts +0 -64
  22. package/dist/__tests__/utils/testTenant.d.ts.map +0 -1
  23. package/dist/__tests__/utils/testTenant.js +0 -71
  24. package/dist/app.d.ts +0 -4
  25. package/dist/app.d.ts.map +0 -1
  26. package/dist/app.js +0 -140
  27. package/dist/data/conversations.d.ts +0 -59
  28. package/dist/data/conversations.d.ts.map +0 -1
  29. package/dist/data/conversations.js +0 -216
  30. package/dist/data/db/clean.d.ts +0 -6
  31. package/dist/data/db/clean.d.ts.map +0 -1
  32. package/dist/data/db/clean.js +0 -77
  33. package/dist/data/db/dbClient.d.ts +0 -3
  34. package/dist/data/db/dbClient.d.ts.map +0 -1
  35. package/dist/data/db/dbClient.js +0 -13
  36. package/dist/data/graphFull.d.ts +0 -11
  37. package/dist/data/graphFull.d.ts.map +0 -1
  38. package/dist/data/graphFull.js +0 -90
  39. package/dist/data/graphFullClient.d.ts +0 -22
  40. package/dist/data/graphFullClient.d.ts.map +0 -1
  41. package/dist/data/graphFullClient.js +0 -189
  42. package/dist/data/tools.d.ts +0 -81
  43. package/dist/data/tools.d.ts.map +0 -1
  44. package/dist/data/tools.js +0 -266
  45. package/dist/env.d.ts +0 -41
  46. package/dist/env.d.ts.map +0 -1
  47. package/dist/env.js +0 -59
  48. package/dist/index.d.ts.map +0 -1
  49. package/dist/logger.d.ts +0 -4
  50. package/dist/logger.d.ts.map +0 -1
  51. package/dist/logger.js +0 -32
  52. package/dist/middleware/auth.d.ts +0 -12
  53. package/dist/middleware/auth.d.ts.map +0 -1
  54. package/dist/middleware/auth.js +0 -36
  55. package/dist/openapi.d.ts +0 -2
  56. package/dist/openapi.d.ts.map +0 -1
  57. package/dist/openapi.js +0 -38
  58. package/dist/routes/agentArtifactComponents.d.ts +0 -4
  59. package/dist/routes/agentArtifactComponents.d.ts.map +0 -1
  60. package/dist/routes/agentArtifactComponents.js +0 -230
  61. package/dist/routes/agentDataComponents.d.ts +0 -4
  62. package/dist/routes/agentDataComponents.d.ts.map +0 -1
  63. package/dist/routes/agentDataComponents.js +0 -225
  64. package/dist/routes/agentGraph.d.ts +0 -4
  65. package/dist/routes/agentGraph.d.ts.map +0 -1
  66. package/dist/routes/agentGraph.js +0 -289
  67. package/dist/routes/agentRelations.d.ts +0 -4
  68. package/dist/routes/agentRelations.d.ts.map +0 -1
  69. package/dist/routes/agentRelations.js +0 -290
  70. package/dist/routes/agentToolRelations.d.ts +0 -4
  71. package/dist/routes/agentToolRelations.d.ts.map +0 -1
  72. package/dist/routes/agentToolRelations.js +0 -342
  73. package/dist/routes/agents.d.ts +0 -4
  74. package/dist/routes/agents.d.ts.map +0 -1
  75. package/dist/routes/agents.js +0 -213
  76. package/dist/routes/apiKeys.d.ts +0 -4
  77. package/dist/routes/apiKeys.d.ts.map +0 -1
  78. package/dist/routes/apiKeys.js +0 -236
  79. package/dist/routes/artifactComponents.d.ts +0 -4
  80. package/dist/routes/artifactComponents.d.ts.map +0 -1
  81. package/dist/routes/artifactComponents.js +0 -202
  82. package/dist/routes/contextConfigs.d.ts +0 -4
  83. package/dist/routes/contextConfigs.d.ts.map +0 -1
  84. package/dist/routes/contextConfigs.js +0 -181
  85. package/dist/routes/credentials.d.ts +0 -4
  86. package/dist/routes/credentials.d.ts.map +0 -1
  87. package/dist/routes/credentials.js +0 -219
  88. package/dist/routes/dataComponents.d.ts +0 -4
  89. package/dist/routes/dataComponents.d.ts.map +0 -1
  90. package/dist/routes/dataComponents.js +0 -188
  91. package/dist/routes/externalAgents.d.ts +0 -4
  92. package/dist/routes/externalAgents.d.ts.map +0 -1
  93. package/dist/routes/externalAgents.js +0 -216
  94. package/dist/routes/graphFull.d.ts +0 -4
  95. package/dist/routes/graphFull.d.ts.map +0 -1
  96. package/dist/routes/graphFull.js +0 -248
  97. package/dist/routes/index.d.ts +0 -4
  98. package/dist/routes/index.d.ts.map +0 -1
  99. package/dist/routes/index.js +0 -37
  100. package/dist/routes/oauth.d.ts +0 -14
  101. package/dist/routes/oauth.d.ts.map +0 -1
  102. package/dist/routes/oauth.js +0 -191
  103. package/dist/routes/projects.d.ts +0 -4
  104. package/dist/routes/projects.d.ts.map +0 -1
  105. package/dist/routes/projects.js +0 -221
  106. package/dist/routes/tools.d.ts +0 -4
  107. package/dist/routes/tools.d.ts.map +0 -1
  108. package/dist/routes/tools.js +0 -547
  109. package/dist/utils/auth-detection.d.ts +0 -22
  110. package/dist/utils/auth-detection.d.ts.map +0 -1
  111. package/dist/utils/auth-detection.js +0 -149
  112. package/dist/utils/oauth-service.d.ts +0 -88
  113. package/dist/utils/oauth-service.d.ts.map +0 -1
  114. package/dist/utils/oauth-service.js +0 -240
@@ -1,236 +0,0 @@
1
- import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
2
- import { z } from 'zod';
3
- import { createApiKey, deleteApiKey, getApiKeyById, listApiKeysPaginated, updateApiKey, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyApiCreationResponseSchema, ErrorResponseSchema, IdParamsSchema, ListResponseSchema, PaginationQueryParamsSchema, SingleResponseSchema, TenantProjectParamsSchema, generateApiKey, } from '@inkeep/agents-core';
4
- import { commonGetErrorResponses, createApiError } from '@inkeep/agents-core';
5
- import dbClient from '../data/db/dbClient.js';
6
- const app = new OpenAPIHono();
7
- app.openapi(createRoute({
8
- method: 'get',
9
- path: '/',
10
- summary: 'List API Keys',
11
- description: 'List all API keys for a tenant with optional pagination',
12
- operationId: 'list-api-keys',
13
- tags: ['CRUD API Keys'],
14
- request: {
15
- params: TenantProjectParamsSchema,
16
- query: PaginationQueryParamsSchema.extend({
17
- graphId: z.string().optional().describe('Filter by graph ID'),
18
- }),
19
- },
20
- responses: {
21
- 200: {
22
- description: 'List of API keys retrieved successfully',
23
- content: {
24
- 'application/json': {
25
- schema: ListResponseSchema(ApiKeyApiSelectSchema),
26
- },
27
- },
28
- },
29
- ...commonGetErrorResponses,
30
- },
31
- }), async (c) => {
32
- const { tenantId, projectId } = c.req.valid('param');
33
- const page = Number(c.req.query('page')) || 1;
34
- const limit = Math.min(Number(c.req.query('limit')) || 10, 100);
35
- const graphId = c.req.query('graphId');
36
- const result = await listApiKeysPaginated(dbClient)({
37
- scopes: { tenantId, projectId },
38
- pagination: { page, limit },
39
- graphId,
40
- });
41
- // Remove sensitive fields from response
42
- const sanitizedData = result.data.map(({ keyHash, tenantId, projectId, ...apiKey }) => apiKey);
43
- return c.json({
44
- data: sanitizedData,
45
- pagination: result.pagination,
46
- });
47
- });
48
- app.openapi(createRoute({
49
- method: 'get',
50
- path: '/{id}',
51
- summary: 'Get API Key',
52
- description: 'Get a specific API key by ID (does not return the actual key)',
53
- operationId: 'get-api-key-by-id',
54
- tags: ['CRUD API Keys'],
55
- request: {
56
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
57
- },
58
- responses: {
59
- 200: {
60
- description: 'API key found',
61
- content: {
62
- 'application/json': {
63
- schema: SingleResponseSchema(ApiKeyApiSelectSchema),
64
- },
65
- },
66
- },
67
- ...commonGetErrorResponses,
68
- },
69
- }), async (c) => {
70
- const { tenantId, projectId, id } = c.req.valid('param');
71
- const apiKey = await getApiKeyById(dbClient)({
72
- scopes: { tenantId, projectId },
73
- id,
74
- });
75
- if (!apiKey || apiKey === undefined) {
76
- throw createApiError({
77
- code: 'not_found',
78
- message: 'API key not found',
79
- });
80
- }
81
- // Remove sensitive fields from response
82
- const { keyHash: _, tenantId: __, projectId: ___, ...sanitizedApiKey } = apiKey;
83
- return c.json({
84
- data: {
85
- ...sanitizedApiKey,
86
- lastUsedAt: sanitizedApiKey.lastUsedAt ?? null,
87
- expiresAt: sanitizedApiKey.expiresAt ?? null,
88
- },
89
- });
90
- });
91
- app.openapi(createRoute({
92
- method: 'post',
93
- path: '/',
94
- summary: 'Create API Key',
95
- description: 'Create a new API key for a graph. Returns the full key (shown only once).',
96
- operationId: 'create-api-key',
97
- tags: ['CRUD API Keys'],
98
- request: {
99
- params: TenantProjectParamsSchema,
100
- body: {
101
- content: {
102
- 'application/json': {
103
- schema: ApiKeyApiInsertSchema,
104
- },
105
- },
106
- },
107
- },
108
- responses: {
109
- 201: {
110
- description: 'API key created successfully',
111
- content: {
112
- 'application/json': {
113
- schema: ApiKeyApiCreationResponseSchema,
114
- },
115
- },
116
- },
117
- ...commonGetErrorResponses,
118
- },
119
- }), async (c) => {
120
- const { tenantId, projectId } = c.req.valid('param');
121
- const body = c.req.valid('json');
122
- const keyData = await generateApiKey();
123
- const { key, ...keyDataWithoutKey } = keyData;
124
- const insertData = {
125
- tenantId,
126
- projectId,
127
- graphId: body.graphId,
128
- ...keyDataWithoutKey,
129
- expiresAt: body.expiresAt || undefined,
130
- };
131
- const result = await createApiKey(dbClient)(insertData);
132
- // Remove sensitive fields from the apiKey object (but keep the full key)
133
- const { keyHash: _, tenantId: __, projectId: ___, ...sanitizedApiKey } = result;
134
- return c.json({
135
- data: {
136
- apiKey: {
137
- ...sanitizedApiKey,
138
- lastUsedAt: sanitizedApiKey.lastUsedAt ?? null,
139
- expiresAt: sanitizedApiKey.expiresAt ?? null,
140
- },
141
- key: key,
142
- },
143
- }, 201);
144
- });
145
- app.openapi(createRoute({
146
- method: 'put',
147
- path: '/{id}',
148
- summary: 'Update API Key',
149
- description: 'Update an API key (currently only expiration date can be changed)',
150
- operationId: 'update-api-key',
151
- tags: ['CRUD API Keys'],
152
- request: {
153
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
154
- body: {
155
- content: {
156
- 'application/json': {
157
- schema: ApiKeyApiUpdateSchema,
158
- },
159
- },
160
- },
161
- },
162
- responses: {
163
- 200: {
164
- description: 'API key updated successfully',
165
- content: {
166
- 'application/json': {
167
- schema: SingleResponseSchema(ApiKeyApiSelectSchema),
168
- },
169
- },
170
- },
171
- ...commonGetErrorResponses,
172
- },
173
- }), async (c) => {
174
- const { tenantId, projectId, id } = c.req.valid('param');
175
- const body = c.req.valid('json');
176
- const updatedApiKey = await updateApiKey(dbClient)({
177
- scopes: { tenantId, projectId },
178
- id,
179
- data: {
180
- expiresAt: body.expiresAt,
181
- },
182
- });
183
- if (!updatedApiKey) {
184
- throw createApiError({
185
- code: 'not_found',
186
- message: 'API key not found',
187
- });
188
- }
189
- // Remove sensitive fields from response
190
- const { keyHash: _, tenantId: __, projectId: ___, ...sanitizedApiKey } = updatedApiKey;
191
- return c.json({
192
- data: {
193
- ...sanitizedApiKey,
194
- lastUsedAt: sanitizedApiKey.lastUsedAt ?? null,
195
- expiresAt: sanitizedApiKey.expiresAt ?? null,
196
- },
197
- });
198
- });
199
- app.openapi(createRoute({
200
- method: 'delete',
201
- path: '/{id}',
202
- summary: 'Delete API Key',
203
- description: 'Delete an API key permanently',
204
- operationId: 'delete-api-key',
205
- tags: ['CRUD API Keys'],
206
- request: {
207
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
208
- },
209
- responses: {
210
- 204: {
211
- description: 'API key deleted successfully',
212
- },
213
- 404: {
214
- description: 'API key not found',
215
- content: {
216
- 'application/json': {
217
- schema: ErrorResponseSchema,
218
- },
219
- },
220
- },
221
- },
222
- }), async (c) => {
223
- const { tenantId, projectId, id } = c.req.valid('param');
224
- const deleted = await deleteApiKey(dbClient)({
225
- scopes: { tenantId, projectId },
226
- id,
227
- });
228
- if (!deleted) {
229
- throw createApiError({
230
- code: 'not_found',
231
- message: 'API key not found',
232
- });
233
- }
234
- return c.body(null, 204);
235
- });
236
- export default app;
@@ -1,4 +0,0 @@
1
- import { OpenAPIHono } from '@hono/zod-openapi';
2
- declare const app: OpenAPIHono<import("hono").Env, {}, "/">;
3
- export default app;
4
- //# sourceMappingURL=artifactComponents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifactComponents.d.ts","sourceRoot":"","sources":["../../src/routes/artifactComponents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAqB7D,QAAA,MAAM,GAAG,0CAAoB,CAAC;AAoO9B,eAAe,GAAG,CAAC"}
@@ -1,202 +0,0 @@
1
- import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
2
- import { nanoid } from 'nanoid';
3
- import { commonGetErrorResponses, createApiError } from '@inkeep/agents-core';
4
- import { ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ErrorResponseSchema, IdParamsSchema, ListResponseSchema, PaginationQueryParamsSchema, SingleResponseSchema, TenantProjectParamsSchema, createArtifactComponent, deleteArtifactComponent, getArtifactComponentById, listArtifactComponentsPaginated, updateArtifactComponent, } from '@inkeep/agents-core';
5
- import dbClient from '../data/db/dbClient.js';
6
- const app = new OpenAPIHono();
7
- app.openapi(createRoute({
8
- method: 'get',
9
- path: '/',
10
- summary: 'List Artifact Components',
11
- operationId: 'list-artifact-components',
12
- tags: ['CRUD Artifact Component'],
13
- request: {
14
- params: TenantProjectParamsSchema,
15
- query: PaginationQueryParamsSchema,
16
- },
17
- responses: {
18
- 200: {
19
- description: 'List of artifact components retrieved successfully',
20
- content: {
21
- 'application/json': {
22
- schema: ListResponseSchema(ArtifactComponentApiSelectSchema),
23
- },
24
- },
25
- },
26
- ...commonGetErrorResponses,
27
- },
28
- }), async (c) => {
29
- const { tenantId, projectId } = c.req.valid('param');
30
- const page = Number(c.req.query('page')) || 1;
31
- const limit = Math.min(Number(c.req.query('limit')) || 10, 100);
32
- const result = await listArtifactComponentsPaginated(dbClient)({
33
- scopes: { tenantId, projectId },
34
- pagination: { page, limit },
35
- });
36
- return c.json(result);
37
- });
38
- app.openapi(createRoute({
39
- method: 'get',
40
- path: '/{id}',
41
- summary: 'Get Artifact Component',
42
- operationId: 'get-artifact-component-by-id',
43
- tags: ['CRUD Artifact Component'],
44
- request: {
45
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
46
- },
47
- responses: {
48
- 200: {
49
- description: 'Artifact component found',
50
- content: {
51
- 'application/json': {
52
- schema: SingleResponseSchema(ArtifactComponentApiSelectSchema),
53
- },
54
- },
55
- },
56
- ...commonGetErrorResponses,
57
- },
58
- }), async (c) => {
59
- const { tenantId, projectId, id } = c.req.valid('param');
60
- const artifactComponent = await getArtifactComponentById(dbClient)({
61
- scopes: { tenantId, projectId },
62
- id,
63
- });
64
- if (!artifactComponent) {
65
- throw createApiError({
66
- code: 'not_found',
67
- message: 'Artifact component not found',
68
- });
69
- }
70
- return c.json({ data: artifactComponent });
71
- });
72
- app.openapi(createRoute({
73
- method: 'post',
74
- path: '/',
75
- summary: 'Create Artifact Component',
76
- operationId: 'create-artifact-component',
77
- tags: ['CRUD Artifact Component'],
78
- request: {
79
- params: TenantProjectParamsSchema,
80
- body: {
81
- content: {
82
- 'application/json': {
83
- schema: ArtifactComponentApiInsertSchema,
84
- },
85
- },
86
- },
87
- },
88
- responses: {
89
- 201: {
90
- description: 'Artifact component created successfully',
91
- content: {
92
- 'application/json': {
93
- schema: SingleResponseSchema(ArtifactComponentApiSelectSchema),
94
- },
95
- },
96
- },
97
- ...commonGetErrorResponses,
98
- },
99
- }), async (c) => {
100
- const { tenantId, projectId } = c.req.valid('param');
101
- const body = c.req.valid('json');
102
- const finalId = body.id ? String(body.id) : nanoid();
103
- const componentData = {
104
- tenantId,
105
- projectId,
106
- id: finalId,
107
- name: String(body.name),
108
- description: String(body.description),
109
- summaryProps: body.summaryProps || undefined,
110
- fullProps: body.fullProps || undefined,
111
- };
112
- const artifactComponent = await createArtifactComponent(dbClient)({
113
- ...componentData,
114
- });
115
- return c.json({ data: artifactComponent }, 201);
116
- });
117
- app.openapi(createRoute({
118
- method: 'put',
119
- path: '/{id}',
120
- summary: 'Update Artifact Component',
121
- operationId: 'update-artifact-component',
122
- tags: ['CRUD Artifact Component'],
123
- request: {
124
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
125
- body: {
126
- content: {
127
- 'application/json': {
128
- schema: ArtifactComponentApiUpdateSchema,
129
- },
130
- },
131
- },
132
- },
133
- responses: {
134
- 200: {
135
- description: 'Artifact component updated successfully',
136
- content: {
137
- 'application/json': {
138
- schema: SingleResponseSchema(ArtifactComponentApiSelectSchema),
139
- },
140
- },
141
- },
142
- ...commonGetErrorResponses,
143
- },
144
- }), async (c) => {
145
- const { tenantId, projectId, id } = c.req.valid('param');
146
- const body = c.req.valid('json');
147
- const updatedArtifactComponent = await updateArtifactComponent(dbClient)({
148
- scopes: { tenantId, projectId },
149
- id,
150
- data: {
151
- name: body.name ? String(body.name) : undefined,
152
- description: body.description ? String(body.description) : undefined,
153
- summaryProps: body.summaryProps || undefined,
154
- fullProps: body.fullProps || undefined,
155
- },
156
- });
157
- if (!updatedArtifactComponent) {
158
- throw createApiError({
159
- code: 'not_found',
160
- message: 'Artifact component not found',
161
- });
162
- }
163
- return c.json({ data: updatedArtifactComponent });
164
- });
165
- app.openapi(createRoute({
166
- method: 'delete',
167
- path: '/{id}',
168
- summary: 'Delete Artifact Component',
169
- operationId: 'delete-artifact-component',
170
- tags: ['CRUD Artifact Component'],
171
- request: {
172
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
173
- },
174
- responses: {
175
- 204: {
176
- description: 'Artifact component deleted successfully',
177
- },
178
- 404: {
179
- description: 'Artifact component not found',
180
- content: {
181
- 'application/json': {
182
- schema: ErrorResponseSchema,
183
- },
184
- },
185
- },
186
- },
187
- }), async (c) => {
188
- const { tenantId, projectId, id } = c.req.valid('param');
189
- const deleted = await deleteArtifactComponent(dbClient)({
190
- scopes: { tenantId, projectId },
191
- id,
192
- });
193
- if (!deleted) {
194
- throw createApiError({
195
- code: 'not_found',
196
- message: 'Artifact component not found',
197
- });
198
- }
199
- // Always return 204 for DELETE operations (idempotent)
200
- return c.body(null, 204);
201
- });
202
- export default app;
@@ -1,4 +0,0 @@
1
- import { OpenAPIHono } from '@hono/zod-openapi';
2
- declare const app: OpenAPIHono<import("hono").Env, {}, "/">;
3
- export default app;
4
- //# sourceMappingURL=contextConfigs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contextConfigs.d.ts","sourceRoot":"","sources":["../../src/routes/contextConfigs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAyB7D,QAAA,MAAM,GAAG,0CAAoB,CAAC;AAgN9B,eAAe,GAAG,CAAC"}
@@ -1,181 +0,0 @@
1
- import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
2
- import { commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, } from '@inkeep/agents-core';
3
- import { ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, IdParamsSchema, ListResponseSchema, PaginationQueryParamsSchema, SingleResponseSchema, TenantProjectParamsSchema, createContextConfig, deleteContextConfig, getContextConfigById, listContextConfigsPaginated, updateContextConfig, } from '@inkeep/agents-core';
4
- import dbClient from '../data/db/dbClient.js';
5
- const app = new OpenAPIHono();
6
- app.openapi(createRoute({
7
- method: 'get',
8
- path: '/',
9
- summary: 'List Context Configurations',
10
- operationId: 'list-context-configs',
11
- tags: ['CRUD Context Config'],
12
- request: {
13
- params: TenantProjectParamsSchema,
14
- query: PaginationQueryParamsSchema,
15
- },
16
- responses: {
17
- 200: {
18
- description: 'List of context configurations retrieved successfully',
19
- content: {
20
- 'application/json': {
21
- schema: ListResponseSchema(ContextConfigApiSelectSchema),
22
- },
23
- },
24
- },
25
- ...commonGetErrorResponses,
26
- },
27
- }), async (c) => {
28
- const { tenantId, projectId } = c.req.valid('param');
29
- const page = Number(c.req.query('page')) || 1;
30
- const limit = Math.min(Number(c.req.query('limit')) || 10, 100);
31
- const result = await listContextConfigsPaginated(dbClient)({
32
- scopes: { tenantId, projectId },
33
- pagination: { page, limit },
34
- });
35
- return c.json(result);
36
- });
37
- app.openapi(createRoute({
38
- method: 'get',
39
- path: '/{id}',
40
- summary: 'Get Context Configuration',
41
- operationId: 'get-context-config-by-id',
42
- tags: ['CRUD Context Config'],
43
- request: {
44
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
45
- },
46
- responses: {
47
- 200: {
48
- description: 'Context configuration found',
49
- content: {
50
- 'application/json': {
51
- schema: SingleResponseSchema(ContextConfigApiSelectSchema),
52
- },
53
- },
54
- },
55
- ...commonGetErrorResponses,
56
- },
57
- }), async (c) => {
58
- const { tenantId, projectId, id } = c.req.valid('param');
59
- const contextConfig = await getContextConfigById(dbClient)({
60
- scopes: { tenantId, projectId },
61
- id,
62
- });
63
- if (!contextConfig) {
64
- throw createApiError({
65
- code: 'not_found',
66
- message: 'Context configuration not found',
67
- });
68
- }
69
- return c.json({ data: contextConfig });
70
- });
71
- app.openapi(createRoute({
72
- method: 'post',
73
- path: '/',
74
- summary: 'Create Context Configuration',
75
- operationId: 'create-context-config',
76
- tags: ['CRUD Context Config'],
77
- request: {
78
- params: TenantProjectParamsSchema,
79
- body: {
80
- content: {
81
- 'application/json': {
82
- schema: ContextConfigApiInsertSchema,
83
- },
84
- },
85
- },
86
- },
87
- responses: {
88
- 201: {
89
- description: 'Context configuration created successfully',
90
- content: {
91
- 'application/json': {
92
- schema: SingleResponseSchema(ContextConfigApiSelectSchema),
93
- },
94
- },
95
- },
96
- ...commonGetErrorResponses,
97
- },
98
- }), async (c) => {
99
- const { tenantId, projectId } = c.req.valid('param');
100
- const body = c.req.valid('json');
101
- const configData = {
102
- tenantId,
103
- projectId,
104
- ...body,
105
- };
106
- const contextConfig = await createContextConfig(dbClient)(configData);
107
- return c.json({ data: contextConfig }, 201);
108
- });
109
- app.openapi(createRoute({
110
- method: 'put',
111
- path: '/{id}',
112
- summary: 'Update Context Configuration',
113
- operationId: 'update-context-config',
114
- tags: ['CRUD Context Config'],
115
- request: {
116
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
117
- body: {
118
- content: {
119
- 'application/json': {
120
- schema: ContextConfigApiUpdateSchema,
121
- },
122
- },
123
- },
124
- },
125
- responses: {
126
- 200: {
127
- description: 'Context configuration updated successfully',
128
- content: {
129
- 'application/json': {
130
- schema: SingleResponseSchema(ContextConfigApiSelectSchema),
131
- },
132
- },
133
- },
134
- ...commonUpdateErrorResponses,
135
- },
136
- }), async (c) => {
137
- const { tenantId, projectId, id } = c.req.valid('param');
138
- const body = c.req.valid('json');
139
- const updatedContextConfig = await updateContextConfig(dbClient)({
140
- scopes: { tenantId, projectId },
141
- id,
142
- data: body,
143
- });
144
- if (!updatedContextConfig) {
145
- throw createApiError({
146
- code: 'not_found',
147
- message: 'Context configuration not found',
148
- });
149
- }
150
- return c.json({ data: updatedContextConfig });
151
- });
152
- app.openapi(createRoute({
153
- method: 'delete',
154
- path: '/{id}',
155
- summary: 'Delete Context Configuration',
156
- operationId: 'delete-context-config',
157
- tags: ['CRUD Context Config'],
158
- request: {
159
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
160
- },
161
- responses: {
162
- 204: {
163
- description: 'Context configuration deleted successfully',
164
- },
165
- ...commonDeleteErrorResponses,
166
- },
167
- }), async (c) => {
168
- const { tenantId, projectId, id } = c.req.valid('param');
169
- const deleted = await deleteContextConfig(dbClient)({
170
- scopes: { tenantId, projectId },
171
- id,
172
- });
173
- if (!deleted) {
174
- throw createApiError({
175
- code: 'not_found',
176
- message: 'Context configuration not found',
177
- });
178
- }
179
- return c.body(null, 204);
180
- });
181
- export default app;
@@ -1,4 +0,0 @@
1
- import { OpenAPIHono } from '@hono/zod-openapi';
2
- declare const app: OpenAPIHono<import("hono").Env, {}, "/">;
3
- export default app;
4
- //# sourceMappingURL=credentials.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/routes/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAsB7D,QAAA,MAAM,GAAG,0CAAoB,CAAC;AA8P9B,eAAe,GAAG,CAAC"}