@gpt-platform/admin 0.6.1 → 0.6.2
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/index.d.mts +1617 -2354
- package/dist/index.d.ts +1617 -2354
- package/dist/index.js +183 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +183 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -853,7 +853,7 @@ var createClient = (config = {}) => {
|
|
|
853
853
|
};
|
|
854
854
|
|
|
855
855
|
// src/version.ts
|
|
856
|
-
var SDK_VERSION = "0.6.
|
|
856
|
+
var SDK_VERSION = "0.6.2";
|
|
857
857
|
var DEFAULT_API_VERSION = "2026-03-09";
|
|
858
858
|
|
|
859
859
|
// src/base-client.ts
|
|
@@ -2744,6 +2744,15 @@ var getAdminAccounts = (options) => (options.client ?? client).get({
|
|
|
2744
2744
|
url: "/admin/accounts",
|
|
2745
2745
|
...options
|
|
2746
2746
|
});
|
|
2747
|
+
var postAdminUsersAuthRegisterViaInvitation = (options) => (options.client ?? client).post({
|
|
2748
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2749
|
+
url: "/admin/users/auth/register-via-invitation",
|
|
2750
|
+
...options,
|
|
2751
|
+
headers: {
|
|
2752
|
+
"Content-Type": "application/vnd.api+json",
|
|
2753
|
+
...options.headers
|
|
2754
|
+
}
|
|
2755
|
+
});
|
|
2747
2756
|
var getAdminStorageStats = (options) => (options.client ?? client).get({
|
|
2748
2757
|
security: [{ scheme: "bearer", type: "http" }],
|
|
2749
2758
|
url: "/admin/storage/stats",
|
|
@@ -6602,6 +6611,36 @@ function createUsersNamespace(rb) {
|
|
|
6602
6611
|
options
|
|
6603
6612
|
);
|
|
6604
6613
|
},
|
|
6614
|
+
/**
|
|
6615
|
+
* Register a new user via invitation token — skips personal tenant creation,
|
|
6616
|
+
* accepts the invitation, and creates the appropriate AccessGrant.
|
|
6617
|
+
* @param email - Email address (must match the invitation)
|
|
6618
|
+
* @param password - Password (min 8 characters)
|
|
6619
|
+
* @param passwordConfirmation - Must match password
|
|
6620
|
+
* @param invitationToken - Raw invitation token from the invitation email
|
|
6621
|
+
* @param attrs - Optional extra attributes (first_name, last_name)
|
|
6622
|
+
* @returns Created user with JWT token
|
|
6623
|
+
*/
|
|
6624
|
+
registerViaInvitation: async (email, password, passwordConfirmation, invitationToken, attrs, options) => {
|
|
6625
|
+
return rb.execute(
|
|
6626
|
+
postAdminUsersAuthRegisterViaInvitation,
|
|
6627
|
+
{
|
|
6628
|
+
body: {
|
|
6629
|
+
data: {
|
|
6630
|
+
type: "user",
|
|
6631
|
+
attributes: {
|
|
6632
|
+
email,
|
|
6633
|
+
password,
|
|
6634
|
+
password_confirmation: passwordConfirmation,
|
|
6635
|
+
invitation_token: invitationToken,
|
|
6636
|
+
...attrs
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
}
|
|
6640
|
+
},
|
|
6641
|
+
options
|
|
6642
|
+
);
|
|
6643
|
+
},
|
|
6605
6644
|
/**
|
|
6606
6645
|
* Delete a user and all associated data.
|
|
6607
6646
|
* @param id - User ID
|
|
@@ -11989,6 +12028,147 @@ function createTenantsNamespace(rb) {
|
|
|
11989
12028
|
};
|
|
11990
12029
|
}
|
|
11991
12030
|
|
|
12031
|
+
// src/namespaces/access-grants.ts
|
|
12032
|
+
function createAccessGrantsNamespace(rb) {
|
|
12033
|
+
return {
|
|
12034
|
+
/**
|
|
12035
|
+
* List access grants. Filter by subject or object using query params.
|
|
12036
|
+
*
|
|
12037
|
+
* @param params - Optional filter parameters (subject_id, object_id, object_type, relation)
|
|
12038
|
+
* @returns Paginated list of access grants
|
|
12039
|
+
* @example
|
|
12040
|
+
* const grants = await admin.accessGrants.list({ subject_id: userId });
|
|
12041
|
+
*/
|
|
12042
|
+
async list(params) {
|
|
12043
|
+
const query = params ? `?${new URLSearchParams(params).toString()}` : "";
|
|
12044
|
+
return rb.rawGet(`/admin/access-grants${query}`);
|
|
12045
|
+
},
|
|
12046
|
+
/**
|
|
12047
|
+
* Get a single access grant by ID.
|
|
12048
|
+
*
|
|
12049
|
+
* @param id - AccessGrant UUID
|
|
12050
|
+
* @returns The access grant record
|
|
12051
|
+
* @example
|
|
12052
|
+
* const grant = await admin.accessGrants.get("grant-uuid");
|
|
12053
|
+
*/
|
|
12054
|
+
async get(id) {
|
|
12055
|
+
return rb.rawGet(`/admin/access-grants/${id}`);
|
|
12056
|
+
},
|
|
12057
|
+
/**
|
|
12058
|
+
* Create a new access grant, giving a subject (user or application) a relation to an object (tenant or workspace).
|
|
12059
|
+
*
|
|
12060
|
+
* @param attrs - Grant attributes (subject_type, subject_id, relation, object_type, object_id, expires_at)
|
|
12061
|
+
* @returns The created access grant
|
|
12062
|
+
* @example
|
|
12063
|
+
* const grant = await admin.accessGrants.create({
|
|
12064
|
+
* data: {
|
|
12065
|
+
* type: "access-grant",
|
|
12066
|
+
* attributes: {
|
|
12067
|
+
* subject_type: "user",
|
|
12068
|
+
* subject_id: "user-uuid",
|
|
12069
|
+
* relation: "workspace_editor",
|
|
12070
|
+
* object_type: "workspace",
|
|
12071
|
+
* object_id: "workspace-uuid",
|
|
12072
|
+
* },
|
|
12073
|
+
* },
|
|
12074
|
+
* });
|
|
12075
|
+
*/
|
|
12076
|
+
async create(attrs) {
|
|
12077
|
+
return rb.rawPost(`/admin/access-grants`, attrs);
|
|
12078
|
+
},
|
|
12079
|
+
/**
|
|
12080
|
+
* Update an existing access grant (relation, custom_permissions, expires_at).
|
|
12081
|
+
*
|
|
12082
|
+
* @param id - AccessGrant UUID
|
|
12083
|
+
* @param attrs - Attributes to update
|
|
12084
|
+
* @returns The updated access grant
|
|
12085
|
+
* @example
|
|
12086
|
+
* const updated = await admin.accessGrants.update("grant-uuid", {
|
|
12087
|
+
* data: { type: "access-grant", id: "grant-uuid", attributes: { expires_at: "2027-01-01T00:00:00Z" } },
|
|
12088
|
+
* });
|
|
12089
|
+
*/
|
|
12090
|
+
async update(id, attrs) {
|
|
12091
|
+
return rb.rawPatch(
|
|
12092
|
+
`/admin/access-grants/${id}`,
|
|
12093
|
+
attrs
|
|
12094
|
+
);
|
|
12095
|
+
},
|
|
12096
|
+
/**
|
|
12097
|
+
* Revoke (delete) an access grant.
|
|
12098
|
+
*
|
|
12099
|
+
* @param id - AccessGrant UUID
|
|
12100
|
+
* @returns void
|
|
12101
|
+
* @example
|
|
12102
|
+
* await admin.accessGrants.revoke("grant-uuid");
|
|
12103
|
+
*/
|
|
12104
|
+
async revoke(id) {
|
|
12105
|
+
return rb.rawDelete(`/admin/access-grants/${id}`);
|
|
12106
|
+
}
|
|
12107
|
+
};
|
|
12108
|
+
}
|
|
12109
|
+
|
|
12110
|
+
// src/namespaces/roles.ts
|
|
12111
|
+
function createRolesNamespace(rb) {
|
|
12112
|
+
return {
|
|
12113
|
+
/**
|
|
12114
|
+
* List all roles for the current application.
|
|
12115
|
+
*
|
|
12116
|
+
* @param params - Optional filter parameters
|
|
12117
|
+
* @returns Paginated list of roles
|
|
12118
|
+
* @example
|
|
12119
|
+
* const roles = await admin.roles.list();
|
|
12120
|
+
*/
|
|
12121
|
+
async list(params) {
|
|
12122
|
+
const query = params ? `?${new URLSearchParams(params).toString()}` : "";
|
|
12123
|
+
return rb.rawGet(`/admin/roles${query}`);
|
|
12124
|
+
},
|
|
12125
|
+
/**
|
|
12126
|
+
* Create a new role with a set of permissions.
|
|
12127
|
+
*
|
|
12128
|
+
* @param attrs - Role attributes (name, permissions, description)
|
|
12129
|
+
* @returns The created role
|
|
12130
|
+
* @example
|
|
12131
|
+
* const role = await admin.roles.create({
|
|
12132
|
+
* data: {
|
|
12133
|
+
* type: "role",
|
|
12134
|
+
* attributes: {
|
|
12135
|
+
* name: "Document Manager",
|
|
12136
|
+
* permissions: ["extract:document:read:all", "extract:document:ingest:all"],
|
|
12137
|
+
* },
|
|
12138
|
+
* },
|
|
12139
|
+
* });
|
|
12140
|
+
*/
|
|
12141
|
+
async create(attrs) {
|
|
12142
|
+
return rb.rawPost(`/admin/roles`, attrs);
|
|
12143
|
+
},
|
|
12144
|
+
/**
|
|
12145
|
+
* Update an existing role's name or permissions.
|
|
12146
|
+
*
|
|
12147
|
+
* @param id - Role UUID
|
|
12148
|
+
* @param attrs - Attributes to update
|
|
12149
|
+
* @returns The updated role
|
|
12150
|
+
* @example
|
|
12151
|
+
* const updated = await admin.roles.update("role-uuid", {
|
|
12152
|
+
* data: { type: "role", id: "role-uuid", attributes: { name: "Senior Document Manager" } },
|
|
12153
|
+
* });
|
|
12154
|
+
*/
|
|
12155
|
+
async update(id, attrs) {
|
|
12156
|
+
return rb.rawPatch(`/admin/roles/${id}`, attrs);
|
|
12157
|
+
},
|
|
12158
|
+
/**
|
|
12159
|
+
* Delete a role.
|
|
12160
|
+
*
|
|
12161
|
+
* @param id - Role UUID
|
|
12162
|
+
* @returns void
|
|
12163
|
+
* @example
|
|
12164
|
+
* await admin.roles.destroy("role-uuid");
|
|
12165
|
+
*/
|
|
12166
|
+
async destroy(id) {
|
|
12167
|
+
return rb.rawDelete(`/admin/roles/${id}`);
|
|
12168
|
+
}
|
|
12169
|
+
};
|
|
12170
|
+
}
|
|
12171
|
+
|
|
11992
12172
|
// src/gpt-admin.ts
|
|
11993
12173
|
var GptAdmin = class extends BaseClient {
|
|
11994
12174
|
constructor(config) {
|
|
@@ -12027,6 +12207,8 @@ var GptAdmin = class extends BaseClient {
|
|
|
12027
12207
|
this.compliance = createComplianceNamespace(rb);
|
|
12028
12208
|
this.pipelines = createPipelinesNamespace(rb);
|
|
12029
12209
|
this.tenants = createTenantsNamespace(rb);
|
|
12210
|
+
this.accessGrants = createAccessGrantsNamespace(rb);
|
|
12211
|
+
this.roles = createRolesNamespace(rb);
|
|
12030
12212
|
}
|
|
12031
12213
|
};
|
|
12032
12214
|
|