@pptb/types 1.2.7-beta.4 → 1.2.7-beta.5
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 +24 -3
- package/package.json +1 -1
- package/pptbConfig.d.ts +30 -5
- package/toolboxAPI.d.ts +32 -1
package/README.md
CHANGED
|
@@ -256,6 +256,18 @@ The ToolBox API provides organized namespaces for different functionality:
|
|
|
256
256
|
|
|
257
257
|
### Connections
|
|
258
258
|
|
|
259
|
+
Declare an exact count or range with `features.connections`, for example `3`, `{ "min": 0, "max": 3 }`, or `{ "min": 1, "max": 4 }`. Exact `0` means no connections. Counts are bounded to 0–10; object defaults are min 1 and max equal to the resolved min. Remove the deprecated `multiConnection` and `connectionRequirement` fields when migrating; existing legacy-only tools remain supported.
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
const slots = await toolboxAPI.connections.getConnections();
|
|
263
|
+
const third = await toolboxAPI.connections.getConnection(2);
|
|
264
|
+
if (third) {
|
|
265
|
+
const records = await dataverseAPI.queryData("accounts?$select=name&$top=5", 2);
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Targets are zero-based; `"primary"` and `"secondary"` alias 0 and 1. Null slots retain their positions, so never filter the array before routing requests. `getSecondaryConnection()` is deprecated but supported; use `getConnection(1)` or `(await getConnections())[1]`. See the [connection-slot author guide](https://github.com/PowerPlatformToolBox/desktop-app/blob/main/docs/N_CONNECTION_TOOL_AUTHOR_GUIDE.md) for migration and lifecycle examples.
|
|
270
|
+
|
|
259
271
|
```typescript
|
|
260
272
|
// Get the active Dataverse connection
|
|
261
273
|
const connection = await toolboxAPI.connections.getActiveConnection();
|
|
@@ -690,6 +702,13 @@ Core platform features organized into namespaces:
|
|
|
690
702
|
|
|
691
703
|
#### Connections
|
|
692
704
|
|
|
705
|
+
- **getConnections()**: Promise<Array<Connection | null>>
|
|
706
|
+
- Returns configured slots, preserving null gaps; not necessarily padded to the declared maximum.
|
|
707
|
+
- **getConnection(target: "primary" | "secondary" | number)**: Promise<Connection | null>
|
|
708
|
+
- Gets one slot by zero-based index or legacy alias. Unassigned slots return null; negative/fractional targets reject.
|
|
709
|
+
- **getSecondaryConnection()**: Promise<Connection | null>
|
|
710
|
+
- Deprecated compatibility adapter; prefer `getConnection("secondary")`.
|
|
711
|
+
|
|
693
712
|
- **getActiveConnection()**: Promise<Connection | null>
|
|
694
713
|
- Returns the currently active connection or null if none is active
|
|
695
714
|
- Includes `enabledForPowerPlatformAPI` so tools can decide whether to use Power Platform API
|
|
@@ -784,7 +803,7 @@ Core platform features organized into namespaces:
|
|
|
784
803
|
- **launchTool(targetToolId, prefillData?, options?)**: Promise\<unknown\>
|
|
785
804
|
- Launches the specified tool, optionally with prefill data
|
|
786
805
|
- Returns a Promise that resolves with the data returned by the callee, or `null` if it closes without returning or the user clicks the "Return to Caller" banner
|
|
787
|
-
- The callee
|
|
806
|
+
- The callee inherits the caller's full positional connection array, bounded by its declared maximum; `options.connectionIds` replaces the array and legacy overrides affect only slots 0/1
|
|
788
807
|
- Only one active callee per caller is allowed; throws `"A callee invocation is already in progress"` if a callee is already open
|
|
789
808
|
- Pass `options.noReturn: true` for one-way "Send To" flows; the banner is suppressed entirely for the callee
|
|
790
809
|
|
|
@@ -835,13 +854,13 @@ Complete HTTP client for interacting with Microsoft Dataverse:
|
|
|
835
854
|
- Supports both bound and unbound operations
|
|
836
855
|
- **publishCustomizations(tableLogicalName?: string)**: Promise<void>
|
|
837
856
|
- Publishes pending customizations. When `tableLogicalName` is omitted it runs PublishAllXml; otherwise it publishes only the specified table.
|
|
838
|
-
- **deploySolution(base64SolutionContent: string | ArrayBuffer | ArrayBufferView, options?: DeploySolutionOptions, connectionTarget?: "primary" | "secondary")**: Promise<{ImportJobId: string}>
|
|
857
|
+
- **deploySolution(base64SolutionContent: string | ArrayBuffer | ArrayBufferView, options?: DeploySolutionOptions, connectionTarget?: "primary" | "secondary" | number)**: Promise<{ImportJobId: string}>
|
|
839
858
|
- Deploys (imports) a solution to the Dataverse environment
|
|
840
859
|
- Accepts either a base64-encoded solution zip string or raw binary data (Buffer, ArrayBuffer, Uint8Array)
|
|
841
860
|
- Always supplies `PublishWorkflows` and `OverwriteUnmanagedCustomizations` booleans to Dataverse, defaulting to `false` when you omit them
|
|
842
861
|
- Supports optional parameters for customizing the import (publishWorkflows, overwriteUnmanagedCustomizations, skipProductUpdateDependencies, convertToManaged)
|
|
843
862
|
- Returns an ImportJobId for tracking the import progress
|
|
844
|
-
- **getImportJobStatus(importJobId: string, connectionTarget?: "primary" | "secondary")**: Promise<Record<string, unknown>>
|
|
863
|
+
- **getImportJobStatus(importJobId: string, connectionTarget?: "primary" | "secondary" | number)**: Promise<Record<string, unknown>>
|
|
845
864
|
- Gets the status of a solution import job
|
|
846
865
|
- Returns import job details including progress, completion status, and error information
|
|
847
866
|
- Use to track the progress of a solution deployment initiated with deploySolution
|
|
@@ -852,6 +871,8 @@ Generic HTTP client for Power Platform Admin APIs covering all categories:
|
|
|
852
871
|
|
|
853
872
|
#### Category Methods
|
|
854
873
|
|
|
874
|
+
`connectionTarget` accepts zero-based numeric slots plus `"primary"` / `"secondary"`. For example, `powerplatformAPI.PowerApps.Get("apps", 2)` routes to slot 3. Calling an API with an unassigned slot returns a missing-connection error.
|
|
875
|
+
|
|
855
876
|
Each category (Analytics, AppManagement, Authorization, Connectivity, CopilotStudio, Dynamics, EnvironmentManagement, Governance, Licensing, PowerApps, PowerAutomate, PowerPages, ResourceQuery, UserManagement, WorkflowAgents) exposes:
|
|
856
877
|
|
|
857
878
|
- **Get(path?, connectionTarget?, headers?)**: Promise<PowerPlatformResponse>
|
package/package.json
CHANGED
package/pptbConfig.d.ts
CHANGED
|
@@ -174,15 +174,40 @@ export interface InvocationConfig {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* This file lives alongside `package.json` in the tool's package root.
|
|
180
|
-
* All sections are optional; the file itself is optional. When present it
|
|
181
|
-
* is validated by `pptb-validate` in addition to `package.json`.
|
|
177
|
+
* Author-facing runtime policy. Latest maps to native LatestMajor in later runtime work.
|
|
182
178
|
*/
|
|
179
|
+
export type WorkerRollForward = "Disable" | "Latest" | "Minor" | "Major";
|
|
180
|
+
export type WorkerTargetFramework = "net8.0" | "net9.0" | "net10.0";
|
|
181
|
+
export type WorkerPlatform = "all" | "windows-x64" | "windows-arm64" | "macos-x64" | "macos-arm64" | "linux-x64" | "linux-arm64";
|
|
182
|
+
|
|
183
|
+
/** Declarative metadata only; no worker execution API is available yet. */
|
|
184
|
+
export interface WorkerDeclaration {
|
|
185
|
+
kind: "dotnet-tool";
|
|
186
|
+
packageId: string;
|
|
187
|
+
/** Exact NuGet version; ranges, floating versions and tags are forbidden. */
|
|
188
|
+
packageVersion: string;
|
|
189
|
+
command: string;
|
|
190
|
+
dotnet: {
|
|
191
|
+
targetFramework: WorkerTargetFramework;
|
|
192
|
+
/** Stable major.minor.patch matching the executable target framework. */
|
|
193
|
+
minimumRuntimeVersion: string;
|
|
194
|
+
/** Defaults to Major when omitted. Explicit null/empty/unknown values are invalid. */
|
|
195
|
+
rollForward?: WorkerRollForward;
|
|
196
|
+
};
|
|
197
|
+
/** Required unique aliases; all must appear alone and names the versioned officially supported PPTB platform matrix. */
|
|
198
|
+
platforms: WorkerPlatform[];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface NormalizedWorkerDeclaration extends WorkerDeclaration {
|
|
202
|
+
dotnet: WorkerDeclaration["dotnet"] & { rollForward: WorkerRollForward };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Optional package-root config, validated alongside package.json by pptb-validate. */
|
|
183
206
|
export interface PPTBConfig {
|
|
184
207
|
/** Invocation contract – how this tool can be called by other tools. */
|
|
185
208
|
invocation?: InvocationConfig;
|
|
186
209
|
/** Agent contract – how this tool can be called by external automation. */
|
|
187
210
|
agents?: AgentsConfig;
|
|
211
|
+
/** Native worker declarations keyed by stable ID. Requires package.json features.minAPI. */
|
|
212
|
+
workers?: Record<string, WorkerDeclaration>;
|
|
188
213
|
}
|
package/toolboxAPI.d.ts
CHANGED
|
@@ -169,6 +169,34 @@ declare namespace ToolBoxAPI {
|
|
|
169
169
|
error?: string;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
const workerHandleBrand: unique symbol;
|
|
173
|
+
export type WorkerHandle = string & { readonly [workerHandleBrand]: true };
|
|
174
|
+
|
|
175
|
+
export type WorkerRpcMessage =
|
|
176
|
+
| { jsonrpc: "2.0"; method: string; id?: string | number; params?: unknown[] | Record<string, unknown> }
|
|
177
|
+
| { jsonrpc: "2.0"; id: string | number | null; result: unknown }
|
|
178
|
+
| { jsonrpc: "2.0"; id: string | number | null; error: { code: number; message: string; data?: unknown } };
|
|
179
|
+
|
|
180
|
+
export interface WorkerSnapshot {
|
|
181
|
+
state: "starting" | "running" | "stopping" | "exited" | "failed";
|
|
182
|
+
failure?: string;
|
|
183
|
+
stderr: { bytes: number; truncated: boolean; summary: "Worker stderr redacted" };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface WorkerStart {
|
|
187
|
+
handle: WorkerHandle;
|
|
188
|
+
ready: Promise<void>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface WorkersAPI {
|
|
192
|
+
start(workerId: string): Promise<WorkerStart>;
|
|
193
|
+
send(handle: WorkerHandle, message: WorkerRpcMessage): Promise<void>;
|
|
194
|
+
onMessage(handle: WorkerHandle, callback: (message: WorkerRpcMessage) => void): () => void;
|
|
195
|
+
onExit(handle: WorkerHandle, callback: (snapshot: WorkerSnapshot) => void): () => void;
|
|
196
|
+
stop(handle: WorkerHandle): Promise<void>;
|
|
197
|
+
dispose(handle: WorkerHandle): Promise<void>;
|
|
198
|
+
}
|
|
199
|
+
|
|
172
200
|
/**
|
|
173
201
|
* Connections namespace - restricted access for tools
|
|
174
202
|
*/
|
|
@@ -179,7 +207,7 @@ declare namespace ToolBoxAPI {
|
|
|
179
207
|
getActiveConnection: () => Promise<Connection | null>;
|
|
180
208
|
|
|
181
209
|
/**
|
|
182
|
-
* @deprecated Use `getConnection("secondary")` or `getConnections()[1]` for slot-aware connection access.
|
|
210
|
+
* @deprecated Use `getConnection("secondary")` or `(await getConnections())[1]` for slot-aware connection access.
|
|
183
211
|
*/
|
|
184
212
|
getSecondaryConnection: () => Promise<Connection | null>;
|
|
185
213
|
|
|
@@ -406,6 +434,9 @@ declare namespace ToolBoxAPI {
|
|
|
406
434
|
* Main ToolBox API exposed to tools via window.toolboxAPI
|
|
407
435
|
*/
|
|
408
436
|
export interface API {
|
|
437
|
+
/** Start and communicate with a worker declared by this tool's manifest. */
|
|
438
|
+
workers: WorkersAPI;
|
|
439
|
+
|
|
409
440
|
/**
|
|
410
441
|
* Connection-related operations (restricted)
|
|
411
442
|
*/
|