@inkeep/agents-core 0.0.0-dev-20250910233133 → 0.0.0-dev-20250910233151
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/chunk-BIIFENNH.js +11 -0
- package/dist/chunk-H2F72PDA.js +15 -0
- package/dist/chunk-MKBO26DX.js +9 -0
- package/dist/chunk-ODONDMHT.js +665 -0
- package/dist/chunk-TSPWAF64.js +821 -0
- package/dist/client-exports.cjs +232 -0
- package/dist/client-exports.d.cts +302 -0
- package/dist/client-exports.d.ts +46 -43
- package/dist/client-exports.js +200 -247
- package/dist/db/schema.cjs +818 -0
- package/dist/db/schema.d.cts +7 -0
- package/dist/db/schema.d.ts +7 -4335
- package/dist/db/schema.js +1 -696
- package/dist/index.cjs +9809 -0
- package/dist/index.d.cts +3992 -0
- package/dist/index.d.ts +3992 -12
- package/dist/index.js +7807 -13
- package/dist/schema-B5YbTpz8.d.ts +4382 -0
- package/dist/schema-E0ulMd3k.d.cts +4382 -0
- package/dist/types/index.cjs +29 -0
- package/dist/types/index.d.cts +123 -0
- package/dist/types/index.d.ts +123 -5
- package/dist/types/index.js +2 -6
- package/dist/{validation/schemas.d.ts → utility-D2Lb-YAS.d.cts} +1350 -617
- package/dist/utility-D2Lb-YAS.d.ts +7946 -0
- package/dist/validation/index.cjs +1617 -0
- package/dist/validation/index.d.cts +63 -0
- package/dist/validation/index.d.ts +63 -4
- package/dist/validation/index.js +1 -5
- package/package.json +2 -2
- package/dist/__tests__/integration/helpers.d.ts +0 -5
- package/dist/__tests__/integration/helpers.d.ts.map +0 -1
- package/dist/__tests__/integration/helpers.js +0 -37
- package/dist/__tests__/integration/helpers.js.map +0 -1
- package/dist/__tests__/setup.d.ts +0 -3
- package/dist/__tests__/setup.d.ts.map +0 -1
- package/dist/__tests__/setup.js +0 -29
- package/dist/__tests__/setup.js.map +0 -1
- package/dist/client-exports.d.ts.map +0 -1
- package/dist/client-exports.js.map +0 -1
- package/dist/context/ContextConfig.d.ts +0 -54
- package/dist/context/ContextConfig.d.ts.map +0 -1
- package/dist/context/ContextConfig.js +0 -302
- package/dist/context/ContextConfig.js.map +0 -1
- package/dist/context/ContextFetcher.d.ts +0 -64
- package/dist/context/ContextFetcher.d.ts.map +0 -1
- package/dist/context/ContextFetcher.js +0 -325
- package/dist/context/ContextFetcher.js.map +0 -1
- package/dist/context/ContextResolver.d.ts +0 -52
- package/dist/context/ContextResolver.d.ts.map +0 -1
- package/dist/context/ContextResolver.js +0 -298
- package/dist/context/ContextResolver.js.map +0 -1
- package/dist/context/TemplateEngine.d.ts +0 -46
- package/dist/context/TemplateEngine.d.ts.map +0 -1
- package/dist/context/TemplateEngine.js +0 -175
- package/dist/context/TemplateEngine.js.map +0 -1
- package/dist/context/context.d.ts +0 -8
- package/dist/context/context.d.ts.map +0 -1
- package/dist/context/context.js +0 -157
- package/dist/context/context.js.map +0 -1
- package/dist/context/contextCache.d.ts +0 -50
- package/dist/context/contextCache.d.ts.map +0 -1
- package/dist/context/contextCache.js +0 -175
- package/dist/context/contextCache.js.map +0 -1
- package/dist/context/index.d.ts +0 -11
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -8
- package/dist/context/index.js.map +0 -1
- package/dist/credential-stores/CredentialStoreRegistry.d.ts +0 -39
- package/dist/credential-stores/CredentialStoreRegistry.d.ts.map +0 -1
- package/dist/credential-stores/CredentialStoreRegistry.js +0 -65
- package/dist/credential-stores/CredentialStoreRegistry.js.map +0 -1
- package/dist/credential-stores/defaults.d.ts +0 -6
- package/dist/credential-stores/defaults.d.ts.map +0 -1
- package/dist/credential-stores/defaults.js +0 -22
- package/dist/credential-stores/defaults.js.map +0 -1
- package/dist/credential-stores/index.d.ts +0 -6
- package/dist/credential-stores/index.d.ts.map +0 -1
- package/dist/credential-stores/index.js +0 -6
- package/dist/credential-stores/index.js.map +0 -1
- package/dist/credential-stores/keychain-store.d.ts +0 -100
- package/dist/credential-stores/keychain-store.d.ts.map +0 -1
- package/dist/credential-stores/keychain-store.js +0 -225
- package/dist/credential-stores/keychain-store.js.map +0 -1
- package/dist/credential-stores/memory-store.d.ts +0 -39
- package/dist/credential-stores/memory-store.d.ts.map +0 -1
- package/dist/credential-stores/memory-store.js +0 -58
- package/dist/credential-stores/memory-store.js.map +0 -1
- package/dist/credential-stores/nango-store.d.ts +0 -59
- package/dist/credential-stores/nango-store.d.ts.map +0 -1
- package/dist/credential-stores/nango-store.js +0 -264
- package/dist/credential-stores/nango-store.js.map +0 -1
- package/dist/credential-stuffer/CredentialStuffer.d.ts +0 -80
- package/dist/credential-stuffer/CredentialStuffer.d.ts.map +0 -1
- package/dist/credential-stuffer/CredentialStuffer.js +0 -186
- package/dist/credential-stuffer/CredentialStuffer.js.map +0 -1
- package/dist/credential-stuffer/index.d.ts +0 -2
- package/dist/credential-stuffer/index.d.ts.map +0 -1
- package/dist/credential-stuffer/index.js +0 -2
- package/dist/credential-stuffer/index.js.map +0 -1
- package/dist/data-access/agentDataComponents.d.ts +0 -1
- package/dist/data-access/agentDataComponents.d.ts.map +0 -1
- package/dist/data-access/agentDataComponents.js +0 -2
- package/dist/data-access/agentDataComponents.js.map +0 -1
- package/dist/data-access/agentGraphs.d.ts +0 -399
- package/dist/data-access/agentGraphs.d.ts.map +0 -1
- package/dist/data-access/agentGraphs.js +0 -551
- package/dist/data-access/agentGraphs.js.map +0 -1
- package/dist/data-access/agentRelations.d.ts +0 -456
- package/dist/data-access/agentRelations.d.ts.map +0 -1
- package/dist/data-access/agentRelations.js +0 -471
- package/dist/data-access/agentRelations.js.map +0 -1
- package/dist/data-access/agents.d.ts +0 -218
- package/dist/data-access/agents.d.ts.map +0 -1
- package/dist/data-access/agents.js +0 -130
- package/dist/data-access/agents.js.map +0 -1
- package/dist/data-access/apiKeys.d.ts +0 -114
- package/dist/data-access/apiKeys.d.ts.map +0 -1
- package/dist/data-access/apiKeys.js +0 -185
- package/dist/data-access/apiKeys.js.map +0 -1
- package/dist/data-access/artifactComponents.d.ts +0 -152
- package/dist/data-access/artifactComponents.d.ts.map +0 -1
- package/dist/data-access/artifactComponents.js +0 -214
- package/dist/data-access/artifactComponents.js.map +0 -1
- package/dist/data-access/contextCache.d.ts +0 -68
- package/dist/data-access/contextCache.d.ts.map +0 -1
- package/dist/data-access/contextCache.js +0 -135
- package/dist/data-access/contextCache.js.map +0 -1
- package/dist/data-access/contextConfigs.d.ts +0 -110
- package/dist/data-access/contextConfigs.d.ts.map +0 -1
- package/dist/data-access/contextConfigs.js +0 -156
- package/dist/data-access/contextConfigs.js.map +0 -1
- package/dist/data-access/conversations.d.ts +0 -125
- package/dist/data-access/conversations.d.ts.map +0 -1
- package/dist/data-access/conversations.js +0 -244
- package/dist/data-access/conversations.js.map +0 -1
- package/dist/data-access/credentialReferences.d.ts +0 -86
- package/dist/data-access/credentialReferences.d.ts.map +0 -1
- package/dist/data-access/credentialReferences.js +0 -175
- package/dist/data-access/credentialReferences.js.map +0 -1
- package/dist/data-access/dataComponents.d.ts +0 -129
- package/dist/data-access/dataComponents.d.ts.map +0 -1
- package/dist/data-access/dataComponents.js +0 -213
- package/dist/data-access/dataComponents.js.map +0 -1
- package/dist/data-access/externalAgents.d.ts +0 -83
- package/dist/data-access/externalAgents.d.ts.map +0 -1
- package/dist/data-access/externalAgents.js +0 -163
- package/dist/data-access/externalAgents.js.map +0 -1
- package/dist/data-access/graphFull.d.ts +0 -32
- package/dist/data-access/graphFull.d.ts.map +0 -1
- package/dist/data-access/graphFull.js +0 -996
- package/dist/data-access/graphFull.js.map +0 -1
- package/dist/data-access/index.d.ts +0 -21
- package/dist/data-access/index.d.ts.map +0 -1
- package/dist/data-access/index.js +0 -22
- package/dist/data-access/index.js.map +0 -1
- package/dist/data-access/ledgerArtifacts.d.ts +0 -49
- package/dist/data-access/ledgerArtifacts.d.ts.map +0 -1
- package/dist/data-access/ledgerArtifacts.js +0 -112
- package/dist/data-access/ledgerArtifacts.js.map +0 -1
- package/dist/data-access/messages.d.ts +0 -209
- package/dist/data-access/messages.d.ts.map +0 -1
- package/dist/data-access/messages.js +0 -100
- package/dist/data-access/messages.js.map +0 -1
- package/dist/data-access/projects.d.ts +0 -67
- package/dist/data-access/projects.d.ts.map +0 -1
- package/dist/data-access/projects.js +0 -337
- package/dist/data-access/projects.js.map +0 -1
- package/dist/data-access/tasks.d.ts +0 -37
- package/dist/data-access/tasks.d.ts.map +0 -1
- package/dist/data-access/tasks.js +0 -40
- package/dist/data-access/tasks.js.map +0 -1
- package/dist/data-access/tools.d.ts +0 -277
- package/dist/data-access/tools.d.ts.map +0 -1
- package/dist/data-access/tools.js +0 -183
- package/dist/data-access/tools.js.map +0 -1
- package/dist/data-access/validation.d.ts +0 -17
- package/dist/data-access/validation.d.ts.map +0 -1
- package/dist/data-access/validation.js +0 -52
- package/dist/data-access/validation.js.map +0 -1
- package/dist/db/clean.d.ts +0 -6
- package/dist/db/clean.d.ts.map +0 -1
- package/dist/db/clean.js +0 -81
- package/dist/db/clean.js.map +0 -1
- package/dist/db/client.d.ts +0 -19
- package/dist/db/client.d.ts.map +0 -1
- package/dist/db/client.js +0 -24
- package/dist/db/client.js.map +0 -1
- package/dist/db/schema.d.ts.map +0 -1
- package/dist/db/schema.js.map +0 -1
- package/dist/db/test-client.d.ts +0 -25
- package/dist/db/test-client.d.ts.map +0 -1
- package/dist/db/test-client.js +0 -136
- package/dist/db/test-client.js.map +0 -1
- package/dist/env.d.ts +0 -19
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js +0 -49
- package/dist/env.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/middleware/contextValidation.d.ts +0 -49
- package/dist/middleware/contextValidation.d.ts.map +0 -1
- package/dist/middleware/contextValidation.js +0 -473
- package/dist/middleware/contextValidation.js.map +0 -1
- package/dist/middleware/index.d.ts +0 -2
- package/dist/middleware/index.d.ts.map +0 -1
- package/dist/middleware/index.js +0 -2
- package/dist/middleware/index.js.map +0 -1
- package/dist/types/a2a.d.ts +0 -373
- package/dist/types/a2a.d.ts.map +0 -1
- package/dist/types/a2a.js +0 -14
- package/dist/types/a2a.js.map +0 -1
- package/dist/types/entities.d.ts +0 -147
- package/dist/types/entities.d.ts.map +0 -1
- package/dist/types/entities.js +0 -2
- package/dist/types/entities.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/server.d.ts +0 -116
- package/dist/types/server.d.ts.map +0 -1
- package/dist/types/server.js +0 -2
- package/dist/types/server.js.map +0 -1
- package/dist/types/utility.d.ts +0 -213
- package/dist/types/utility.d.ts.map +0 -1
- package/dist/types/utility.js +0 -9
- package/dist/types/utility.js.map +0 -1
- package/dist/utils/apiKeys.d.ts +0 -32
- package/dist/utils/apiKeys.d.ts.map +0 -1
- package/dist/utils/apiKeys.js +0 -117
- package/dist/utils/apiKeys.js.map +0 -1
- package/dist/utils/auth-detection.d.ts +0 -23
- package/dist/utils/auth-detection.d.ts.map +0 -1
- package/dist/utils/auth-detection.js +0 -148
- package/dist/utils/auth-detection.js.map +0 -1
- package/dist/utils/credential-store-utils.d.ts +0 -11
- package/dist/utils/credential-store-utils.d.ts.map +0 -1
- package/dist/utils/credential-store-utils.js +0 -19
- package/dist/utils/credential-store-utils.js.map +0 -1
- package/dist/utils/error.d.ts +0 -526
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js +0 -282
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/execution.d.ts +0 -18
- package/dist/utils/execution.d.ts.map +0 -1
- package/dist/utils/execution.js +0 -25
- package/dist/utils/execution.js.map +0 -1
- package/dist/utils/index.d.ts +0 -9
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -9
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -79
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -102
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/logging.d.ts +0 -11
- package/dist/utils/logging.d.ts.map +0 -1
- package/dist/utils/logging.js +0 -6
- package/dist/utils/logging.js.map +0 -1
- package/dist/utils/mcp-client.d.ts +0 -48
- package/dist/utils/mcp-client.d.ts.map +0 -1
- package/dist/utils/mcp-client.js +0 -174
- package/dist/utils/mcp-client.js.map +0 -1
- package/dist/utils/tracer.d.ts +0 -24
- package/dist/utils/tracer.d.ts.map +0 -1
- package/dist/utils/tracer.js +0 -110
- package/dist/utils/tracer.js.map +0 -1
- package/dist/validation/graphFull.d.ts +0 -36
- package/dist/validation/graphFull.d.ts.map +0 -1
- package/dist/validation/graphFull.js +0 -128
- package/dist/validation/graphFull.js.map +0 -1
- package/dist/validation/id-validation.d.ts +0 -38
- package/dist/validation/id-validation.d.ts.map +0 -1
- package/dist/validation/id-validation.js +0 -60
- package/dist/validation/id-validation.js.map +0 -1
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/schemas.d.ts.map +0 -1
- package/dist/validation/schemas.js +0 -576
- package/dist/validation/schemas.js.map +0 -1
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import type { DatabaseClient } from '../db/client';
|
|
2
|
-
import type { AgentInsert, AgentSelect, AgentUpdate } from '../types/entities';
|
|
3
|
-
import type { PaginationConfig, ScopeConfig } from '../types/utility';
|
|
4
|
-
export declare const getAgentById: (db: DatabaseClient) => (params: {
|
|
5
|
-
scopes: ScopeConfig;
|
|
6
|
-
agentId: string;
|
|
7
|
-
}) => Promise<{
|
|
8
|
-
tenantId: string;
|
|
9
|
-
projectId: string;
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
prompt: string;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
updatedAt: string;
|
|
16
|
-
models: {
|
|
17
|
-
base?: {
|
|
18
|
-
model?: string | undefined;
|
|
19
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
20
|
-
} | undefined;
|
|
21
|
-
structuredOutput?: {
|
|
22
|
-
model?: string | undefined;
|
|
23
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
24
|
-
} | undefined;
|
|
25
|
-
summarizer?: {
|
|
26
|
-
model?: string | undefined;
|
|
27
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
28
|
-
} | undefined;
|
|
29
|
-
} | null;
|
|
30
|
-
stopWhen: {
|
|
31
|
-
stepCountIs?: number;
|
|
32
|
-
} | null;
|
|
33
|
-
conversationHistoryConfig: import("..").ConversationHistoryConfig | null;
|
|
34
|
-
} | undefined>;
|
|
35
|
-
export declare const listAgents: (db: DatabaseClient) => (params: {
|
|
36
|
-
scopes: ScopeConfig;
|
|
37
|
-
}) => Promise<{
|
|
38
|
-
tenantId: string;
|
|
39
|
-
projectId: string;
|
|
40
|
-
id: string;
|
|
41
|
-
name: string;
|
|
42
|
-
description: string;
|
|
43
|
-
prompt: string;
|
|
44
|
-
createdAt: string;
|
|
45
|
-
updatedAt: string;
|
|
46
|
-
models: {
|
|
47
|
-
base?: {
|
|
48
|
-
model?: string | undefined;
|
|
49
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
50
|
-
} | undefined;
|
|
51
|
-
structuredOutput?: {
|
|
52
|
-
model?: string | undefined;
|
|
53
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
54
|
-
} | undefined;
|
|
55
|
-
summarizer?: {
|
|
56
|
-
model?: string | undefined;
|
|
57
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
58
|
-
} | undefined;
|
|
59
|
-
} | null;
|
|
60
|
-
stopWhen: {
|
|
61
|
-
stepCountIs?: number;
|
|
62
|
-
} | null;
|
|
63
|
-
conversationHistoryConfig: import("..").ConversationHistoryConfig | null;
|
|
64
|
-
}[]>;
|
|
65
|
-
export declare const listAgentsPaginated: (db: DatabaseClient) => (params: {
|
|
66
|
-
scopes: ScopeConfig;
|
|
67
|
-
pagination?: PaginationConfig;
|
|
68
|
-
}) => Promise<{
|
|
69
|
-
data: {
|
|
70
|
-
tenantId: string;
|
|
71
|
-
projectId: string;
|
|
72
|
-
id: string;
|
|
73
|
-
name: string;
|
|
74
|
-
description: string;
|
|
75
|
-
prompt: string;
|
|
76
|
-
conversationHistoryConfig: import("..").ConversationHistoryConfig | null;
|
|
77
|
-
models: {
|
|
78
|
-
base?: {
|
|
79
|
-
model?: string | undefined;
|
|
80
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
81
|
-
} | undefined;
|
|
82
|
-
structuredOutput?: {
|
|
83
|
-
model?: string | undefined;
|
|
84
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
85
|
-
} | undefined;
|
|
86
|
-
summarizer?: {
|
|
87
|
-
model?: string | undefined;
|
|
88
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
89
|
-
} | undefined;
|
|
90
|
-
} | null;
|
|
91
|
-
stopWhen: {
|
|
92
|
-
stepCountIs?: number;
|
|
93
|
-
} | null;
|
|
94
|
-
createdAt: string;
|
|
95
|
-
updatedAt: string;
|
|
96
|
-
}[];
|
|
97
|
-
pagination: {
|
|
98
|
-
page: number;
|
|
99
|
-
limit: number;
|
|
100
|
-
total: number;
|
|
101
|
-
pages: number;
|
|
102
|
-
};
|
|
103
|
-
}>;
|
|
104
|
-
export declare const createAgent: (db: DatabaseClient) => (params: AgentInsert) => Promise<{
|
|
105
|
-
tenantId: string;
|
|
106
|
-
projectId: string;
|
|
107
|
-
id: string;
|
|
108
|
-
name: string;
|
|
109
|
-
description: string;
|
|
110
|
-
prompt: string;
|
|
111
|
-
createdAt: string;
|
|
112
|
-
updatedAt: string;
|
|
113
|
-
models: {
|
|
114
|
-
base?: {
|
|
115
|
-
model?: string | undefined;
|
|
116
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
117
|
-
} | undefined;
|
|
118
|
-
structuredOutput?: {
|
|
119
|
-
model?: string | undefined;
|
|
120
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
121
|
-
} | undefined;
|
|
122
|
-
summarizer?: {
|
|
123
|
-
model?: string | undefined;
|
|
124
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
125
|
-
} | undefined;
|
|
126
|
-
} | null;
|
|
127
|
-
stopWhen: {
|
|
128
|
-
stepCountIs?: number;
|
|
129
|
-
} | null;
|
|
130
|
-
conversationHistoryConfig: import("..").ConversationHistoryConfig | null;
|
|
131
|
-
}>;
|
|
132
|
-
export declare const updateAgent: (db: DatabaseClient) => (params: {
|
|
133
|
-
scopes: ScopeConfig;
|
|
134
|
-
agentId: string;
|
|
135
|
-
data: AgentUpdate;
|
|
136
|
-
}) => Promise<{
|
|
137
|
-
tenantId: string;
|
|
138
|
-
projectId: string;
|
|
139
|
-
id: string;
|
|
140
|
-
name: string;
|
|
141
|
-
description: string;
|
|
142
|
-
prompt: string;
|
|
143
|
-
createdAt: string;
|
|
144
|
-
updatedAt: string;
|
|
145
|
-
models: {
|
|
146
|
-
base?: {
|
|
147
|
-
model?: string | undefined;
|
|
148
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
149
|
-
} | undefined;
|
|
150
|
-
structuredOutput?: {
|
|
151
|
-
model?: string | undefined;
|
|
152
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
153
|
-
} | undefined;
|
|
154
|
-
summarizer?: {
|
|
155
|
-
model?: string | undefined;
|
|
156
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
157
|
-
} | undefined;
|
|
158
|
-
} | null;
|
|
159
|
-
stopWhen: {
|
|
160
|
-
stepCountIs?: number;
|
|
161
|
-
} | null;
|
|
162
|
-
conversationHistoryConfig: import("..").ConversationHistoryConfig | null;
|
|
163
|
-
}>;
|
|
164
|
-
/**
|
|
165
|
-
* Upsert agent (create if it doesn't exist, update if it does)
|
|
166
|
-
*/
|
|
167
|
-
export declare const upsertAgent: (db: DatabaseClient) => (params: {
|
|
168
|
-
data: AgentInsert;
|
|
169
|
-
}) => Promise<AgentSelect>;
|
|
170
|
-
export declare const deleteAgent: (db: DatabaseClient) => (params: {
|
|
171
|
-
scopes: ScopeConfig;
|
|
172
|
-
agentId: string;
|
|
173
|
-
}) => Promise<boolean>;
|
|
174
|
-
export declare const getAgentsByIds: (db: DatabaseClient) => (params: {
|
|
175
|
-
scopes: ScopeConfig;
|
|
176
|
-
agentIds: string[];
|
|
177
|
-
}) => Promise<{
|
|
178
|
-
tenantId: string;
|
|
179
|
-
projectId: string;
|
|
180
|
-
id: string;
|
|
181
|
-
name: string;
|
|
182
|
-
description: string;
|
|
183
|
-
prompt: string;
|
|
184
|
-
conversationHistoryConfig: import("..").ConversationHistoryConfig | null;
|
|
185
|
-
models: {
|
|
186
|
-
base?: {
|
|
187
|
-
model?: string | undefined;
|
|
188
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
189
|
-
} | undefined;
|
|
190
|
-
structuredOutput?: {
|
|
191
|
-
model?: string | undefined;
|
|
192
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
193
|
-
} | undefined;
|
|
194
|
-
summarizer?: {
|
|
195
|
-
model?: string | undefined;
|
|
196
|
-
providerOptions?: Record<string, unknown> | undefined;
|
|
197
|
-
} | undefined;
|
|
198
|
-
} | null;
|
|
199
|
-
stopWhen: {
|
|
200
|
-
stepCountIs?: number;
|
|
201
|
-
} | null;
|
|
202
|
-
createdAt: string;
|
|
203
|
-
updatedAt: string;
|
|
204
|
-
}[]>;
|
|
205
|
-
export declare const getAgentInGraphContext: (db: DatabaseClient) => (params: {
|
|
206
|
-
scopes: ScopeConfig;
|
|
207
|
-
graphId: string;
|
|
208
|
-
agentId: string;
|
|
209
|
-
}) => Promise<{
|
|
210
|
-
id: string;
|
|
211
|
-
name: string;
|
|
212
|
-
description: string;
|
|
213
|
-
prompt: string;
|
|
214
|
-
tenantId: string;
|
|
215
|
-
graphId: string;
|
|
216
|
-
sourceAgentId: string;
|
|
217
|
-
}[]>;
|
|
218
|
-
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":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AY,QAAQ;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,qBAiB9E,CAAC;AAEJ,eAAO,MAAM,cAAc,GACxB,IAAI,cAAc,MAAY,QAAQ;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;IAejF,CAAC;AAEJ,eAAO,MAAM,sBAAsB,GAChC,IAAI,cAAc,MACZ,QAAQ;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;;;;;;;;IA6BvE,CAAC"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { and, count, desc, eq, inArray } from 'drizzle-orm';
|
|
2
|
-
import { agentRelations, agents } from '../db/schema';
|
|
3
|
-
export const getAgentById = (db) => async (params) => {
|
|
4
|
-
const result = await db.query.agents.findFirst({
|
|
5
|
-
where: and(eq(agents.tenantId, params.scopes.tenantId), eq(agents.projectId, params.scopes.projectId), eq(agents.id, params.agentId)),
|
|
6
|
-
});
|
|
7
|
-
return result;
|
|
8
|
-
};
|
|
9
|
-
export const listAgents = (db) => async (params) => {
|
|
10
|
-
return await db.query.agents.findMany({
|
|
11
|
-
where: and(eq(agents.tenantId, params.scopes.tenantId), eq(agents.projectId, params.scopes.projectId)),
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
export const listAgentsPaginated = (db) => async (params) => {
|
|
15
|
-
const page = params.pagination?.page || 1;
|
|
16
|
-
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
17
|
-
const offset = (page - 1) * limit;
|
|
18
|
-
const whereClause = and(eq(agents.tenantId, params.scopes.tenantId), eq(agents.projectId, params.scopes.projectId));
|
|
19
|
-
const [data, totalResult] = await Promise.all([
|
|
20
|
-
db
|
|
21
|
-
.select()
|
|
22
|
-
.from(agents)
|
|
23
|
-
.where(whereClause)
|
|
24
|
-
.limit(limit)
|
|
25
|
-
.offset(offset)
|
|
26
|
-
.orderBy(desc(agents.createdAt)),
|
|
27
|
-
db.select({ count: count() }).from(agents).where(whereClause),
|
|
28
|
-
]);
|
|
29
|
-
const total = totalResult[0]?.count || 0;
|
|
30
|
-
const pages = Math.ceil(total / limit);
|
|
31
|
-
return {
|
|
32
|
-
data,
|
|
33
|
-
pagination: { page, limit, total, pages },
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export const createAgent = (db) => async (params) => {
|
|
37
|
-
const agent = await db.insert(agents).values(params).returning();
|
|
38
|
-
return agent[0];
|
|
39
|
-
};
|
|
40
|
-
export const updateAgent = (db) => async (params) => {
|
|
41
|
-
const data = params.data;
|
|
42
|
-
// Handle model settings clearing - if empty object with no meaningful values, set to null
|
|
43
|
-
if (data.models !== undefined) {
|
|
44
|
-
if (!data.models ||
|
|
45
|
-
(!data.models.base?.model &&
|
|
46
|
-
!data.models.structuredOutput?.model &&
|
|
47
|
-
!data.models.summarizer?.model &&
|
|
48
|
-
!data.models.base?.providerOptions &&
|
|
49
|
-
!data.models.structuredOutput?.providerOptions &&
|
|
50
|
-
!data.models.summarizer?.providerOptions)) {
|
|
51
|
-
data.models = null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const updateData = {
|
|
55
|
-
...data,
|
|
56
|
-
updatedAt: new Date().toISOString(),
|
|
57
|
-
};
|
|
58
|
-
const agent = await db
|
|
59
|
-
.update(agents)
|
|
60
|
-
.set(updateData)
|
|
61
|
-
.where(and(eq(agents.tenantId, params.scopes.tenantId), eq(agents.projectId, params.scopes.projectId), eq(agents.id, params.agentId)))
|
|
62
|
-
.returning();
|
|
63
|
-
return agent[0] ?? null;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Upsert agent (create if it doesn't exist, update if it does)
|
|
67
|
-
*/
|
|
68
|
-
export const upsertAgent = (db) => async (params) => {
|
|
69
|
-
const scopes = { tenantId: params.data.tenantId, projectId: params.data.projectId };
|
|
70
|
-
const existing = await getAgentById(db)({
|
|
71
|
-
scopes,
|
|
72
|
-
agentId: params.data.id,
|
|
73
|
-
});
|
|
74
|
-
if (existing) {
|
|
75
|
-
// Update existing agent
|
|
76
|
-
const updated = await updateAgent(db)({
|
|
77
|
-
scopes,
|
|
78
|
-
agentId: params.data.id,
|
|
79
|
-
data: {
|
|
80
|
-
name: params.data.name,
|
|
81
|
-
description: params.data.description,
|
|
82
|
-
prompt: params.data.prompt,
|
|
83
|
-
conversationHistoryConfig: params.data.conversationHistoryConfig,
|
|
84
|
-
models: params.data.models,
|
|
85
|
-
stopWhen: params.data.stopWhen,
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
return updated; // We know it exists since we just updated it
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
// Create new agent
|
|
92
|
-
return await createAgent(db)(params.data);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
export const deleteAgent = (db) => async (params) => {
|
|
96
|
-
await db
|
|
97
|
-
.delete(agents)
|
|
98
|
-
.where(and(eq(agents.tenantId, params.scopes.tenantId), eq(agents.projectId, params.scopes.projectId), eq(agents.id, params.agentId)));
|
|
99
|
-
// Check if agent still exists to confirm deletion
|
|
100
|
-
const deletedAgent = await getAgentById(db)({
|
|
101
|
-
scopes: params.scopes,
|
|
102
|
-
agentId: params.agentId,
|
|
103
|
-
});
|
|
104
|
-
return deletedAgent === undefined;
|
|
105
|
-
};
|
|
106
|
-
export const getAgentsByIds = (db) => async (params) => {
|
|
107
|
-
if (params.agentIds.length === 0) {
|
|
108
|
-
return [];
|
|
109
|
-
}
|
|
110
|
-
return await db
|
|
111
|
-
.select()
|
|
112
|
-
.from(agents)
|
|
113
|
-
.where(and(eq(agents.tenantId, params.scopes.tenantId), eq(agents.projectId, params.scopes.projectId), inArray(agents.id, params.agentIds)));
|
|
114
|
-
};
|
|
115
|
-
export const getAgentInGraphContext = (db) => async (params) => {
|
|
116
|
-
return await db
|
|
117
|
-
.select({
|
|
118
|
-
id: agents.id,
|
|
119
|
-
name: agents.name,
|
|
120
|
-
description: agents.description,
|
|
121
|
-
prompt: agents.prompt,
|
|
122
|
-
tenantId: agents.tenantId,
|
|
123
|
-
graphId: agentRelations.graphId,
|
|
124
|
-
sourceAgentId: agentRelations.sourceAgentId,
|
|
125
|
-
})
|
|
126
|
-
.from(agents)
|
|
127
|
-
.innerJoin(agentRelations, and(eq(agents.tenantId, agentRelations.tenantId), eq(agents.projectId, agentRelations.projectId), eq(agents.id, agentRelations.sourceAgentId), eq(agentRelations.graphId, params.graphId)))
|
|
128
|
-
.where(and(eq(agents.tenantId, params.scopes.tenantId), eq(agents.projectId, params.scopes.projectId), eq(agents.id, params.agentId), eq(agentRelations.graphId, params.graphId)));
|
|
129
|
-
};
|
|
130
|
-
//# sourceMappingURL=agents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/data-access/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItD,MAAM,CAAC,MAAM,YAAY,GACvB,CAAC,EAAkB,EAAE,EAAE,CAAC,KAAK,EAAE,MAAgD,EAAE,EAAE;IACjF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;QAC7C,KAAK,EAAE,GAAG,CACR,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAC3C,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAC7C,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,C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C9C,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,CAAC,aAAa,CAAC,EAC3C,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAC3C,CACF;SACA,KAAK,CACJ,GAAG,CACD,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAC3C,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAC7C,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,EAC7B,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAC3C,CACF,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type { DatabaseClient } from '../db/client';
|
|
2
|
-
import type { ApiKeyInsert, ApiKeySelect, ApiKeyUpdate } from '../types/entities';
|
|
3
|
-
import type { ApiKeyCreateResult, CreateApiKeyParams, PaginationConfig, ScopeConfig } from '../types/utility';
|
|
4
|
-
export declare const getApiKeyById: (db: DatabaseClient) => (params: {
|
|
5
|
-
scopes: ScopeConfig;
|
|
6
|
-
id: string;
|
|
7
|
-
}) => Promise<{
|
|
8
|
-
tenantId: string;
|
|
9
|
-
projectId: string;
|
|
10
|
-
id: string;
|
|
11
|
-
graphId: string;
|
|
12
|
-
publicId: string;
|
|
13
|
-
keyHash: string;
|
|
14
|
-
keyPrefix: string;
|
|
15
|
-
lastUsedAt: string | null;
|
|
16
|
-
expiresAt: string | null;
|
|
17
|
-
createdAt: string;
|
|
18
|
-
updatedAt: string;
|
|
19
|
-
} | undefined>;
|
|
20
|
-
export declare const getApiKeyByPublicId: (db: DatabaseClient) => (publicId: string) => Promise<{
|
|
21
|
-
tenantId: string;
|
|
22
|
-
projectId: string;
|
|
23
|
-
id: string;
|
|
24
|
-
graphId: string;
|
|
25
|
-
publicId: string;
|
|
26
|
-
keyHash: string;
|
|
27
|
-
keyPrefix: string;
|
|
28
|
-
lastUsedAt: string | null;
|
|
29
|
-
expiresAt: string | null;
|
|
30
|
-
createdAt: string;
|
|
31
|
-
updatedAt: string;
|
|
32
|
-
} | undefined>;
|
|
33
|
-
export declare const listApiKeys: (db: DatabaseClient) => (params: {
|
|
34
|
-
scopes: ScopeConfig;
|
|
35
|
-
graphId?: string;
|
|
36
|
-
}) => Promise<{
|
|
37
|
-
tenantId: string;
|
|
38
|
-
projectId: string;
|
|
39
|
-
id: string;
|
|
40
|
-
graphId: string;
|
|
41
|
-
publicId: string;
|
|
42
|
-
keyHash: string;
|
|
43
|
-
keyPrefix: string;
|
|
44
|
-
lastUsedAt: string | null;
|
|
45
|
-
expiresAt: string | null;
|
|
46
|
-
createdAt: string;
|
|
47
|
-
updatedAt: string;
|
|
48
|
-
}[]>;
|
|
49
|
-
export declare const listApiKeysPaginated: (db: DatabaseClient) => (params: {
|
|
50
|
-
scopes: ScopeConfig;
|
|
51
|
-
pagination?: PaginationConfig;
|
|
52
|
-
graphId?: string;
|
|
53
|
-
}) => Promise<{
|
|
54
|
-
data: ApiKeySelect[];
|
|
55
|
-
pagination: {
|
|
56
|
-
page: number;
|
|
57
|
-
limit: number;
|
|
58
|
-
total: number;
|
|
59
|
-
pages: number;
|
|
60
|
-
};
|
|
61
|
-
}>;
|
|
62
|
-
export declare const createApiKey: (db: DatabaseClient) => (params: ApiKeyInsert) => Promise<{
|
|
63
|
-
tenantId: string;
|
|
64
|
-
projectId: string;
|
|
65
|
-
id: string;
|
|
66
|
-
graphId: string;
|
|
67
|
-
publicId: string;
|
|
68
|
-
keyHash: string;
|
|
69
|
-
keyPrefix: string;
|
|
70
|
-
lastUsedAt: string | null;
|
|
71
|
-
expiresAt: string | null;
|
|
72
|
-
createdAt: string;
|
|
73
|
-
updatedAt: string;
|
|
74
|
-
}>;
|
|
75
|
-
export declare const updateApiKey: (db: DatabaseClient) => (params: {
|
|
76
|
-
scopes: ScopeConfig;
|
|
77
|
-
id: string;
|
|
78
|
-
data: ApiKeyUpdate;
|
|
79
|
-
}) => Promise<{
|
|
80
|
-
tenantId: string;
|
|
81
|
-
projectId: string;
|
|
82
|
-
id: string;
|
|
83
|
-
graphId: string;
|
|
84
|
-
publicId: string;
|
|
85
|
-
keyHash: string;
|
|
86
|
-
keyPrefix: string;
|
|
87
|
-
lastUsedAt: string | null;
|
|
88
|
-
expiresAt: string | null;
|
|
89
|
-
createdAt: string;
|
|
90
|
-
updatedAt: string;
|
|
91
|
-
}>;
|
|
92
|
-
export declare const deleteApiKey: (db: DatabaseClient) => (params: {
|
|
93
|
-
scopes: ScopeConfig;
|
|
94
|
-
id: string;
|
|
95
|
-
}) => Promise<boolean>;
|
|
96
|
-
export declare const hasApiKey: (db: DatabaseClient) => (params: {
|
|
97
|
-
scopes: ScopeConfig;
|
|
98
|
-
id: string;
|
|
99
|
-
}) => Promise<boolean>;
|
|
100
|
-
export declare const updateApiKeyLastUsed: (db: DatabaseClient) => (id: string) => Promise<void>;
|
|
101
|
-
export declare const countApiKeys: (db: DatabaseClient) => (params: {
|
|
102
|
-
scopes: ScopeConfig;
|
|
103
|
-
graphId?: string;
|
|
104
|
-
}) => Promise<number>;
|
|
105
|
-
/**
|
|
106
|
-
* Create a new API key
|
|
107
|
-
* Returns both the API key record and the full key (which should be shown to the user only once)
|
|
108
|
-
*/
|
|
109
|
-
export declare const generateAndCreateApiKey: (params: CreateApiKeyParams, db: DatabaseClient) => Promise<ApiKeyCreateResult>;
|
|
110
|
-
/**
|
|
111
|
-
* Validate an API key and return the associated record if valid
|
|
112
|
-
*/
|
|
113
|
-
export declare const validateAndGetApiKey: (key: string, db: DatabaseClient) => Promise<ApiKeySelect | null>;
|
|
114
|
-
//# sourceMappingURL=apiKeys.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiKeys.d.ts","sourceRoot":"","sources":["../../src/data-access/apiKeys.ts"],"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,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAE;;;;;;;;;;;;EAmBrE,CAAC;AAEJ,eAAO,MAAM,YAAY,GACtB,IAAI,cAAc,MACZ,QAAQ;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,KAAG,OAAO,CAAC,OAAO,CA2BnE,CAAC;AAEJ,eAAO,MAAM,SAAS,GACnB,IAAI,cAAc,MACZ,QAAQ;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,KAAG,OAAO,CAAC,OAAO,CAGnE,CAAC;AAEJ,eAAO,MAAM,oBAAoB,GAC9B,IAAI,cAAc,MACZ,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CAK/B,CAAC;AAEJ,eAAO,MAAM,YAAY,GACtB,IAAI,cAAc,MACZ,QAAQ;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,OAAO,CAAC,MAAM,CAiBxE,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,kBAAkB,EAC1B,IAAI,cAAc,KACjB,OAAO,CAAC,kBAAkB,CAmB5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,KAAK,MAAM,EACX,IAAI,cAAc,KACjB,OAAO,CAAC,YAAY,GAAG,IAAI,CAiC7B,CAAC"}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { and, count, desc, eq } from 'drizzle-orm';
|
|
2
|
-
import { apiKeys } from '../db/schema';
|
|
3
|
-
import { extractPublicId, generateApiKey, isApiKeyExpired, validateApiKey } from '../utils/apiKeys';
|
|
4
|
-
export const getApiKeyById = (db) => async (params) => {
|
|
5
|
-
return await db.query.apiKeys.findFirst({
|
|
6
|
-
where: and(eq(apiKeys.tenantId, params.scopes.tenantId), eq(apiKeys.projectId, params.scopes.projectId), eq(apiKeys.id, params.id)),
|
|
7
|
-
});
|
|
8
|
-
};
|
|
9
|
-
export const getApiKeyByPublicId = (db) => async (publicId) => {
|
|
10
|
-
return await db.query.apiKeys.findFirst({
|
|
11
|
-
where: eq(apiKeys.publicId, publicId),
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
export const listApiKeys = (db) => async (params) => {
|
|
15
|
-
const conditions = [
|
|
16
|
-
eq(apiKeys.tenantId, params.scopes.tenantId),
|
|
17
|
-
eq(apiKeys.projectId, params.scopes.projectId),
|
|
18
|
-
];
|
|
19
|
-
if (params.graphId) {
|
|
20
|
-
conditions.push(eq(apiKeys.graphId, params.graphId));
|
|
21
|
-
}
|
|
22
|
-
return await db.query.apiKeys.findMany({
|
|
23
|
-
where: and(...conditions),
|
|
24
|
-
orderBy: [desc(apiKeys.createdAt)],
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
export const listApiKeysPaginated = (db) => async (params) => {
|
|
28
|
-
const page = params.pagination?.page || 1;
|
|
29
|
-
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
30
|
-
const offset = (page - 1) * limit;
|
|
31
|
-
const conditions = [
|
|
32
|
-
eq(apiKeys.tenantId, params.scopes.tenantId),
|
|
33
|
-
eq(apiKeys.projectId, params.scopes.projectId),
|
|
34
|
-
];
|
|
35
|
-
if (params.graphId) {
|
|
36
|
-
conditions.push(eq(apiKeys.graphId, params.graphId));
|
|
37
|
-
}
|
|
38
|
-
const whereClause = and(...conditions);
|
|
39
|
-
const [data, totalResult] = await Promise.all([
|
|
40
|
-
db
|
|
41
|
-
.select()
|
|
42
|
-
.from(apiKeys)
|
|
43
|
-
.where(whereClause)
|
|
44
|
-
.limit(limit)
|
|
45
|
-
.offset(offset)
|
|
46
|
-
.orderBy(desc(apiKeys.createdAt)),
|
|
47
|
-
db.select({ count: count() }).from(apiKeys).where(whereClause),
|
|
48
|
-
]);
|
|
49
|
-
const total = totalResult[0]?.count || 0;
|
|
50
|
-
const totalNumber = typeof total === 'string' ? Number.parseInt(total, 10) : total;
|
|
51
|
-
const pages = Math.ceil(totalNumber / limit);
|
|
52
|
-
return {
|
|
53
|
-
data,
|
|
54
|
-
pagination: { page, limit, total: totalNumber, pages },
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export const createApiKey = (db) => async (params) => {
|
|
58
|
-
const now = new Date().toISOString();
|
|
59
|
-
const [apiKey] = await db
|
|
60
|
-
.insert(apiKeys)
|
|
61
|
-
.values({
|
|
62
|
-
id: params.id,
|
|
63
|
-
tenantId: params.tenantId,
|
|
64
|
-
projectId: params.projectId,
|
|
65
|
-
graphId: params.graphId,
|
|
66
|
-
publicId: params.publicId,
|
|
67
|
-
keyHash: params.keyHash,
|
|
68
|
-
keyPrefix: params.keyPrefix,
|
|
69
|
-
expiresAt: params.expiresAt,
|
|
70
|
-
createdAt: now,
|
|
71
|
-
updatedAt: now,
|
|
72
|
-
})
|
|
73
|
-
.returning();
|
|
74
|
-
return apiKey;
|
|
75
|
-
};
|
|
76
|
-
export const updateApiKey = (db) => async (params) => {
|
|
77
|
-
const now = new Date().toISOString();
|
|
78
|
-
const [updatedKey] = await db
|
|
79
|
-
.update(apiKeys)
|
|
80
|
-
.set({
|
|
81
|
-
expiresAt: params.data.expiresAt,
|
|
82
|
-
updatedAt: now,
|
|
83
|
-
})
|
|
84
|
-
.where(and(eq(apiKeys.tenantId, params.scopes.tenantId), eq(apiKeys.projectId, params.scopes.projectId), eq(apiKeys.id, params.id)))
|
|
85
|
-
.returning();
|
|
86
|
-
return updatedKey;
|
|
87
|
-
};
|
|
88
|
-
export const deleteApiKey = (db) => async (params) => {
|
|
89
|
-
try {
|
|
90
|
-
// Check if the API key exists
|
|
91
|
-
const existingKey = await getApiKeyById(db)({
|
|
92
|
-
scopes: params.scopes,
|
|
93
|
-
id: params.id,
|
|
94
|
-
});
|
|
95
|
-
if (!existingKey) {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
await db
|
|
99
|
-
.delete(apiKeys)
|
|
100
|
-
.where(and(eq(apiKeys.tenantId, params.scopes.tenantId), eq(apiKeys.projectId, params.scopes.projectId), eq(apiKeys.id, params.id)));
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
console.error('Error deleting API key:', error);
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
export const hasApiKey = (db) => async (params) => {
|
|
109
|
-
const apiKey = await getApiKeyById(db)(params);
|
|
110
|
-
return apiKey !== null;
|
|
111
|
-
};
|
|
112
|
-
export const updateApiKeyLastUsed = (db) => async (id) => {
|
|
113
|
-
await db
|
|
114
|
-
.update(apiKeys)
|
|
115
|
-
.set({ lastUsedAt: new Date().toISOString() })
|
|
116
|
-
.where(eq(apiKeys.id, id));
|
|
117
|
-
};
|
|
118
|
-
export const countApiKeys = (db) => async (params) => {
|
|
119
|
-
const conditions = [
|
|
120
|
-
eq(apiKeys.tenantId, params.scopes.tenantId),
|
|
121
|
-
eq(apiKeys.projectId, params.scopes.projectId),
|
|
122
|
-
];
|
|
123
|
-
if (params.graphId) {
|
|
124
|
-
conditions.push(eq(apiKeys.graphId, params.graphId));
|
|
125
|
-
}
|
|
126
|
-
const result = await db
|
|
127
|
-
.select({ count: count() })
|
|
128
|
-
.from(apiKeys)
|
|
129
|
-
.where(and(...conditions));
|
|
130
|
-
const total = result[0]?.count || 0;
|
|
131
|
-
return typeof total === 'string' ? Number.parseInt(total, 10) : total;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Create a new API key
|
|
135
|
-
* Returns both the API key record and the full key (which should be shown to the user only once)
|
|
136
|
-
*/
|
|
137
|
-
export const generateAndCreateApiKey = async (params, db) => {
|
|
138
|
-
const { tenantId, projectId, graphId, expiresAt } = params;
|
|
139
|
-
// Generate the API key
|
|
140
|
-
const keyData = await generateApiKey();
|
|
141
|
-
// Store the API key in the database
|
|
142
|
-
const apiKey = await createApiKey(db)({
|
|
143
|
-
tenantId,
|
|
144
|
-
projectId,
|
|
145
|
-
graphId,
|
|
146
|
-
expiresAt,
|
|
147
|
-
...keyData,
|
|
148
|
-
});
|
|
149
|
-
return {
|
|
150
|
-
apiKey,
|
|
151
|
-
key: keyData.key, // Return the full key to show to the user once
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* Validate an API key and return the associated record if valid
|
|
156
|
-
*/
|
|
157
|
-
export const validateAndGetApiKey = async (key, db) => {
|
|
158
|
-
// Extract publicId from the key for O(1) lookup
|
|
159
|
-
const publicId = extractPublicId(key);
|
|
160
|
-
if (!publicId) {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
// Direct lookup using publicId (O(1) with unique index)
|
|
164
|
-
const apiKey = await getApiKeyByPublicId(db)(publicId);
|
|
165
|
-
if (!apiKey) {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
// Validate the full key against the stored hash
|
|
169
|
-
const isValid = await validateApiKey(key, apiKey.keyHash);
|
|
170
|
-
if (!isValid) {
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
// Check if the key has expired
|
|
174
|
-
if (isApiKeyExpired(apiKey.expiresAt)) {
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
// Update last used timestamp
|
|
178
|
-
await updateApiKey(db)({
|
|
179
|
-
scopes: { tenantId: apiKey.tenantId, projectId: apiKey.projectId },
|
|
180
|
-
id: apiKey.id,
|
|
181
|
-
data: { lastUsedAt: new Date().toISOString() },
|
|
182
|
-
});
|
|
183
|
-
return apiKey;
|
|
184
|
-
};
|
|
185
|
-
//# sourceMappingURL=apiKeys.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiKeys.js","sourceRoot":"","sources":["../../src/data-access/apiKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;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