@omnibase/core-js 0.7.1 → 0.7.3

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.
@@ -1,195 +1,2 @@
1
- import { RelationshipApi, PermissionApi } from '@ory/client';
2
-
3
- /**
4
- * Client for managing permissions and relationships using Ory Keto
5
- *
6
- * This client provides access to Ory Keto's permission system, allowing you to
7
- * create, manage, and check relationships between subjects and objects. It handles
8
- * both read operations (permission checks) and write operations (relationship management).
9
- *
10
- * The client automatically configures separate endpoints for read and write operations
11
- * to optimize performance and security by following Ory Keto's recommended architecture.
12
- *
13
- * @example
14
- * Basic permission checking:
15
- * ```typescript
16
- * import { PermissionsClient } from '@omnibase/core-js/permissions';
17
- *
18
- * const permissionsClient = new PermissionsClient('https://api.example.com');
19
- *
20
- * // Check if a user can view a tenant
21
- * const canView = await permissionsClient.permissions.checkPermission(
22
- * undefined,
23
- * {
24
- * namespace: 'Tenant',
25
- * object: 'tenant_123',
26
- * relation: 'view',
27
- * subjectId: 'user_456'
28
- * }
29
- * );
30
- *
31
- * if (canView.data.allowed) {
32
- * console.log('User can view the tenant');
33
- * }
34
- * ```
35
- *
36
- * @example
37
- * Creating tenant relationships:
38
- * ```typescript
39
- * // Create a relationship making a user an owner of a tenant
40
- * await permissionsClient.relationships.createRelationship(
41
- * undefined,
42
- * {
43
- * namespace: 'Tenant',
44
- * object: 'tenant_123',
45
- * relation: 'owners',
46
- * subjectId: 'user_456'
47
- * }
48
- * );
49
- *
50
- * // Now the user has owner permissions on the tenant
51
- * console.log('User is now an owner of the tenant');
52
- * ```
53
- *
54
- * @example
55
- * Complex tenant permission management:
56
- * ```typescript
57
- * const tenantId = 'tenant_123';
58
- * const userId = 'user_456';
59
- *
60
- * // Grant admin permissions to a user
61
- * await permissionsClient.relationships.createRelationship(
62
- * undefined,
63
- * {
64
- * namespace: 'Tenant',
65
- * object: tenantId,
66
- * relation: 'admins',
67
- * subjectId: userId
68
- * }
69
- * );
70
- *
71
- * // Check if user can manage members (admins and owners can)
72
- * const canManageMembers = await permissionsClient.permissions.checkPermission(
73
- * undefined,
74
- * {
75
- * namespace: 'Tenant',
76
- * object: tenantId,
77
- * relation: 'manage_members',
78
- * subjectId: userId
79
- * }
80
- * );
81
- *
82
- * if (canManageMembers.data.allowed) {
83
- * // User can invite/remove members
84
- * console.log('User can manage tenant members');
85
- * }
86
- *
87
- * // Later, remove admin permissions
88
- * await permissionsClient.relationships.deleteRelationships(
89
- * undefined,
90
- * {
91
- * namespace: 'Tenant',
92
- * object: tenantId,
93
- * relation: 'admins',
94
- * subjectId: userId
95
- * }
96
- * );
97
- * ```
98
- *
99
- * @since 1.0.0
100
- * @public
101
- * @group Client
102
- */
103
- declare class PermissionsClient {
104
- /**
105
- * Ory Keto RelationshipApi for managing subject-object relationships
106
- *
107
- * Provides methods for creating, updating, and deleting relationships between
108
- * subjects (users, groups) and objects (tenants, resources). This API handles
109
- * write operations and is used to establish permission structures.
110
- *
111
- * Key methods:
112
- * - `createRelationship()` - Creates a new relationship tuple
113
- * - `deleteRelationships()` - Removes existing relationship tuples
114
- * - `getRelationships()` - Queries existing relationships
115
- * - `patchRelationships()` - Updates multiple relationships atomically
116
- *
117
- * @example
118
- * ```typescript
119
- * // Create a relationship
120
- * await client.relationships.createRelationship(
121
- * undefined,
122
- * {
123
- * namespace: 'Tenant',
124
- * object: 'tenant_123',
125
- * relation: 'members',
126
- * subjectId: 'user_456'
127
- * }
128
- * );
129
- * ```
130
- *
131
- * @since 1.0.0
132
- * @group Relationships
133
- */
134
- relationships: RelationshipApi;
135
- /**
136
- * Ory Keto PermissionApi for checking permissions
137
- *
138
- * Provides methods for querying whether a subject has a specific permission
139
- * on an object. This API handles read operations and is optimized for fast
140
- * permission checks in your application logic.
141
- *
142
- * Key methods:
143
- * - `checkPermission()` - Checks if a subject has permission on an object
144
- * - `checkPermissionOrError()` - Same as above but throws error if denied
145
- * - `expandPermissions()` - Expands relationships to show all granted permissions
146
- *
147
- * @example
148
- * ```typescript
149
- * // Check permission
150
- * const result = await client.permissions.checkPermission(
151
- * undefined,
152
- * {
153
- * namespace: 'Tenant',
154
- * object: 'tenant_123',
155
- * relation: 'view',
156
- * subjectId: 'user_456'
157
- * }
158
- * );
159
- *
160
- * console.log('Has permission:', result.data.allowed);
161
- * ```
162
- *
163
- * @since 1.0.0
164
- * @group Permissions
165
- */
166
- permissions: PermissionApi;
167
- /**
168
- * Creates a new PermissionsClient instance
169
- *
170
- * Initializes the client with separate endpoints for read and write operations.
171
- * The client automatically appends the appropriate Keto API paths to the base URL
172
- * for optimal performance and security separation.
173
- *
174
- * @param apiBaseUrl - The base URL for your Omnibase API instance
175
- *
176
- * @throws {Error} When the base URL is invalid or cannot be reached
177
- *
178
- * @example
179
- * ```typescript
180
- * const client = new PermissionsClient('https://api.example.com');
181
- * ```
182
- *
183
- * @example
184
- * Local development:
185
- * ```typescript
186
- * const client = new PermissionsClient('http://localhost:8080');
187
- * ```
188
- *
189
- * @since 1.0.0
190
- * @group Client
191
- */
192
- constructor(apiBaseUrl: string);
193
- }
194
-
195
- export { PermissionsClient };
1
+ export { A as AssignRoleRequest, C as CreateRoleRequest, N as NamespaceDefinition, P as PermissionsClient, a as Role, R as RolesHandler, U as UpdateRoleRequest } from '../payments/index.js';
2
+ import '@ory/client';
@@ -1,6 +1,8 @@
1
1
  import {
2
- PermissionsClient
3
- } from "../chunk-DDFBRGMG.js";
2
+ PermissionsClient,
3
+ RolesHandler
4
+ } from "../chunk-V4FWENQQ.js";
4
5
  export {
5
- PermissionsClient
6
+ PermissionsClient,
7
+ RolesHandler
6
8
  };
@@ -1,3 +1,2 @@
1
- export { D as DownloadResult, S as StorageClient, U as UploadOptions, a as UploadResult } from '../payments/index.cjs';
2
- import '../permissions/index.cjs';
1
+ export { D as DownloadResult, S as StorageClient, b as UploadOptions, c as UploadResult } from '../payments/index.cjs';
3
2
  import '@ory/client';
@@ -1,3 +1,2 @@
1
- export { D as DownloadResult, S as StorageClient, U as UploadOptions, a as UploadResult } from '../payments/index.js';
2
- import '../permissions/index.js';
1
+ export { D as DownloadResult, S as StorageClient, b as UploadOptions, c as UploadResult } from '../payments/index.js';
3
2
  import '@ory/client';
@@ -1,3 +1,2 @@
1
- export { A as AcceptTenantInviteRequest, b as AcceptTenantInviteResponse, j as CreateTenantRequest, h as CreateTenantResponse, d as CreateTenantUserInviteRequest, C as CreateTenantUserInviteResponse, g as DeleteTenantResponse, f as SwitchActiveTenantResponse, i as Tenant, T as TenantHandler, c as TenantInvite, e as TenantInviteManager, k as TenantManger } from '../payments/index.cjs';
2
- import '../permissions/index.cjs';
1
+ export { d as AcceptTenantInviteRequest, e as AcceptTenantInviteResponse, n as CreateTenantRequest, l as CreateTenantResponse, h as CreateTenantUserInviteRequest, f as CreateTenantUserInviteResponse, k as DeleteTenantResponse, j as SwitchActiveTenantResponse, m as Tenant, T as TenantHandler, g as TenantInvite, i as TenantInviteManager, o as TenantManger } from '../payments/index.cjs';
3
2
  import '@ory/client';
@@ -1,3 +1,2 @@
1
- export { A as AcceptTenantInviteRequest, b as AcceptTenantInviteResponse, j as CreateTenantRequest, h as CreateTenantResponse, d as CreateTenantUserInviteRequest, C as CreateTenantUserInviteResponse, g as DeleteTenantResponse, f as SwitchActiveTenantResponse, i as Tenant, T as TenantHandler, c as TenantInvite, e as TenantInviteManager, k as TenantManger } from '../payments/index.js';
2
- import '../permissions/index.js';
1
+ export { d as AcceptTenantInviteRequest, e as AcceptTenantInviteResponse, n as CreateTenantRequest, l as CreateTenantResponse, h as CreateTenantUserInviteRequest, f as CreateTenantUserInviteResponse, k as DeleteTenantResponse, j as SwitchActiveTenantResponse, m as Tenant, T as TenantHandler, g as TenantInvite, i as TenantInviteManager, o as TenantManger } from '../payments/index.js';
3
2
  import '@ory/client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnibase/core-js",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "OmniBase core Javascript SDK - framework agnostic",
5
5
  "files": [
6
6
  "dist/**/*"