lemma-sdk 0.2.0 → 0.2.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/README.md +108 -36
- package/dist/browser/lemma-client.js +2012 -1242
- package/dist/client.d.ts +23 -6
- package/dist/client.js +32 -11
- package/dist/http.d.ts +18 -5
- package/dist/http.js +77 -22
- package/dist/index.d.ts +16 -7
- package/dist/index.js +1 -0
- package/dist/namespaces/assistants.d.ts +61 -16
- package/dist/namespaces/assistants.js +130 -19
- package/dist/namespaces/icons.d.ts +7 -0
- package/dist/namespaces/icons.js +13 -0
- package/dist/namespaces/organizations.d.ts +46 -0
- package/dist/namespaces/organizations.js +51 -0
- package/dist/namespaces/pod-members.d.ts +15 -0
- package/dist/namespaces/pod-members.js +19 -0
- package/dist/namespaces/pod-surfaces.d.ts +16 -0
- package/dist/namespaces/pod-surfaces.js +22 -0
- package/dist/namespaces/pods.d.ts +26 -0
- package/dist/namespaces/pods.js +41 -0
- package/dist/namespaces/records.d.ts +7 -3
- package/dist/namespaces/records.js +34 -3
- package/dist/namespaces/resources.d.ts +16 -0
- package/dist/namespaces/resources.js +32 -0
- package/dist/namespaces/tables.d.ts +7 -1
- package/dist/namespaces/tables.js +11 -1
- package/dist/namespaces/tasks.d.ts +15 -9
- package/dist/namespaces/tasks.js +43 -11
- package/dist/namespaces/users.d.ts +9 -0
- package/dist/namespaces/users.js +16 -0
- package/dist/namespaces/workflows.d.ts +8 -1
- package/dist/namespaces/workflows.js +23 -1
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.js +2 -0
- package/dist/react/useAgentRun.d.ts +17 -0
- package/dist/react/useAgentRun.js +66 -0
- package/dist/react/useAssistantRun.d.ts +18 -0
- package/dist/react/useAssistantRun.js +82 -0
- package/dist/streams.d.ts +10 -0
- package/dist/streams.js +68 -0
- package/dist/types.d.ts +39 -1
- package/package.json +5 -5
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { GeneratedClientAdapter } from "../generated.js";
|
|
2
|
+
import type { HttpClient } from "../http.js";
|
|
3
|
+
import type { OrganizationCreateRequest } from "../openapi_client/models/OrganizationCreateRequest.js";
|
|
4
|
+
import type { OrganizationInvitationListResponse } from "../openapi_client/models/OrganizationInvitationListResponse.js";
|
|
5
|
+
import type { OrganizationInvitationRequest } from "../openapi_client/models/OrganizationInvitationRequest.js";
|
|
6
|
+
import type { OrganizationInvitationStatus } from "../openapi_client/models/OrganizationInvitationStatus.js";
|
|
7
|
+
import type { OrganizationRole } from "../openapi_client/models/OrganizationRole.js";
|
|
8
|
+
export declare class OrganizationsNamespace {
|
|
9
|
+
private readonly client;
|
|
10
|
+
private readonly http;
|
|
11
|
+
constructor(client: GeneratedClientAdapter, http: HttpClient);
|
|
12
|
+
list(options?: {
|
|
13
|
+
limit?: number;
|
|
14
|
+
pageToken?: string;
|
|
15
|
+
cursor?: string;
|
|
16
|
+
}): Promise<import("../index.js").OrganizationListResponse>;
|
|
17
|
+
get(orgId: string): Promise<import("../index.js").OrganizationResponse>;
|
|
18
|
+
create(payload: OrganizationCreateRequest): Promise<import("../index.js").OrganizationResponse>;
|
|
19
|
+
readonly members: {
|
|
20
|
+
list: (orgId: string, options?: {
|
|
21
|
+
limit?: number;
|
|
22
|
+
pageToken?: string;
|
|
23
|
+
cursor?: string;
|
|
24
|
+
}) => Promise<import("../index.js").OrganizationMemberListResponse>;
|
|
25
|
+
updateRole: (orgId: string, memberId: string, role: OrganizationRole) => Promise<import("../index.js").OrganizationMemberResponse>;
|
|
26
|
+
remove: (orgId: string, memberId: string) => Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
readonly invitations: {
|
|
29
|
+
listMine: (options?: {
|
|
30
|
+
status?: OrganizationInvitationStatus;
|
|
31
|
+
limit?: number;
|
|
32
|
+
pageToken?: string;
|
|
33
|
+
cursor?: string;
|
|
34
|
+
}) => Promise<OrganizationInvitationListResponse>;
|
|
35
|
+
list: (orgId: string, options?: {
|
|
36
|
+
status?: OrganizationInvitationStatus;
|
|
37
|
+
limit?: number;
|
|
38
|
+
pageToken?: string;
|
|
39
|
+
cursor?: string;
|
|
40
|
+
}) => Promise<OrganizationInvitationListResponse>;
|
|
41
|
+
get: (invitationId: string) => Promise<import("../index.js").OrganizationInvitationResponse>;
|
|
42
|
+
invite: (orgId: string, payload: OrganizationInvitationRequest) => Promise<import("../index.js").OrganizationInvitationResponse>;
|
|
43
|
+
accept: (invitationId: string) => Promise<import("../index.js").OrganizationMessageResponse>;
|
|
44
|
+
revoke: (invitationId: string) => Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { OrganizationsService } from "../openapi_client/services/OrganizationsService.js";
|
|
2
|
+
export class OrganizationsNamespace {
|
|
3
|
+
client;
|
|
4
|
+
http;
|
|
5
|
+
constructor(client, http) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
list(options = {}) {
|
|
10
|
+
return this.client.request(() => OrganizationsService.orgList(options.limit ?? 100, options.pageToken ?? options.cursor));
|
|
11
|
+
}
|
|
12
|
+
get(orgId) {
|
|
13
|
+
return this.client.request(() => OrganizationsService.orgGet(orgId));
|
|
14
|
+
}
|
|
15
|
+
create(payload) {
|
|
16
|
+
return this.client.request(() => OrganizationsService.orgCreate(payload));
|
|
17
|
+
}
|
|
18
|
+
members = {
|
|
19
|
+
list: (orgId, options = {}) => this.client.request(() => OrganizationsService.orgMemberList(orgId, options.limit ?? 100, options.pageToken ?? options.cursor)),
|
|
20
|
+
updateRole: (orgId, memberId, role) => this.client.request(() => OrganizationsService.orgMemberUpdateRole(orgId, memberId, { role })),
|
|
21
|
+
remove: (orgId, memberId) => this.client.request(() => OrganizationsService.orgMemberRemove(orgId, memberId)),
|
|
22
|
+
};
|
|
23
|
+
invitations = {
|
|
24
|
+
listMine: async (options = {}) => {
|
|
25
|
+
if (options.status) {
|
|
26
|
+
return this.client.request(() => OrganizationsService.orgInvitationListMine(options.status, options.limit ?? 100, options.pageToken ?? options.cursor));
|
|
27
|
+
}
|
|
28
|
+
return this.http.request("GET", "/organizations/invitations", {
|
|
29
|
+
params: {
|
|
30
|
+
limit: options.limit ?? 100,
|
|
31
|
+
page_token: options.pageToken ?? options.cursor,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
list: async (orgId, options = {}) => {
|
|
36
|
+
if (options.status) {
|
|
37
|
+
return this.client.request(() => OrganizationsService.orgInvitationList(orgId, options.status, options.limit ?? 100, options.pageToken ?? options.cursor));
|
|
38
|
+
}
|
|
39
|
+
return this.http.request("GET", `/organizations/${encodeURIComponent(orgId)}/invitations`, {
|
|
40
|
+
params: {
|
|
41
|
+
limit: options.limit ?? 100,
|
|
42
|
+
page_token: options.pageToken ?? options.cursor,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
get: (invitationId) => this.client.request(() => OrganizationsService.orgInvitationGet(invitationId)),
|
|
47
|
+
invite: (orgId, payload) => this.client.request(() => OrganizationsService.orgInvitationInvite(orgId, payload)),
|
|
48
|
+
accept: (invitationId) => this.client.request(() => OrganizationsService.orgInvitationAccept(invitationId)),
|
|
49
|
+
revoke: (invitationId) => this.client.request(() => OrganizationsService.orgInvitationRevoke(invitationId)),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GeneratedClientAdapter } from "../generated.js";
|
|
2
|
+
import type { PodMemberAddRequest } from "../openapi_client/models/PodMemberAddRequest.js";
|
|
3
|
+
import type { PodRole } from "../openapi_client/models/PodRole.js";
|
|
4
|
+
export declare class PodMembersNamespace {
|
|
5
|
+
private readonly client;
|
|
6
|
+
constructor(client: GeneratedClientAdapter);
|
|
7
|
+
list(podId: string, options?: {
|
|
8
|
+
limit?: number;
|
|
9
|
+
pageToken?: string;
|
|
10
|
+
cursor?: string;
|
|
11
|
+
}): Promise<import("../index.js").PodMemberListResponse>;
|
|
12
|
+
add(podId: string, payload: PodMemberAddRequest): Promise<import("../index.js").PodMemberResponse>;
|
|
13
|
+
updateRole(podId: string, memberId: string, role: PodRole): Promise<import("../index.js").PodMemberResponse>;
|
|
14
|
+
remove(podId: string, memberId: string): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PodMembersService } from "../openapi_client/services/PodMembersService.js";
|
|
2
|
+
export class PodMembersNamespace {
|
|
3
|
+
client;
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
list(podId, options = {}) {
|
|
8
|
+
return this.client.request(() => PodMembersService.podMemberList(podId, options.limit ?? 100, options.pageToken ?? options.cursor));
|
|
9
|
+
}
|
|
10
|
+
add(podId, payload) {
|
|
11
|
+
return this.client.request(() => PodMembersService.podMemberAdd(podId, payload));
|
|
12
|
+
}
|
|
13
|
+
updateRole(podId, memberId, role) {
|
|
14
|
+
return this.client.request(() => PodMembersService.podMemberUpdateRole(podId, memberId, { role }));
|
|
15
|
+
}
|
|
16
|
+
remove(podId, memberId) {
|
|
17
|
+
return this.client.request(() => PodMembersService.podMemberRemove(podId, memberId));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GeneratedClientAdapter } from "../generated.js";
|
|
2
|
+
import type { CreateSurfaceRequest } from "../openapi_client/models/CreateSurfaceRequest.js";
|
|
3
|
+
import type { UpdateSurfaceRequest } from "../openapi_client/models/UpdateSurfaceRequest.js";
|
|
4
|
+
export declare class PodSurfacesNamespace {
|
|
5
|
+
private readonly client;
|
|
6
|
+
constructor(client: GeneratedClientAdapter);
|
|
7
|
+
list(podId: string, options?: {
|
|
8
|
+
limit?: number;
|
|
9
|
+
pageToken?: string;
|
|
10
|
+
cursor?: string;
|
|
11
|
+
}): Promise<import("../index.js").AssistantSurfaceListResponse>;
|
|
12
|
+
create(podId: string, payload: CreateSurfaceRequest): Promise<any>;
|
|
13
|
+
get(podId: string, surfaceId: string): Promise<any>;
|
|
14
|
+
updateConfig(podId: string, surfaceId: string, payload: UpdateSurfaceRequest): Promise<any>;
|
|
15
|
+
toggle(podId: string, surfaceId: string, isActive: boolean): Promise<any>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AssistantSurfacesService } from "../openapi_client/services/AssistantSurfacesService.js";
|
|
2
|
+
export class PodSurfacesNamespace {
|
|
3
|
+
client;
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
list(podId, options = {}) {
|
|
8
|
+
return this.client.request(() => AssistantSurfacesService.assistantSurfaceList(podId, options.limit ?? 100, options.pageToken ?? options.cursor));
|
|
9
|
+
}
|
|
10
|
+
create(podId, payload) {
|
|
11
|
+
return this.client.request(() => AssistantSurfacesService.assistantSurfaceCreate(podId, payload));
|
|
12
|
+
}
|
|
13
|
+
get(podId, surfaceId) {
|
|
14
|
+
return this.client.request(() => AssistantSurfacesService.assistantSurfaceGet(podId, surfaceId));
|
|
15
|
+
}
|
|
16
|
+
updateConfig(podId, surfaceId, payload) {
|
|
17
|
+
return this.client.request(() => AssistantSurfacesService.assistantSurfaceUpdateConfig(podId, surfaceId, payload));
|
|
18
|
+
}
|
|
19
|
+
toggle(podId, surfaceId, isActive) {
|
|
20
|
+
return this.client.request(() => AssistantSurfacesService.assistantSurfaceToggle(podId, surfaceId, { is_active: isActive }));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GeneratedClientAdapter } from "../generated.js";
|
|
2
|
+
import type { HttpClient } from "../http.js";
|
|
3
|
+
import type { PodCreateRequest } from "../openapi_client/models/PodCreateRequest.js";
|
|
4
|
+
import type { PodListResponse } from "../openapi_client/models/PodListResponse.js";
|
|
5
|
+
import type { PodUpdateRequest } from "../openapi_client/models/PodUpdateRequest.js";
|
|
6
|
+
export declare class PodsNamespace {
|
|
7
|
+
private readonly client;
|
|
8
|
+
private readonly http;
|
|
9
|
+
constructor(client: GeneratedClientAdapter, http: HttpClient);
|
|
10
|
+
list(options?: {
|
|
11
|
+
organizationId?: string;
|
|
12
|
+
limit?: number;
|
|
13
|
+
pageToken?: string;
|
|
14
|
+
cursor?: string;
|
|
15
|
+
}): Promise<PodListResponse>;
|
|
16
|
+
listByOrganization(organizationId: string, options?: {
|
|
17
|
+
limit?: number;
|
|
18
|
+
pageToken?: string;
|
|
19
|
+
cursor?: string;
|
|
20
|
+
}): Promise<PodListResponse>;
|
|
21
|
+
get(podId: string): Promise<import("../index.js").PodResponse>;
|
|
22
|
+
create(payload: PodCreateRequest): Promise<import("../index.js").PodResponse>;
|
|
23
|
+
update(podId: string, payload: PodUpdateRequest): Promise<import("../index.js").PodResponse>;
|
|
24
|
+
delete(podId: string): Promise<void>;
|
|
25
|
+
config(podId: string): Promise<import("../index.js").PodConfigResponse>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PodsService } from "../openapi_client/services/PodsService.js";
|
|
2
|
+
export class PodsNamespace {
|
|
3
|
+
client;
|
|
4
|
+
http;
|
|
5
|
+
constructor(client, http) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
list(options = {}) {
|
|
10
|
+
if (options.organizationId) {
|
|
11
|
+
return this.listByOrganization(options.organizationId, {
|
|
12
|
+
limit: options.limit,
|
|
13
|
+
pageToken: options.pageToken ?? options.cursor,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return this.http.request("GET", "/pods", {
|
|
17
|
+
params: {
|
|
18
|
+
limit: options.limit ?? 100,
|
|
19
|
+
page_token: options.pageToken ?? options.cursor,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
listByOrganization(organizationId, options = {}) {
|
|
24
|
+
return this.client.request(() => PodsService.podList(organizationId, options.limit ?? 100, options.pageToken ?? options.cursor));
|
|
25
|
+
}
|
|
26
|
+
get(podId) {
|
|
27
|
+
return this.client.request(() => PodsService.podGet(podId));
|
|
28
|
+
}
|
|
29
|
+
create(payload) {
|
|
30
|
+
return this.client.request(() => PodsService.podCreate(payload));
|
|
31
|
+
}
|
|
32
|
+
update(podId, payload) {
|
|
33
|
+
return this.client.request(() => PodsService.podUpdate(podId, payload));
|
|
34
|
+
}
|
|
35
|
+
delete(podId) {
|
|
36
|
+
return this.client.request(() => PodsService.podDelete(podId));
|
|
37
|
+
}
|
|
38
|
+
config(podId) {
|
|
39
|
+
return this.client.request(() => PodsService.podConfigGet(podId));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import type { GeneratedClientAdapter } from "../generated.js";
|
|
2
|
+
import type { HttpClient } from "../http.js";
|
|
3
|
+
import type { RecordListResponse } from "../openapi_client/models/RecordListResponse.js";
|
|
2
4
|
import type { RecordQueryRequest } from "../openapi_client/models/RecordQueryRequest.js";
|
|
3
5
|
import type { ListRecordsOptions } from "../types.js";
|
|
4
6
|
export declare class RecordsNamespace {
|
|
5
7
|
private readonly client;
|
|
8
|
+
private readonly http;
|
|
6
9
|
private readonly podId;
|
|
7
|
-
constructor(client: GeneratedClientAdapter, podId: () => string);
|
|
8
|
-
list(datastore: string, table: string, options?: ListRecordsOptions): Promise<
|
|
10
|
+
constructor(client: GeneratedClientAdapter, http: HttpClient, podId: () => string);
|
|
11
|
+
list(datastore: string, table: string, options?: ListRecordsOptions): Promise<RecordListResponse>;
|
|
12
|
+
listWithParams(datastore: string, table: string, params: Record<string, string | number | boolean | undefined | null>): Promise<RecordListResponse>;
|
|
9
13
|
create(datastore: string, table: string, data: Record<string, unknown>): Promise<import("../index.js").RecordResponse>;
|
|
10
14
|
get(datastore: string, table: string, recordId: string): Promise<import("../index.js").RecordResponse>;
|
|
11
15
|
update(datastore: string, table: string, recordId: string, data: Record<string, unknown>): Promise<import("../index.js").RecordResponse>;
|
|
12
16
|
delete(datastore: string, table: string, recordId: string): Promise<import("../index.js").DatastoreMessageResponse>;
|
|
13
|
-
query(datastore: string, table: string, payload: RecordQueryRequest): Promise<
|
|
17
|
+
query(datastore: string, table: string, payload: RecordQueryRequest): Promise<RecordListResponse>;
|
|
14
18
|
readonly bulk: {
|
|
15
19
|
create: (datastore: string, table: string, records: Record<string, unknown>[]) => Promise<import("../index.js").DatastoreMessageResponse>;
|
|
16
20
|
update: (datastore: string, table: string, records: Record<string, unknown>[]) => Promise<import("../index.js").DatastoreMessageResponse>;
|
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
import { RecordsService } from "../openapi_client/services/RecordsService.js";
|
|
2
|
+
function getRecordsPath(podId, datastore, table) {
|
|
3
|
+
return `/pods/${encodeURIComponent(podId)}/datastores/${encodeURIComponent(datastore)}/tables/${encodeURIComponent(table)}/records`;
|
|
4
|
+
}
|
|
2
5
|
export class RecordsNamespace {
|
|
3
6
|
client;
|
|
7
|
+
http;
|
|
4
8
|
podId;
|
|
5
|
-
constructor(client, podId) {
|
|
9
|
+
constructor(client, http, podId) {
|
|
6
10
|
this.client = client;
|
|
11
|
+
this.http = http;
|
|
7
12
|
this.podId = podId;
|
|
8
13
|
}
|
|
9
14
|
list(datastore, table, options = {}) {
|
|
10
|
-
const { filters, sort, limit, pageToken } = options;
|
|
15
|
+
const { filters, sort, limit, pageToken, offset, sortBy, order, params } = options;
|
|
11
16
|
if (filters || sort) {
|
|
12
|
-
const payload = {
|
|
17
|
+
const payload = {
|
|
18
|
+
filters,
|
|
19
|
+
sort,
|
|
20
|
+
limit,
|
|
21
|
+
page_token: pageToken,
|
|
22
|
+
};
|
|
13
23
|
return this.client.request(() => RecordsService.recordQuery(this.podId(), datastore, table, payload));
|
|
14
24
|
}
|
|
25
|
+
const hasCustomParams = typeof offset === "number" ||
|
|
26
|
+
typeof sortBy === "string" ||
|
|
27
|
+
typeof order === "string" ||
|
|
28
|
+
!!params;
|
|
29
|
+
if (hasCustomParams) {
|
|
30
|
+
return this.http.request("GET", getRecordsPath(this.podId(), datastore, table), {
|
|
31
|
+
params: {
|
|
32
|
+
limit: limit ?? 20,
|
|
33
|
+
page_token: pageToken,
|
|
34
|
+
offset,
|
|
35
|
+
sort_by: sortBy,
|
|
36
|
+
order,
|
|
37
|
+
...(params ?? {}),
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
15
41
|
return this.client.request(() => RecordsService.recordList(this.podId(), datastore, table, limit ?? 20, pageToken));
|
|
16
42
|
}
|
|
43
|
+
listWithParams(datastore, table, params) {
|
|
44
|
+
return this.http.request("GET", getRecordsPath(this.podId(), datastore, table), {
|
|
45
|
+
params,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
17
48
|
create(datastore, table, data) {
|
|
18
49
|
return this.client.request(() => RecordsService.recordCreate(this.podId(), datastore, table, { data }));
|
|
19
50
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
export type ResourceType = "conversation" | "assistant" | "task" | string;
|
|
3
|
+
export declare class ResourcesNamespace {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: HttpClient);
|
|
6
|
+
list(resourceType: ResourceType, resourceId: string, options?: {
|
|
7
|
+
path?: string;
|
|
8
|
+
}): Promise<unknown>;
|
|
9
|
+
upload(resourceType: ResourceType, resourceId: string, file: Blob, options?: {
|
|
10
|
+
path?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
fieldName?: string;
|
|
13
|
+
}): Promise<unknown>;
|
|
14
|
+
delete(resourceType: ResourceType, resourceId: string, filePath: string): Promise<unknown>;
|
|
15
|
+
download(resourceType: ResourceType, resourceId: string, filePath: string): Promise<Blob>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class ResourcesNamespace {
|
|
2
|
+
http;
|
|
3
|
+
constructor(http) {
|
|
4
|
+
this.http = http;
|
|
5
|
+
}
|
|
6
|
+
list(resourceType, resourceId, options = {}) {
|
|
7
|
+
return this.http.request("GET", `/files/${resourceType}/${resourceId}/list`, {
|
|
8
|
+
params: {
|
|
9
|
+
path: options.path,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
upload(resourceType, resourceId, file, options = {}) {
|
|
14
|
+
const formData = new FormData();
|
|
15
|
+
const fieldName = options.fieldName ?? "file";
|
|
16
|
+
const name = options.name ?? (file instanceof File ? file.name : "upload.bin");
|
|
17
|
+
formData.append(fieldName, file, name);
|
|
18
|
+
return this.http.request("POST", `/files/${resourceType}/${resourceId}/upload`, {
|
|
19
|
+
params: {
|
|
20
|
+
path: options.path,
|
|
21
|
+
},
|
|
22
|
+
body: formData,
|
|
23
|
+
isFormData: true,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
delete(resourceType, resourceId, filePath) {
|
|
27
|
+
return this.http.request("DELETE", `/files/${resourceType}/${resourceId}/delete/${filePath}`);
|
|
28
|
+
}
|
|
29
|
+
download(resourceType, resourceId, filePath) {
|
|
30
|
+
return this.http.requestBytes("GET", `/files/${resourceType}/${resourceId}/download/${filePath}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -2,6 +2,11 @@ import type { GeneratedClientAdapter } from "../generated.js";
|
|
|
2
2
|
import type { AddColumnRequest } from "../openapi_client/models/AddColumnRequest.js";
|
|
3
3
|
import type { CreateTableRequest } from "../openapi_client/models/CreateTableRequest.js";
|
|
4
4
|
import type { UpdateTableRequest } from "../openapi_client/models/UpdateTableRequest.js";
|
|
5
|
+
type LegacyCreateTableRequest = Omit<CreateTableRequest, "name"> & {
|
|
6
|
+
table_name: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
};
|
|
9
|
+
export type CreateTableInput = CreateTableRequest | LegacyCreateTableRequest;
|
|
5
10
|
export declare class TablesNamespace {
|
|
6
11
|
private readonly client;
|
|
7
12
|
private readonly podId;
|
|
@@ -10,7 +15,7 @@ export declare class TablesNamespace {
|
|
|
10
15
|
limit?: number;
|
|
11
16
|
pageToken?: string;
|
|
12
17
|
}): Promise<import("../index.js").TableListResponse>;
|
|
13
|
-
create(datastore: string, payload:
|
|
18
|
+
create(datastore: string, payload: CreateTableInput): Promise<import("../index.js").TableResponse>;
|
|
14
19
|
get(datastore: string, tableName: string): Promise<import("../index.js").TableResponse>;
|
|
15
20
|
update(datastore: string, tableName: string, payload: UpdateTableRequest): Promise<import("../index.js").TableResponse>;
|
|
16
21
|
delete(datastore: string, tableName: string): Promise<import("../index.js").DatastoreMessageResponse>;
|
|
@@ -19,3 +24,4 @@ export declare class TablesNamespace {
|
|
|
19
24
|
remove: (datastore: string, tableName: string, columnName: string) => Promise<import("../index.js").DatastoreMessageResponse>;
|
|
20
25
|
};
|
|
21
26
|
}
|
|
27
|
+
export {};
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { TablesService } from "../openapi_client/services/TablesService.js";
|
|
2
|
+
function normalizeCreateTablePayload(payload) {
|
|
3
|
+
if ("table_name" in payload) {
|
|
4
|
+
const { table_name, name, ...rest } = payload;
|
|
5
|
+
return {
|
|
6
|
+
...rest,
|
|
7
|
+
name: name ?? table_name,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return payload;
|
|
11
|
+
}
|
|
2
12
|
export class TablesNamespace {
|
|
3
13
|
client;
|
|
4
14
|
podId;
|
|
@@ -10,7 +20,7 @@ export class TablesNamespace {
|
|
|
10
20
|
return this.client.request(() => TablesService.tableList(this.podId(), datastore, options.limit ?? 100, options.pageToken));
|
|
11
21
|
}
|
|
12
22
|
create(datastore, payload) {
|
|
13
|
-
return this.client.request(() => TablesService.tableCreate(this.podId(), datastore, payload));
|
|
23
|
+
return this.client.request(() => TablesService.tableCreate(this.podId(), datastore, normalizeCreateTablePayload(payload)));
|
|
14
24
|
}
|
|
15
25
|
get(datastore, tableName) {
|
|
16
26
|
return this.client.request(() => TablesService.tableGet(this.podId(), datastore, tableName));
|
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
2
|
import type { CreateTaskOptions } from "../types.js";
|
|
3
3
|
export declare class TasksNamespace {
|
|
4
|
-
private readonly
|
|
4
|
+
private readonly http;
|
|
5
5
|
private readonly podId;
|
|
6
|
-
constructor(
|
|
6
|
+
constructor(http: HttpClient, podId: () => string);
|
|
7
7
|
list(options?: {
|
|
8
8
|
agentName?: string;
|
|
9
|
+
agentId?: string;
|
|
9
10
|
limit?: number;
|
|
10
11
|
pageToken?: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
cursor?: string;
|
|
13
|
+
}): Promise<unknown>;
|
|
14
|
+
create(options: CreateTaskOptions): Promise<unknown>;
|
|
15
|
+
get(taskId: string): Promise<unknown>;
|
|
16
|
+
stop(taskId: string): Promise<unknown>;
|
|
17
|
+
stream(taskId: string, options?: {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
15
20
|
readonly messages: {
|
|
16
21
|
list: (taskId: string, options?: {
|
|
17
22
|
limit?: number;
|
|
18
23
|
pageToken?: string;
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
cursor?: string;
|
|
25
|
+
}) => Promise<unknown>;
|
|
26
|
+
add: (taskId: string, content: string) => Promise<unknown>;
|
|
21
27
|
};
|
|
22
28
|
}
|
package/dist/namespaces/tasks.js
CHANGED
|
@@ -1,29 +1,61 @@
|
|
|
1
|
-
import { TasksService } from "../openapi_client/services/TasksService.js";
|
|
2
1
|
export class TasksNamespace {
|
|
3
|
-
|
|
2
|
+
http;
|
|
4
3
|
podId;
|
|
5
|
-
constructor(
|
|
6
|
-
this.
|
|
4
|
+
constructor(http, podId) {
|
|
5
|
+
this.http = http;
|
|
7
6
|
this.podId = podId;
|
|
8
7
|
}
|
|
9
8
|
list(options = {}) {
|
|
10
|
-
return this.
|
|
9
|
+
return this.http.request("GET", `/pods/${this.podId()}/tasks`, {
|
|
10
|
+
params: {
|
|
11
|
+
agent_name: options.agentName,
|
|
12
|
+
agent_id: options.agentId,
|
|
13
|
+
limit: options.limit ?? 100,
|
|
14
|
+
page_token: options.pageToken ?? options.cursor,
|
|
15
|
+
cursor: options.cursor,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
11
18
|
}
|
|
12
19
|
create(options) {
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
if (!options.agentId && !options.agentName) {
|
|
21
|
+
throw new Error("Either agentId or agentName is required.");
|
|
22
|
+
}
|
|
23
|
+
return this.http.request("POST", `/pods/${this.podId()}/tasks`, {
|
|
24
|
+
body: {
|
|
25
|
+
agent_id: options.agentId,
|
|
26
|
+
agent_name: options.agentName ?? options.agentId,
|
|
27
|
+
input_data: options.input,
|
|
28
|
+
runtime_account_ids: options.runtimeAccountIds,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
15
31
|
}
|
|
16
32
|
get(taskId) {
|
|
17
|
-
return this.
|
|
33
|
+
return this.http.request("GET", `/pods/${this.podId()}/tasks/${taskId}`);
|
|
18
34
|
}
|
|
19
35
|
stop(taskId) {
|
|
20
|
-
return this.
|
|
36
|
+
return this.http.request("PATCH", `/pods/${this.podId()}/tasks/${taskId}/stop`);
|
|
37
|
+
}
|
|
38
|
+
stream(taskId, options = {}) {
|
|
39
|
+
return this.http.stream(`/pods/${this.podId()}/tasks/${taskId}/stream`, {
|
|
40
|
+
signal: options.signal,
|
|
41
|
+
headers: {
|
|
42
|
+
Accept: "text/event-stream",
|
|
43
|
+
},
|
|
44
|
+
});
|
|
21
45
|
}
|
|
22
46
|
messages = {
|
|
23
|
-
list: (taskId, options = {}) => this.
|
|
47
|
+
list: (taskId, options = {}) => this.http.request("GET", `/pods/${this.podId()}/tasks/${taskId}/messages`, {
|
|
48
|
+
params: {
|
|
49
|
+
limit: options.limit ?? 100,
|
|
50
|
+
page_token: options.pageToken ?? options.cursor,
|
|
51
|
+
cursor: options.cursor,
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
24
54
|
add: (taskId, content) => {
|
|
25
55
|
const payload = { content };
|
|
26
|
-
return this.
|
|
56
|
+
return this.http.request("POST", `/pods/${this.podId()}/tasks/${taskId}/messages`, {
|
|
57
|
+
body: payload,
|
|
58
|
+
});
|
|
27
59
|
},
|
|
28
60
|
};
|
|
29
61
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GeneratedClientAdapter } from "../generated.js";
|
|
2
|
+
import type { UserProfileRequest } from "../openapi_client/models/UserProfileRequest.js";
|
|
3
|
+
export declare class UsersNamespace {
|
|
4
|
+
private readonly client;
|
|
5
|
+
constructor(client: GeneratedClientAdapter);
|
|
6
|
+
current(): Promise<import("../index.js").UserResponse>;
|
|
7
|
+
getProfile(): Promise<import("../index.js").UserResponse>;
|
|
8
|
+
upsertProfile(payload: UserProfileRequest): Promise<import("../index.js").UserResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UsersService } from "../openapi_client/services/UsersService.js";
|
|
2
|
+
export class UsersNamespace {
|
|
3
|
+
client;
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
current() {
|
|
8
|
+
return this.client.request(() => UsersService.userCurrentGet());
|
|
9
|
+
}
|
|
10
|
+
getProfile() {
|
|
11
|
+
return this.client.request(() => UsersService.userProfileGet());
|
|
12
|
+
}
|
|
13
|
+
upsertProfile(payload) {
|
|
14
|
+
return this.client.request(() => UsersService.userProfileUpsert(payload));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GeneratedClientAdapter } from "../generated.js";
|
|
2
|
+
import { type HttpClient } from "../http.js";
|
|
2
3
|
import type { WorkflowCreateRequest } from "../openapi_client/models/WorkflowCreateRequest.js";
|
|
3
4
|
import type { WorkflowGraphUpdateRequest } from "../openapi_client/models/WorkflowGraphUpdateRequest.js";
|
|
4
5
|
import type { WorkflowInstallRequest } from "../openapi_client/models/WorkflowInstallRequest.js";
|
|
@@ -6,8 +7,9 @@ import type { WorkflowUpdateRequest } from "../openapi_client/models/WorkflowUpd
|
|
|
6
7
|
import type { WorkflowRunInputs } from "../types.js";
|
|
7
8
|
export declare class WorkflowsNamespace {
|
|
8
9
|
private readonly client;
|
|
10
|
+
private readonly http;
|
|
9
11
|
private readonly podId;
|
|
10
|
-
constructor(client: GeneratedClientAdapter, podId: () => string);
|
|
12
|
+
constructor(client: GeneratedClientAdapter, http: HttpClient, podId: () => string);
|
|
11
13
|
list(options?: {
|
|
12
14
|
limit?: number;
|
|
13
15
|
pageToken?: string;
|
|
@@ -16,6 +18,7 @@ export declare class WorkflowsNamespace {
|
|
|
16
18
|
get(workflowName: string): Promise<import("../index.js").FlowEntity>;
|
|
17
19
|
update(workflowName: string, payload: WorkflowUpdateRequest): Promise<import("../index.js").FlowEntity>;
|
|
18
20
|
delete(workflowName: string): Promise<void>;
|
|
21
|
+
visualize(workflowName: string): Promise<string>;
|
|
19
22
|
readonly graph: {
|
|
20
23
|
update: (workflowName: string, graph: WorkflowGraphUpdateRequest) => Promise<import("../index.js").FlowEntity>;
|
|
21
24
|
};
|
|
@@ -23,6 +26,7 @@ export declare class WorkflowsNamespace {
|
|
|
23
26
|
create: (workflowName: string, payload?: WorkflowInstallRequest) => Promise<import("../index.js").FlowInstallEntity>;
|
|
24
27
|
delete: (workflowName: string, installId: string) => Promise<void>;
|
|
25
28
|
};
|
|
29
|
+
private postRunAction;
|
|
26
30
|
readonly runs: {
|
|
27
31
|
start: (workflowName: string, inputs?: WorkflowRunInputs) => Promise<import("../index.js").FlowRunEntity>;
|
|
28
32
|
list: (workflowName: string, options?: {
|
|
@@ -31,5 +35,8 @@ export declare class WorkflowsNamespace {
|
|
|
31
35
|
}) => Promise<import("../index.js").WorkflowRunListResponse>;
|
|
32
36
|
get: (runId: string, podId?: string) => Promise<import("../index.js").FlowRunEntity>;
|
|
33
37
|
resume: (runId: string, inputs?: WorkflowRunInputs, podId?: string) => Promise<import("../index.js").FlowRunEntity>;
|
|
38
|
+
visualize: (runId: string, podId?: string) => Promise<string>;
|
|
39
|
+
cancel: (runId: string, podId?: string) => Promise<Record<string, unknown>>;
|
|
40
|
+
retry: (runId: string, podId?: string) => Promise<Record<string, unknown>>;
|
|
34
41
|
};
|
|
35
42
|
}
|