@inkeep/agents-core 0.0.0-dev-20260123205017 → 0.0.0-dev-20260123212735
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/auth/auth-schema.d.ts +104 -104
- package/dist/auth/auth-validation-schemas.d.ts +129 -129
- package/dist/auth/auth.d.ts +63 -63
- package/dist/auth/auth.js +16 -12
- package/dist/auth/authz/client.d.ts +9 -3
- package/dist/auth/authz/client.js +24 -17
- package/dist/auth/authz/config.d.ts +51 -24
- package/dist/auth/authz/config.js +44 -27
- package/dist/auth/authz/index.d.ts +3 -3
- package/dist/auth/authz/index.js +3 -3
- package/dist/auth/authz/permissions.d.ts +0 -4
- package/dist/auth/authz/permissions.js +13 -13
- package/dist/auth/authz/sync.d.ts +23 -2
- package/dist/auth/authz/sync.js +136 -52
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/client-exports.d.ts +2 -1
- package/dist/client-exports.js +2 -1
- package/dist/data-access/index.d.ts +2 -2
- package/dist/data-access/index.js +2 -2
- package/dist/data-access/manage/agents.d.ts +39 -39
- package/dist/data-access/manage/artifactComponents.d.ts +4 -4
- package/dist/data-access/manage/functionTools.d.ts +6 -6
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +6 -6
- package/dist/data-access/manage/subAgentRelations.d.ts +2 -2
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +6 -6
- package/dist/data-access/manage/subAgents.d.ts +21 -21
- package/dist/data-access/manage/tools.d.ts +12 -12
- package/dist/data-access/manage/triggers.d.ts +2 -2
- package/dist/data-access/runtime/apiKeys.d.ts +4 -4
- package/dist/data-access/runtime/conversations.d.ts +4 -4
- package/dist/data-access/runtime/organizations.d.ts +2 -2
- package/dist/data-access/runtime/organizations.js +2 -2
- package/dist/db/manage/manage-schema.d.ts +4 -4
- package/dist/db/runtime/runtime-schema.d.ts +175 -175
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/validation/schemas.d.ts +1532 -1532
- package/package.json +2 -1
- package/spicedb/schema.zed +114 -0
|
@@ -4,31 +4,20 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Feature flag and configuration for the SpiceDB authorization system.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* When called without tenantId:
|
|
11
|
-
* - Returns true if ENABLE_AUTHZ=true
|
|
12
|
-
*
|
|
13
|
-
* When called with tenantId:
|
|
14
|
-
* - If ENABLE_AUTHZ=false → returns false
|
|
15
|
-
* - If ENABLE_AUTHZ=true and TENANT_ID is not set → returns true (all tenants)
|
|
16
|
-
* - If ENABLE_AUTHZ=true and TENANT_ID is set → returns true only if tenantId matches
|
|
17
|
-
*/
|
|
18
|
-
function isAuthzEnabled(tenantId) {
|
|
19
|
-
if (process.env.ENABLE_AUTHZ !== "true") return false;
|
|
20
|
-
const configuredTenantId = process.env.TENANT_ID?.trim();
|
|
21
|
-
if (!configuredTenantId) return true;
|
|
22
|
-
return tenantId === configuredTenantId;
|
|
7
|
+
function isAuthzEnabled() {
|
|
8
|
+
return process.env.ENABLE_AUTHZ === "true";
|
|
23
9
|
}
|
|
24
10
|
/**
|
|
25
11
|
* Get SpiceDB connection configuration from environment variables.
|
|
12
|
+
* TLS is auto-detected: disabled for localhost, enabled for remote endpoints.
|
|
26
13
|
*/
|
|
27
14
|
function getSpiceDbConfig() {
|
|
15
|
+
const endpoint = process.env.SPICEDB_ENDPOINT || "localhost:50051";
|
|
16
|
+
const isLocalhost = endpoint.startsWith("localhost") || endpoint.startsWith("127.0.0.1");
|
|
28
17
|
return {
|
|
29
|
-
endpoint
|
|
18
|
+
endpoint,
|
|
30
19
|
token: process.env.SPICEDB_PRESHARED_KEY || "",
|
|
31
|
-
tlsEnabled:
|
|
20
|
+
tlsEnabled: !isLocalhost
|
|
32
21
|
};
|
|
33
22
|
}
|
|
34
23
|
/**
|
|
@@ -55,22 +44,50 @@ const SpiceDbRelations = {
|
|
|
55
44
|
PROJECT_VIEWER: "project_viewer"
|
|
56
45
|
};
|
|
57
46
|
/**
|
|
58
|
-
* SpiceDB permissions
|
|
47
|
+
* SpiceDB permissions for organization resources.
|
|
59
48
|
*
|
|
60
|
-
*
|
|
49
|
+
* From schema.zed definition organization:
|
|
50
|
+
* - view: owner + admin + member
|
|
51
|
+
* - manage: owner + admin (includes managing org settings and all projects)
|
|
61
52
|
*/
|
|
53
|
+
const SpiceDbOrgPermissions = {
|
|
54
|
+
VIEW: "view",
|
|
55
|
+
MANAGE: "manage"
|
|
56
|
+
};
|
|
62
57
|
/**
|
|
63
|
-
* SpiceDB permissions
|
|
58
|
+
* SpiceDB permissions for project resources.
|
|
64
59
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
60
|
+
* From schema.zed definition project:
|
|
61
|
+
* - view: read-only access to project and its resources
|
|
62
|
+
* - use: invoke agents, create API keys, view traces
|
|
63
|
+
* - edit: modify configurations, manage members
|
|
67
64
|
*/
|
|
68
|
-
const
|
|
65
|
+
const SpiceDbProjectPermissions = {
|
|
69
66
|
VIEW: "view",
|
|
70
67
|
USE: "use",
|
|
71
|
-
EDIT: "edit"
|
|
72
|
-
|
|
68
|
+
EDIT: "edit"
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Organization roles from SpiceDB schema.
|
|
72
|
+
*/
|
|
73
|
+
const OrgRoles = {
|
|
74
|
+
OWNER: "owner",
|
|
75
|
+
ADMIN: "admin",
|
|
76
|
+
MEMBER: "member"
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Project roles from SpiceDB schema.
|
|
80
|
+
*
|
|
81
|
+
* Hierarchy:
|
|
82
|
+
* - project_admin: Full access (view + use + edit + manage members)
|
|
83
|
+
* - project_member: Operator access (view + use: invoke agents, create API keys)
|
|
84
|
+
* - project_viewer: Read-only access (view only)
|
|
85
|
+
*/
|
|
86
|
+
const ProjectRoles = {
|
|
87
|
+
ADMIN: "project_admin",
|
|
88
|
+
MEMBER: "project_member",
|
|
89
|
+
VIEWER: "project_viewer"
|
|
73
90
|
};
|
|
74
91
|
|
|
75
92
|
//#endregion
|
|
76
|
-
export {
|
|
93
|
+
export { OrgRoles, ProjectRoles, SpiceDbOrgPermissions, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes, getSpiceDbConfig, isAuthzEnabled };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, lookupResources, readRelationships, resetSpiceClient, writeRelationship } from "./client.js";
|
|
2
|
-
import { OrgRole, ProjectRole,
|
|
2
|
+
import { OrgRole, OrgRoles, ProjectPermissionLevel, ProjectPermissions, ProjectRole, ProjectRoles, SpiceDbOrgPermission, SpiceDbOrgPermissions, SpiceDbProjectPermission, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes, getSpiceDbConfig, isAuthzEnabled } from "./config.js";
|
|
3
3
|
import { canEditProject, canUseProject, canViewProject, listAccessibleProjectIds } from "./permissions.js";
|
|
4
|
-
import { changeProjectRole, grantProjectAccess, listProjectMembers, removeProjectFromSpiceDb, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb } from "./sync.js";
|
|
5
|
-
export { type OrgRole, type ProjectRole,
|
|
4
|
+
import { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, listUserProjectMembershipsInSpiceDb, removeProjectFromSpiceDb, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb } from "./sync.js";
|
|
5
|
+
export { type OrgRole, OrgRoles, type ProjectPermissionLevel, type ProjectPermissions, type ProjectRole, ProjectRoles, type SpiceDbOrgPermission, SpiceDbOrgPermissions, type SpiceDbProjectPermission, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes, canEditProject, canUseProject, canViewProject, changeOrgRole, changeProjectRole, checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, getSpiceDbConfig, grantProjectAccess, isAuthzEnabled, listAccessibleProjectIds, listProjectMembers, listUserProjectMembershipsInSpiceDb, lookupResources, readRelationships, removeProjectFromSpiceDb, resetSpiceClient, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb, writeRelationship };
|
package/dist/auth/authz/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OrgRoles, ProjectRoles, SpiceDbOrgPermissions, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes, getSpiceDbConfig, isAuthzEnabled } from "./config.js";
|
|
2
2
|
import { checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, lookupResources, readRelationships, resetSpiceClient, writeRelationship } from "./client.js";
|
|
3
3
|
import { canEditProject, canUseProject, canViewProject, listAccessibleProjectIds } from "./permissions.js";
|
|
4
|
-
import { changeProjectRole, grantProjectAccess, listProjectMembers, removeProjectFromSpiceDb, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb } from "./sync.js";
|
|
4
|
+
import { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, listUserProjectMembershipsInSpiceDb, removeProjectFromSpiceDb, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb } from "./sync.js";
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { OrgRoles, ProjectRoles, SpiceDbOrgPermissions, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes, canEditProject, canUseProject, canViewProject, changeOrgRole, changeProjectRole, checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, getSpiceDbConfig, grantProjectAccess, isAuthzEnabled, listAccessibleProjectIds, listProjectMembers, listUserProjectMembershipsInSpiceDb, lookupResources, readRelationships, removeProjectFromSpiceDb, resetSpiceClient, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb, writeRelationship };
|
|
@@ -10,7 +10,6 @@ import { OrgRole } from "./config.js";
|
|
|
10
10
|
* - Otherwise: checks SpiceDB
|
|
11
11
|
*/
|
|
12
12
|
declare function canViewProject(params: {
|
|
13
|
-
tenantId: string;
|
|
14
13
|
userId: string;
|
|
15
14
|
projectId: string;
|
|
16
15
|
orgRole: OrgRole;
|
|
@@ -23,7 +22,6 @@ declare function canViewProject(params: {
|
|
|
23
22
|
* - Otherwise: checks SpiceDB for use permission
|
|
24
23
|
*/
|
|
25
24
|
declare function canUseProject(params: {
|
|
26
|
-
tenantId: string;
|
|
27
25
|
userId: string;
|
|
28
26
|
projectId: string;
|
|
29
27
|
orgRole: OrgRole;
|
|
@@ -36,7 +34,6 @@ declare function canUseProject(params: {
|
|
|
36
34
|
* - Otherwise: checks SpiceDB for edit permission
|
|
37
35
|
*/
|
|
38
36
|
declare function canEditProject(params: {
|
|
39
|
-
tenantId: string;
|
|
40
37
|
userId: string;
|
|
41
38
|
projectId: string;
|
|
42
39
|
orgRole: OrgRole;
|
|
@@ -49,7 +46,6 @@ declare function canEditProject(params: {
|
|
|
49
46
|
* - Otherwise: uses SpiceDB LookupResources
|
|
50
47
|
*/
|
|
51
48
|
declare function listAccessibleProjectIds(params: {
|
|
52
|
-
tenantId: string;
|
|
53
49
|
userId: string;
|
|
54
50
|
orgRole: OrgRole;
|
|
55
51
|
}): Promise<string[] | 'all'>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OrgRoles, SpiceDbProjectPermissions, SpiceDbResourceTypes, isAuthzEnabled } from "./config.js";
|
|
2
2
|
import { checkPermission, lookupResources } from "./client.js";
|
|
3
3
|
|
|
4
4
|
//#region src/auth/authz/permissions.ts
|
|
@@ -15,12 +15,12 @@ import { checkPermission, lookupResources } from "./client.js";
|
|
|
15
15
|
* - Otherwise: checks SpiceDB
|
|
16
16
|
*/
|
|
17
17
|
async function canViewProject(params) {
|
|
18
|
-
|
|
19
|
-
if (
|
|
18
|
+
const isAdmin = params.orgRole === OrgRoles.OWNER || params.orgRole === OrgRoles.ADMIN;
|
|
19
|
+
if (!isAuthzEnabled() || isAdmin) return true;
|
|
20
20
|
return checkPermission({
|
|
21
21
|
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
22
22
|
resourceId: params.projectId,
|
|
23
|
-
permission:
|
|
23
|
+
permission: SpiceDbProjectPermissions.VIEW,
|
|
24
24
|
subjectType: SpiceDbResourceTypes.USER,
|
|
25
25
|
subjectId: params.userId
|
|
26
26
|
});
|
|
@@ -33,12 +33,12 @@ async function canViewProject(params) {
|
|
|
33
33
|
* - Otherwise: checks SpiceDB for use permission
|
|
34
34
|
*/
|
|
35
35
|
async function canUseProject(params) {
|
|
36
|
-
|
|
37
|
-
if (
|
|
36
|
+
const isAdmin = params.orgRole === OrgRoles.OWNER || params.orgRole === OrgRoles.ADMIN;
|
|
37
|
+
if (!isAuthzEnabled() || isAdmin) return true;
|
|
38
38
|
return checkPermission({
|
|
39
39
|
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
40
40
|
resourceId: params.projectId,
|
|
41
|
-
permission:
|
|
41
|
+
permission: SpiceDbProjectPermissions.USE,
|
|
42
42
|
subjectType: SpiceDbResourceTypes.USER,
|
|
43
43
|
subjectId: params.userId
|
|
44
44
|
});
|
|
@@ -51,12 +51,12 @@ async function canUseProject(params) {
|
|
|
51
51
|
* - Otherwise: checks SpiceDB for edit permission
|
|
52
52
|
*/
|
|
53
53
|
async function canEditProject(params) {
|
|
54
|
-
if (
|
|
55
|
-
if (
|
|
54
|
+
if (params.orgRole === OrgRoles.OWNER || params.orgRole === OrgRoles.ADMIN) return true;
|
|
55
|
+
if (!isAuthzEnabled()) return false;
|
|
56
56
|
return checkPermission({
|
|
57
57
|
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
58
58
|
resourceId: params.projectId,
|
|
59
|
-
permission:
|
|
59
|
+
permission: SpiceDbProjectPermissions.EDIT,
|
|
60
60
|
subjectType: SpiceDbResourceTypes.USER,
|
|
61
61
|
subjectId: params.userId
|
|
62
62
|
});
|
|
@@ -69,11 +69,11 @@ async function canEditProject(params) {
|
|
|
69
69
|
* - Otherwise: uses SpiceDB LookupResources
|
|
70
70
|
*/
|
|
71
71
|
async function listAccessibleProjectIds(params) {
|
|
72
|
-
|
|
73
|
-
if (
|
|
72
|
+
const isAdmin = params.orgRole === OrgRoles.OWNER || params.orgRole === OrgRoles.ADMIN;
|
|
73
|
+
if (!isAuthzEnabled() || isAdmin) return "all";
|
|
74
74
|
return lookupResources({
|
|
75
75
|
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
76
|
-
permission:
|
|
76
|
+
permission: SpiceDbProjectPermissions.VIEW,
|
|
77
77
|
subjectType: SpiceDbResourceTypes.USER,
|
|
78
78
|
subjectId: params.userId
|
|
79
79
|
});
|
|
@@ -25,7 +25,7 @@ declare function changeOrgRole(params: {
|
|
|
25
25
|
}): Promise<void>;
|
|
26
26
|
/**
|
|
27
27
|
* Sync a new project to SpiceDB.
|
|
28
|
-
* Links project to org and grants creator project_admin role.
|
|
28
|
+
* Links project to org and grants creator project_admin role (if not already org admin/owner).
|
|
29
29
|
* Call when: project is created.
|
|
30
30
|
*/
|
|
31
31
|
declare function syncProjectToSpiceDb(params: {
|
|
@@ -81,5 +81,26 @@ declare function listProjectMembers(params: {
|
|
|
81
81
|
userId: string;
|
|
82
82
|
role: ProjectRole;
|
|
83
83
|
}>>;
|
|
84
|
+
/**
|
|
85
|
+
* List all project memberships for a specific user.
|
|
86
|
+
* Returns projects where the user has explicit project_admin, project_member, or project_viewer roles.
|
|
87
|
+
*/
|
|
88
|
+
declare function listUserProjectMembershipsInSpiceDb(params: {
|
|
89
|
+
tenantId: string;
|
|
90
|
+
userId: string;
|
|
91
|
+
}): Promise<Array<{
|
|
92
|
+
projectId: string;
|
|
93
|
+
role: ProjectRole;
|
|
94
|
+
}>>;
|
|
95
|
+
/**
|
|
96
|
+
* Revoke all project memberships for a user.
|
|
97
|
+
* Call when: user is promoted to org admin (they get inherited access, explicit project roles become redundant).
|
|
98
|
+
*
|
|
99
|
+
* Uses efficient bulk delete - deletes all project relationships for user without listing first.
|
|
100
|
+
*/
|
|
101
|
+
declare function revokeAllProjectMemberships(params: {
|
|
102
|
+
tenantId: string;
|
|
103
|
+
userId: string;
|
|
104
|
+
}): Promise<void>;
|
|
84
105
|
//#endregion
|
|
85
|
-
export { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, removeProjectFromSpiceDb, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb };
|
|
106
|
+
export { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, listUserProjectMembershipsInSpiceDb, removeProjectFromSpiceDb, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb };
|
package/dist/auth/authz/sync.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpiceDbRelations, SpiceDbResourceTypes, isAuthzEnabled } from "./config.js";
|
|
2
|
-
import { deleteRelationship, getSpiceClient, readRelationships, writeRelationship } from "./client.js";
|
|
2
|
+
import { RelationshipOperation, deleteRelationship, getSpiceClient, readRelationships, writeRelationship } from "./client.js";
|
|
3
3
|
|
|
4
4
|
//#region src/auth/authz/sync.ts
|
|
5
5
|
/**
|
|
@@ -7,15 +7,12 @@ import { deleteRelationship, getSpiceClient, readRelationships, writeRelationshi
|
|
|
7
7
|
*
|
|
8
8
|
* Functions for syncing data between better-auth and SpiceDB.
|
|
9
9
|
*/
|
|
10
|
-
const RELATIONSHIP_OPERATION_CREATE = 1;
|
|
11
|
-
const RELATIONSHIP_OPERATION_TOUCH = 2;
|
|
12
|
-
const RELATIONSHIP_OPERATION_DELETE = 3;
|
|
13
10
|
/**
|
|
14
11
|
* Sync a user's org membership to SpiceDB.
|
|
15
12
|
* Call when: user joins org, role changes, user leaves org.
|
|
16
13
|
*/
|
|
17
14
|
async function syncOrgMemberToSpiceDb(params) {
|
|
18
|
-
if (!isAuthzEnabled(
|
|
15
|
+
if (!isAuthzEnabled()) return;
|
|
19
16
|
if (params.action === "add") await writeRelationship({
|
|
20
17
|
resourceType: SpiceDbResourceTypes.ORGANIZATION,
|
|
21
18
|
resourceId: params.tenantId,
|
|
@@ -37,11 +34,11 @@ async function syncOrgMemberToSpiceDb(params) {
|
|
|
37
34
|
* Call when: user's org role is updated (e.g., member -> admin).
|
|
38
35
|
*/
|
|
39
36
|
async function changeOrgRole(params) {
|
|
40
|
-
if (!isAuthzEnabled(
|
|
37
|
+
if (!isAuthzEnabled()) return;
|
|
41
38
|
if (params.oldRole === params.newRole) return;
|
|
42
39
|
await getSpiceClient().promises.writeRelationships({
|
|
43
40
|
updates: [{
|
|
44
|
-
operation:
|
|
41
|
+
operation: RelationshipOperation.DELETE,
|
|
45
42
|
relationship: {
|
|
46
43
|
resource: {
|
|
47
44
|
objectType: SpiceDbResourceTypes.ORGANIZATION,
|
|
@@ -58,7 +55,7 @@ async function changeOrgRole(params) {
|
|
|
58
55
|
optionalCaveat: void 0
|
|
59
56
|
}
|
|
60
57
|
}, {
|
|
61
|
-
operation:
|
|
58
|
+
operation: RelationshipOperation.TOUCH,
|
|
62
59
|
relationship: {
|
|
63
60
|
resource: {
|
|
64
61
|
objectType: SpiceDbResourceTypes.ORGANIZATION,
|
|
@@ -81,47 +78,56 @@ async function changeOrgRole(params) {
|
|
|
81
78
|
}
|
|
82
79
|
/**
|
|
83
80
|
* Sync a new project to SpiceDB.
|
|
84
|
-
* Links project to org and grants creator project_admin role.
|
|
81
|
+
* Links project to org and grants creator project_admin role (if not already org admin/owner).
|
|
85
82
|
* Call when: project is created.
|
|
86
83
|
*/
|
|
87
84
|
async function syncProjectToSpiceDb(params) {
|
|
88
|
-
if (!isAuthzEnabled(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
operation: RELATIONSHIP_OPERATION_CREATE,
|
|
109
|
-
relationship: {
|
|
110
|
-
resource: {
|
|
111
|
-
objectType: SpiceDbResourceTypes.PROJECT,
|
|
112
|
-
objectId: params.projectId
|
|
85
|
+
if (!isAuthzEnabled()) return;
|
|
86
|
+
const spice = getSpiceClient();
|
|
87
|
+
const isOrgAdminOrOwner = (await readRelationships({
|
|
88
|
+
resourceType: SpiceDbResourceTypes.ORGANIZATION,
|
|
89
|
+
resourceId: params.tenantId,
|
|
90
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
91
|
+
subjectId: params.creatorUserId
|
|
92
|
+
})).some((r) => r.relation === SpiceDbRelations.ADMIN || r.relation === SpiceDbRelations.OWNER);
|
|
93
|
+
const updates = [{
|
|
94
|
+
operation: RelationshipOperation.CREATE,
|
|
95
|
+
relationship: {
|
|
96
|
+
resource: {
|
|
97
|
+
objectType: SpiceDbResourceTypes.PROJECT,
|
|
98
|
+
objectId: params.projectId
|
|
99
|
+
},
|
|
100
|
+
relation: SpiceDbRelations.ORGANIZATION,
|
|
101
|
+
subject: {
|
|
102
|
+
object: {
|
|
103
|
+
objectType: SpiceDbResourceTypes.ORGANIZATION,
|
|
104
|
+
objectId: params.tenantId
|
|
113
105
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
106
|
+
optionalRelation: ""
|
|
107
|
+
},
|
|
108
|
+
optionalCaveat: void 0
|
|
109
|
+
}
|
|
110
|
+
}];
|
|
111
|
+
if (!isOrgAdminOrOwner) updates.push({
|
|
112
|
+
operation: RelationshipOperation.CREATE,
|
|
113
|
+
relationship: {
|
|
114
|
+
resource: {
|
|
115
|
+
objectType: SpiceDbResourceTypes.PROJECT,
|
|
116
|
+
objectId: params.projectId
|
|
117
|
+
},
|
|
118
|
+
relation: SpiceDbRelations.PROJECT_ADMIN,
|
|
119
|
+
subject: {
|
|
120
|
+
object: {
|
|
121
|
+
objectType: SpiceDbResourceTypes.USER,
|
|
122
|
+
objectId: params.creatorUserId
|
|
121
123
|
},
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
124
|
+
optionalRelation: ""
|
|
125
|
+
},
|
|
126
|
+
optionalCaveat: void 0
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
await spice.promises.writeRelationships({
|
|
130
|
+
updates,
|
|
125
131
|
optionalPreconditions: [],
|
|
126
132
|
optionalTransactionMetadata: void 0
|
|
127
133
|
});
|
|
@@ -130,7 +136,7 @@ async function syncProjectToSpiceDb(params) {
|
|
|
130
136
|
* Grant project access to a user.
|
|
131
137
|
*/
|
|
132
138
|
async function grantProjectAccess(params) {
|
|
133
|
-
if (!isAuthzEnabled(
|
|
139
|
+
if (!isAuthzEnabled()) throw new Error("Authorization is not enabled");
|
|
134
140
|
await writeRelationship({
|
|
135
141
|
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
136
142
|
resourceId: params.projectId,
|
|
@@ -143,7 +149,7 @@ async function grantProjectAccess(params) {
|
|
|
143
149
|
* Revoke project access from a user.
|
|
144
150
|
*/
|
|
145
151
|
async function revokeProjectAccess(params) {
|
|
146
|
-
if (!isAuthzEnabled(
|
|
152
|
+
if (!isAuthzEnabled()) throw new Error("Authorization is not enabled");
|
|
147
153
|
await deleteRelationship({
|
|
148
154
|
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
149
155
|
resourceId: params.projectId,
|
|
@@ -157,11 +163,11 @@ async function revokeProjectAccess(params) {
|
|
|
157
163
|
* Removes the old role and adds the new one atomically in a single transaction.
|
|
158
164
|
*/
|
|
159
165
|
async function changeProjectRole(params) {
|
|
160
|
-
if (!isAuthzEnabled(
|
|
166
|
+
if (!isAuthzEnabled()) throw new Error("Authorization is not enabled");
|
|
161
167
|
if (params.oldRole === params.newRole) return;
|
|
162
168
|
await getSpiceClient().promises.writeRelationships({
|
|
163
169
|
updates: [{
|
|
164
|
-
operation:
|
|
170
|
+
operation: RelationshipOperation.DELETE,
|
|
165
171
|
relationship: {
|
|
166
172
|
resource: {
|
|
167
173
|
objectType: SpiceDbResourceTypes.PROJECT,
|
|
@@ -178,7 +184,7 @@ async function changeProjectRole(params) {
|
|
|
178
184
|
optionalCaveat: void 0
|
|
179
185
|
}
|
|
180
186
|
}, {
|
|
181
|
-
operation:
|
|
187
|
+
operation: RelationshipOperation.TOUCH,
|
|
182
188
|
relationship: {
|
|
183
189
|
resource: {
|
|
184
190
|
objectType: SpiceDbResourceTypes.PROJECT,
|
|
@@ -204,7 +210,7 @@ async function changeProjectRole(params) {
|
|
|
204
210
|
* Call when: project is deleted.
|
|
205
211
|
*/
|
|
206
212
|
async function removeProjectFromSpiceDb(params) {
|
|
207
|
-
if (!isAuthzEnabled(
|
|
213
|
+
if (!isAuthzEnabled()) return;
|
|
208
214
|
await getSpiceClient().promises.deleteRelationships({
|
|
209
215
|
relationshipFilter: {
|
|
210
216
|
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
@@ -223,7 +229,7 @@ async function removeProjectFromSpiceDb(params) {
|
|
|
223
229
|
* Returns users with project_admin, project_member, or project_viewer roles.
|
|
224
230
|
*/
|
|
225
231
|
async function listProjectMembers(params) {
|
|
226
|
-
if (!isAuthzEnabled(
|
|
232
|
+
if (!isAuthzEnabled()) return [];
|
|
227
233
|
return (await readRelationships({
|
|
228
234
|
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
229
235
|
resourceId: params.projectId
|
|
@@ -232,6 +238,84 @@ async function listProjectMembers(params) {
|
|
|
232
238
|
role: rel.relation
|
|
233
239
|
}));
|
|
234
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* List all project memberships for a specific user.
|
|
243
|
+
* Returns projects where the user has explicit project_admin, project_member, or project_viewer roles.
|
|
244
|
+
*/
|
|
245
|
+
async function listUserProjectMembershipsInSpiceDb(params) {
|
|
246
|
+
if (!isAuthzEnabled()) return [];
|
|
247
|
+
return (await readRelationships({
|
|
248
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
249
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
250
|
+
subjectId: params.userId
|
|
251
|
+
})).filter((rel) => rel.relation === SpiceDbRelations.PROJECT_ADMIN || rel.relation === SpiceDbRelations.PROJECT_MEMBER || rel.relation === SpiceDbRelations.PROJECT_VIEWER).map((rel) => ({
|
|
252
|
+
projectId: rel.resourceId,
|
|
253
|
+
role: rel.relation
|
|
254
|
+
}));
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Revoke all project memberships for a user.
|
|
258
|
+
* Call when: user is promoted to org admin (they get inherited access, explicit project roles become redundant).
|
|
259
|
+
*
|
|
260
|
+
* Uses efficient bulk delete - deletes all project relationships for user without listing first.
|
|
261
|
+
*/
|
|
262
|
+
async function revokeAllProjectMemberships(params) {
|
|
263
|
+
if (!isAuthzEnabled()) return;
|
|
264
|
+
const spice = getSpiceClient();
|
|
265
|
+
await Promise.all([
|
|
266
|
+
spice.promises.deleteRelationships({
|
|
267
|
+
relationshipFilter: {
|
|
268
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
269
|
+
optionalResourceId: "",
|
|
270
|
+
optionalResourceIdPrefix: "",
|
|
271
|
+
optionalRelation: SpiceDbRelations.PROJECT_ADMIN,
|
|
272
|
+
optionalSubjectFilter: {
|
|
273
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
274
|
+
optionalSubjectId: params.userId,
|
|
275
|
+
optionalRelation: void 0
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
optionalPreconditions: [],
|
|
279
|
+
optionalLimit: 0,
|
|
280
|
+
optionalAllowPartialDeletions: false,
|
|
281
|
+
optionalTransactionMetadata: void 0
|
|
282
|
+
}),
|
|
283
|
+
spice.promises.deleteRelationships({
|
|
284
|
+
relationshipFilter: {
|
|
285
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
286
|
+
optionalResourceId: "",
|
|
287
|
+
optionalResourceIdPrefix: "",
|
|
288
|
+
optionalRelation: SpiceDbRelations.PROJECT_MEMBER,
|
|
289
|
+
optionalSubjectFilter: {
|
|
290
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
291
|
+
optionalSubjectId: params.userId,
|
|
292
|
+
optionalRelation: void 0
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
optionalPreconditions: [],
|
|
296
|
+
optionalLimit: 0,
|
|
297
|
+
optionalAllowPartialDeletions: false,
|
|
298
|
+
optionalTransactionMetadata: void 0
|
|
299
|
+
}),
|
|
300
|
+
spice.promises.deleteRelationships({
|
|
301
|
+
relationshipFilter: {
|
|
302
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
303
|
+
optionalResourceId: "",
|
|
304
|
+
optionalResourceIdPrefix: "",
|
|
305
|
+
optionalRelation: SpiceDbRelations.PROJECT_VIEWER,
|
|
306
|
+
optionalSubjectFilter: {
|
|
307
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
308
|
+
optionalSubjectId: params.userId,
|
|
309
|
+
optionalRelation: void 0
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
optionalPreconditions: [],
|
|
313
|
+
optionalLimit: 0,
|
|
314
|
+
optionalAllowPartialDeletions: false,
|
|
315
|
+
optionalTransactionMetadata: void 0
|
|
316
|
+
})
|
|
317
|
+
]);
|
|
318
|
+
}
|
|
235
319
|
|
|
236
320
|
//#endregion
|
|
237
|
-
export { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, removeProjectFromSpiceDb, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb };
|
|
321
|
+
export { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, listUserProjectMembershipsInSpiceDb, removeProjectFromSpiceDb, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb };
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as better_auth_plugins69 from "better-auth/plugins";
|
|
2
2
|
import { AccessControl } from "better-auth/plugins/access";
|
|
3
3
|
import { organizationClient } from "better-auth/client/plugins";
|
|
4
4
|
|
|
5
5
|
//#region src/auth/permissions.d.ts
|
|
6
6
|
declare const ac: AccessControl;
|
|
7
7
|
declare const memberRole: {
|
|
8
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "
|
|
9
|
-
actions:
|
|
8
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
|
|
9
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key];
|
|
10
10
|
connector: "OR" | "AND";
|
|
11
|
-
} | undefined } : never, connector?: "OR" | "AND"):
|
|
12
|
-
statements:
|
|
11
|
+
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
12
|
+
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>;
|
|
13
13
|
};
|
|
14
14
|
declare const adminRole: {
|
|
15
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "
|
|
16
|
-
actions:
|
|
15
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
|
|
16
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key];
|
|
17
17
|
connector: "OR" | "AND";
|
|
18
|
-
} | undefined } : never, connector?: "OR" | "AND"):
|
|
19
|
-
statements:
|
|
18
|
+
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
19
|
+
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>;
|
|
20
20
|
};
|
|
21
21
|
declare const ownerRole: {
|
|
22
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "
|
|
23
|
-
actions:
|
|
22
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
|
|
23
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key];
|
|
24
24
|
connector: "OR" | "AND";
|
|
25
|
-
} | undefined } : never, connector?: "OR" | "AND"):
|
|
26
|
-
statements:
|
|
25
|
+
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
26
|
+
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>;
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
29
|
export { ac, adminRole, memberRole, organizationClient, ownerRole };
|
package/dist/client-exports.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OrgRole, OrgRoles, ProjectRole, ProjectRoles } from "./auth/authz/config.js";
|
|
1
2
|
import { BreakdownComponentDef, CONTEXT_BREAKDOWN_TOTAL_SPAN_ATTRIBUTE, ContextBreakdown, V1_BREAKDOWN_SCHEMA, calculateBreakdownTotal, createEmptyBreakdown, parseContextBreakdownFromSpan } from "./constants/context-breakdown.js";
|
|
2
3
|
import { ACTIVITY_NAMES, ACTIVITY_STATUS, ACTIVITY_TYPES, AGENT_IDS, AI_OPERATIONS, AI_TOOL_TYPES, DELEGATION_FROM_SUB_AGENT_ID, DELEGATION_ID, DELEGATION_TO_SUB_AGENT_ID, SPAN_KEYS, SPAN_NAMES, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, UNKNOWN_VALUE } from "./constants/otel-attributes.js";
|
|
3
4
|
import { AGGREGATE_OPERATORS, DATA_SOURCES, DATA_TYPES, FIELD_TYPES, OPERATORS, ORDER_DIRECTIONS, PANEL_TYPES, QUERY_DEFAULTS, QUERY_EXPRESSIONS, QUERY_FIELD_CONFIGS, QUERY_TYPES, REDUCE_OPERATIONS } from "./constants/signoz-queries.js";
|
|
@@ -314,4 +315,4 @@ declare function generateIdFromName(name: string): string;
|
|
|
314
315
|
type ToolInsert = ToolApiInsert;
|
|
315
316
|
type AgentAgentInsert = AgentAgentApiInsert;
|
|
316
317
|
//#endregion
|
|
317
|
-
export { ACTIVITY_NAMES, ACTIVITY_STATUS, ACTIVITY_TYPES, AGENT_IDS, AGGREGATE_OPERATORS, AI_OPERATIONS, AI_TOOL_TYPES, AgentAgentApiInsert, AgentAgentApiInsertSchema, AgentAgentInsert, AgentApiInsert, AgentApiInsertSchema, type AgentStopWhen, AgentStopWhenSchema, ApiKeyApiCreationResponse, ApiKeyApiCreationResponseSchema, ApiKeyApiSelect, ApiKeyApiSelectSchema, ApiKeyApiUpdateResponse, ArtifactComponentApiInsert, ArtifactComponentApiInsertSchema, BreakdownComponentDef, CONTEXT_BREAKDOWN_TOTAL_SPAN_ATTRIBUTE, ContextBreakdown, ContextConfigApiInsert, ContextConfigApiInsertSchema, CredentialReferenceApiInsert, CredentialReferenceApiInsertSchema, CredentialStoreType, DATA_SOURCES, DATA_TYPES, DEFAULT_NANGO_STORE_ID, DELEGATION_FROM_SUB_AGENT_ID, DELEGATION_ID, DELEGATION_TO_SUB_AGENT_ID, DataComponentApiInsert, DataComponentApiInsertSchema, ErrorResponse, ErrorResponseSchema, ExternalAgentApiInsert, ExternalAgentApiInsertSchema, ExternalAgentDefinition, FIELD_TYPES, FullAgentDefinition, FullAgentDefinitionSchema, FunctionApiInsert, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, IdParamsSchema, InternalAgentDefinition, ListResponseSchema, MAX_ID_LENGTH, MCPTransportType, MIN_ID_LENGTH, type ModelSettings, ModelSettingsSchema, OPERATORS, ORDER_DIRECTIONS, PANEL_TYPES, PaginationSchema, QUERY_DEFAULTS, QUERY_EXPRESSIONS, QUERY_FIELD_CONFIGS, QUERY_TYPES, REDUCE_OPERATIONS, SPAN_KEYS, SPAN_NAMES, type SignatureSource, type SignatureVerificationConfig, SignatureVerificationConfigSchema, type SignedComponent, SingleResponseSchema, type StopWhen, StopWhenSchema, type SubAgentStopWhen, SubAgentStopWhenSchema, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, TenantParams, TenantParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsert, ToolApiInsertSchema, ToolInsert, TriggerApiInsert, TriggerApiInsertSchema, TriggerApiSelect, TriggerApiSelectSchema, TriggerApiUpdate, TriggerApiUpdateSchema, TriggerInvocationApiSelect, TriggerInvocationApiSelectSchema, TriggerInvocationListResponse, TriggerInvocationResponse, TriggerInvocationStatusEnum, TriggerListResponse, TriggerResponse, TriggerWithWebhookUrlListResponse, TriggerWithWebhookUrlResponse, TriggerWithWebhookUrlSchema, UNKNOWN_VALUE, URL_SAFE_ID_PATTERN, V1_BREAKDOWN_SCHEMA, calculateBreakdownTotal, createEmptyBreakdown, detectAuthenticationRequired, generateIdFromName, parseContextBreakdownFromSpan, resourceIdSchema, validatePropsAsJsonSchema };
|
|
318
|
+
export { ACTIVITY_NAMES, ACTIVITY_STATUS, ACTIVITY_TYPES, AGENT_IDS, AGGREGATE_OPERATORS, AI_OPERATIONS, AI_TOOL_TYPES, AgentAgentApiInsert, AgentAgentApiInsertSchema, AgentAgentInsert, AgentApiInsert, AgentApiInsertSchema, type AgentStopWhen, AgentStopWhenSchema, ApiKeyApiCreationResponse, ApiKeyApiCreationResponseSchema, ApiKeyApiSelect, ApiKeyApiSelectSchema, ApiKeyApiUpdateResponse, ArtifactComponentApiInsert, ArtifactComponentApiInsertSchema, BreakdownComponentDef, CONTEXT_BREAKDOWN_TOTAL_SPAN_ATTRIBUTE, ContextBreakdown, ContextConfigApiInsert, ContextConfigApiInsertSchema, CredentialReferenceApiInsert, CredentialReferenceApiInsertSchema, CredentialStoreType, DATA_SOURCES, DATA_TYPES, DEFAULT_NANGO_STORE_ID, DELEGATION_FROM_SUB_AGENT_ID, DELEGATION_ID, DELEGATION_TO_SUB_AGENT_ID, DataComponentApiInsert, DataComponentApiInsertSchema, ErrorResponse, ErrorResponseSchema, ExternalAgentApiInsert, ExternalAgentApiInsertSchema, ExternalAgentDefinition, FIELD_TYPES, FullAgentDefinition, FullAgentDefinitionSchema, FunctionApiInsert, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, IdParamsSchema, InternalAgentDefinition, ListResponseSchema, MAX_ID_LENGTH, MCPTransportType, MIN_ID_LENGTH, type ModelSettings, ModelSettingsSchema, OPERATORS, ORDER_DIRECTIONS, type OrgRole, OrgRoles, PANEL_TYPES, PaginationSchema, type ProjectRole, ProjectRoles, QUERY_DEFAULTS, QUERY_EXPRESSIONS, QUERY_FIELD_CONFIGS, QUERY_TYPES, REDUCE_OPERATIONS, SPAN_KEYS, SPAN_NAMES, type SignatureSource, type SignatureVerificationConfig, SignatureVerificationConfigSchema, type SignedComponent, SingleResponseSchema, type StopWhen, StopWhenSchema, type SubAgentStopWhen, SubAgentStopWhenSchema, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, TenantParams, TenantParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsert, ToolApiInsertSchema, ToolInsert, TriggerApiInsert, TriggerApiInsertSchema, TriggerApiSelect, TriggerApiSelectSchema, TriggerApiUpdate, TriggerApiUpdateSchema, TriggerInvocationApiSelect, TriggerInvocationApiSelectSchema, TriggerInvocationListResponse, TriggerInvocationResponse, TriggerInvocationStatusEnum, TriggerListResponse, TriggerResponse, TriggerWithWebhookUrlListResponse, TriggerWithWebhookUrlResponse, TriggerWithWebhookUrlSchema, UNKNOWN_VALUE, URL_SAFE_ID_PATTERN, V1_BREAKDOWN_SCHEMA, calculateBreakdownTotal, createEmptyBreakdown, detectAuthenticationRequired, generateIdFromName, parseContextBreakdownFromSpan, resourceIdSchema, validatePropsAsJsonSchema };
|
package/dist/client-exports.js
CHANGED
|
@@ -3,6 +3,7 @@ import { CredentialStoreType, MCPTransportType } from "./types/utility.js";
|
|
|
3
3
|
import { AgentStopWhenSchema, ArtifactComponentApiInsertSchema as ArtifactComponentApiInsertSchema$1, FullAgentAgentInsertSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, ModelSettingsSchema, SignatureVerificationConfigSchema, StopWhenSchema, SubAgentStopWhenSchema, TriggerApiInsertSchema, TriggerApiSelectSchema, TriggerApiUpdateSchema, TriggerInvocationApiSelectSchema, TriggerInvocationListResponse, TriggerInvocationResponse, TriggerInvocationStatusEnum, TriggerListResponse, TriggerResponse, TriggerWithWebhookUrlListResponse, TriggerWithWebhookUrlResponse, TriggerWithWebhookUrlSchema } from "./validation/schemas.js";
|
|
4
4
|
import { DEFAULT_NANGO_STORE_ID } from "./credential-stores/default-constants.js";
|
|
5
5
|
import { validatePropsAsJsonSchema } from "./validation/props-validation.js";
|
|
6
|
+
import { OrgRoles, ProjectRoles } from "./auth/authz/config.js";
|
|
6
7
|
import { CONTEXT_BREAKDOWN_TOTAL_SPAN_ATTRIBUTE, V1_BREAKDOWN_SCHEMA, calculateBreakdownTotal, createEmptyBreakdown, parseContextBreakdownFromSpan } from "./constants/context-breakdown.js";
|
|
7
8
|
import { ACTIVITY_NAMES, ACTIVITY_STATUS, ACTIVITY_TYPES, AGENT_IDS, AI_OPERATIONS, AI_TOOL_TYPES, DELEGATION_FROM_SUB_AGENT_ID, DELEGATION_ID, DELEGATION_TO_SUB_AGENT_ID, SPAN_KEYS, SPAN_NAMES, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, UNKNOWN_VALUE } from "./constants/otel-attributes.js";
|
|
8
9
|
import { AGGREGATE_OPERATORS, DATA_SOURCES, DATA_TYPES, FIELD_TYPES, OPERATORS, ORDER_DIRECTIONS, PANEL_TYPES, QUERY_DEFAULTS, QUERY_EXPRESSIONS, QUERY_FIELD_CONFIGS, QUERY_TYPES, REDUCE_OPERATIONS } from "./constants/signoz-queries.js";
|
|
@@ -168,4 +169,4 @@ function generateIdFromName(name) {
|
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
//#endregion
|
|
171
|
-
export { ACTIVITY_NAMES, ACTIVITY_STATUS, ACTIVITY_TYPES, AGENT_IDS, AGGREGATE_OPERATORS, AI_OPERATIONS, AI_TOOL_TYPES, AgentAgentApiInsertSchema, AgentApiInsertSchema, AgentStopWhenSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiSelectSchema, ArtifactComponentApiInsertSchema, CONTEXT_BREAKDOWN_TOTAL_SPAN_ATTRIBUTE, ContextConfigApiInsertSchema, CredentialReferenceApiInsertSchema, CredentialStoreType, DATA_SOURCES, DATA_TYPES, DEFAULT_NANGO_STORE_ID, DELEGATION_FROM_SUB_AGENT_ID, DELEGATION_ID, DELEGATION_TO_SUB_AGENT_ID, DataComponentApiInsertSchema, ErrorResponseSchema, ExternalAgentApiInsertSchema, FIELD_TYPES, FullAgentDefinitionSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, IdParamsSchema, ListResponseSchema, MAX_ID_LENGTH, MCPTransportType, MIN_ID_LENGTH, ModelSettingsSchema, OPERATORS, ORDER_DIRECTIONS, PANEL_TYPES, PaginationSchema, QUERY_DEFAULTS, QUERY_EXPRESSIONS, QUERY_FIELD_CONFIGS, QUERY_TYPES, REDUCE_OPERATIONS, SPAN_KEYS, SPAN_NAMES, SignatureVerificationConfigSchema, SingleResponseSchema, StopWhenSchema, SubAgentStopWhenSchema, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, TenantParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, TriggerApiInsertSchema, TriggerApiSelectSchema, TriggerApiUpdateSchema, TriggerInvocationApiSelectSchema, TriggerInvocationListResponse, TriggerInvocationResponse, TriggerInvocationStatusEnum, TriggerListResponse, TriggerResponse, TriggerWithWebhookUrlListResponse, TriggerWithWebhookUrlResponse, TriggerWithWebhookUrlSchema, UNKNOWN_VALUE, URL_SAFE_ID_PATTERN, V1_BREAKDOWN_SCHEMA, calculateBreakdownTotal, createEmptyBreakdown, detectAuthenticationRequired, generateIdFromName, parseContextBreakdownFromSpan, resourceIdSchema, validatePropsAsJsonSchema };
|
|
172
|
+
export { ACTIVITY_NAMES, ACTIVITY_STATUS, ACTIVITY_TYPES, AGENT_IDS, AGGREGATE_OPERATORS, AI_OPERATIONS, AI_TOOL_TYPES, AgentAgentApiInsertSchema, AgentApiInsertSchema, AgentStopWhenSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiSelectSchema, ArtifactComponentApiInsertSchema, CONTEXT_BREAKDOWN_TOTAL_SPAN_ATTRIBUTE, ContextConfigApiInsertSchema, CredentialReferenceApiInsertSchema, CredentialStoreType, DATA_SOURCES, DATA_TYPES, DEFAULT_NANGO_STORE_ID, DELEGATION_FROM_SUB_AGENT_ID, DELEGATION_ID, DELEGATION_TO_SUB_AGENT_ID, DataComponentApiInsertSchema, ErrorResponseSchema, ExternalAgentApiInsertSchema, FIELD_TYPES, FullAgentDefinitionSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, IdParamsSchema, ListResponseSchema, MAX_ID_LENGTH, MCPTransportType, MIN_ID_LENGTH, ModelSettingsSchema, OPERATORS, ORDER_DIRECTIONS, OrgRoles, PANEL_TYPES, PaginationSchema, ProjectRoles, QUERY_DEFAULTS, QUERY_EXPRESSIONS, QUERY_FIELD_CONFIGS, QUERY_TYPES, REDUCE_OPERATIONS, SPAN_KEYS, SPAN_NAMES, SignatureVerificationConfigSchema, SingleResponseSchema, StopWhenSchema, SubAgentStopWhenSchema, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, TenantParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, TriggerApiInsertSchema, TriggerApiSelectSchema, TriggerApiUpdateSchema, TriggerInvocationApiSelectSchema, TriggerInvocationListResponse, TriggerInvocationResponse, TriggerInvocationStatusEnum, TriggerListResponse, TriggerResponse, TriggerWithWebhookUrlListResponse, TriggerWithWebhookUrlResponse, TriggerWithWebhookUrlSchema, UNKNOWN_VALUE, URL_SAFE_ID_PATTERN, V1_BREAKDOWN_SCHEMA, calculateBreakdownTotal, createEmptyBreakdown, detectAuthenticationRequired, generateIdFromName, parseContextBreakdownFromSpan, resourceIdSchema, validatePropsAsJsonSchema };
|