@axiom-lattice/protocols 2.1.13 → 2.1.15

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.
@@ -0,0 +1,81 @@
1
+ /**
2
+ * UserTenantLinkProtocol
3
+ *
4
+ * User-Tenant relationship store protocol
5
+ * Supports many-to-many relationship between users and tenants
6
+ */
7
+
8
+ /**
9
+ * User role in tenant
10
+ */
11
+ export type UserTenantRole = 'owner' | 'admin' | 'member';
12
+
13
+ /**
14
+ * User-Tenant link type definition
15
+ */
16
+ export interface UserTenantLink {
17
+ userId: string;
18
+ tenantId: string;
19
+ role: UserTenantRole;
20
+ joinedAt: Date;
21
+ metadata?: Record<string, any>;
22
+ }
23
+
24
+ /**
25
+ * Create user-tenant link request
26
+ */
27
+ export interface CreateUserTenantLinkRequest {
28
+ userId: string;
29
+ tenantId: string;
30
+ role?: UserTenantRole;
31
+ metadata?: Record<string, any>;
32
+ }
33
+
34
+ /**
35
+ * Update user-tenant link request
36
+ */
37
+ export interface UpdateUserTenantLinkRequest {
38
+ role?: UserTenantRole;
39
+ metadata?: Record<string, any>;
40
+ }
41
+
42
+ /**
43
+ * UserTenantLinkStore interface
44
+ * Manages many-to-many relationship between users and tenants
45
+ */
46
+ export interface UserTenantLinkStore {
47
+ /**
48
+ * Get all tenants for a user
49
+ */
50
+ getTenantsByUser(userId: string): Promise<UserTenantLink[]>;
51
+
52
+ /**
53
+ * Get all users for a tenant
54
+ */
55
+ getUsersByTenant(tenantId: string): Promise<UserTenantLink[]>;
56
+
57
+ /**
58
+ * Get specific link
59
+ */
60
+ getLink(userId: string, tenantId: string): Promise<UserTenantLink | null>;
61
+
62
+ /**
63
+ * Create link between user and tenant
64
+ */
65
+ createLink(data: CreateUserTenantLinkRequest): Promise<UserTenantLink>;
66
+
67
+ /**
68
+ * Update link
69
+ */
70
+ updateLink(userId: string, tenantId: string, updates: UpdateUserTenantLinkRequest): Promise<UserTenantLink | null>;
71
+
72
+ /**
73
+ * Delete link
74
+ */
75
+ deleteLink(userId: string, tenantId: string): Promise<boolean>;
76
+
77
+ /**
78
+ * Check if user belongs to tenant
79
+ */
80
+ hasLink(userId: string, tenantId: string): Promise<boolean>;
81
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * WorkspaceStoreProtocol
3
+ *
4
+ * Workspace and Project store protocol definitions
5
+ * for the Axiom Lattice framework
6
+ */
7
+
8
+ export type StorageType = "sandbox" | "filesystem";
9
+
10
+ /**
11
+ * Workspace type definition
12
+ */
13
+ export interface Workspace {
14
+ id: string;
15
+ tenantId: string;
16
+ name: string;
17
+ description?: string;
18
+ storageType: StorageType;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ }
22
+
23
+ /**
24
+ * Create workspace request type
25
+ */
26
+ export interface CreateWorkspaceRequest {
27
+ name: string;
28
+ description?: string;
29
+ storageType: StorageType;
30
+ }
31
+
32
+ /**
33
+ * Update workspace request type
34
+ */
35
+ export interface UpdateWorkspaceRequest {
36
+ name?: string;
37
+ description?: string;
38
+ storageType?: StorageType;
39
+ }
40
+
41
+ /**
42
+ * WorkspaceStore interface
43
+ * Provides CRUD operations for workspace data
44
+ */
45
+ export interface WorkspaceStore {
46
+ getAllWorkspaces(tenantId: string): Promise<Workspace[]>;
47
+ getWorkspaceById(tenantId: string, id: string): Promise<Workspace | null>;
48
+ createWorkspace(tenantId: string, id: string, data: CreateWorkspaceRequest): Promise<Workspace>;
49
+ updateWorkspace(tenantId: string, id: string, updates: UpdateWorkspaceRequest): Promise<Workspace | null>;
50
+ deleteWorkspace(tenantId: string, id: string): Promise<boolean>;
51
+ }
52
+
53
+ /**
54
+ * Project type definition
55
+ */
56
+ export interface Project {
57
+ id: string;
58
+ tenantId: string;
59
+ workspaceId: string;
60
+ name: string;
61
+ description?: string;
62
+ createdAt: Date;
63
+ updatedAt: Date;
64
+ }
65
+
66
+ /**
67
+ * Create project request type
68
+ */
69
+ export interface CreateProjectRequest {
70
+ name: string;
71
+ description?: string;
72
+ }
73
+
74
+ /**
75
+ * Update project request type
76
+ */
77
+ export interface UpdateProjectRequest {
78
+ name?: string;
79
+ description?: string;
80
+ }
81
+
82
+ /**
83
+ * ProjectStore interface
84
+ * Provides CRUD operations for project data
85
+ */
86
+ export interface ProjectStore {
87
+ getProjectsByWorkspace(tenantId: string, workspaceId: string): Promise<Project[]>;
88
+ getProjectById(tenantId: string, id: string): Promise<Project | null>;
89
+ createProject(tenantId: string, workspaceId: string, id: string, data: CreateProjectRequest): Promise<Project>;
90
+ updateProject(tenantId: string, id: string, updates: UpdateProjectRequest): Promise<Project | null>;
91
+ deleteProject(tenantId: string, id: string): Promise<boolean>;
92
+ }
package/src/index.ts CHANGED
@@ -21,6 +21,12 @@ export * from "./AssistantStoreProtocol";
21
21
  export * from "./SkillLatticeProtocol";
22
22
  export * from "./SkillStoreProtocol";
23
23
  export * from "./McpLatticeProtocol";
24
+ export * from "./WorkspaceStoreProtocol";
25
+ export * from "./TenantStoreProtocol";
26
+ export * from "./DatabaseConfigStoreProtocol";
27
+ export * from "./MetricsServerConfigStoreProtocol";
28
+ export * from "./UserStoreProtocol";
29
+ export * from "./UserTenantLinkProtocol";
24
30
 
25
31
  // 导出通用类型
26
32
  export * from "./types";