@hexis-ai/engram-sdk 0.12.0 → 0.13.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/admin.d.ts +38 -0
- package/dist/admin.js +35 -0
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/admin.d.ts
CHANGED
|
@@ -48,6 +48,34 @@ export interface CreateWorkspaceResult {
|
|
|
48
48
|
/** Present when `issueKey !== false`. */
|
|
49
49
|
key?: IssuedKey;
|
|
50
50
|
}
|
|
51
|
+
export interface Org {
|
|
52
|
+
id: string;
|
|
53
|
+
name?: string | null;
|
|
54
|
+
metadata?: Record<string, unknown>;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
}
|
|
57
|
+
export interface OrgMembership {
|
|
58
|
+
orgId: string;
|
|
59
|
+
userId: string;
|
|
60
|
+
role: string;
|
|
61
|
+
joinedAt: string;
|
|
62
|
+
}
|
|
63
|
+
export interface CreateOrgInput {
|
|
64
|
+
id?: string;
|
|
65
|
+
name?: string;
|
|
66
|
+
metadata?: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
export interface UpsertMemberInput {
|
|
69
|
+
/** Provide one of these — userId wins when both are present. */
|
|
70
|
+
userId?: string;
|
|
71
|
+
email?: string;
|
|
72
|
+
role?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface OrgWorkspace {
|
|
75
|
+
id: string;
|
|
76
|
+
name: string | null;
|
|
77
|
+
orgId: string;
|
|
78
|
+
}
|
|
51
79
|
export declare class EngramAdmin {
|
|
52
80
|
private readonly baseUrl;
|
|
53
81
|
private readonly adminToken;
|
|
@@ -63,6 +91,16 @@ export declare class EngramAdmin {
|
|
|
63
91
|
}): Promise<IssuedKey>;
|
|
64
92
|
listKeys(workspaceId: string): Promise<ApiKey[]>;
|
|
65
93
|
revokeKey(workspaceId: string, keyId: string): Promise<void>;
|
|
94
|
+
createOrg(input?: CreateOrgInput): Promise<Org>;
|
|
95
|
+
listOrgs(): Promise<Org[]>;
|
|
96
|
+
getOrg(id: string): Promise<Org>;
|
|
97
|
+
deleteOrg(id: string): Promise<void>;
|
|
98
|
+
listOrgMembers(orgId: string): Promise<OrgMembership[]>;
|
|
99
|
+
upsertOrgMember(orgId: string, input: UpsertMemberInput): Promise<OrgMembership>;
|
|
100
|
+
removeOrgMember(orgId: string, userId: string): Promise<void>;
|
|
101
|
+
/** Create a workspace under an org and (by default) issue an api key. */
|
|
102
|
+
createWorkspaceUnderOrg(orgId: string, input?: CreateWorkspaceInput): Promise<CreateWorkspaceResult>;
|
|
103
|
+
listOrgWorkspaces(orgId: string): Promise<OrgWorkspace[]>;
|
|
66
104
|
private request;
|
|
67
105
|
}
|
|
68
106
|
export declare function createAdminClient(opts: AdminClientOptions): EngramAdmin;
|
package/dist/admin.js
CHANGED
|
@@ -41,6 +41,41 @@ export class EngramAdmin {
|
|
|
41
41
|
async revokeKey(workspaceId, keyId) {
|
|
42
42
|
await this.request("DELETE", `/admin/v1/workspaces/${encodeURIComponent(workspaceId)}/keys/${encodeURIComponent(keyId)}`);
|
|
43
43
|
}
|
|
44
|
+
// ---------- orgs (Wave G) ---------------------------------
|
|
45
|
+
async createOrg(input = {}) {
|
|
46
|
+
const r = await this.request("POST", "/admin/v1/orgs", input);
|
|
47
|
+
return r.org;
|
|
48
|
+
}
|
|
49
|
+
async listOrgs() {
|
|
50
|
+
const r = await this.request("GET", "/admin/v1/orgs");
|
|
51
|
+
return r.orgs;
|
|
52
|
+
}
|
|
53
|
+
async getOrg(id) {
|
|
54
|
+
const r = await this.request("GET", `/admin/v1/orgs/${encodeURIComponent(id)}`);
|
|
55
|
+
return r.org;
|
|
56
|
+
}
|
|
57
|
+
async deleteOrg(id) {
|
|
58
|
+
await this.request("DELETE", `/admin/v1/orgs/${encodeURIComponent(id)}`);
|
|
59
|
+
}
|
|
60
|
+
async listOrgMembers(orgId) {
|
|
61
|
+
const r = await this.request("GET", `/admin/v1/orgs/${encodeURIComponent(orgId)}/members`);
|
|
62
|
+
return r.members;
|
|
63
|
+
}
|
|
64
|
+
async upsertOrgMember(orgId, input) {
|
|
65
|
+
const r = await this.request("POST", `/admin/v1/orgs/${encodeURIComponent(orgId)}/members`, input);
|
|
66
|
+
return r.member;
|
|
67
|
+
}
|
|
68
|
+
async removeOrgMember(orgId, userId) {
|
|
69
|
+
await this.request("DELETE", `/admin/v1/orgs/${encodeURIComponent(orgId)}/members/${encodeURIComponent(userId)}`);
|
|
70
|
+
}
|
|
71
|
+
/** Create a workspace under an org and (by default) issue an api key. */
|
|
72
|
+
async createWorkspaceUnderOrg(orgId, input = {}) {
|
|
73
|
+
return this.request("POST", `/admin/v1/orgs/${encodeURIComponent(orgId)}/workspaces`, input);
|
|
74
|
+
}
|
|
75
|
+
async listOrgWorkspaces(orgId) {
|
|
76
|
+
const r = await this.request("GET", `/admin/v1/orgs/${encodeURIComponent(orgId)}/workspaces`);
|
|
77
|
+
return r.workspaces;
|
|
78
|
+
}
|
|
44
79
|
async request(method, path, body) {
|
|
45
80
|
const headers = {
|
|
46
81
|
"content-type": "application/json",
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export { extractReferences, encodeResourceId, type RefCandidate, type ReferenceS
|
|
|
3
3
|
export { parseToolName, type ParsedToolName } from "./tool-name";
|
|
4
4
|
export { BufferedTelemetry, type TelemetrySession, type TelemetryMessage, type TelemetryEvent, type TelemetryPerson, type TelemetryIdentity, type TelemetryAlias, } from "./buffered";
|
|
5
5
|
export { fetchIdToken, cloudRunIdTokenAuth } from "./id-token";
|
|
6
|
-
export { EngramAdmin, createAdminClient, type AdminClientOptions, type CreateWorkspaceInput, type CreateWorkspaceResult, type Workspace as AdminWorkspace, type ApiKey as AdminApiKey, type IssuedKey as AdminIssuedKey, } from "./admin";
|
|
6
|
+
export { EngramAdmin, createAdminClient, type AdminClientOptions, type CreateWorkspaceInput, type CreateWorkspaceResult, type Workspace as AdminWorkspace, type ApiKey as AdminApiKey, type IssuedKey as AdminIssuedKey, type Org, type OrgMembership, type CreateOrgInput, type UpsertMemberInput, type OrgWorkspace, } from "./admin";
|
|
7
7
|
export type { SessionInit, SessionUpdate, SessionAck, SessionEvent, StepEvent, ParticipantEvent, TitleEvent, EndEvent, MessageContentBlock, MessageEvent, EventBatch, PersonInfo, PersonCreate, PersonUpdate, PersonMap, AliasInfo, AliasUpsert, IdentityInfo, IdentityUpsert, } from "./types";
|