@inkeep/agents-core 0.41.2 → 0.42.0
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/api-client/base-client.d.ts +87 -8
- package/dist/api-client/base-client.js +174 -1
- package/dist/api-client/eval-api-client.d.ts +47 -0
- package/dist/api-client/eval-api-client.js +65 -0
- package/dist/api-client/index.d.ts +4 -0
- package/dist/api-client/index.js +5 -0
- package/dist/api-client/manage-api-client.d.ts +34 -0
- package/dist/api-client/manage-api-client.js +104 -0
- package/dist/auth/auth.d.ts +86 -20
- package/dist/auth/auth.js +55 -1
- package/dist/auth/authz/client.d.ts +81 -0
- package/dist/auth/authz/client.js +189 -0
- package/dist/auth/authz/config.d.ts +76 -0
- package/dist/auth/authz/config.js +76 -0
- package/dist/auth/authz/index.d.ts +5 -0
- package/dist/auth/authz/index.js +6 -0
- package/dist/auth/authz/permissions.d.ts +57 -0
- package/dist/auth/authz/permissions.js +83 -0
- package/dist/auth/authz/sync.d.ts +85 -0
- package/dist/auth/authz/sync.js +237 -0
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/auth/permissions.js +2 -181
- package/dist/client-exports.d.ts +8 -3
- package/dist/client-exports.js +3 -2
- package/dist/constants/context-breakdown.d.ts +61 -0
- package/dist/constants/context-breakdown.js +124 -0
- package/dist/constants/otel-attributes.d.ts +4 -0
- package/dist/constants/otel-attributes.js +4 -0
- package/dist/context/ContextConfig.d.ts +2 -2
- package/dist/context/ContextConfig.js +3 -3
- package/dist/context/TemplateEngine.js +0 -1
- package/dist/context/index.d.ts +1 -5
- package/dist/context/index.js +1 -5
- package/dist/credential-stuffer/CredentialStuffer.d.ts +1 -1
- package/dist/data-access/index.d.ts +34 -26
- package/dist/data-access/index.js +34 -26
- package/dist/data-access/manage/agentFull.d.ts +36 -0
- package/dist/data-access/{agentFull.js → manage/agentFull.js} +205 -7
- package/dist/data-access/{agents.d.ts → manage/agents.d.ts} +23 -22
- package/dist/data-access/{agents.js → manage/agents.js} +52 -7
- package/dist/data-access/{artifactComponents.d.ts → manage/artifactComponents.d.ts} +21 -21
- package/dist/data-access/{artifactComponents.js → manage/artifactComponents.js} +5 -5
- package/dist/data-access/{contextConfigs.d.ts → manage/contextConfigs.d.ts} +14 -14
- package/dist/data-access/{contextConfigs.js → manage/contextConfigs.js} +3 -3
- package/dist/data-access/{credentialReferences.d.ts → manage/credentialReferences.d.ts} +17 -17
- package/dist/data-access/{credentialReferences.js → manage/credentialReferences.js} +2 -2
- package/dist/data-access/{dataComponents.d.ts → manage/dataComponents.d.ts} +20 -20
- package/dist/data-access/{dataComponents.js → manage/dataComponents.js} +7 -7
- package/dist/data-access/manage/evalConfig.d.ts +221 -0
- package/dist/data-access/manage/evalConfig.js +275 -0
- package/dist/data-access/{externalAgents.d.ts → manage/externalAgents.d.ts} +16 -16
- package/dist/data-access/{externalAgents.js → manage/externalAgents.js} +2 -2
- package/dist/data-access/{functionTools.d.ts → manage/functionTools.d.ts} +65 -15
- package/dist/data-access/{functionTools.js → manage/functionTools.js} +90 -8
- package/dist/data-access/{functions.d.ts → manage/functions.d.ts} +9 -9
- package/dist/data-access/{functions.js → manage/functions.js} +3 -3
- package/dist/data-access/manage/projectFull.d.ts +38 -0
- package/dist/data-access/{projectFull.js → manage/projectFull.js} +64 -65
- package/dist/data-access/manage/projectLifecycle.d.ts +119 -0
- package/dist/data-access/manage/projectLifecycle.js +234 -0
- package/dist/data-access/manage/projects.d.ts +75 -0
- package/dist/data-access/{projects.js → manage/projects.js} +15 -16
- package/dist/data-access/{subAgentExternalAgentRelations.d.ts → manage/subAgentExternalAgentRelations.d.ts} +19 -19
- package/dist/data-access/{subAgentExternalAgentRelations.js → manage/subAgentExternalAgentRelations.js} +2 -2
- package/dist/data-access/{subAgentRelations.d.ts → manage/subAgentRelations.d.ts} +29 -29
- package/dist/data-access/{subAgentRelations.js → manage/subAgentRelations.js} +3 -3
- package/dist/data-access/{subAgentTeamAgentRelations.d.ts → manage/subAgentTeamAgentRelations.d.ts} +19 -19
- package/dist/data-access/{subAgentTeamAgentRelations.js → manage/subAgentTeamAgentRelations.js} +2 -2
- package/dist/data-access/{subAgents.d.ts → manage/subAgents.d.ts} +13 -13
- package/dist/data-access/{subAgents.js → manage/subAgents.js} +4 -4
- package/dist/data-access/{tools.d.ts → manage/tools.d.ts} +26 -19
- package/dist/data-access/{tools.js → manage/tools.js} +57 -35
- package/dist/data-access/manage/triggers.d.ts +80 -0
- package/dist/data-access/manage/triggers.js +81 -0
- package/dist/data-access/{apiKeys.d.ts → runtime/apiKeys.d.ts} +17 -17
- package/dist/data-access/{apiKeys.js → runtime/apiKeys.js} +3 -3
- package/dist/data-access/runtime/cascade-delete.d.ts +77 -0
- package/dist/data-access/runtime/cascade-delete.js +111 -0
- package/dist/data-access/{contextCache.d.ts → runtime/contextCache.d.ts} +13 -13
- package/dist/data-access/{contextCache.js → runtime/contextCache.js} +5 -5
- package/dist/data-access/{conversations.d.ts → runtime/conversations.d.ts} +68 -19
- package/dist/data-access/{conversations.js → runtime/conversations.js} +13 -7
- package/dist/data-access/runtime/evalRuns.d.ts +120 -0
- package/dist/data-access/runtime/evalRuns.js +168 -0
- package/dist/data-access/{ledgerArtifacts.d.ts → runtime/ledgerArtifacts.d.ts} +13 -13
- package/dist/data-access/{ledgerArtifacts.js → runtime/ledgerArtifacts.js} +3 -3
- package/dist/data-access/{messages.d.ts → runtime/messages.d.ts} +15 -15
- package/dist/data-access/{messages.js → runtime/messages.js} +2 -2
- package/dist/data-access/{organizations.d.ts → runtime/organizations.d.ts} +16 -7
- package/dist/data-access/{organizations.js → runtime/organizations.js} +15 -3
- package/dist/data-access/runtime/projects.d.ts +62 -0
- package/dist/data-access/runtime/projects.js +90 -0
- package/dist/data-access/runtime/tasks.d.ts +55 -0
- package/dist/data-access/{tasks.js → runtime/tasks.js} +2 -2
- package/dist/data-access/runtime/triggerInvocations.d.ts +62 -0
- package/dist/data-access/runtime/triggerInvocations.js +54 -0
- package/dist/data-access/runtime/users.d.ts +19 -0
- package/dist/data-access/{users.js → runtime/users.js} +2 -2
- package/dist/data-access/validation.d.ts +4 -4
- package/dist/data-access/validation.js +1 -1
- package/dist/db/clean.d.ts +8 -4
- package/dist/db/clean.js +14 -105
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +7 -10
- package/dist/db/manage/dolt-cleanup.d.ts +51 -0
- package/dist/db/manage/dolt-cleanup.js +132 -0
- package/dist/db/manage/manage-client.d.ts +26 -0
- package/dist/db/manage/manage-client.js +68 -0
- package/dist/db/{schema.d.ts → manage/manage-schema.d.ts} +1459 -1285
- package/dist/db/{schema.js → manage/manage-schema.js} +433 -341
- package/dist/db/manage/test-manage-client.d.ts +27 -0
- package/dist/db/manage/test-manage-client.js +68 -0
- package/dist/db/runtime/runtime-client.d.ts +20 -0
- package/dist/db/runtime/runtime-client.js +30 -0
- package/dist/db/runtime/runtime-schema.d.ts +2834 -0
- package/dist/db/runtime/runtime-schema.js +483 -0
- package/dist/db/runtime/test-runtime-client.d.ts +27 -0
- package/dist/db/{test-client.js → runtime/test-runtime-client.js} +11 -25
- package/dist/dolt/branch.d.ts +62 -0
- package/dist/dolt/branch.js +82 -0
- package/dist/dolt/branches-api.d.ts +108 -0
- package/dist/dolt/branches-api.js +162 -0
- package/dist/dolt/commit.d.ts +94 -0
- package/dist/dolt/commit.js +103 -0
- package/dist/dolt/diff.d.ts +27 -0
- package/dist/dolt/diff.js +21 -0
- package/dist/dolt/index.d.ts +10 -0
- package/dist/dolt/index.js +11 -0
- package/dist/dolt/merge.d.ts +63 -0
- package/dist/dolt/merge.js +81 -0
- package/dist/dolt/migrate-all-branches.d.ts +4 -0
- package/dist/dolt/migrate-all-branches.js +78 -0
- package/dist/dolt/migrate-dolt.d.ts +1 -0
- package/dist/dolt/migrate-dolt.js +22 -0
- package/dist/dolt/ref-helpers.d.ts +19 -0
- package/dist/dolt/ref-helpers.js +65 -0
- package/dist/dolt/ref-middleware.d.ts +82 -0
- package/dist/dolt/ref-middleware.js +217 -0
- package/dist/dolt/ref-scope.d.ts +101 -0
- package/dist/dolt/ref-scope.js +231 -0
- package/dist/dolt/schema-sync.d.ts +134 -0
- package/dist/dolt/schema-sync.js +246 -0
- package/dist/env.d.ts +6 -4
- package/dist/env.js +3 -2
- package/dist/index.d.ts +71 -44
- package/dist/index.js +74 -47
- package/dist/types/entities.d.ts +81 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/utility.d.ts +45 -4
- package/dist/utils/JsonTransformer.d.ts +44 -0
- package/dist/utils/JsonTransformer.js +112 -0
- package/dist/utils/apiKeys.d.ts +5 -1
- package/dist/utils/apiKeys.js +11 -1
- package/dist/utils/colors.d.ts +34 -0
- package/dist/utils/colors.js +49 -0
- package/dist/utils/credential-store-utils.d.ts +1 -1
- package/dist/utils/format-messages.d.ts +1 -1
- package/dist/utils/index.d.ts +7 -3
- package/dist/utils/index.js +7 -3
- package/dist/utils/internal-service-auth.d.ts +79 -0
- package/dist/utils/internal-service-auth.js +140 -0
- package/dist/utils/jwt-helpers.d.ts +56 -0
- package/dist/utils/jwt-helpers.js +90 -0
- package/dist/utils/service-token-auth.d.ts +9 -27
- package/dist/utils/service-token-auth.js +48 -96
- package/dist/utils/template-interpolation.d.ts +22 -0
- package/dist/utils/template-interpolation.js +62 -0
- package/dist/utils/third-party-mcp-servers/composio-client.js +23 -23
- package/dist/utils/trigger-auth.d.ts +62 -0
- package/dist/utils/trigger-auth.js +125 -0
- package/dist/validation/agentFull.js +2 -4
- package/dist/validation/dolt-schemas.d.ts +49 -0
- package/dist/validation/dolt-schemas.js +44 -0
- package/dist/validation/drizzle-schema-helpers.d.ts +4 -26
- package/dist/validation/drizzle-schema-helpers.js +5 -151
- package/dist/validation/index.d.ts +4 -3
- package/dist/validation/index.js +3 -2
- package/dist/validation/schemas.d.ts +17647 -4789
- package/dist/validation/schemas.js +328 -11
- package/drizzle/manage/0000_tearful_rhodey.sql +414 -0
- package/drizzle/manage/0001_broken_wendell_vaughn.sql +19 -0
- package/drizzle/manage/0002_bent_sunfire.sql +1 -0
- package/drizzle/manage/meta/0000_snapshot.json +2987 -0
- package/drizzle/manage/meta/0001_snapshot.json +3115 -0
- package/drizzle/manage/meta/0002_snapshot.json +3115 -0
- package/drizzle/manage/meta/_journal.json +27 -0
- package/drizzle/runtime/0008_silly_preak.sql +127 -0
- package/drizzle/runtime/0009_freezing_leo.sql +17 -0
- package/drizzle/runtime/meta/0008_snapshot.json +2263 -0
- package/drizzle/runtime/meta/0009_snapshot.json +2397 -0
- package/drizzle/{meta → runtime/meta}/_journal.json +14 -0
- package/package.json +48 -15
- package/dist/context/ContextFetcher.d.ts +0 -73
- package/dist/context/ContextFetcher.js +0 -291
- package/dist/context/ContextResolver.d.ts +0 -60
- package/dist/context/ContextResolver.js +0 -278
- package/dist/context/context.d.ts +0 -27
- package/dist/context/context.js +0 -128
- package/dist/context/contextCache.d.ts +0 -58
- package/dist/context/contextCache.js +0 -177
- package/dist/data-access/agentFull.d.ts +0 -33
- package/dist/data-access/projectFull.d.ts +0 -32
- package/dist/data-access/projects.d.ts +0 -71
- package/dist/data-access/tasks.d.ts +0 -45
- package/dist/data-access/users.d.ts +0 -19
- package/dist/db/client.d.ts +0 -20
- package/dist/db/client.js +0 -28
- package/dist/db/test-client.d.ts +0 -31
- package/dist/middleware/contextValidation.d.ts +0 -46
- package/dist/middleware/contextValidation.js +0 -280
- package/dist/middleware/index.d.ts +0 -2
- package/dist/middleware/index.js +0 -3
- package/dist/utils/execution.d.ts +0 -22
- package/dist/utils/execution.js +0 -25
- /package/drizzle/{0000_exotic_mysterio.sql → runtime/0000_exotic_mysterio.sql} +0 -0
- /package/drizzle/{0001_calm_sheva_callister.sql → runtime/0001_calm_sheva_callister.sql} +0 -0
- /package/drizzle/{0002_puzzling_goblin_queen.sql → runtime/0002_puzzling_goblin_queen.sql} +0 -0
- /package/drizzle/{0003_sweet_human_robot.sql → runtime/0003_sweet_human_robot.sql} +0 -0
- /package/drizzle/{0004_cuddly_shooting_star.sql → runtime/0004_cuddly_shooting_star.sql} +0 -0
- /package/drizzle/{0005_reflective_starfox.sql → runtime/0005_reflective_starfox.sql} +0 -0
- /package/drizzle/{0006_stale_thaddeus_ross.sql → runtime/0006_stale_thaddeus_ross.sql} +0 -0
- /package/drizzle/{0007_slim_karma.sql → runtime/0007_slim_karma.sql} +0 -0
- /package/drizzle/{meta → runtime/meta}/0000_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0001_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0003_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0005_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0006_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0007_snapshot.json +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//#region src/auth/authz/config.ts
|
|
2
|
+
/**
|
|
3
|
+
* SpiceDB Authorization Configuration
|
|
4
|
+
*
|
|
5
|
+
* Feature flag and configuration for the SpiceDB authorization system.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Check if authorization is enabled.
|
|
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;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get SpiceDB connection configuration from environment variables.
|
|
26
|
+
*/
|
|
27
|
+
function getSpiceDbConfig() {
|
|
28
|
+
return {
|
|
29
|
+
endpoint: process.env.SPICEDB_ENDPOINT || "localhost:50051",
|
|
30
|
+
token: process.env.SPICEDB_PRESHARED_KEY || "",
|
|
31
|
+
tlsEnabled: process.env.SPICEDB_TLS_ENABLED === "true"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* SpiceDB resource types used in the schema
|
|
36
|
+
*/
|
|
37
|
+
const SpiceDbResourceTypes = {
|
|
38
|
+
USER: "user",
|
|
39
|
+
ORGANIZATION: "organization",
|
|
40
|
+
PROJECT: "project"
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* SpiceDB relations used in the schema
|
|
44
|
+
*
|
|
45
|
+
* Relations are named as nouns (roles) per SpiceDB best practices.
|
|
46
|
+
* Project roles are prefixed for clarity when debugging/grepping.
|
|
47
|
+
*/
|
|
48
|
+
const SpiceDbRelations = {
|
|
49
|
+
OWNER: "owner",
|
|
50
|
+
ADMIN: "admin",
|
|
51
|
+
MEMBER: "member",
|
|
52
|
+
ORGANIZATION: "organization",
|
|
53
|
+
PROJECT_ADMIN: "project_admin",
|
|
54
|
+
PROJECT_MEMBER: "project_member",
|
|
55
|
+
PROJECT_VIEWER: "project_viewer"
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* SpiceDB permissions used in the schema
|
|
59
|
+
*
|
|
60
|
+
* Permissions are named as verbs (actions) per SpiceDB best practices.
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* SpiceDB permissions used in permission checks.
|
|
64
|
+
*
|
|
65
|
+
* Note: Organization-level permissions (manage) are handled via
|
|
66
|
+
* orgRole bypass in permission functions, not direct SpiceDB checks.
|
|
67
|
+
*/
|
|
68
|
+
const SpiceDbPermissions = {
|
|
69
|
+
VIEW: "view",
|
|
70
|
+
USE: "use",
|
|
71
|
+
EDIT: "edit",
|
|
72
|
+
DELETE: "delete"
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { SpiceDbPermissions, SpiceDbRelations, SpiceDbResourceTypes, getSpiceDbConfig, isAuthzEnabled };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, lookupResources, readRelationships, resetSpiceClient, writeRelationship } from "./client.js";
|
|
2
|
+
import { OrgRole, ProjectRole, SpiceDbPermissions, SpiceDbRelations, SpiceDbResourceTypes, getSpiceDbConfig, isAuthzEnabled } from "./config.js";
|
|
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, SpiceDbPermissions, SpiceDbRelations, SpiceDbResourceTypes, canEditProject, canUseProject, canViewProject, changeProjectRole, checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, getSpiceDbConfig, grantProjectAccess, isAuthzEnabled, listAccessibleProjectIds, listProjectMembers, lookupResources, readRelationships, removeProjectFromSpiceDb, resetSpiceClient, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb, writeRelationship };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SpiceDbPermissions, SpiceDbRelations, SpiceDbResourceTypes, getSpiceDbConfig, isAuthzEnabled } from "./config.js";
|
|
2
|
+
import { checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, lookupResources, readRelationships, resetSpiceClient, writeRelationship } from "./client.js";
|
|
3
|
+
import { canEditProject, canUseProject, canViewProject, listAccessibleProjectIds } from "./permissions.js";
|
|
4
|
+
import { changeProjectRole, grantProjectAccess, listProjectMembers, removeProjectFromSpiceDb, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb } from "./sync.js";
|
|
5
|
+
|
|
6
|
+
export { SpiceDbPermissions, SpiceDbRelations, SpiceDbResourceTypes, canEditProject, canUseProject, canViewProject, changeProjectRole, checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, getSpiceDbConfig, grantProjectAccess, isAuthzEnabled, listAccessibleProjectIds, listProjectMembers, lookupResources, readRelationships, removeProjectFromSpiceDb, resetSpiceClient, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb, writeRelationship };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { OrgRole } from "./config.js";
|
|
2
|
+
|
|
3
|
+
//#region src/auth/authz/permissions.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Check if a user can view a project.
|
|
7
|
+
*
|
|
8
|
+
* - If authz is disabled: returns true (current behavior)
|
|
9
|
+
* - If user is org owner/admin: returns true (bypass)
|
|
10
|
+
* - Otherwise: checks SpiceDB
|
|
11
|
+
*/
|
|
12
|
+
declare function canViewProject(params: {
|
|
13
|
+
tenantId: string;
|
|
14
|
+
userId: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
orgRole: OrgRole;
|
|
17
|
+
}): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a user can use a project (invoke agents, create API keys, view traces).
|
|
20
|
+
*
|
|
21
|
+
* - If authz is disabled: returns true (current behavior)
|
|
22
|
+
* - If user is org owner/admin: returns true (bypass)
|
|
23
|
+
* - Otherwise: checks SpiceDB for use permission
|
|
24
|
+
*/
|
|
25
|
+
declare function canUseProject(params: {
|
|
26
|
+
tenantId: string;
|
|
27
|
+
userId: string;
|
|
28
|
+
projectId: string;
|
|
29
|
+
orgRole: OrgRole;
|
|
30
|
+
}): Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Check if a user can edit a project (modify configurations).
|
|
33
|
+
*
|
|
34
|
+
* - If authz is disabled: only org owner/admin can edit
|
|
35
|
+
* - If user is org owner/admin: returns true (bypass)
|
|
36
|
+
* - Otherwise: checks SpiceDB for edit permission
|
|
37
|
+
*/
|
|
38
|
+
declare function canEditProject(params: {
|
|
39
|
+
tenantId: string;
|
|
40
|
+
userId: string;
|
|
41
|
+
projectId: string;
|
|
42
|
+
orgRole: OrgRole;
|
|
43
|
+
}): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Get list of accessible project IDs for a user.
|
|
46
|
+
*
|
|
47
|
+
* - If authz is disabled: returns 'all' (no filtering needed)
|
|
48
|
+
* - If user is org owner/admin: returns 'all' (no filtering needed)
|
|
49
|
+
* - Otherwise: uses SpiceDB LookupResources
|
|
50
|
+
*/
|
|
51
|
+
declare function listAccessibleProjectIds(params: {
|
|
52
|
+
tenantId: string;
|
|
53
|
+
userId: string;
|
|
54
|
+
orgRole: OrgRole;
|
|
55
|
+
}): Promise<string[] | 'all'>;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { canEditProject, canUseProject, canViewProject, listAccessibleProjectIds };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { SpiceDbPermissions, SpiceDbResourceTypes, isAuthzEnabled } from "./config.js";
|
|
2
|
+
import { checkPermission, lookupResources } from "./client.js";
|
|
3
|
+
|
|
4
|
+
//#region src/auth/authz/permissions.ts
|
|
5
|
+
/**
|
|
6
|
+
* SpiceDB Permission Check Functions
|
|
7
|
+
*
|
|
8
|
+
* High-level functions for checking project-level permissions.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Check if a user can view a project.
|
|
12
|
+
*
|
|
13
|
+
* - If authz is disabled: returns true (current behavior)
|
|
14
|
+
* - If user is org owner/admin: returns true (bypass)
|
|
15
|
+
* - Otherwise: checks SpiceDB
|
|
16
|
+
*/
|
|
17
|
+
async function canViewProject(params) {
|
|
18
|
+
if (!isAuthzEnabled(params.tenantId)) return true;
|
|
19
|
+
if (params.orgRole === "owner" || params.orgRole === "admin") return true;
|
|
20
|
+
return checkPermission({
|
|
21
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
22
|
+
resourceId: params.projectId,
|
|
23
|
+
permission: SpiceDbPermissions.VIEW,
|
|
24
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
25
|
+
subjectId: params.userId
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if a user can use a project (invoke agents, create API keys, view traces).
|
|
30
|
+
*
|
|
31
|
+
* - If authz is disabled: returns true (current behavior)
|
|
32
|
+
* - If user is org owner/admin: returns true (bypass)
|
|
33
|
+
* - Otherwise: checks SpiceDB for use permission
|
|
34
|
+
*/
|
|
35
|
+
async function canUseProject(params) {
|
|
36
|
+
if (!isAuthzEnabled(params.tenantId)) return true;
|
|
37
|
+
if (params.orgRole === "owner" || params.orgRole === "admin") return true;
|
|
38
|
+
return checkPermission({
|
|
39
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
40
|
+
resourceId: params.projectId,
|
|
41
|
+
permission: SpiceDbPermissions.USE,
|
|
42
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
43
|
+
subjectId: params.userId
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Check if a user can edit a project (modify configurations).
|
|
48
|
+
*
|
|
49
|
+
* - If authz is disabled: only org owner/admin can edit
|
|
50
|
+
* - If user is org owner/admin: returns true (bypass)
|
|
51
|
+
* - Otherwise: checks SpiceDB for edit permission
|
|
52
|
+
*/
|
|
53
|
+
async function canEditProject(params) {
|
|
54
|
+
if (!isAuthzEnabled(params.tenantId)) return params.orgRole === "owner" || params.orgRole === "admin";
|
|
55
|
+
if (params.orgRole === "owner" || params.orgRole === "admin") return true;
|
|
56
|
+
return checkPermission({
|
|
57
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
58
|
+
resourceId: params.projectId,
|
|
59
|
+
permission: SpiceDbPermissions.EDIT,
|
|
60
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
61
|
+
subjectId: params.userId
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get list of accessible project IDs for a user.
|
|
66
|
+
*
|
|
67
|
+
* - If authz is disabled: returns 'all' (no filtering needed)
|
|
68
|
+
* - If user is org owner/admin: returns 'all' (no filtering needed)
|
|
69
|
+
* - Otherwise: uses SpiceDB LookupResources
|
|
70
|
+
*/
|
|
71
|
+
async function listAccessibleProjectIds(params) {
|
|
72
|
+
if (!isAuthzEnabled(params.tenantId)) return "all";
|
|
73
|
+
if (params.orgRole === "owner" || params.orgRole === "admin") return "all";
|
|
74
|
+
return lookupResources({
|
|
75
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
76
|
+
permission: SpiceDbPermissions.VIEW,
|
|
77
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
78
|
+
subjectId: params.userId
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
export { canEditProject, canUseProject, canViewProject, listAccessibleProjectIds };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { OrgRole, ProjectRole } from "./config.js";
|
|
2
|
+
|
|
3
|
+
//#region src/auth/authz/sync.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sync a user's org membership to SpiceDB.
|
|
7
|
+
* Call when: user joins org, role changes, user leaves org.
|
|
8
|
+
*/
|
|
9
|
+
declare function syncOrgMemberToSpiceDb(params: {
|
|
10
|
+
tenantId: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
role: OrgRole;
|
|
13
|
+
action: 'add' | 'remove';
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Change a user's organization role.
|
|
17
|
+
* Removes the old role and adds the new one atomically in a single transaction.
|
|
18
|
+
* Call when: user's org role is updated (e.g., member -> admin).
|
|
19
|
+
*/
|
|
20
|
+
declare function changeOrgRole(params: {
|
|
21
|
+
tenantId: string;
|
|
22
|
+
userId: string;
|
|
23
|
+
oldRole: OrgRole;
|
|
24
|
+
newRole: OrgRole;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Sync a new project to SpiceDB.
|
|
28
|
+
* Links project to org and grants creator project_admin role.
|
|
29
|
+
* Call when: project is created.
|
|
30
|
+
*/
|
|
31
|
+
declare function syncProjectToSpiceDb(params: {
|
|
32
|
+
tenantId: string;
|
|
33
|
+
projectId: string;
|
|
34
|
+
creatorUserId: string;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Grant project access to a user.
|
|
38
|
+
*/
|
|
39
|
+
declare function grantProjectAccess(params: {
|
|
40
|
+
tenantId: string;
|
|
41
|
+
projectId: string;
|
|
42
|
+
userId: string;
|
|
43
|
+
role: ProjectRole;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Revoke project access from a user.
|
|
47
|
+
*/
|
|
48
|
+
declare function revokeProjectAccess(params: {
|
|
49
|
+
tenantId: string;
|
|
50
|
+
projectId: string;
|
|
51
|
+
userId: string;
|
|
52
|
+
role: ProjectRole;
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Change a user's project role.
|
|
56
|
+
* Removes the old role and adds the new one atomically in a single transaction.
|
|
57
|
+
*/
|
|
58
|
+
declare function changeProjectRole(params: {
|
|
59
|
+
tenantId: string;
|
|
60
|
+
projectId: string;
|
|
61
|
+
userId: string;
|
|
62
|
+
oldRole: ProjectRole;
|
|
63
|
+
newRole: ProjectRole;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Remove a project from SpiceDB.
|
|
67
|
+
* Call when: project is deleted.
|
|
68
|
+
*/
|
|
69
|
+
declare function removeProjectFromSpiceDb(params: {
|
|
70
|
+
tenantId: string;
|
|
71
|
+
projectId: string;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* List all explicit project members from SpiceDB.
|
|
75
|
+
* Returns users with project_admin, project_member, or project_viewer roles.
|
|
76
|
+
*/
|
|
77
|
+
declare function listProjectMembers(params: {
|
|
78
|
+
tenantId: string;
|
|
79
|
+
projectId: string;
|
|
80
|
+
}): Promise<Array<{
|
|
81
|
+
userId: string;
|
|
82
|
+
role: ProjectRole;
|
|
83
|
+
}>>;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, removeProjectFromSpiceDb, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb };
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { SpiceDbRelations, SpiceDbResourceTypes, isAuthzEnabled } from "./config.js";
|
|
2
|
+
import { deleteRelationship, getSpiceClient, readRelationships, writeRelationship } from "./client.js";
|
|
3
|
+
|
|
4
|
+
//#region src/auth/authz/sync.ts
|
|
5
|
+
/**
|
|
6
|
+
* SpiceDB Sync Utilities
|
|
7
|
+
*
|
|
8
|
+
* Functions for syncing data between better-auth and SpiceDB.
|
|
9
|
+
*/
|
|
10
|
+
const RELATIONSHIP_OPERATION_CREATE = 1;
|
|
11
|
+
const RELATIONSHIP_OPERATION_TOUCH = 2;
|
|
12
|
+
const RELATIONSHIP_OPERATION_DELETE = 3;
|
|
13
|
+
/**
|
|
14
|
+
* Sync a user's org membership to SpiceDB.
|
|
15
|
+
* Call when: user joins org, role changes, user leaves org.
|
|
16
|
+
*/
|
|
17
|
+
async function syncOrgMemberToSpiceDb(params) {
|
|
18
|
+
if (!isAuthzEnabled(params.tenantId)) return;
|
|
19
|
+
if (params.action === "add") await writeRelationship({
|
|
20
|
+
resourceType: SpiceDbResourceTypes.ORGANIZATION,
|
|
21
|
+
resourceId: params.tenantId,
|
|
22
|
+
relation: params.role,
|
|
23
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
24
|
+
subjectId: params.userId
|
|
25
|
+
});
|
|
26
|
+
else await deleteRelationship({
|
|
27
|
+
resourceType: SpiceDbResourceTypes.ORGANIZATION,
|
|
28
|
+
resourceId: params.tenantId,
|
|
29
|
+
relation: params.role,
|
|
30
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
31
|
+
subjectId: params.userId
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Change a user's organization role.
|
|
36
|
+
* Removes the old role and adds the new one atomically in a single transaction.
|
|
37
|
+
* Call when: user's org role is updated (e.g., member -> admin).
|
|
38
|
+
*/
|
|
39
|
+
async function changeOrgRole(params) {
|
|
40
|
+
if (!isAuthzEnabled(params.tenantId)) return;
|
|
41
|
+
if (params.oldRole === params.newRole) return;
|
|
42
|
+
await getSpiceClient().promises.writeRelationships({
|
|
43
|
+
updates: [{
|
|
44
|
+
operation: RELATIONSHIP_OPERATION_DELETE,
|
|
45
|
+
relationship: {
|
|
46
|
+
resource: {
|
|
47
|
+
objectType: SpiceDbResourceTypes.ORGANIZATION,
|
|
48
|
+
objectId: params.tenantId
|
|
49
|
+
},
|
|
50
|
+
relation: params.oldRole,
|
|
51
|
+
subject: {
|
|
52
|
+
object: {
|
|
53
|
+
objectType: SpiceDbResourceTypes.USER,
|
|
54
|
+
objectId: params.userId
|
|
55
|
+
},
|
|
56
|
+
optionalRelation: ""
|
|
57
|
+
},
|
|
58
|
+
optionalCaveat: void 0
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
operation: RELATIONSHIP_OPERATION_TOUCH,
|
|
62
|
+
relationship: {
|
|
63
|
+
resource: {
|
|
64
|
+
objectType: SpiceDbResourceTypes.ORGANIZATION,
|
|
65
|
+
objectId: params.tenantId
|
|
66
|
+
},
|
|
67
|
+
relation: params.newRole,
|
|
68
|
+
subject: {
|
|
69
|
+
object: {
|
|
70
|
+
objectType: SpiceDbResourceTypes.USER,
|
|
71
|
+
objectId: params.userId
|
|
72
|
+
},
|
|
73
|
+
optionalRelation: ""
|
|
74
|
+
},
|
|
75
|
+
optionalCaveat: void 0
|
|
76
|
+
}
|
|
77
|
+
}],
|
|
78
|
+
optionalPreconditions: [],
|
|
79
|
+
optionalTransactionMetadata: void 0
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Sync a new project to SpiceDB.
|
|
84
|
+
* Links project to org and grants creator project_admin role.
|
|
85
|
+
* Call when: project is created.
|
|
86
|
+
*/
|
|
87
|
+
async function syncProjectToSpiceDb(params) {
|
|
88
|
+
if (!isAuthzEnabled(params.tenantId)) return;
|
|
89
|
+
await getSpiceClient().promises.writeRelationships({
|
|
90
|
+
updates: [{
|
|
91
|
+
operation: RELATIONSHIP_OPERATION_CREATE,
|
|
92
|
+
relationship: {
|
|
93
|
+
resource: {
|
|
94
|
+
objectType: SpiceDbResourceTypes.PROJECT,
|
|
95
|
+
objectId: params.projectId
|
|
96
|
+
},
|
|
97
|
+
relation: SpiceDbRelations.ORGANIZATION,
|
|
98
|
+
subject: {
|
|
99
|
+
object: {
|
|
100
|
+
objectType: SpiceDbResourceTypes.ORGANIZATION,
|
|
101
|
+
objectId: params.tenantId
|
|
102
|
+
},
|
|
103
|
+
optionalRelation: ""
|
|
104
|
+
},
|
|
105
|
+
optionalCaveat: void 0
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
operation: RELATIONSHIP_OPERATION_CREATE,
|
|
109
|
+
relationship: {
|
|
110
|
+
resource: {
|
|
111
|
+
objectType: SpiceDbResourceTypes.PROJECT,
|
|
112
|
+
objectId: params.projectId
|
|
113
|
+
},
|
|
114
|
+
relation: SpiceDbRelations.PROJECT_ADMIN,
|
|
115
|
+
subject: {
|
|
116
|
+
object: {
|
|
117
|
+
objectType: SpiceDbResourceTypes.USER,
|
|
118
|
+
objectId: params.creatorUserId
|
|
119
|
+
},
|
|
120
|
+
optionalRelation: ""
|
|
121
|
+
},
|
|
122
|
+
optionalCaveat: void 0
|
|
123
|
+
}
|
|
124
|
+
}],
|
|
125
|
+
optionalPreconditions: [],
|
|
126
|
+
optionalTransactionMetadata: void 0
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Grant project access to a user.
|
|
131
|
+
*/
|
|
132
|
+
async function grantProjectAccess(params) {
|
|
133
|
+
if (!isAuthzEnabled(params.tenantId)) throw new Error("Authorization is not enabled");
|
|
134
|
+
await writeRelationship({
|
|
135
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
136
|
+
resourceId: params.projectId,
|
|
137
|
+
relation: params.role,
|
|
138
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
139
|
+
subjectId: params.userId
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Revoke project access from a user.
|
|
144
|
+
*/
|
|
145
|
+
async function revokeProjectAccess(params) {
|
|
146
|
+
if (!isAuthzEnabled(params.tenantId)) throw new Error("Authorization is not enabled");
|
|
147
|
+
await deleteRelationship({
|
|
148
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
149
|
+
resourceId: params.projectId,
|
|
150
|
+
relation: params.role,
|
|
151
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
152
|
+
subjectId: params.userId
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Change a user's project role.
|
|
157
|
+
* Removes the old role and adds the new one atomically in a single transaction.
|
|
158
|
+
*/
|
|
159
|
+
async function changeProjectRole(params) {
|
|
160
|
+
if (!isAuthzEnabled(params.tenantId)) throw new Error("Authorization is not enabled");
|
|
161
|
+
if (params.oldRole === params.newRole) return;
|
|
162
|
+
await getSpiceClient().promises.writeRelationships({
|
|
163
|
+
updates: [{
|
|
164
|
+
operation: RELATIONSHIP_OPERATION_DELETE,
|
|
165
|
+
relationship: {
|
|
166
|
+
resource: {
|
|
167
|
+
objectType: SpiceDbResourceTypes.PROJECT,
|
|
168
|
+
objectId: params.projectId
|
|
169
|
+
},
|
|
170
|
+
relation: params.oldRole,
|
|
171
|
+
subject: {
|
|
172
|
+
object: {
|
|
173
|
+
objectType: SpiceDbResourceTypes.USER,
|
|
174
|
+
objectId: params.userId
|
|
175
|
+
},
|
|
176
|
+
optionalRelation: ""
|
|
177
|
+
},
|
|
178
|
+
optionalCaveat: void 0
|
|
179
|
+
}
|
|
180
|
+
}, {
|
|
181
|
+
operation: RELATIONSHIP_OPERATION_TOUCH,
|
|
182
|
+
relationship: {
|
|
183
|
+
resource: {
|
|
184
|
+
objectType: SpiceDbResourceTypes.PROJECT,
|
|
185
|
+
objectId: params.projectId
|
|
186
|
+
},
|
|
187
|
+
relation: params.newRole,
|
|
188
|
+
subject: {
|
|
189
|
+
object: {
|
|
190
|
+
objectType: SpiceDbResourceTypes.USER,
|
|
191
|
+
objectId: params.userId
|
|
192
|
+
},
|
|
193
|
+
optionalRelation: ""
|
|
194
|
+
},
|
|
195
|
+
optionalCaveat: void 0
|
|
196
|
+
}
|
|
197
|
+
}],
|
|
198
|
+
optionalPreconditions: [],
|
|
199
|
+
optionalTransactionMetadata: void 0
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Remove a project from SpiceDB.
|
|
204
|
+
* Call when: project is deleted.
|
|
205
|
+
*/
|
|
206
|
+
async function removeProjectFromSpiceDb(params) {
|
|
207
|
+
if (!isAuthzEnabled(params.tenantId)) return;
|
|
208
|
+
await getSpiceClient().promises.deleteRelationships({
|
|
209
|
+
relationshipFilter: {
|
|
210
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
211
|
+
optionalResourceId: params.projectId,
|
|
212
|
+
optionalResourceIdPrefix: "",
|
|
213
|
+
optionalRelation: ""
|
|
214
|
+
},
|
|
215
|
+
optionalPreconditions: [],
|
|
216
|
+
optionalLimit: 0,
|
|
217
|
+
optionalAllowPartialDeletions: false,
|
|
218
|
+
optionalTransactionMetadata: void 0
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* List all explicit project members from SpiceDB.
|
|
223
|
+
* Returns users with project_admin, project_member, or project_viewer roles.
|
|
224
|
+
*/
|
|
225
|
+
async function listProjectMembers(params) {
|
|
226
|
+
if (!isAuthzEnabled(params.tenantId)) return [];
|
|
227
|
+
return (await readRelationships({
|
|
228
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
229
|
+
resourceId: params.projectId
|
|
230
|
+
})).filter((rel) => rel.subjectType === SpiceDbResourceTypes.USER && (rel.relation === SpiceDbRelations.PROJECT_ADMIN || rel.relation === SpiceDbRelations.PROJECT_MEMBER || rel.relation === SpiceDbRelations.PROJECT_VIEWER)).map((rel) => ({
|
|
231
|
+
userId: rel.subjectId,
|
|
232
|
+
role: rel.relation
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
//#endregion
|
|
237
|
+
export { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, removeProjectFromSpiceDb, 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 "
|
|
9
|
-
actions:
|
|
8
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
|
|
9
|
+
actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", 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" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
|
|
13
13
|
};
|
|
14
14
|
declare const adminRole: {
|
|
15
|
-
authorize<K_1 extends "
|
|
16
|
-
actions:
|
|
15
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
|
|
16
|
+
actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", 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" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
|
|
20
20
|
};
|
|
21
21
|
declare const ownerRole: {
|
|
22
|
-
authorize<K_1 extends "
|
|
23
|
-
actions:
|
|
22
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
|
|
23
|
+
actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", 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" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
29
|
export { ac, adminRole, memberRole, organizationClient, ownerRole };
|