@palettelab/sdk 0.1.22 → 0.1.23
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 +51 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -366,6 +366,18 @@ events through the SDK. The app manifest must list the targets under
|
|
|
366
366
|
`consumes.services` or `consumes.events`; Palette checks the manifest and the
|
|
367
367
|
org install grant before dispatching.
|
|
368
368
|
|
|
369
|
+
The model is intentionally contract-first:
|
|
370
|
+
|
|
371
|
+
- Provider apps declare `provides.namespace`, `provides.services[].methods`,
|
|
372
|
+
optional JSON schemas, and `provides.events`.
|
|
373
|
+
- Consumer apps declare exact qualified targets such as
|
|
374
|
+
`hr/v1#approvalChain.get` under `consumes.services` or `consumes.events`.
|
|
375
|
+
- Installs use a dependency plan so required provider apps can be installed
|
|
376
|
+
first.
|
|
377
|
+
- Org owners/admins can grant or revoke each consumed service/event target after
|
|
378
|
+
install.
|
|
379
|
+
- Every service call and event subscription is checked again at runtime.
|
|
380
|
+
|
|
369
381
|
```tsx
|
|
370
382
|
import { createPaletteClient, usePlatform } from "@palettelab/sdk"
|
|
371
383
|
|
|
@@ -390,6 +402,45 @@ call when a generated helper is not available.
|
|
|
390
402
|
managing target strings by hand. Broker failures are surfaced as
|
|
391
403
|
`MissingDependencyError`, `CrossAppGrantError`, or `BrokerCallError`.
|
|
392
404
|
|
|
405
|
+
In Palette native runtime, the SDK calls `/api/v1/os-broker/dispatch` and
|
|
406
|
+
`/api/v1/os-broker/events/stream` directly with the current app identity. In
|
|
407
|
+
iframe sandbox runtime, the SDK sends `palette.broker.call`,
|
|
408
|
+
`palette.broker.emit`, and `palette.broker.subscribe` messages to the Palette
|
|
409
|
+
host. The host forwards the request through the same broker endpoints, so
|
|
410
|
+
sandboxed apps still get the same manifest, install, grant, and schema checks.
|
|
411
|
+
|
|
412
|
+
Declare the frontend dependency in `palette-plugin.json`:
|
|
413
|
+
|
|
414
|
+
```json
|
|
415
|
+
{
|
|
416
|
+
"consumes": {
|
|
417
|
+
"services": [
|
|
418
|
+
{
|
|
419
|
+
"target": "hr/v1#approvalChain.get",
|
|
420
|
+
"required": true,
|
|
421
|
+
"reason": "Route leave approvals through HR"
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
"events": [
|
|
425
|
+
{
|
|
426
|
+
"target": "hr/v1#hierarchy.updated",
|
|
427
|
+
"required": false,
|
|
428
|
+
"reason": "Refresh approval-chain cache"
|
|
429
|
+
}
|
|
430
|
+
]
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Generated service clients use the default exported `palette` client from the
|
|
436
|
+
SDK. That lets generated files work in both app components and shared modules:
|
|
437
|
+
|
|
438
|
+
```ts
|
|
439
|
+
import { hr } from "./.palette/types/services"
|
|
440
|
+
|
|
441
|
+
const chain = await hr.approvalChain.get({ user_id })
|
|
442
|
+
```
|
|
443
|
+
|
|
393
444
|
### Data Room Folders By Name
|
|
394
445
|
|
|
395
446
|
Apps can create or reuse custom Data Room folders by name:
|