@axiom-lattice/pg-stores 1.0.80 → 1.0.82
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +18 -0
- package/dist/index.d.mts +29 -3
- package/dist/index.d.ts +29 -3
- package/dist/index.js +253 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +250 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/createPgStoreConfig.ts +2 -0
- package/src/index.ts +10 -0
- package/src/migrations/menu_items_add_file_type.ts +29 -0
- package/src/migrations/menu_items_migration.ts +1 -1
- package/src/migrations/shared_resources_migration.ts +43 -0
- package/src/stores/MenuStore.ts +2 -0
- package/src/stores/PostgresSharedResourceStore.ts +220 -0
- package/src/stores/SharedResourceStore.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/pg-stores@1.0.
|
|
2
|
+
> @axiom-lattice/pg-stores@1.0.82 build /home/runner/work/agentic/agentic/packages/pg-stores
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2020
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m238.68 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m441.54 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 588ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m232.87 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m441.35 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 615ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 17295ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m54.51 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m54.51 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
+
## 1.0.82
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9d3cb30: fix share url
|
|
8
|
+
- Updated dependencies [9d3cb30]
|
|
9
|
+
- @axiom-lattice/core@2.1.91
|
|
10
|
+
- @axiom-lattice/protocols@2.1.46
|
|
11
|
+
|
|
12
|
+
## 1.0.81
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- f2dce99: fix bugs
|
|
17
|
+
- Updated dependencies [f2dce99]
|
|
18
|
+
- @axiom-lattice/core@2.1.90
|
|
19
|
+
- @axiom-lattice/protocols@2.1.45
|
|
20
|
+
|
|
3
21
|
## 1.0.80
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PoolConfig, PoolClient, Pool } from 'pg';
|
|
2
2
|
export { Pool, PoolConfig } from 'pg';
|
|
3
|
-
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, Project, CreateProjectRequest, UpdateProjectRequest, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, WorkflowTrackingStore, CreateWorkflowRunRequest, WorkflowRun, UpdateWorkflowRunRequest, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, A2AApiKeyStore, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
4
|
-
export { Assistant, AssistantStore, Binding, BindingRegistry, ChannelInstallation, ChannelInstallationStore, CreateAssistantRequest, CreateBindingInput, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateEvalCaseRequest, CreateEvalProjectRequest, CreateEvalRunRequest, CreateEvalSuiteRequest, CreateMcpServerConfigRequest, CreateMenuItemInput, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateRunStepRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkflowRunRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, EvalCase, EvalProject, EvalProjectReport, EvalRun, EvalRunResult, EvalStore, EvalSuite, LarkChannelInstallationConfig, McpServerConfigEntry, McpServerConfigStore, MenuItem, MenuRegistry, MetricsServerConfig, MetricsServerConfigEntry, MetricsServerConfigStore, Project, ProjectStore, RunStep, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Skill, SkillStore, StorageType, Tenant, TenantStatus, TenantStore, Thread, ThreadStore, UpdateChannelInstallationRequest, UpdateDatabaseConfigRequest, UpdateMcpServerConfigRequest, UpdateMetricsServerConfigRequest, UpdateProjectRequest, UpdateRunStepRequest, UpdateTenantRequest, UpdateUserRequest, UpdateUserTenantLinkRequest, UpdateWorkflowRunRequest, UpdateWorkspaceRequest, User, UserStore, UserTenantLink, UserTenantLinkStore, UserTenantRole, WorkflowRun, WorkflowTrackingStore, Workspace, WorkspaceStore } from '@axiom-lattice/protocols';
|
|
3
|
+
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, Project, CreateProjectRequest, UpdateProjectRequest, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, WorkflowTrackingStore, CreateWorkflowRunRequest, WorkflowRun, UpdateWorkflowRunRequest, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, A2AApiKeyStore, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SharedResourceStore, ShareRecord, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
4
|
+
export { Assistant, AssistantStore, Binding, BindingRegistry, ChannelInstallation, ChannelInstallationStore, CreateAssistantRequest, CreateBindingInput, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateEvalCaseRequest, CreateEvalProjectRequest, CreateEvalRunRequest, CreateEvalSuiteRequest, CreateMcpServerConfigRequest, CreateMenuItemInput, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateRunStepRequest, CreateShareRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkflowRunRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, EvalCase, EvalProject, EvalProjectReport, EvalRun, EvalRunResult, EvalStore, EvalSuite, LarkChannelInstallationConfig, McpServerConfigEntry, McpServerConfigStore, MenuItem, MenuRegistry, MetricsServerConfig, MetricsServerConfigEntry, MetricsServerConfigStore, Project, ProjectStore, ResourceAddress, RunStep, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ShareRecord, ShareResult, ShareVisibility, SharedResourceStore, Skill, SkillStore, StorageType, Tenant, TenantStatus, TenantStore, Thread, ThreadStore, UpdateChannelInstallationRequest, UpdateDatabaseConfigRequest, UpdateMcpServerConfigRequest, UpdateMetricsServerConfigRequest, UpdateProjectRequest, UpdateRunStepRequest, UpdateTenantRequest, UpdateUserRequest, UpdateUserTenantLinkRequest, UpdateWorkflowRunRequest, UpdateWorkspaceRequest, User, UserStore, UserTenantLink, UserTenantLinkStore, UserTenantRole, WorkflowRun, WorkflowTrackingStore, Workspace, WorkspaceStore } from '@axiom-lattice/protocols';
|
|
5
5
|
import { IMessageQueueStore, AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
|
|
6
6
|
export { AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
|
|
7
7
|
import { PostgresSaver } from '@langchain/langgraph-checkpoint-postgres';
|
|
@@ -1136,6 +1136,27 @@ declare class MenuStore implements MenuRegistry {
|
|
|
1136
1136
|
private mapRowToMenuItem;
|
|
1137
1137
|
}
|
|
1138
1138
|
|
|
1139
|
+
interface PostgresSharedResourceStoreOptions {
|
|
1140
|
+
poolConfig: string | PoolConfig;
|
|
1141
|
+
autoMigrate?: boolean;
|
|
1142
|
+
}
|
|
1143
|
+
declare class PostgresSharedResourceStore implements SharedResourceStore {
|
|
1144
|
+
private pool;
|
|
1145
|
+
private migrationManager;
|
|
1146
|
+
private initialized;
|
|
1147
|
+
private initPromise;
|
|
1148
|
+
constructor(options: PostgresSharedResourceStoreOptions);
|
|
1149
|
+
initialize(): Promise<void>;
|
|
1150
|
+
findByToken(token: string): Promise<ShareRecord | null>;
|
|
1151
|
+
create(record: Omit<ShareRecord, "accessCount" | "createdAt" | "version">): Promise<ShareRecord>;
|
|
1152
|
+
update(token: string, patch: Record<string, unknown>): Promise<void>;
|
|
1153
|
+
listByUser(tenantId: string, userId: string): Promise<ShareRecord[]>;
|
|
1154
|
+
incrementAccess(token: string): Promise<void>;
|
|
1155
|
+
atomicIncrementAccess(token: string): Promise<boolean>;
|
|
1156
|
+
private ensureInitialized;
|
|
1157
|
+
private _mapRow;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1139
1160
|
declare function createPgStoreConfig(connectionString: string): {
|
|
1140
1161
|
workspace: PostgreSQLWorkspaceStore;
|
|
1141
1162
|
project: PostgreSQLProjectStore;
|
|
@@ -1156,6 +1177,7 @@ declare function createPgStoreConfig(connectionString: string): {
|
|
|
1156
1177
|
a2aApiKey: PostgreSQLA2AApiKeyStore;
|
|
1157
1178
|
schedule: PostgreSQLScheduleStorage;
|
|
1158
1179
|
menu: MenuStore;
|
|
1180
|
+
sharedResource: PostgresSharedResourceStore;
|
|
1159
1181
|
checkpoint: PostgresSaver;
|
|
1160
1182
|
};
|
|
1161
1183
|
|
|
@@ -1504,6 +1526,8 @@ declare const alterChannelInstallationsTable: Migration;
|
|
|
1504
1526
|
|
|
1505
1527
|
declare const createChannelBindingsTable: Migration;
|
|
1506
1528
|
|
|
1529
|
+
declare const createSharedResourcesTable: Migration;
|
|
1530
|
+
|
|
1507
1531
|
declare const createA2AApiKeysTable: Migration;
|
|
1508
1532
|
|
|
1509
1533
|
/**
|
|
@@ -1606,4 +1630,6 @@ declare const evalMigrations: Migration[];
|
|
|
1606
1630
|
|
|
1607
1631
|
declare const createMenuItemsTable: Migration;
|
|
1608
1632
|
|
|
1609
|
-
|
|
1633
|
+
declare const addFileContentType: Migration;
|
|
1634
|
+
|
|
1635
|
+
export { ChannelBindingStore, type ChannelBindingStoreOptions, type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, MenuStore, type MenuStoreOptions, type Migration, MigrationManager, PostgreSQLA2AApiKeyStore, type PostgreSQLA2AApiKeyStoreOptions, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, PostgreSQLEvalStore, type PostgreSQLEvalStoreOptions, PostgreSQLMcpServerConfigStore, type PostgreSQLMcpServerConfigStoreOptions, PostgreSQLMetricsServerConfigStore, type PostgreSQLMetricsServerConfigStoreOptions, PostgreSQLProjectStore, type PostgreSQLProjectStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLTenantStore, type PostgreSQLTenantStoreOptions, type PostgreSQLThreadMessageQueueStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, PostgreSQLUserStore, type PostgreSQLUserStoreOptions, PostgreSQLUserTenantLinkStore, type PostgreSQLUserTenantLinkStoreOptions, PostgreSQLWorkflowTrackingStore, type PostgreSQLWorkflowTrackingStoreOptions, PostgreSQLWorkspaceStore, type PostgreSQLWorkspaceStoreOptions, PostgresSharedResourceStore, type PostgresSharedResourceStoreOptions, ThreadMessageQueueStore, addAssistantTenantId, addFileContentType, addProjectConfigColumn, addScheduleTenantId, addSkillTenantId, addStepThreadId, addThreadTenantId, alterChannelInstallationsTable, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createA2AApiKeysTable, createAssistantsTable, createChannelBindingsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createDatabaseConfigsTable, createEvalCasesTable, createEvalProjectsTable, createEvalRunResultsTable, createEvalRunsTable, createEvalSuitesTable, createMcpServerConfigsTable, createMenuItemsTable, createMetricsConfigsTable, createPgStoreConfig, createProjectsTable, createScheduledTasksTable, createSharedResourcesTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, evalMigrations, mapRowToRunStep, mapRowToWorkflowRun, safeParse };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PoolConfig, PoolClient, Pool } from 'pg';
|
|
2
2
|
export { Pool, PoolConfig } from 'pg';
|
|
3
|
-
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, Project, CreateProjectRequest, UpdateProjectRequest, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, WorkflowTrackingStore, CreateWorkflowRunRequest, WorkflowRun, UpdateWorkflowRunRequest, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, A2AApiKeyStore, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
4
|
-
export { Assistant, AssistantStore, Binding, BindingRegistry, ChannelInstallation, ChannelInstallationStore, CreateAssistantRequest, CreateBindingInput, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateEvalCaseRequest, CreateEvalProjectRequest, CreateEvalRunRequest, CreateEvalSuiteRequest, CreateMcpServerConfigRequest, CreateMenuItemInput, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateRunStepRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkflowRunRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, EvalCase, EvalProject, EvalProjectReport, EvalRun, EvalRunResult, EvalStore, EvalSuite, LarkChannelInstallationConfig, McpServerConfigEntry, McpServerConfigStore, MenuItem, MenuRegistry, MetricsServerConfig, MetricsServerConfigEntry, MetricsServerConfigStore, Project, ProjectStore, RunStep, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Skill, SkillStore, StorageType, Tenant, TenantStatus, TenantStore, Thread, ThreadStore, UpdateChannelInstallationRequest, UpdateDatabaseConfigRequest, UpdateMcpServerConfigRequest, UpdateMetricsServerConfigRequest, UpdateProjectRequest, UpdateRunStepRequest, UpdateTenantRequest, UpdateUserRequest, UpdateUserTenantLinkRequest, UpdateWorkflowRunRequest, UpdateWorkspaceRequest, User, UserStore, UserTenantLink, UserTenantLinkStore, UserTenantRole, WorkflowRun, WorkflowTrackingStore, Workspace, WorkspaceStore } from '@axiom-lattice/protocols';
|
|
3
|
+
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, Project, CreateProjectRequest, UpdateProjectRequest, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, WorkflowTrackingStore, CreateWorkflowRunRequest, WorkflowRun, UpdateWorkflowRunRequest, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, A2AApiKeyStore, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SharedResourceStore, ShareRecord, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
4
|
+
export { Assistant, AssistantStore, Binding, BindingRegistry, ChannelInstallation, ChannelInstallationStore, CreateAssistantRequest, CreateBindingInput, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateEvalCaseRequest, CreateEvalProjectRequest, CreateEvalRunRequest, CreateEvalSuiteRequest, CreateMcpServerConfigRequest, CreateMenuItemInput, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateRunStepRequest, CreateShareRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkflowRunRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, EvalCase, EvalProject, EvalProjectReport, EvalRun, EvalRunResult, EvalStore, EvalSuite, LarkChannelInstallationConfig, McpServerConfigEntry, McpServerConfigStore, MenuItem, MenuRegistry, MetricsServerConfig, MetricsServerConfigEntry, MetricsServerConfigStore, Project, ProjectStore, ResourceAddress, RunStep, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ShareRecord, ShareResult, ShareVisibility, SharedResourceStore, Skill, SkillStore, StorageType, Tenant, TenantStatus, TenantStore, Thread, ThreadStore, UpdateChannelInstallationRequest, UpdateDatabaseConfigRequest, UpdateMcpServerConfigRequest, UpdateMetricsServerConfigRequest, UpdateProjectRequest, UpdateRunStepRequest, UpdateTenantRequest, UpdateUserRequest, UpdateUserTenantLinkRequest, UpdateWorkflowRunRequest, UpdateWorkspaceRequest, User, UserStore, UserTenantLink, UserTenantLinkStore, UserTenantRole, WorkflowRun, WorkflowTrackingStore, Workspace, WorkspaceStore } from '@axiom-lattice/protocols';
|
|
5
5
|
import { IMessageQueueStore, AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
|
|
6
6
|
export { AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
|
|
7
7
|
import { PostgresSaver } from '@langchain/langgraph-checkpoint-postgres';
|
|
@@ -1136,6 +1136,27 @@ declare class MenuStore implements MenuRegistry {
|
|
|
1136
1136
|
private mapRowToMenuItem;
|
|
1137
1137
|
}
|
|
1138
1138
|
|
|
1139
|
+
interface PostgresSharedResourceStoreOptions {
|
|
1140
|
+
poolConfig: string | PoolConfig;
|
|
1141
|
+
autoMigrate?: boolean;
|
|
1142
|
+
}
|
|
1143
|
+
declare class PostgresSharedResourceStore implements SharedResourceStore {
|
|
1144
|
+
private pool;
|
|
1145
|
+
private migrationManager;
|
|
1146
|
+
private initialized;
|
|
1147
|
+
private initPromise;
|
|
1148
|
+
constructor(options: PostgresSharedResourceStoreOptions);
|
|
1149
|
+
initialize(): Promise<void>;
|
|
1150
|
+
findByToken(token: string): Promise<ShareRecord | null>;
|
|
1151
|
+
create(record: Omit<ShareRecord, "accessCount" | "createdAt" | "version">): Promise<ShareRecord>;
|
|
1152
|
+
update(token: string, patch: Record<string, unknown>): Promise<void>;
|
|
1153
|
+
listByUser(tenantId: string, userId: string): Promise<ShareRecord[]>;
|
|
1154
|
+
incrementAccess(token: string): Promise<void>;
|
|
1155
|
+
atomicIncrementAccess(token: string): Promise<boolean>;
|
|
1156
|
+
private ensureInitialized;
|
|
1157
|
+
private _mapRow;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1139
1160
|
declare function createPgStoreConfig(connectionString: string): {
|
|
1140
1161
|
workspace: PostgreSQLWorkspaceStore;
|
|
1141
1162
|
project: PostgreSQLProjectStore;
|
|
@@ -1156,6 +1177,7 @@ declare function createPgStoreConfig(connectionString: string): {
|
|
|
1156
1177
|
a2aApiKey: PostgreSQLA2AApiKeyStore;
|
|
1157
1178
|
schedule: PostgreSQLScheduleStorage;
|
|
1158
1179
|
menu: MenuStore;
|
|
1180
|
+
sharedResource: PostgresSharedResourceStore;
|
|
1159
1181
|
checkpoint: PostgresSaver;
|
|
1160
1182
|
};
|
|
1161
1183
|
|
|
@@ -1504,6 +1526,8 @@ declare const alterChannelInstallationsTable: Migration;
|
|
|
1504
1526
|
|
|
1505
1527
|
declare const createChannelBindingsTable: Migration;
|
|
1506
1528
|
|
|
1529
|
+
declare const createSharedResourcesTable: Migration;
|
|
1530
|
+
|
|
1507
1531
|
declare const createA2AApiKeysTable: Migration;
|
|
1508
1532
|
|
|
1509
1533
|
/**
|
|
@@ -1606,4 +1630,6 @@ declare const evalMigrations: Migration[];
|
|
|
1606
1630
|
|
|
1607
1631
|
declare const createMenuItemsTable: Migration;
|
|
1608
1632
|
|
|
1609
|
-
|
|
1633
|
+
declare const addFileContentType: Migration;
|
|
1634
|
+
|
|
1635
|
+
export { ChannelBindingStore, type ChannelBindingStoreOptions, type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, MenuStore, type MenuStoreOptions, type Migration, MigrationManager, PostgreSQLA2AApiKeyStore, type PostgreSQLA2AApiKeyStoreOptions, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, PostgreSQLEvalStore, type PostgreSQLEvalStoreOptions, PostgreSQLMcpServerConfigStore, type PostgreSQLMcpServerConfigStoreOptions, PostgreSQLMetricsServerConfigStore, type PostgreSQLMetricsServerConfigStoreOptions, PostgreSQLProjectStore, type PostgreSQLProjectStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLTenantStore, type PostgreSQLTenantStoreOptions, type PostgreSQLThreadMessageQueueStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, PostgreSQLUserStore, type PostgreSQLUserStoreOptions, PostgreSQLUserTenantLinkStore, type PostgreSQLUserTenantLinkStoreOptions, PostgreSQLWorkflowTrackingStore, type PostgreSQLWorkflowTrackingStoreOptions, PostgreSQLWorkspaceStore, type PostgreSQLWorkspaceStoreOptions, PostgresSharedResourceStore, type PostgresSharedResourceStoreOptions, ThreadMessageQueueStore, addAssistantTenantId, addFileContentType, addProjectConfigColumn, addScheduleTenantId, addSkillTenantId, addStepThreadId, addThreadTenantId, alterChannelInstallationsTable, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createA2AApiKeysTable, createAssistantsTable, createChannelBindingsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createDatabaseConfigsTable, createEvalCasesTable, createEvalProjectsTable, createEvalRunResultsTable, createEvalRunsTable, createEvalSuitesTable, createMcpServerConfigsTable, createMenuItemsTable, createMetricsConfigsTable, createPgStoreConfig, createProjectsTable, createScheduledTasksTable, createSharedResourcesTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, evalMigrations, mapRowToRunStep, mapRowToWorkflowRun, safeParse };
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
ChannelIdentityMappingStore: () => ChannelIdentityMappingStore,
|
|
35
35
|
MenuStore: () => MenuStore,
|
|
36
36
|
MigrationManager: () => MigrationManager,
|
|
37
|
-
Pool: () =>
|
|
37
|
+
Pool: () => import_pg23.Pool,
|
|
38
38
|
PostgreSQLA2AApiKeyStore: () => PostgreSQLA2AApiKeyStore,
|
|
39
39
|
PostgreSQLAssistantStore: () => PostgreSQLAssistantStore,
|
|
40
40
|
PostgreSQLChannelInstallationStore: () => PostgreSQLChannelInstallationStore,
|
|
@@ -51,8 +51,10 @@ __export(index_exports, {
|
|
|
51
51
|
PostgreSQLUserTenantLinkStore: () => PostgreSQLUserTenantLinkStore,
|
|
52
52
|
PostgreSQLWorkflowTrackingStore: () => PostgreSQLWorkflowTrackingStore,
|
|
53
53
|
PostgreSQLWorkspaceStore: () => PostgreSQLWorkspaceStore,
|
|
54
|
+
PostgresSharedResourceStore: () => PostgresSharedResourceStore,
|
|
54
55
|
ThreadMessageQueueStore: () => ThreadMessageQueueStore,
|
|
55
56
|
addAssistantTenantId: () => addAssistantTenantId,
|
|
57
|
+
addFileContentType: () => addFileContentType,
|
|
56
58
|
addProjectConfigColumn: () => addProjectConfigColumn,
|
|
57
59
|
addScheduleTenantId: () => addScheduleTenantId,
|
|
58
60
|
addSkillTenantId: () => addSkillTenantId,
|
|
@@ -79,6 +81,7 @@ __export(index_exports, {
|
|
|
79
81
|
createPgStoreConfig: () => createPgStoreConfig,
|
|
80
82
|
createProjectsTable: () => createProjectsTable,
|
|
81
83
|
createScheduledTasksTable: () => createScheduledTasksTable,
|
|
84
|
+
createSharedResourcesTable: () => createSharedResourcesTable,
|
|
82
85
|
createSkillsTable: () => createSkillsTable,
|
|
83
86
|
createTenantsTable: () => createTenantsTable,
|
|
84
87
|
createThreadMessageQueueTable: () => createThreadMessageQueueTable,
|
|
@@ -92,7 +95,7 @@ __export(index_exports, {
|
|
|
92
95
|
safeParse: () => safeParse
|
|
93
96
|
});
|
|
94
97
|
module.exports = __toCommonJS(index_exports);
|
|
95
|
-
var
|
|
98
|
+
var import_pg23 = require("pg");
|
|
96
99
|
|
|
97
100
|
// src/stores/PostgreSQLThreadStore.ts
|
|
98
101
|
var import_pg = require("pg");
|
|
@@ -6322,7 +6325,7 @@ var createMenuItemsTable = {
|
|
|
6322
6325
|
name VARCHAR(255) NOT NULL,
|
|
6323
6326
|
icon VARCHAR(50),
|
|
6324
6327
|
sort_order INT NOT NULL DEFAULT 0,
|
|
6325
|
-
|
|
6328
|
+
content_type VARCHAR(20) NOT NULL CHECK (content_type IN ('agent', 'html', 'custom', 'file')),
|
|
6326
6329
|
content_config JSONB NOT NULL DEFAULT '{}',
|
|
6327
6330
|
enabled BOOLEAN NOT NULL DEFAULT true,
|
|
6328
6331
|
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
@@ -6343,6 +6346,34 @@ var createMenuItemsTable = {
|
|
|
6343
6346
|
}
|
|
6344
6347
|
};
|
|
6345
6348
|
|
|
6349
|
+
// src/migrations/menu_items_add_file_type.ts
|
|
6350
|
+
var addFileContentType = {
|
|
6351
|
+
version: 136,
|
|
6352
|
+
name: "add_file_content_type_to_menu_items",
|
|
6353
|
+
up: async (client) => {
|
|
6354
|
+
await client.query(`
|
|
6355
|
+
ALTER TABLE lattice_menu_items
|
|
6356
|
+
DROP CONSTRAINT IF EXISTS lattice_menu_items_content_type_check
|
|
6357
|
+
`);
|
|
6358
|
+
await client.query(`
|
|
6359
|
+
ALTER TABLE lattice_menu_items
|
|
6360
|
+
ADD CONSTRAINT lattice_menu_items_content_type_check
|
|
6361
|
+
CHECK (content_type IN ('agent', 'html', 'custom', 'file'))
|
|
6362
|
+
`);
|
|
6363
|
+
},
|
|
6364
|
+
down: async (client) => {
|
|
6365
|
+
await client.query(`
|
|
6366
|
+
ALTER TABLE lattice_menu_items
|
|
6367
|
+
DROP CONSTRAINT IF EXISTS lattice_menu_items_content_type_check
|
|
6368
|
+
`);
|
|
6369
|
+
await client.query(`
|
|
6370
|
+
ALTER TABLE lattice_menu_items
|
|
6371
|
+
ADD CONSTRAINT lattice_menu_items_content_type_check
|
|
6372
|
+
CHECK (content_type IN ('agent', 'html', 'custom'))
|
|
6373
|
+
`);
|
|
6374
|
+
}
|
|
6375
|
+
};
|
|
6376
|
+
|
|
6346
6377
|
// src/stores/MenuStore.ts
|
|
6347
6378
|
var MenuStore = class {
|
|
6348
6379
|
constructor(options) {
|
|
@@ -6351,6 +6382,7 @@ var MenuStore = class {
|
|
|
6351
6382
|
this.pool = typeof options.poolConfig === "string" ? new import_pg19.Pool({ connectionString: options.poolConfig }) : new import_pg19.Pool(options.poolConfig);
|
|
6352
6383
|
this.migrationManager = new MigrationManager(this.pool);
|
|
6353
6384
|
this.migrationManager.register(createMenuItemsTable);
|
|
6385
|
+
this.migrationManager.register(addFileContentType);
|
|
6354
6386
|
if (options.autoMigrate !== false) {
|
|
6355
6387
|
this.initialize().catch((error) => {
|
|
6356
6388
|
console.error("Failed to initialize MenuStore:", error);
|
|
@@ -6494,6 +6526,215 @@ var MenuStore = class {
|
|
|
6494
6526
|
}
|
|
6495
6527
|
};
|
|
6496
6528
|
|
|
6529
|
+
// src/stores/PostgresSharedResourceStore.ts
|
|
6530
|
+
var import_pg20 = require("pg");
|
|
6531
|
+
|
|
6532
|
+
// src/migrations/shared_resources_migration.ts
|
|
6533
|
+
var createSharedResourcesTable = {
|
|
6534
|
+
version: 135,
|
|
6535
|
+
name: "create_shared_resources_table",
|
|
6536
|
+
up: async (client) => {
|
|
6537
|
+
await client.query(`
|
|
6538
|
+
CREATE TABLE IF NOT EXISTS lattice_shared_resources (
|
|
6539
|
+
token VARCHAR(64) PRIMARY KEY,
|
|
6540
|
+
address JSONB NOT NULL,
|
|
6541
|
+
title VARCHAR(256),
|
|
6542
|
+
created_by VARCHAR(64) NOT NULL,
|
|
6543
|
+
tenant_id VARCHAR(64) NOT NULL,
|
|
6544
|
+
workspace_id VARCHAR(64) NOT NULL,
|
|
6545
|
+
project_id VARCHAR(64) NOT NULL,
|
|
6546
|
+
assistant_id VARCHAR(64),
|
|
6547
|
+
vm_isolation VARCHAR(16) NOT NULL DEFAULT 'project',
|
|
6548
|
+
visibility VARCHAR(16) NOT NULL DEFAULT 'public',
|
|
6549
|
+
password_hash VARCHAR(128),
|
|
6550
|
+
expires_at TIMESTAMPTZ,
|
|
6551
|
+
max_access INT,
|
|
6552
|
+
access_count INT DEFAULT 0,
|
|
6553
|
+
revoked BOOLEAN DEFAULT FALSE,
|
|
6554
|
+
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
6555
|
+
version INT DEFAULT 1
|
|
6556
|
+
)
|
|
6557
|
+
`);
|
|
6558
|
+
await client.query(`
|
|
6559
|
+
CREATE INDEX IF NOT EXISTS idx_shared_resources_tenant
|
|
6560
|
+
ON lattice_shared_resources(tenant_id)
|
|
6561
|
+
`);
|
|
6562
|
+
await client.query(`
|
|
6563
|
+
CREATE INDEX IF NOT EXISTS idx_shared_resources_user
|
|
6564
|
+
ON lattice_shared_resources(created_by)
|
|
6565
|
+
`);
|
|
6566
|
+
},
|
|
6567
|
+
down: async (client) => {
|
|
6568
|
+
await client.query("DROP TABLE IF EXISTS lattice_shared_resources");
|
|
6569
|
+
}
|
|
6570
|
+
};
|
|
6571
|
+
|
|
6572
|
+
// src/stores/PostgresSharedResourceStore.ts
|
|
6573
|
+
var PostgresSharedResourceStore = class {
|
|
6574
|
+
constructor(options) {
|
|
6575
|
+
this.initialized = false;
|
|
6576
|
+
this.initPromise = null;
|
|
6577
|
+
this.pool = typeof options.poolConfig === "string" ? new import_pg20.Pool({ connectionString: options.poolConfig }) : new import_pg20.Pool(options.poolConfig);
|
|
6578
|
+
this.migrationManager = new MigrationManager(this.pool);
|
|
6579
|
+
this.migrationManager.register(createSharedResourcesTable);
|
|
6580
|
+
if (options.autoMigrate !== false) {
|
|
6581
|
+
this.initialize().catch((error) => {
|
|
6582
|
+
console.error(
|
|
6583
|
+
"Failed to initialize PostgresSharedResourceStore:",
|
|
6584
|
+
error
|
|
6585
|
+
);
|
|
6586
|
+
throw error;
|
|
6587
|
+
});
|
|
6588
|
+
}
|
|
6589
|
+
}
|
|
6590
|
+
async initialize() {
|
|
6591
|
+
if (this.initialized) return;
|
|
6592
|
+
if (this.initPromise) return this.initPromise;
|
|
6593
|
+
this.initPromise = (async () => {
|
|
6594
|
+
try {
|
|
6595
|
+
await this.migrationManager.migrate();
|
|
6596
|
+
this.initialized = true;
|
|
6597
|
+
} finally {
|
|
6598
|
+
this.initPromise = null;
|
|
6599
|
+
}
|
|
6600
|
+
})();
|
|
6601
|
+
return this.initPromise;
|
|
6602
|
+
}
|
|
6603
|
+
async findByToken(token) {
|
|
6604
|
+
await this.ensureInitialized();
|
|
6605
|
+
const { rows } = await this.pool.query(
|
|
6606
|
+
"SELECT * FROM lattice_shared_resources WHERE token = $1",
|
|
6607
|
+
[token]
|
|
6608
|
+
);
|
|
6609
|
+
if (rows.length === 0) return null;
|
|
6610
|
+
return this._mapRow(rows[0]);
|
|
6611
|
+
}
|
|
6612
|
+
async create(record) {
|
|
6613
|
+
await this.ensureInitialized();
|
|
6614
|
+
const { rows } = await this.pool.query(
|
|
6615
|
+
`INSERT INTO lattice_shared_resources
|
|
6616
|
+
(token, address, title, created_by, tenant_id, workspace_id, project_id,
|
|
6617
|
+
assistant_id, vm_isolation, visibility, password_hash,
|
|
6618
|
+
expires_at, max_access, revoked)
|
|
6619
|
+
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)
|
|
6620
|
+
RETURNING *`,
|
|
6621
|
+
[
|
|
6622
|
+
record.token,
|
|
6623
|
+
JSON.stringify(record.address),
|
|
6624
|
+
record.title,
|
|
6625
|
+
record.createdBy,
|
|
6626
|
+
record.tenantId,
|
|
6627
|
+
record.workspaceId,
|
|
6628
|
+
record.projectId,
|
|
6629
|
+
record.assistantId,
|
|
6630
|
+
record.vmIsolation,
|
|
6631
|
+
record.visibility,
|
|
6632
|
+
record.passwordHash,
|
|
6633
|
+
record.expiresAt ? record.expiresAt.toISOString() : null,
|
|
6634
|
+
record.maxAccess,
|
|
6635
|
+
record.revoked
|
|
6636
|
+
]
|
|
6637
|
+
);
|
|
6638
|
+
return this._mapRow(rows[0]);
|
|
6639
|
+
}
|
|
6640
|
+
async update(token, patch) {
|
|
6641
|
+
await this.ensureInitialized();
|
|
6642
|
+
const ALLOWED_COLUMNS = /* @__PURE__ */ new Set([
|
|
6643
|
+
"title",
|
|
6644
|
+
"expiresAt",
|
|
6645
|
+
"maxAccess",
|
|
6646
|
+
"revoked",
|
|
6647
|
+
"visibility",
|
|
6648
|
+
"passwordHash"
|
|
6649
|
+
]);
|
|
6650
|
+
const COLUMN_MAP = {
|
|
6651
|
+
"title": "title",
|
|
6652
|
+
"expiresAt": "expires_at",
|
|
6653
|
+
"maxAccess": "max_access",
|
|
6654
|
+
"revoked": "revoked",
|
|
6655
|
+
"visibility": "visibility",
|
|
6656
|
+
"passwordHash": "password_hash"
|
|
6657
|
+
};
|
|
6658
|
+
const sets = [];
|
|
6659
|
+
const vals = [];
|
|
6660
|
+
let i = 1;
|
|
6661
|
+
for (const [col, val] of Object.entries(patch)) {
|
|
6662
|
+
const dbCol = COLUMN_MAP[col];
|
|
6663
|
+
if (dbCol && val !== void 0) {
|
|
6664
|
+
sets.push(`${dbCol} = $${i++}`);
|
|
6665
|
+
vals.push(val);
|
|
6666
|
+
}
|
|
6667
|
+
}
|
|
6668
|
+
if (sets.length === 0) return;
|
|
6669
|
+
vals.push(token);
|
|
6670
|
+
await this.pool.query(
|
|
6671
|
+
`UPDATE lattice_shared_resources SET ${sets.join(", ")} WHERE token = $${i}`,
|
|
6672
|
+
vals
|
|
6673
|
+
);
|
|
6674
|
+
}
|
|
6675
|
+
async listByUser(tenantId, userId) {
|
|
6676
|
+
await this.ensureInitialized();
|
|
6677
|
+
const { rows } = await this.pool.query(
|
|
6678
|
+
`SELECT * FROM lattice_shared_resources
|
|
6679
|
+
WHERE tenant_id = $1 AND created_by = $2
|
|
6680
|
+
ORDER BY created_at DESC`,
|
|
6681
|
+
[tenantId, userId]
|
|
6682
|
+
);
|
|
6683
|
+
return rows.map((r) => this._mapRow(r));
|
|
6684
|
+
}
|
|
6685
|
+
async incrementAccess(token) {
|
|
6686
|
+
await this.ensureInitialized();
|
|
6687
|
+
await this.pool.query(
|
|
6688
|
+
"UPDATE lattice_shared_resources SET access_count = access_count + 1 WHERE token = $1",
|
|
6689
|
+
[token]
|
|
6690
|
+
);
|
|
6691
|
+
}
|
|
6692
|
+
async atomicIncrementAccess(token) {
|
|
6693
|
+
await this.ensureInitialized();
|
|
6694
|
+
const { rows } = await this.pool.query(
|
|
6695
|
+
`UPDATE lattice_shared_resources SET access_count = access_count + 1
|
|
6696
|
+
WHERE token = $1 AND NOT revoked
|
|
6697
|
+
AND (expires_at IS NULL OR expires_at > NOW())
|
|
6698
|
+
AND (max_access IS NULL OR access_count < max_access)
|
|
6699
|
+
RETURNING 1`,
|
|
6700
|
+
[token]
|
|
6701
|
+
);
|
|
6702
|
+
return rows.length > 0;
|
|
6703
|
+
}
|
|
6704
|
+
async ensureInitialized() {
|
|
6705
|
+
if (!this.initialized) {
|
|
6706
|
+
await this.initialize();
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
_mapRow(row) {
|
|
6710
|
+
let address;
|
|
6711
|
+
if (typeof row.address === "string") {
|
|
6712
|
+
address = JSON.parse(row.address);
|
|
6713
|
+
} else {
|
|
6714
|
+
address = row.address;
|
|
6715
|
+
}
|
|
6716
|
+
return {
|
|
6717
|
+
token: row.token,
|
|
6718
|
+
address,
|
|
6719
|
+
title: row.title,
|
|
6720
|
+
createdBy: row.created_by,
|
|
6721
|
+
tenantId: row.tenant_id,
|
|
6722
|
+
workspaceId: row.workspace_id,
|
|
6723
|
+
projectId: row.project_id,
|
|
6724
|
+
assistantId: row.assistant_id,
|
|
6725
|
+
vmIsolation: row.vm_isolation,
|
|
6726
|
+
visibility: row.visibility,
|
|
6727
|
+
passwordHash: row.password_hash,
|
|
6728
|
+
expiresAt: row.expires_at ? new Date(row.expires_at) : null,
|
|
6729
|
+
maxAccess: row.max_access,
|
|
6730
|
+
accessCount: row.access_count ?? 0,
|
|
6731
|
+
revoked: row.revoked ?? false,
|
|
6732
|
+
createdAt: new Date(row.created_at),
|
|
6733
|
+
version: row.version ?? 1
|
|
6734
|
+
};
|
|
6735
|
+
}
|
|
6736
|
+
};
|
|
6737
|
+
|
|
6497
6738
|
// src/createPgStoreConfig.ts
|
|
6498
6739
|
var import_langgraph_checkpoint_postgres = require("@langchain/langgraph-checkpoint-postgres");
|
|
6499
6740
|
function createPgStoreConfig(connectionString) {
|
|
@@ -6522,12 +6763,13 @@ function createPgStoreConfig(connectionString) {
|
|
|
6522
6763
|
a2aApiKey: new PostgreSQLA2AApiKeyStore(opts),
|
|
6523
6764
|
schedule: new PostgreSQLScheduleStorage(opts),
|
|
6524
6765
|
menu: new MenuStore(opts),
|
|
6766
|
+
sharedResource: new PostgresSharedResourceStore(opts),
|
|
6525
6767
|
checkpoint
|
|
6526
6768
|
};
|
|
6527
6769
|
}
|
|
6528
6770
|
|
|
6529
6771
|
// src/stores/PostgreSQLSkillStore.ts
|
|
6530
|
-
var
|
|
6772
|
+
var import_pg21 = require("pg");
|
|
6531
6773
|
|
|
6532
6774
|
// src/migrations/skill_migrations.ts
|
|
6533
6775
|
var createSkillsTable = {
|
|
@@ -6689,9 +6931,9 @@ var PostgreSQLSkillStore = class {
|
|
|
6689
6931
|
this.ownsPool = true;
|
|
6690
6932
|
this.initPromise = null;
|
|
6691
6933
|
if (typeof options.poolConfig === "string") {
|
|
6692
|
-
this.pool = new
|
|
6934
|
+
this.pool = new import_pg21.Pool({ connectionString: options.poolConfig });
|
|
6693
6935
|
} else {
|
|
6694
|
-
this.pool = new
|
|
6936
|
+
this.pool = new import_pg21.Pool(options.poolConfig);
|
|
6695
6937
|
}
|
|
6696
6938
|
this.migrationManager = new MigrationManager(this.pool);
|
|
6697
6939
|
this.migrationManager.register(createSkillsTable);
|
|
@@ -7045,12 +7287,12 @@ var createChannelIdentityMappingTables = {
|
|
|
7045
7287
|
};
|
|
7046
7288
|
|
|
7047
7289
|
// src/stores/ChannelIdentityMappingStore.ts
|
|
7048
|
-
var
|
|
7290
|
+
var import_pg22 = require("pg");
|
|
7049
7291
|
var ChannelIdentityMappingStore = class {
|
|
7050
7292
|
constructor(options) {
|
|
7051
7293
|
this.initialized = false;
|
|
7052
7294
|
this.initPromise = null;
|
|
7053
|
-
this.pool = typeof options.poolConfig === "string" ? new
|
|
7295
|
+
this.pool = typeof options.poolConfig === "string" ? new import_pg22.Pool({ connectionString: options.poolConfig }) : new import_pg22.Pool(options.poolConfig);
|
|
7054
7296
|
this.migrationManager = new MigrationManager(this.pool);
|
|
7055
7297
|
this.migrationManager.register(createChannelIdentityMappingTables);
|
|
7056
7298
|
if (options.autoMigrate !== false) {
|
|
@@ -7284,8 +7526,10 @@ function mapRowToChannelIdentityMapping(row) {
|
|
|
7284
7526
|
PostgreSQLUserTenantLinkStore,
|
|
7285
7527
|
PostgreSQLWorkflowTrackingStore,
|
|
7286
7528
|
PostgreSQLWorkspaceStore,
|
|
7529
|
+
PostgresSharedResourceStore,
|
|
7287
7530
|
ThreadMessageQueueStore,
|
|
7288
7531
|
addAssistantTenantId,
|
|
7532
|
+
addFileContentType,
|
|
7289
7533
|
addProjectConfigColumn,
|
|
7290
7534
|
addScheduleTenantId,
|
|
7291
7535
|
addSkillTenantId,
|
|
@@ -7312,6 +7556,7 @@ function mapRowToChannelIdentityMapping(row) {
|
|
|
7312
7556
|
createPgStoreConfig,
|
|
7313
7557
|
createProjectsTable,
|
|
7314
7558
|
createScheduledTasksTable,
|
|
7559
|
+
createSharedResourcesTable,
|
|
7315
7560
|
createSkillsTable,
|
|
7316
7561
|
createTenantsTable,
|
|
7317
7562
|
createThreadMessageQueueTable,
|