@palettelab/sdk 0.1.15 → 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 +36 -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-BDVWt7DE.d.ts → index-D0i35Hem.d.ts} +1 -1
- package/dist/{index-Bu5EQGYo.d.mts → index-DsfTFnZb.d.mts} +1 -1
- package/dist/index.d.mts +36 -4
- package/dist/index.d.ts +36 -4
- package/dist/index.js +291 -27
- package/dist/index.mjs +288 -26
- package/dist/{plugin-UV46q1mU.d.mts → plugin-dpLzOtF6.d.mts} +47 -2
- package/dist/{plugin-UV46q1mU.d.ts → plugin-dpLzOtF6.d.ts} +47 -2
- package/dist/router/index.d.mts +346 -0
- package/dist/router/index.d.ts +346 -0
- package/dist/router/index.js +247 -0
- package/dist/router/index.mjs +225 -0
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -257,6 +257,32 @@ The CLI reads that config in `pltt dev`, `pltt test`, `pltt package`, and
|
|
|
257
257
|
`NEXT_PUBLIC_*` environment variables, and path aliases from
|
|
258
258
|
`frontend/tsconfig.json`.
|
|
259
259
|
|
|
260
|
+
## Palette App Router
|
|
261
|
+
|
|
262
|
+
For OS-native routed apps, set `frontend.framework` to `palette-app` and point
|
|
263
|
+
`frontend.entry` at `frontend/app`. The CLI scans app-directory UI files and
|
|
264
|
+
still publishes one safe browser bundle.
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"frontend": {
|
|
269
|
+
"entry": "./frontend/app",
|
|
270
|
+
"sandbox": true,
|
|
271
|
+
"framework": "palette-app"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Supported UI files are `layout.tsx`, `page.tsx`, `loading.tsx`, `error.tsx`,
|
|
277
|
+
and `not-found.tsx`. Static routes, route groups, `[id]`, `[...slug]`, and
|
|
278
|
+
`[[...slug]]` are supported. Use `Link`, `useRouter`, `usePathname`,
|
|
279
|
+
`useSearchParams`, and `useParams` from `@palettelab/sdk`, or use the
|
|
280
|
+
`next/link` and `next/navigation` compatibility imports in `palette-app`
|
|
281
|
+
projects.
|
|
282
|
+
|
|
283
|
+
Server-side Next features are intentionally not part of this mode. Put APIs,
|
|
284
|
+
database access, permissions, and secrets in the plugin backend.
|
|
285
|
+
|
|
260
286
|
## Palette Client
|
|
261
287
|
|
|
262
288
|
Use `createPaletteClient()` when an app needs common Palette OS services without
|
|
@@ -420,6 +446,16 @@ const config = await getInstallConfig("my-plugin")
|
|
|
420
446
|
await updateInstallConfig("my-plugin", { ...config, enabled: true })
|
|
421
447
|
```
|
|
422
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
|
+
|
|
423
459
|
## Sandbox Bridge
|
|
424
460
|
|
|
425
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,11 @@
|
|
|
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
|
+
export { Link, PaletteAppRoute, PaletteAppRouter, notFound, useParams, usePathname, useRouter, useSearchParams } from './router/index.mjs';
|
|
8
9
|
export { PluginProvider } from './components/index.mjs';
|
|
9
10
|
import 'react/jsx-runtime';
|
|
10
11
|
|
|
@@ -53,6 +54,31 @@ type InstallConfig = Record<string, unknown>;
|
|
|
53
54
|
declare function getInstallConfig(pluginId: string): Promise<InstallConfig>;
|
|
54
55
|
declare function updateInstallConfig(pluginId: string, config: InstallConfig): Promise<InstallConfig>;
|
|
55
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
|
+
|
|
56
82
|
declare function createMockPlatformContext(overrides?: Partial<PlatformContext>): PlatformContext;
|
|
57
83
|
declare function withPluginProvider(element: ReactElement, platform?: Partial<PlatformContext>): ReactElement;
|
|
58
84
|
|
|
@@ -195,6 +221,12 @@ declare function createPaletteClient(ctx?: PlatformContext): {
|
|
|
195
221
|
get: (pluginId?: string) => Promise<InstallConfig>;
|
|
196
222
|
update: (values: Record<string, unknown>, pluginId?: string) => Promise<InstallConfig>;
|
|
197
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
|
+
};
|
|
198
230
|
permissions: {
|
|
199
231
|
has: (permission: string) => boolean;
|
|
200
232
|
hasAny: (permissions: string[]) => boolean;
|
|
@@ -212,4 +244,4 @@ declare function hasPermission(ctx: PlatformContext, permission: string): boolea
|
|
|
212
244
|
declare function hasAnyPermission(ctx: PlatformContext, permissions: string[]): boolean;
|
|
213
245
|
declare function hasAllPermissions(ctx: PlatformContext, permissions: string[]): boolean;
|
|
214
246
|
|
|
215
|
-
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,11 @@
|
|
|
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
|
+
export { Link, PaletteAppRoute, PaletteAppRouter, notFound, useParams, usePathname, useRouter, useSearchParams } from './router/index.js';
|
|
8
9
|
export { PluginProvider } from './components/index.js';
|
|
9
10
|
import 'react/jsx-runtime';
|
|
10
11
|
|
|
@@ -53,6 +54,31 @@ type InstallConfig = Record<string, unknown>;
|
|
|
53
54
|
declare function getInstallConfig(pluginId: string): Promise<InstallConfig>;
|
|
54
55
|
declare function updateInstallConfig(pluginId: string, config: InstallConfig): Promise<InstallConfig>;
|
|
55
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
|
+
|
|
56
82
|
declare function createMockPlatformContext(overrides?: Partial<PlatformContext>): PlatformContext;
|
|
57
83
|
declare function withPluginProvider(element: ReactElement, platform?: Partial<PlatformContext>): ReactElement;
|
|
58
84
|
|
|
@@ -195,6 +221,12 @@ declare function createPaletteClient(ctx?: PlatformContext): {
|
|
|
195
221
|
get: (pluginId?: string) => Promise<InstallConfig>;
|
|
196
222
|
update: (values: Record<string, unknown>, pluginId?: string) => Promise<InstallConfig>;
|
|
197
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
|
+
};
|
|
198
230
|
permissions: {
|
|
199
231
|
has: (permission: string) => boolean;
|
|
200
232
|
hasAny: (permissions: string[]) => boolean;
|
|
@@ -212,4 +244,4 @@ declare function hasPermission(ctx: PlatformContext, permission: string): boolea
|
|
|
212
244
|
declare function hasAnyPermission(ctx: PlatformContext, permissions: string[]): boolean;
|
|
213
245
|
declare function hasAllPermissions(ctx: PlatformContext, permissions: string[]): boolean;
|
|
214
246
|
|
|
215
|
-
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 };
|