@palettelab/sdk 0.1.16 → 0.1.17
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 +10 -0
- 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-Beo6F2Fr.d.ts → index-D0i35Hem.d.ts} +1 -1
- package/dist/{index-BGT6xBGD.d.mts → index-DsfTFnZb.d.mts} +1 -1
- package/dist/index.d.mts +35 -4
- package/dist/index.d.ts +35 -4
- package/dist/index.js +56 -0
- package/dist/index.mjs +52 -0
- package/dist/{plugin-CG6spHKI.d.mts → plugin-dpLzOtF6.d.mts} +44 -1
- package/dist/{plugin-CG6spHKI.d.ts → plugin-dpLzOtF6.d.ts} +44 -1
- 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
|
@@ -446,6 +446,16 @@ const config = await getInstallConfig("my-plugin")
|
|
|
446
446
|
await updateInstallConfig("my-plugin", { ...config, enabled: true })
|
|
447
447
|
```
|
|
448
448
|
|
|
449
|
+
Plugins can also read and start Palette-managed third-party connections declared
|
|
450
|
+
in `palette-plugin.json`:
|
|
451
|
+
|
|
452
|
+
```ts
|
|
453
|
+
import { getConnections, startConnection } from "@palettelab/sdk"
|
|
454
|
+
|
|
455
|
+
const connections = await getConnections("my-plugin")
|
|
456
|
+
await startConnection("my-plugin", "google_calendar")
|
|
457
|
+
```
|
|
458
|
+
|
|
449
459
|
## Sandbox Bridge
|
|
450
460
|
|
|
451
461
|
Appstore plugin frontends run inside an iframe sandbox by default. Use `createSandboxBridge` when you need to explicitly call host-proxied APIs from sandbox runtime code.
|
|
@@ -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-dpLzOtF6.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-dpLzOtF6.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-DsfTFnZb.mjs';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../plugin-
|
|
3
|
+
import '../plugin-dpLzOtF6.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-D0i35Hem.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../plugin-
|
|
3
|
+
import '../plugin-dpLzOtF6.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-dpLzOtF6.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-dpLzOtF6.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
|
|
1
|
+
import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-dpLzOtF6.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 PluginConnectionDefinition, h as PluginManifest, i as PluginToolDefinition } from './plugin-dpLzOtF6.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-DsfTFnZb.mjs';
|
|
8
8
|
export { Link, PaletteAppRoute, PaletteAppRouter, notFound, useParams, usePathname, useRouter, useSearchParams } from './router/index.mjs';
|
|
9
9
|
export { PluginProvider } from './components/index.mjs';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
@@ -54,6 +54,31 @@ type InstallConfig = Record<string, unknown>;
|
|
|
54
54
|
declare function getInstallConfig(pluginId: string): Promise<InstallConfig>;
|
|
55
55
|
declare function updateInstallConfig(pluginId: string, config: InstallConfig): Promise<InstallConfig>;
|
|
56
56
|
|
|
57
|
+
type ConnectionStatusValue = "available" | "connected" | "expiring" | "failed" | "missing";
|
|
58
|
+
interface ConnectionStatus {
|
|
59
|
+
id: string;
|
|
60
|
+
provider: string;
|
|
61
|
+
label: string;
|
|
62
|
+
auth: "oauth2" | "api_key";
|
|
63
|
+
scopes: string[];
|
|
64
|
+
required: boolean;
|
|
65
|
+
status: ConnectionStatusValue;
|
|
66
|
+
account_label?: string | null;
|
|
67
|
+
granted_scopes: string[];
|
|
68
|
+
expires_at?: string | null;
|
|
69
|
+
connected_at?: string | null;
|
|
70
|
+
last_error?: string | null;
|
|
71
|
+
}
|
|
72
|
+
interface ConnectionAuthStart {
|
|
73
|
+
connection_id: string;
|
|
74
|
+
authorize_url: string;
|
|
75
|
+
mode: "oauth2" | "mock";
|
|
76
|
+
}
|
|
77
|
+
declare function getConnections(pluginId: string): Promise<ConnectionStatus[]>;
|
|
78
|
+
declare function startConnection(pluginId: string, connectionId: string): Promise<ConnectionAuthStart>;
|
|
79
|
+
declare function disconnectConnection(pluginId: string, connectionId: string): Promise<void>;
|
|
80
|
+
declare function requireConnection(pluginId: string, connectionId: string): Promise<ConnectionStatus>;
|
|
81
|
+
|
|
57
82
|
declare function createMockPlatformContext(overrides?: Partial<PlatformContext>): PlatformContext;
|
|
58
83
|
declare function withPluginProvider(element: ReactElement, platform?: Partial<PlatformContext>): ReactElement;
|
|
59
84
|
|
|
@@ -196,6 +221,12 @@ declare function createPaletteClient(ctx?: PlatformContext): {
|
|
|
196
221
|
get: (pluginId?: string) => Promise<InstallConfig>;
|
|
197
222
|
update: (values: Record<string, unknown>, pluginId?: string) => Promise<InstallConfig>;
|
|
198
223
|
};
|
|
224
|
+
connections: {
|
|
225
|
+
list: (pluginId?: string) => Promise<ConnectionStatus[]>;
|
|
226
|
+
connect: (connectionId: string, pluginId?: string) => Promise<ConnectionAuthStart>;
|
|
227
|
+
disconnect: (connectionId: string, pluginId?: string) => Promise<void>;
|
|
228
|
+
require: (connectionId: string, pluginId?: string) => Promise<ConnectionStatus>;
|
|
229
|
+
};
|
|
199
230
|
permissions: {
|
|
200
231
|
has: (permission: string) => boolean;
|
|
201
232
|
hasAny: (permissions: string[]) => boolean;
|
|
@@ -213,4 +244,4 @@ declare function hasPermission(ctx: PlatformContext, permission: string): boolea
|
|
|
213
244
|
declare function hasAnyPermission(ctx: PlatformContext, permissions: string[]): boolean;
|
|
214
245
|
declare function hasAllPermissions(ctx: PlatformContext, permissions: string[]): boolean;
|
|
215
246
|
|
|
216
|
-
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, type StorageUploadOptions, type StorageUploadProgress, type StorageUploadResult, type StorageUploadState, User, UserClient, apiFetch, apiUpload, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, errorFromResponse, getBaseUrl, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, setBaseUrl, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
|
247
|
+
export { type ConnectionAuthStart, type ConnectionStatus, type ConnectionStatusValue, 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, type StorageUploadOptions, type StorageUploadProgress, type StorageUploadResult, type StorageUploadState, User, UserClient, apiFetch, apiUpload, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, disconnectConnection, errorFromResponse, getBaseUrl, getConnections, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, requireConnection, setBaseUrl, startConnection, 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
|
|
1
|
+
import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-dpLzOtF6.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 PluginConnectionDefinition, h as PluginManifest, i as PluginToolDefinition } from './plugin-dpLzOtF6.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-D0i35Hem.js';
|
|
8
8
|
export { Link, PaletteAppRoute, PaletteAppRouter, notFound, useParams, usePathname, useRouter, useSearchParams } from './router/index.js';
|
|
9
9
|
export { PluginProvider } from './components/index.js';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
@@ -54,6 +54,31 @@ type InstallConfig = Record<string, unknown>;
|
|
|
54
54
|
declare function getInstallConfig(pluginId: string): Promise<InstallConfig>;
|
|
55
55
|
declare function updateInstallConfig(pluginId: string, config: InstallConfig): Promise<InstallConfig>;
|
|
56
56
|
|
|
57
|
+
type ConnectionStatusValue = "available" | "connected" | "expiring" | "failed" | "missing";
|
|
58
|
+
interface ConnectionStatus {
|
|
59
|
+
id: string;
|
|
60
|
+
provider: string;
|
|
61
|
+
label: string;
|
|
62
|
+
auth: "oauth2" | "api_key";
|
|
63
|
+
scopes: string[];
|
|
64
|
+
required: boolean;
|
|
65
|
+
status: ConnectionStatusValue;
|
|
66
|
+
account_label?: string | null;
|
|
67
|
+
granted_scopes: string[];
|
|
68
|
+
expires_at?: string | null;
|
|
69
|
+
connected_at?: string | null;
|
|
70
|
+
last_error?: string | null;
|
|
71
|
+
}
|
|
72
|
+
interface ConnectionAuthStart {
|
|
73
|
+
connection_id: string;
|
|
74
|
+
authorize_url: string;
|
|
75
|
+
mode: "oauth2" | "mock";
|
|
76
|
+
}
|
|
77
|
+
declare function getConnections(pluginId: string): Promise<ConnectionStatus[]>;
|
|
78
|
+
declare function startConnection(pluginId: string, connectionId: string): Promise<ConnectionAuthStart>;
|
|
79
|
+
declare function disconnectConnection(pluginId: string, connectionId: string): Promise<void>;
|
|
80
|
+
declare function requireConnection(pluginId: string, connectionId: string): Promise<ConnectionStatus>;
|
|
81
|
+
|
|
57
82
|
declare function createMockPlatformContext(overrides?: Partial<PlatformContext>): PlatformContext;
|
|
58
83
|
declare function withPluginProvider(element: ReactElement, platform?: Partial<PlatformContext>): ReactElement;
|
|
59
84
|
|
|
@@ -196,6 +221,12 @@ declare function createPaletteClient(ctx?: PlatformContext): {
|
|
|
196
221
|
get: (pluginId?: string) => Promise<InstallConfig>;
|
|
197
222
|
update: (values: Record<string, unknown>, pluginId?: string) => Promise<InstallConfig>;
|
|
198
223
|
};
|
|
224
|
+
connections: {
|
|
225
|
+
list: (pluginId?: string) => Promise<ConnectionStatus[]>;
|
|
226
|
+
connect: (connectionId: string, pluginId?: string) => Promise<ConnectionAuthStart>;
|
|
227
|
+
disconnect: (connectionId: string, pluginId?: string) => Promise<void>;
|
|
228
|
+
require: (connectionId: string, pluginId?: string) => Promise<ConnectionStatus>;
|
|
229
|
+
};
|
|
199
230
|
permissions: {
|
|
200
231
|
has: (permission: string) => boolean;
|
|
201
232
|
hasAny: (permissions: string[]) => boolean;
|
|
@@ -213,4 +244,4 @@ declare function hasPermission(ctx: PlatformContext, permission: string): boolea
|
|
|
213
244
|
declare function hasAnyPermission(ctx: PlatformContext, permissions: string[]): boolean;
|
|
214
245
|
declare function hasAllPermissions(ctx: PlatformContext, permissions: string[]): boolean;
|
|
215
246
|
|
|
216
|
-
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, type StorageUploadOptions, type StorageUploadProgress, type StorageUploadResult, type StorageUploadState, User, UserClient, apiFetch, apiUpload, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, errorFromResponse, getBaseUrl, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, setBaseUrl, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
|
247
|
+
export { type ConnectionAuthStart, type ConnectionStatus, type ConnectionStatusValue, 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, type StorageUploadOptions, type StorageUploadProgress, type StorageUploadResult, type StorageUploadState, User, UserClient, apiFetch, apiUpload, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, disconnectConnection, errorFromResponse, getBaseUrl, getConnections, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, requireConnection, setBaseUrl, startConnection, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
package/dist/index.js
CHANGED
|
@@ -35,8 +35,10 @@ __export(src_exports, {
|
|
|
35
35
|
createPaletteClient: () => createPaletteClient,
|
|
36
36
|
createSandboxBridge: () => createSandboxBridge,
|
|
37
37
|
dataRooms: () => dataRooms,
|
|
38
|
+
disconnectConnection: () => disconnectConnection,
|
|
38
39
|
errorFromResponse: () => errorFromResponse,
|
|
39
40
|
getBaseUrl: () => getBaseUrl,
|
|
41
|
+
getConnections: () => getConnections,
|
|
40
42
|
getInstallConfig: () => getInstallConfig,
|
|
41
43
|
hasAllPermissions: () => hasAllPermissions,
|
|
42
44
|
hasAnyPermission: () => hasAnyPermission,
|
|
@@ -45,7 +47,9 @@ __export(src_exports, {
|
|
|
45
47
|
isSandboxRuntime: () => isSandboxRuntime,
|
|
46
48
|
normalizePaletteLanguage: () => normalizePaletteLanguage,
|
|
47
49
|
notFound: () => notFound,
|
|
50
|
+
requireConnection: () => requireConnection,
|
|
48
51
|
setBaseUrl: () => setBaseUrl,
|
|
52
|
+
startConnection: () => startConnection,
|
|
49
53
|
translate: () => translate,
|
|
50
54
|
updateInstallConfig: () => updateInstallConfig,
|
|
51
55
|
uploadToSignedUrl: () => uploadToSignedUrl,
|
|
@@ -174,6 +178,32 @@ async function updateInstallConfig(pluginId, config) {
|
|
|
174
178
|
return res.json();
|
|
175
179
|
}
|
|
176
180
|
|
|
181
|
+
// src/connections.ts
|
|
182
|
+
async function getConnections(pluginId) {
|
|
183
|
+
const res = await apiFetch(`/api/v1/app-installs/${encodeURIComponent(pluginId)}/connections`);
|
|
184
|
+
return res.json();
|
|
185
|
+
}
|
|
186
|
+
async function startConnection(pluginId, connectionId) {
|
|
187
|
+
const res = await apiFetch(
|
|
188
|
+
`/api/v1/app-installs/${encodeURIComponent(pluginId)}/connections/${encodeURIComponent(connectionId)}/authorize`,
|
|
189
|
+
{ method: "POST" }
|
|
190
|
+
);
|
|
191
|
+
return res.json();
|
|
192
|
+
}
|
|
193
|
+
async function disconnectConnection(pluginId, connectionId) {
|
|
194
|
+
await apiFetch(
|
|
195
|
+
`/api/v1/app-installs/${encodeURIComponent(pluginId)}/connections/${encodeURIComponent(connectionId)}`,
|
|
196
|
+
{ method: "DELETE" }
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
async function requireConnection(pluginId, connectionId) {
|
|
200
|
+
const connection = (await getConnections(pluginId)).find((item) => item.id === connectionId);
|
|
201
|
+
if (!connection || !["connected", "expiring"].includes(connection.status)) {
|
|
202
|
+
throw new Error(`Palette connection is not configured: ${connectionId}`);
|
|
203
|
+
}
|
|
204
|
+
return connection;
|
|
205
|
+
}
|
|
206
|
+
|
|
177
207
|
// src/test-utils.tsx
|
|
178
208
|
var import_react2 = require("react");
|
|
179
209
|
|
|
@@ -649,6 +679,28 @@ function createPaletteClient(ctx) {
|
|
|
649
679
|
return updateInstallConfig(resolved, values);
|
|
650
680
|
}
|
|
651
681
|
},
|
|
682
|
+
connections: {
|
|
683
|
+
list: (pluginId = ctx?.pluginId ?? "") => {
|
|
684
|
+
const resolved = pluginId || defaultPluginId2();
|
|
685
|
+
if (!resolved) throw new Error("pluginId is required to read connections");
|
|
686
|
+
return getConnections(resolved);
|
|
687
|
+
},
|
|
688
|
+
connect: (connectionId, pluginId = ctx?.pluginId ?? "") => {
|
|
689
|
+
const resolved = pluginId || defaultPluginId2();
|
|
690
|
+
if (!resolved) throw new Error("pluginId is required to start a connection");
|
|
691
|
+
return startConnection(resolved, connectionId);
|
|
692
|
+
},
|
|
693
|
+
disconnect: (connectionId, pluginId = ctx?.pluginId ?? "") => {
|
|
694
|
+
const resolved = pluginId || defaultPluginId2();
|
|
695
|
+
if (!resolved) throw new Error("pluginId is required to disconnect a connection");
|
|
696
|
+
return disconnectConnection(resolved, connectionId);
|
|
697
|
+
},
|
|
698
|
+
require: (connectionId, pluginId = ctx?.pluginId ?? "") => {
|
|
699
|
+
const resolved = pluginId || defaultPluginId2();
|
|
700
|
+
if (!resolved) throw new Error("pluginId is required to require a connection");
|
|
701
|
+
return requireConnection(resolved, connectionId);
|
|
702
|
+
}
|
|
703
|
+
},
|
|
652
704
|
permissions: {
|
|
653
705
|
has: (permission) => ctx ? hasPermission(ctx, permission) : false,
|
|
654
706
|
hasAny: (permissions) => ctx ? hasAnyPermission(ctx, permissions) : false,
|
|
@@ -1122,8 +1174,10 @@ function usePluginChat(agentId) {
|
|
|
1122
1174
|
createPaletteClient,
|
|
1123
1175
|
createSandboxBridge,
|
|
1124
1176
|
dataRooms,
|
|
1177
|
+
disconnectConnection,
|
|
1125
1178
|
errorFromResponse,
|
|
1126
1179
|
getBaseUrl,
|
|
1180
|
+
getConnections,
|
|
1127
1181
|
getInstallConfig,
|
|
1128
1182
|
hasAllPermissions,
|
|
1129
1183
|
hasAnyPermission,
|
|
@@ -1132,7 +1186,9 @@ function usePluginChat(agentId) {
|
|
|
1132
1186
|
isSandboxRuntime,
|
|
1133
1187
|
normalizePaletteLanguage,
|
|
1134
1188
|
notFound,
|
|
1189
|
+
requireConnection,
|
|
1135
1190
|
setBaseUrl,
|
|
1191
|
+
startConnection,
|
|
1136
1192
|
translate,
|
|
1137
1193
|
updateInstallConfig,
|
|
1138
1194
|
uploadToSignedUrl,
|
package/dist/index.mjs
CHANGED
|
@@ -110,6 +110,32 @@ async function updateInstallConfig(pluginId, config) {
|
|
|
110
110
|
return res.json();
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// src/connections.ts
|
|
114
|
+
async function getConnections(pluginId) {
|
|
115
|
+
const res = await apiFetch(`/api/v1/app-installs/${encodeURIComponent(pluginId)}/connections`);
|
|
116
|
+
return res.json();
|
|
117
|
+
}
|
|
118
|
+
async function startConnection(pluginId, connectionId) {
|
|
119
|
+
const res = await apiFetch(
|
|
120
|
+
`/api/v1/app-installs/${encodeURIComponent(pluginId)}/connections/${encodeURIComponent(connectionId)}/authorize`,
|
|
121
|
+
{ method: "POST" }
|
|
122
|
+
);
|
|
123
|
+
return res.json();
|
|
124
|
+
}
|
|
125
|
+
async function disconnectConnection(pluginId, connectionId) {
|
|
126
|
+
await apiFetch(
|
|
127
|
+
`/api/v1/app-installs/${encodeURIComponent(pluginId)}/connections/${encodeURIComponent(connectionId)}`,
|
|
128
|
+
{ method: "DELETE" }
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
async function requireConnection(pluginId, connectionId) {
|
|
132
|
+
const connection = (await getConnections(pluginId)).find((item) => item.id === connectionId);
|
|
133
|
+
if (!connection || !["connected", "expiring"].includes(connection.status)) {
|
|
134
|
+
throw new Error(`Palette connection is not configured: ${connectionId}`);
|
|
135
|
+
}
|
|
136
|
+
return connection;
|
|
137
|
+
}
|
|
138
|
+
|
|
113
139
|
// src/test-utils.tsx
|
|
114
140
|
import { createElement } from "react";
|
|
115
141
|
|
|
@@ -585,6 +611,28 @@ function createPaletteClient(ctx) {
|
|
|
585
611
|
return updateInstallConfig(resolved, values);
|
|
586
612
|
}
|
|
587
613
|
},
|
|
614
|
+
connections: {
|
|
615
|
+
list: (pluginId = ctx?.pluginId ?? "") => {
|
|
616
|
+
const resolved = pluginId || defaultPluginId2();
|
|
617
|
+
if (!resolved) throw new Error("pluginId is required to read connections");
|
|
618
|
+
return getConnections(resolved);
|
|
619
|
+
},
|
|
620
|
+
connect: (connectionId, pluginId = ctx?.pluginId ?? "") => {
|
|
621
|
+
const resolved = pluginId || defaultPluginId2();
|
|
622
|
+
if (!resolved) throw new Error("pluginId is required to start a connection");
|
|
623
|
+
return startConnection(resolved, connectionId);
|
|
624
|
+
},
|
|
625
|
+
disconnect: (connectionId, pluginId = ctx?.pluginId ?? "") => {
|
|
626
|
+
const resolved = pluginId || defaultPluginId2();
|
|
627
|
+
if (!resolved) throw new Error("pluginId is required to disconnect a connection");
|
|
628
|
+
return disconnectConnection(resolved, connectionId);
|
|
629
|
+
},
|
|
630
|
+
require: (connectionId, pluginId = ctx?.pluginId ?? "") => {
|
|
631
|
+
const resolved = pluginId || defaultPluginId2();
|
|
632
|
+
if (!resolved) throw new Error("pluginId is required to require a connection");
|
|
633
|
+
return requireConnection(resolved, connectionId);
|
|
634
|
+
}
|
|
635
|
+
},
|
|
588
636
|
permissions: {
|
|
589
637
|
has: (permission) => ctx ? hasPermission(ctx, permission) : false,
|
|
590
638
|
hasAny: (permissions) => ctx ? hasAnyPermission(ctx, permissions) : false,
|
|
@@ -1066,8 +1114,10 @@ export {
|
|
|
1066
1114
|
createPaletteClient,
|
|
1067
1115
|
createSandboxBridge,
|
|
1068
1116
|
dataRooms,
|
|
1117
|
+
disconnectConnection,
|
|
1069
1118
|
errorFromResponse,
|
|
1070
1119
|
getBaseUrl,
|
|
1120
|
+
getConnections,
|
|
1071
1121
|
getInstallConfig,
|
|
1072
1122
|
hasAllPermissions,
|
|
1073
1123
|
hasAnyPermission,
|
|
@@ -1076,7 +1126,9 @@ export {
|
|
|
1076
1126
|
isSandboxRuntime,
|
|
1077
1127
|
normalizePaletteLanguage,
|
|
1078
1128
|
notFound,
|
|
1129
|
+
requireConnection,
|
|
1079
1130
|
setBaseUrl,
|
|
1131
|
+
startConnection,
|
|
1080
1132
|
translate,
|
|
1081
1133
|
updateInstallConfig,
|
|
1082
1134
|
uploadToSignedUrl,
|
|
@@ -116,6 +116,9 @@ interface PluginManifest {
|
|
|
116
116
|
agents?: PluginAgentDefinition[];
|
|
117
117
|
tools?: PluginToolDefinition[];
|
|
118
118
|
permissions?: string[];
|
|
119
|
+
connections?: PluginConnectionDefinition[];
|
|
120
|
+
provides?: PluginProvidesDefinition;
|
|
121
|
+
requires?: PluginRequiresDefinition;
|
|
119
122
|
public_routes?: string[];
|
|
120
123
|
rate_limit?: {
|
|
121
124
|
per_minute?: number;
|
|
@@ -124,6 +127,46 @@ interface PluginManifest {
|
|
|
124
127
|
reviews?: number;
|
|
125
128
|
featured?: boolean;
|
|
126
129
|
}
|
|
130
|
+
interface PluginConnectionDefinition {
|
|
131
|
+
id: string;
|
|
132
|
+
provider: "google" | "instagram" | "slack" | "linear" | "hubspot" | "stripe" | "zendesk" | "custom";
|
|
133
|
+
label: string;
|
|
134
|
+
auth?: "oauth2" | "api_key";
|
|
135
|
+
scopes?: string[];
|
|
136
|
+
required?: boolean;
|
|
137
|
+
}
|
|
138
|
+
interface PluginServiceRouteDefinition {
|
|
139
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
140
|
+
path: string;
|
|
141
|
+
operation_id?: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
}
|
|
144
|
+
interface PluginServiceDefinition {
|
|
145
|
+
id: string;
|
|
146
|
+
version?: string;
|
|
147
|
+
label?: string;
|
|
148
|
+
description?: string;
|
|
149
|
+
permissions?: string[];
|
|
150
|
+
routes?: PluginServiceRouteDefinition[];
|
|
151
|
+
}
|
|
152
|
+
interface PluginProvidesDefinition {
|
|
153
|
+
services?: PluginServiceDefinition[];
|
|
154
|
+
events?: string[];
|
|
155
|
+
}
|
|
156
|
+
interface PluginAppDependencyDefinition {
|
|
157
|
+
id: string;
|
|
158
|
+
version?: string;
|
|
159
|
+
required?: boolean;
|
|
160
|
+
reason?: string;
|
|
161
|
+
}
|
|
162
|
+
interface PluginServiceDependencyDefinition extends PluginAppDependencyDefinition {
|
|
163
|
+
provider?: string;
|
|
164
|
+
}
|
|
165
|
+
interface PluginRequiresDefinition {
|
|
166
|
+
apps?: PluginAppDependencyDefinition[];
|
|
167
|
+
services?: PluginServiceDependencyDefinition[];
|
|
168
|
+
events?: string[];
|
|
169
|
+
}
|
|
127
170
|
interface PluginAgentDefinition {
|
|
128
171
|
name: string;
|
|
129
172
|
field: string;
|
|
@@ -177,4 +220,4 @@ interface PluginComponentProps {
|
|
|
177
220
|
platform: PlatformContext;
|
|
178
221
|
}
|
|
179
222
|
|
|
180
|
-
export type { Agent as A, OrgSummary as O, PlatformContext as P, User as U, AgentConfig as a, AppCategory as b, AuthContextValue as c, PaletteLanguage as d, PluginAgentDefinition as e, PluginComponentProps as f,
|
|
223
|
+
export type { Agent as A, OrgSummary as O, PlatformContext as P, User as U, AgentConfig as a, AppCategory as b, AuthContextValue as c, PaletteLanguage as d, PluginAgentDefinition as e, PluginComponentProps as f, PluginConnectionDefinition as g, PluginManifest as h, PluginToolDefinition as i };
|
|
@@ -116,6 +116,9 @@ interface PluginManifest {
|
|
|
116
116
|
agents?: PluginAgentDefinition[];
|
|
117
117
|
tools?: PluginToolDefinition[];
|
|
118
118
|
permissions?: string[];
|
|
119
|
+
connections?: PluginConnectionDefinition[];
|
|
120
|
+
provides?: PluginProvidesDefinition;
|
|
121
|
+
requires?: PluginRequiresDefinition;
|
|
119
122
|
public_routes?: string[];
|
|
120
123
|
rate_limit?: {
|
|
121
124
|
per_minute?: number;
|
|
@@ -124,6 +127,46 @@ interface PluginManifest {
|
|
|
124
127
|
reviews?: number;
|
|
125
128
|
featured?: boolean;
|
|
126
129
|
}
|
|
130
|
+
interface PluginConnectionDefinition {
|
|
131
|
+
id: string;
|
|
132
|
+
provider: "google" | "instagram" | "slack" | "linear" | "hubspot" | "stripe" | "zendesk" | "custom";
|
|
133
|
+
label: string;
|
|
134
|
+
auth?: "oauth2" | "api_key";
|
|
135
|
+
scopes?: string[];
|
|
136
|
+
required?: boolean;
|
|
137
|
+
}
|
|
138
|
+
interface PluginServiceRouteDefinition {
|
|
139
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
140
|
+
path: string;
|
|
141
|
+
operation_id?: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
}
|
|
144
|
+
interface PluginServiceDefinition {
|
|
145
|
+
id: string;
|
|
146
|
+
version?: string;
|
|
147
|
+
label?: string;
|
|
148
|
+
description?: string;
|
|
149
|
+
permissions?: string[];
|
|
150
|
+
routes?: PluginServiceRouteDefinition[];
|
|
151
|
+
}
|
|
152
|
+
interface PluginProvidesDefinition {
|
|
153
|
+
services?: PluginServiceDefinition[];
|
|
154
|
+
events?: string[];
|
|
155
|
+
}
|
|
156
|
+
interface PluginAppDependencyDefinition {
|
|
157
|
+
id: string;
|
|
158
|
+
version?: string;
|
|
159
|
+
required?: boolean;
|
|
160
|
+
reason?: string;
|
|
161
|
+
}
|
|
162
|
+
interface PluginServiceDependencyDefinition extends PluginAppDependencyDefinition {
|
|
163
|
+
provider?: string;
|
|
164
|
+
}
|
|
165
|
+
interface PluginRequiresDefinition {
|
|
166
|
+
apps?: PluginAppDependencyDefinition[];
|
|
167
|
+
services?: PluginServiceDependencyDefinition[];
|
|
168
|
+
events?: string[];
|
|
169
|
+
}
|
|
127
170
|
interface PluginAgentDefinition {
|
|
128
171
|
name: string;
|
|
129
172
|
field: string;
|
|
@@ -177,4 +220,4 @@ interface PluginComponentProps {
|
|
|
177
220
|
platform: PlatformContext;
|
|
178
221
|
}
|
|
179
222
|
|
|
180
|
-
export type { Agent as A, OrgSummary as O, PlatformContext as P, User as U, AgentConfig as a, AppCategory as b, AuthContextValue as c, PaletteLanguage as d, PluginAgentDefinition as e, PluginComponentProps as f,
|
|
223
|
+
export type { Agent as A, OrgSummary as O, PlatformContext as P, User as U, AgentConfig as a, AppCategory as b, AuthContextValue as c, PaletteLanguage as d, PluginAgentDefinition as e, PluginComponentProps as f, PluginConnectionDefinition as g, PluginManifest as h, PluginToolDefinition as i };
|
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
|
|
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 PluginConnectionDefinition, h as PluginManifest, i as PluginToolDefinition, U as User } from '../plugin-dpLzOtF6.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
|
|
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 PluginConnectionDefinition, h as PluginManifest, i as PluginToolDefinition, U as User } from '../plugin-dpLzOtF6.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 {
|