@palettelab/sdk 0.1.11 → 0.1.13
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 +29 -1
- package/dist/components/index.d.mts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/{index-DEvPH60n.d.ts → index-BDVWt7DE.d.ts} +1 -1
- package/dist/{index-BL37Z-Ns.d.mts → index-Bu5EQGYo.d.mts} +1 -1
- package/dist/index.d.mts +28 -4
- package/dist/index.d.ts +28 -4
- package/dist/index.js +38 -0
- package/dist/index.mjs +38 -0
- package/dist/{plugin-DZRaxKt3.d.mts → plugin-UV46q1mU.d.mts} +2 -0
- package/dist/{plugin-DZRaxKt3.d.ts → plugin-UV46q1mU.d.ts} +2 -0
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -201,6 +201,28 @@ function App() {
|
|
|
201
201
|
The same context is available in `pltt dev`, so local development and OS runtime
|
|
202
202
|
use the same translation path.
|
|
203
203
|
|
|
204
|
+
## Next-Compatible Apps
|
|
205
|
+
|
|
206
|
+
The Palette appstore runtime loads plugin frontends as native React modules. If
|
|
207
|
+
an app wants a Next-style config file, set `frontend.framework` in
|
|
208
|
+
`palette-plugin.json` and place the config at `frontend/next.config.ts`.
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"frontend": {
|
|
213
|
+
"entry": "./frontend/src/index.tsx",
|
|
214
|
+
"sandbox": true,
|
|
215
|
+
"framework": "next",
|
|
216
|
+
"config": "./frontend/next.config.ts"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
The CLI reads that config in `pltt dev`, `pltt test`, `pltt package`, and
|
|
222
|
+
`pltt publish`. In native mode it supports `env` values from Next config,
|
|
223
|
+
`NEXT_PUBLIC_*` environment variables, and path aliases from
|
|
224
|
+
`frontend/tsconfig.json`.
|
|
225
|
+
|
|
204
226
|
## Palette Client
|
|
205
227
|
|
|
206
228
|
Use `createPaletteClient()` when an app needs common Palette OS services without
|
|
@@ -226,7 +248,7 @@ function App() {
|
|
|
226
248
|
Included clients:
|
|
227
249
|
|
|
228
250
|
- `palette.user.current()` and `palette.user.updateProfile()`
|
|
229
|
-
- `palette.organization.currentId()`, `currentRole()`, and `
|
|
251
|
+
- `palette.organization.currentId()`, `currentRole()`, `listMine()`, `listMembers()`, `getMember()`, `getMemberByEmail()`, `inviteMember()`, and `updateMemberRole()`
|
|
230
252
|
- `palette.dataRooms.list()`, `create()`, `get()`, `folder()`, `createFolder()`, `ensureFolder()`, `findRoomByName()`, `findFolderByName()`, `resolveFolderPath()`, `findFileByName()`, and `uploadFile()`
|
|
231
253
|
- `palette.config.get()` and `palette.config.update(values)`, with optional plugin ID override
|
|
232
254
|
- `palette.permissions.has()`, `hasAny()`, and `hasAll()`
|
|
@@ -236,6 +258,12 @@ Included clients:
|
|
|
236
258
|
These helpers are intentionally thin wrappers over platform APIs. Apps can still
|
|
237
259
|
use `apiFetch()` directly for custom backend routes.
|
|
238
260
|
|
|
261
|
+
Member helpers operate on the active organisation. Use `members:read` for
|
|
262
|
+
listing or looking up members, and `members:write` for invitations or role
|
|
263
|
+
updates. When the runtime provides declared app permissions, these helpers check
|
|
264
|
+
those permissions before calling the platform API. Member deletion/removal is
|
|
265
|
+
intentionally not exposed through the app SDK.
|
|
266
|
+
|
|
239
267
|
### Data Room Folders By Name
|
|
240
268
|
|
|
241
269
|
Apps can create or reuse custom Data Room folders by name:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import react__default from 'react';
|
|
3
|
-
import { P as PlatformContext } from '../plugin-
|
|
3
|
+
import { P as PlatformContext } from '../plugin-UV46q1mU.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Provider that wraps plugin components with the platform context.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import react__default from 'react';
|
|
3
|
-
import { P as PlatformContext } from '../plugin-
|
|
3
|
+
import { P as PlatformContext } from '../plugin-UV46q1mU.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Provider that wraps plugin components with the platform context.
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as PlatformCtx, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from '../index-
|
|
1
|
+
export { P as PlatformCtx, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from '../index-Bu5EQGYo.mjs';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../plugin-
|
|
3
|
+
import '../plugin-UV46q1mU.mjs';
|
|
4
4
|
import '../data-room-Dtd9LLHf.mjs';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as PlatformCtx, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from '../index-
|
|
1
|
+
export { P as PlatformCtx, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from '../index-BDVWt7DE.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../plugin-
|
|
3
|
+
import '../plugin-UV46q1mU.js';
|
|
4
4
|
import '../data-room-Dtd9LLHf.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { d as PaletteLanguage, P as PlatformContext } from './plugin-
|
|
2
|
+
import { d as PaletteLanguage, P as PlatformContext } from './plugin-UV46q1mU.js';
|
|
3
3
|
import { T as Task, i as TaskStats, g as TaskCreatePayload, l as TaskUpdatePayload, D as DataRoom, a as DataRoomFolder, b as DataRoomFile, d as ChatThread, c as ChatMessage } from './data-room-Dtd9LLHf.js';
|
|
4
4
|
|
|
5
5
|
type TranslationPrimitive = string | number | boolean | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { d as PaletteLanguage, P as PlatformContext } from './plugin-
|
|
2
|
+
import { d as PaletteLanguage, P as PlatformContext } from './plugin-UV46q1mU.mjs';
|
|
3
3
|
import { T as Task, i as TaskStats, g as TaskCreatePayload, l as TaskUpdatePayload, D as DataRoom, a as DataRoomFolder, b as DataRoomFile, d as ChatThread, c as ChatMessage } from './data-room-Dtd9LLHf.mjs';
|
|
4
4
|
|
|
5
5
|
type TranslationPrimitive = string | number | boolean | null;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-
|
|
2
|
-
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as PaletteLanguage, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginManifest, h as PluginToolDefinition } from './plugin-
|
|
1
|
+
import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-UV46q1mU.mjs';
|
|
2
|
+
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as PaletteLanguage, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginManifest, h as PluginToolDefinition } from './plugin-UV46q1mU.mjs';
|
|
3
3
|
import { D as DataRoom, a as DataRoomFolder, b as DataRoomFile } from './data-room-Dtd9LLHf.mjs';
|
|
4
4
|
export { C as ChatAttachment, c as ChatMessage, d as ChatThread, e as DataRoomPermission, T as Task, f as TaskAgentSnippet, g as TaskCreatePayload, h as TaskPriority, i as TaskStats, j as TaskStatus, k as TaskType, l as TaskUpdatePayload } from './data-room-Dtd9LLHf.mjs';
|
|
5
5
|
export { AgentResource, ResourcesByGroup } from './types/index.mjs';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
|
-
export { P as PlatformCtx, T as TranslateOptions, a as TranslationDictionary, b as TranslationPrimitive, c as TranslationResources, d as TranslationValues, U as UsePluginTranslationsOptions, n as normalizePaletteLanguage, t as translate, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from './index-
|
|
7
|
+
export { P as PlatformCtx, T as TranslateOptions, a as TranslationDictionary, b as TranslationPrimitive, c as TranslationResources, d as TranslationValues, U as UsePluginTranslationsOptions, n as normalizePaletteLanguage, t as translate, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from './index-Bu5EQGYo.mjs';
|
|
8
8
|
export { PluginProvider } from './components/index.mjs';
|
|
9
9
|
import 'react/jsx-runtime';
|
|
10
10
|
|
|
@@ -112,6 +112,24 @@ declare class StorageClient {
|
|
|
112
112
|
uploadToSignedUrl: typeof uploadToSignedUrl;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
type OrgMemberRole = "owner" | "admin" | "member" | "viewer";
|
|
116
|
+
interface OrgMember {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
email: string;
|
|
120
|
+
role: OrgMemberRole;
|
|
121
|
+
is_active: boolean;
|
|
122
|
+
joined_at: string;
|
|
123
|
+
}
|
|
124
|
+
interface OrgInviteMemberInput {
|
|
125
|
+
email: string;
|
|
126
|
+
role?: OrgMemberRole;
|
|
127
|
+
}
|
|
128
|
+
interface OrgInviteMemberResponse {
|
|
129
|
+
message: string;
|
|
130
|
+
email: string;
|
|
131
|
+
role: OrgMemberRole;
|
|
132
|
+
}
|
|
115
133
|
declare class UserClient {
|
|
116
134
|
private readonly ctx?;
|
|
117
135
|
constructor(ctx?: PlatformContext | undefined);
|
|
@@ -124,9 +142,15 @@ declare class UserClient {
|
|
|
124
142
|
declare class OrganizationClient {
|
|
125
143
|
private readonly ctx?;
|
|
126
144
|
constructor(ctx?: PlatformContext | undefined);
|
|
145
|
+
private assertPermission;
|
|
127
146
|
currentId(): number | null;
|
|
128
147
|
currentRole(): string | null;
|
|
129
148
|
listMine(): Promise<OrgSummary[]>;
|
|
149
|
+
listMembers(): Promise<OrgMember[]>;
|
|
150
|
+
getMember(userId: string): Promise<OrgMember | null>;
|
|
151
|
+
getMemberByEmail(email: string): Promise<OrgMember | null>;
|
|
152
|
+
inviteMember(input: OrgInviteMemberInput): Promise<OrgInviteMemberResponse>;
|
|
153
|
+
updateMemberRole(userId: string, role: OrgMemberRole): Promise<OrgMember>;
|
|
130
154
|
}
|
|
131
155
|
|
|
132
156
|
declare function createPaletteClient(ctx?: PlatformContext): {
|
|
@@ -155,4 +179,4 @@ declare function hasPermission(ctx: PlatformContext, permission: string): boolea
|
|
|
155
179
|
declare function hasAnyPermission(ctx: PlatformContext, permissions: string[]): boolean;
|
|
156
180
|
declare function hasAllPermissions(ctx: PlatformContext, permissions: string[]): boolean;
|
|
157
181
|
|
|
158
|
-
export { DataRoom, DataRoomClient, type DataRoomContents, DataRoomFile, DataRoomFolder, type DataRoomUploadOptions, type InstallConfig, OrgSummary, OrganizationClient, PaletteApiError, type PaletteClient, PlatformContext, type SandboxBridge, StorageClient, User, UserClient, apiFetch, apiUpload, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, errorFromResponse, getBaseUrl, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, setBaseUrl, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
|
182
|
+
export { DataRoom, DataRoomClient, type DataRoomContents, DataRoomFile, DataRoomFolder, type DataRoomUploadOptions, type InstallConfig, type OrgInviteMemberInput, type OrgInviteMemberResponse, type OrgMember, type OrgMemberRole, OrgSummary, OrganizationClient, PaletteApiError, type PaletteClient, PlatformContext, type SandboxBridge, StorageClient, User, UserClient, apiFetch, apiUpload, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, errorFromResponse, getBaseUrl, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, setBaseUrl, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-
|
|
2
|
-
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as PaletteLanguage, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginManifest, h as PluginToolDefinition } from './plugin-
|
|
1
|
+
import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-UV46q1mU.js';
|
|
2
|
+
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as PaletteLanguage, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginManifest, h as PluginToolDefinition } from './plugin-UV46q1mU.js';
|
|
3
3
|
import { D as DataRoom, a as DataRoomFolder, b as DataRoomFile } from './data-room-Dtd9LLHf.js';
|
|
4
4
|
export { C as ChatAttachment, c as ChatMessage, d as ChatThread, e as DataRoomPermission, T as Task, f as TaskAgentSnippet, g as TaskCreatePayload, h as TaskPriority, i as TaskStats, j as TaskStatus, k as TaskType, l as TaskUpdatePayload } from './data-room-Dtd9LLHf.js';
|
|
5
5
|
export { AgentResource, ResourcesByGroup } from './types/index.js';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
|
-
export { P as PlatformCtx, T as TranslateOptions, a as TranslationDictionary, b as TranslationPrimitive, c as TranslationResources, d as TranslationValues, U as UsePluginTranslationsOptions, n as normalizePaletteLanguage, t as translate, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from './index-
|
|
7
|
+
export { P as PlatformCtx, T as TranslateOptions, a as TranslationDictionary, b as TranslationPrimitive, c as TranslationResources, d as TranslationValues, U as UsePluginTranslationsOptions, n as normalizePaletteLanguage, t as translate, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from './index-BDVWt7DE.js';
|
|
8
8
|
export { PluginProvider } from './components/index.js';
|
|
9
9
|
import 'react/jsx-runtime';
|
|
10
10
|
|
|
@@ -112,6 +112,24 @@ declare class StorageClient {
|
|
|
112
112
|
uploadToSignedUrl: typeof uploadToSignedUrl;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
type OrgMemberRole = "owner" | "admin" | "member" | "viewer";
|
|
116
|
+
interface OrgMember {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
email: string;
|
|
120
|
+
role: OrgMemberRole;
|
|
121
|
+
is_active: boolean;
|
|
122
|
+
joined_at: string;
|
|
123
|
+
}
|
|
124
|
+
interface OrgInviteMemberInput {
|
|
125
|
+
email: string;
|
|
126
|
+
role?: OrgMemberRole;
|
|
127
|
+
}
|
|
128
|
+
interface OrgInviteMemberResponse {
|
|
129
|
+
message: string;
|
|
130
|
+
email: string;
|
|
131
|
+
role: OrgMemberRole;
|
|
132
|
+
}
|
|
115
133
|
declare class UserClient {
|
|
116
134
|
private readonly ctx?;
|
|
117
135
|
constructor(ctx?: PlatformContext | undefined);
|
|
@@ -124,9 +142,15 @@ declare class UserClient {
|
|
|
124
142
|
declare class OrganizationClient {
|
|
125
143
|
private readonly ctx?;
|
|
126
144
|
constructor(ctx?: PlatformContext | undefined);
|
|
145
|
+
private assertPermission;
|
|
127
146
|
currentId(): number | null;
|
|
128
147
|
currentRole(): string | null;
|
|
129
148
|
listMine(): Promise<OrgSummary[]>;
|
|
149
|
+
listMembers(): Promise<OrgMember[]>;
|
|
150
|
+
getMember(userId: string): Promise<OrgMember | null>;
|
|
151
|
+
getMemberByEmail(email: string): Promise<OrgMember | null>;
|
|
152
|
+
inviteMember(input: OrgInviteMemberInput): Promise<OrgInviteMemberResponse>;
|
|
153
|
+
updateMemberRole(userId: string, role: OrgMemberRole): Promise<OrgMember>;
|
|
130
154
|
}
|
|
131
155
|
|
|
132
156
|
declare function createPaletteClient(ctx?: PlatformContext): {
|
|
@@ -155,4 +179,4 @@ declare function hasPermission(ctx: PlatformContext, permission: string): boolea
|
|
|
155
179
|
declare function hasAnyPermission(ctx: PlatformContext, permissions: string[]): boolean;
|
|
156
180
|
declare function hasAllPermissions(ctx: PlatformContext, permissions: string[]): boolean;
|
|
157
181
|
|
|
158
|
-
export { DataRoom, DataRoomClient, type DataRoomContents, DataRoomFile, DataRoomFolder, type DataRoomUploadOptions, type InstallConfig, OrgSummary, OrganizationClient, PaletteApiError, type PaletteClient, PlatformContext, type SandboxBridge, StorageClient, User, UserClient, apiFetch, apiUpload, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, errorFromResponse, getBaseUrl, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, setBaseUrl, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
|
182
|
+
export { DataRoom, DataRoomClient, type DataRoomContents, DataRoomFile, DataRoomFolder, type DataRoomUploadOptions, type InstallConfig, type OrgInviteMemberInput, type OrgInviteMemberResponse, type OrgMember, type OrgMemberRole, OrgSummary, OrganizationClient, PaletteApiError, type PaletteClient, PlatformContext, type SandboxBridge, StorageClient, User, UserClient, apiFetch, apiUpload, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, errorFromResponse, getBaseUrl, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, setBaseUrl, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
package/dist/index.js
CHANGED
|
@@ -395,6 +395,11 @@ var OrganizationClient = class {
|
|
|
395
395
|
constructor(ctx) {
|
|
396
396
|
this.ctx = ctx;
|
|
397
397
|
}
|
|
398
|
+
assertPermission(permission) {
|
|
399
|
+
if (this.ctx?.permissions && !this.ctx.permissions.includes(permission)) {
|
|
400
|
+
throw new Error(`App does not declare required permission: ${permission}`);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
398
403
|
currentId() {
|
|
399
404
|
return this.ctx?.organizationId ?? null;
|
|
400
405
|
}
|
|
@@ -406,6 +411,39 @@ var OrganizationClient = class {
|
|
|
406
411
|
const res = await apiFetch("/api/v1/auth/my-orgs");
|
|
407
412
|
return res.json();
|
|
408
413
|
}
|
|
414
|
+
async listMembers() {
|
|
415
|
+
this.assertPermission("members:read");
|
|
416
|
+
const res = await apiFetch("/api/v1/org/members");
|
|
417
|
+
return res.json();
|
|
418
|
+
}
|
|
419
|
+
async getMember(userId) {
|
|
420
|
+
const members = await this.listMembers();
|
|
421
|
+
return members.find((member) => member.id === userId) ?? null;
|
|
422
|
+
}
|
|
423
|
+
async getMemberByEmail(email) {
|
|
424
|
+
const normalizedEmail = email.trim().toLowerCase();
|
|
425
|
+
const members = await this.listMembers();
|
|
426
|
+
return members.find((member) => member.email.toLowerCase() === normalizedEmail) ?? null;
|
|
427
|
+
}
|
|
428
|
+
async inviteMember(input) {
|
|
429
|
+
this.assertPermission("members:write");
|
|
430
|
+
const res = await apiFetch("/api/v1/org/members", {
|
|
431
|
+
method: "POST",
|
|
432
|
+
body: JSON.stringify({
|
|
433
|
+
email: input.email,
|
|
434
|
+
role: input.role ?? "member"
|
|
435
|
+
})
|
|
436
|
+
});
|
|
437
|
+
return res.json();
|
|
438
|
+
}
|
|
439
|
+
async updateMemberRole(userId, role) {
|
|
440
|
+
this.assertPermission("members:write");
|
|
441
|
+
const res = await apiFetch(`/api/v1/org/members/${encodeURIComponent(userId)}/role`, {
|
|
442
|
+
method: "PATCH",
|
|
443
|
+
body: JSON.stringify({ role })
|
|
444
|
+
});
|
|
445
|
+
return res.json();
|
|
446
|
+
}
|
|
409
447
|
};
|
|
410
448
|
|
|
411
449
|
// src/palette-client.ts
|
package/dist/index.mjs
CHANGED
|
@@ -338,6 +338,11 @@ var OrganizationClient = class {
|
|
|
338
338
|
constructor(ctx) {
|
|
339
339
|
this.ctx = ctx;
|
|
340
340
|
}
|
|
341
|
+
assertPermission(permission) {
|
|
342
|
+
if (this.ctx?.permissions && !this.ctx.permissions.includes(permission)) {
|
|
343
|
+
throw new Error(`App does not declare required permission: ${permission}`);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
341
346
|
currentId() {
|
|
342
347
|
return this.ctx?.organizationId ?? null;
|
|
343
348
|
}
|
|
@@ -349,6 +354,39 @@ var OrganizationClient = class {
|
|
|
349
354
|
const res = await apiFetch("/api/v1/auth/my-orgs");
|
|
350
355
|
return res.json();
|
|
351
356
|
}
|
|
357
|
+
async listMembers() {
|
|
358
|
+
this.assertPermission("members:read");
|
|
359
|
+
const res = await apiFetch("/api/v1/org/members");
|
|
360
|
+
return res.json();
|
|
361
|
+
}
|
|
362
|
+
async getMember(userId) {
|
|
363
|
+
const members = await this.listMembers();
|
|
364
|
+
return members.find((member) => member.id === userId) ?? null;
|
|
365
|
+
}
|
|
366
|
+
async getMemberByEmail(email) {
|
|
367
|
+
const normalizedEmail = email.trim().toLowerCase();
|
|
368
|
+
const members = await this.listMembers();
|
|
369
|
+
return members.find((member) => member.email.toLowerCase() === normalizedEmail) ?? null;
|
|
370
|
+
}
|
|
371
|
+
async inviteMember(input) {
|
|
372
|
+
this.assertPermission("members:write");
|
|
373
|
+
const res = await apiFetch("/api/v1/org/members", {
|
|
374
|
+
method: "POST",
|
|
375
|
+
body: JSON.stringify({
|
|
376
|
+
email: input.email,
|
|
377
|
+
role: input.role ?? "member"
|
|
378
|
+
})
|
|
379
|
+
});
|
|
380
|
+
return res.json();
|
|
381
|
+
}
|
|
382
|
+
async updateMemberRole(userId, role) {
|
|
383
|
+
this.assertPermission("members:write");
|
|
384
|
+
const res = await apiFetch(`/api/v1/org/members/${encodeURIComponent(userId)}/role`, {
|
|
385
|
+
method: "PATCH",
|
|
386
|
+
body: JSON.stringify({ role })
|
|
387
|
+
});
|
|
388
|
+
return res.json();
|
|
389
|
+
}
|
|
352
390
|
};
|
|
353
391
|
|
|
354
392
|
// src/palette-client.ts
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteLanguage, P as PlatformContext, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginManifest, h as PluginToolDefinition, U as User } from '../plugin-
|
|
1
|
+
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteLanguage, P as PlatformContext, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginManifest, h as PluginToolDefinition, U as User } from '../plugin-UV46q1mU.mjs';
|
|
2
2
|
export { C as ChatAttachment, c as ChatMessage, d as ChatThread, D as DataRoom, b as DataRoomFile, a as DataRoomFolder, e as DataRoomPermission, T as Task, f as TaskAgentSnippet, g as TaskCreatePayload, h as TaskPriority, i as TaskStats, j as TaskStatus, k as TaskType, l as TaskUpdatePayload } from '../data-room-Dtd9LLHf.mjs';
|
|
3
3
|
|
|
4
4
|
interface AgentResource {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteLanguage, P as PlatformContext, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginManifest, h as PluginToolDefinition, U as User } from '../plugin-
|
|
1
|
+
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteLanguage, P as PlatformContext, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginManifest, h as PluginToolDefinition, U as User } from '../plugin-UV46q1mU.js';
|
|
2
2
|
export { C as ChatAttachment, c as ChatMessage, d as ChatThread, D as DataRoom, b as DataRoomFile, a as DataRoomFolder, e as DataRoomPermission, T as Task, f as TaskAgentSnippet, g as TaskCreatePayload, h as TaskPriority, i as TaskStats, j as TaskStatus, k as TaskType, l as TaskUpdatePayload } from '../data-room-Dtd9LLHf.js';
|
|
3
3
|
|
|
4
4
|
interface AgentResource {
|