@pptb/types 1.0.12 → 1.0.14
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 +32 -8
- package/dataverseAPI.d.ts +21 -0
- package/package.json +2 -2
- package/toolboxAPI.d.ts +28 -3
package/README.md
CHANGED
|
@@ -103,20 +103,30 @@ if (filePath) {
|
|
|
103
103
|
console.log("File saved to:", filePath);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
// Select a folder for exporting assets
|
|
107
|
+
const targetFolder = await toolboxAPI.utils.selectPath({
|
|
108
|
+
type: "folder",
|
|
109
|
+
title: "Choose export directory",
|
|
110
|
+
defaultPath: "/Users/me/Downloads",
|
|
111
|
+
});
|
|
112
|
+
if (!targetFolder) {
|
|
113
|
+
console.log("User canceled folder selection");
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
// Get current theme
|
|
107
117
|
const theme = await toolboxAPI.utils.getCurrentTheme();
|
|
108
118
|
console.log("Current theme:", theme); // "light" or "dark"
|
|
109
119
|
|
|
110
120
|
// Execute multiple operations in parallel
|
|
111
121
|
const [account, contact, opportunities] = await toolboxAPI.utils.executeParallel(
|
|
112
|
-
dataverseAPI.retrieve(
|
|
113
|
-
dataverseAPI.retrieve(
|
|
114
|
-
dataverseAPI.fetchXmlQuery(opportunityFetchXml)
|
|
122
|
+
dataverseAPI.retrieve("account", accountId, ["name"]),
|
|
123
|
+
dataverseAPI.retrieve("contact", contactId, ["fullname"]),
|
|
124
|
+
dataverseAPI.fetchXmlQuery(opportunityFetchXml),
|
|
115
125
|
);
|
|
116
|
-
console.log(
|
|
126
|
+
console.log("All data fetched:", account, contact, opportunities);
|
|
117
127
|
|
|
118
128
|
// Show loading screen during operations
|
|
119
|
-
await toolboxAPI.utils.showLoading(
|
|
129
|
+
await toolboxAPI.utils.showLoading("Processing data...");
|
|
120
130
|
try {
|
|
121
131
|
// Perform operations
|
|
122
132
|
await processData();
|
|
@@ -253,6 +263,12 @@ const result = await dataverseAPI.execute({
|
|
|
253
263
|
FieldName: "total_revenue",
|
|
254
264
|
},
|
|
255
265
|
});
|
|
266
|
+
|
|
267
|
+
// Publish customizations for the active environment
|
|
268
|
+
await dataverseAPI.publishCustomizations();
|
|
269
|
+
|
|
270
|
+
// Publish only a specific table (in this case, the account table)
|
|
271
|
+
await dataverseAPI.publishCustomizations("account");
|
|
256
272
|
```
|
|
257
273
|
|
|
258
274
|
## API Reference
|
|
@@ -282,6 +298,12 @@ Core platform features organized into namespaces:
|
|
|
282
298
|
|
|
283
299
|
- Opens a save dialog and writes the content. Returns the saved file path or null if canceled
|
|
284
300
|
|
|
301
|
+
- **selectPath(options?: SelectPathOptions)**: Promise<string | null>
|
|
302
|
+
|
|
303
|
+
- Opens a native dialog to select either a file or folder (defaults to file)
|
|
304
|
+
- Supports custom titles, button labels, default paths, and filters when selecting files
|
|
305
|
+
- Returns the selected path or null if the user cancels
|
|
306
|
+
|
|
285
307
|
- **getCurrentTheme()**: Promise<"light" | "dark">
|
|
286
308
|
|
|
287
309
|
- Returns the current UI theme setting
|
|
@@ -294,9 +316,9 @@ Core platform features organized into namespaces:
|
|
|
294
316
|
- Example:
|
|
295
317
|
```typescript
|
|
296
318
|
const [account, contact, opportunities] = await toolboxAPI.utils.executeParallel(
|
|
297
|
-
dataverseAPI.retrieve(
|
|
298
|
-
dataverseAPI.retrieve(
|
|
299
|
-
dataverseAPI.fetchXmlQuery(fetchXml)
|
|
319
|
+
dataverseAPI.retrieve("account", id1),
|
|
320
|
+
dataverseAPI.retrieve("contact", id2),
|
|
321
|
+
dataverseAPI.fetchXmlQuery(fetchXml),
|
|
300
322
|
);
|
|
301
323
|
```
|
|
302
324
|
|
|
@@ -407,6 +429,8 @@ Complete HTTP client for interacting with Microsoft Dataverse:
|
|
|
407
429
|
- **execute(request: ExecuteRequest)**: Promise<Record<string, unknown>>
|
|
408
430
|
- Executes a Dataverse Web API action or function
|
|
409
431
|
- Supports both bound and unbound operations
|
|
432
|
+
- **publishCustomizations(tableLogicalName?: string)**: Promise<void>
|
|
433
|
+
- Publishes pending customizations. When `tableLogicalName` is omitted it runs PublishAllXml; otherwise it publishes only the specified table.
|
|
410
434
|
|
|
411
435
|
### Security Notes
|
|
412
436
|
|
package/dataverseAPI.d.ts
CHANGED
|
@@ -381,6 +381,25 @@ declare namespace DataverseAPI {
|
|
|
381
381
|
*/
|
|
382
382
|
queryData: (odataQuery: string, connectionTarget?: "primary" | "secondary") => Promise<{ value: Record<string, unknown>[] }>;
|
|
383
383
|
|
|
384
|
+
/**
|
|
385
|
+
* Publish customizations for the current environment.
|
|
386
|
+
*
|
|
387
|
+
* When `tableLogicalName` is provided, this method publishes only that table by executing the PublishXml action with a generated payload.
|
|
388
|
+
* When no table name is provided, it runs PublishAllXml (equivalent to "Publish All Customizations").
|
|
389
|
+
*
|
|
390
|
+
* @param tableLogicalName - Optional table (entity) logical name to publish. If omitted, all pending customizations are published.
|
|
391
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* // Publish all customizations
|
|
395
|
+
* await dataverseAPI.publishCustomizations();
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* // Publish only the account table
|
|
399
|
+
* await dataverseAPI.publishCustomizations('account');
|
|
400
|
+
*/
|
|
401
|
+
publishCustomizations: (tableLogicalName?: string, connectionTarget?: "primary" | "secondary") => Promise<void>;
|
|
402
|
+
|
|
384
403
|
/**
|
|
385
404
|
* Create multiple records in Dataverse
|
|
386
405
|
*
|
|
@@ -410,6 +429,8 @@ declare namespace DataverseAPI {
|
|
|
410
429
|
* ]);
|
|
411
430
|
*/
|
|
412
431
|
updateMultiple: (entityLogicalName: string, records: Record<string, unknown>[], connectionTarget?: "primary" | "secondary") => Promise<void>;
|
|
432
|
+
|
|
433
|
+
/**
|
|
413
434
|
* Gets the Dataverse entity set (collection) name for the specified table.
|
|
414
435
|
*
|
|
415
436
|
* This is typically used when building OData queries where the collection name
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pptb/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "TypeScript type definitions for Power Platform Tool Box API",
|
|
5
5
|
"main": "index.d.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
"url": "https://github.com/PowerPlatformToolBox/desktop-app.git",
|
|
20
20
|
"directory": "packages"
|
|
21
21
|
}
|
|
22
|
-
}
|
|
22
|
+
}
|
package/toolboxAPI.d.ts
CHANGED
|
@@ -27,6 +27,26 @@ declare namespace ToolBoxAPI {
|
|
|
27
27
|
duration?: number; // Duration in milliseconds, 0 for persistent
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* File dialog filter definition
|
|
32
|
+
*/
|
|
33
|
+
export interface FileDialogFilter {
|
|
34
|
+
name: string;
|
|
35
|
+
extensions: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Options for selecting a file or folder path
|
|
40
|
+
*/
|
|
41
|
+
export interface SelectPathOptions {
|
|
42
|
+
type?: "file" | "folder";
|
|
43
|
+
title?: string;
|
|
44
|
+
message?: string;
|
|
45
|
+
buttonLabel?: string;
|
|
46
|
+
defaultPath?: string;
|
|
47
|
+
filters?: FileDialogFilter[];
|
|
48
|
+
}
|
|
49
|
+
|
|
30
50
|
/**
|
|
31
51
|
* Event types that can be emitted by the ToolBox
|
|
32
52
|
*/
|
|
@@ -128,17 +148,17 @@ declare namespace ToolBoxAPI {
|
|
|
128
148
|
* Get the currently active Dataverse connection
|
|
129
149
|
*/
|
|
130
150
|
getActiveConnection: () => Promise<DataverseConnection | null>;
|
|
131
|
-
|
|
151
|
+
|
|
132
152
|
/**
|
|
133
153
|
* Get the secondary connection for multi-connection tools
|
|
134
154
|
*/
|
|
135
155
|
getSecondaryConnection: () => Promise<DataverseConnection | null>;
|
|
136
|
-
|
|
156
|
+
|
|
137
157
|
/**
|
|
138
158
|
* Get the secondary connection URL for multi-connection tools
|
|
139
159
|
*/
|
|
140
160
|
getSecondaryConnectionUrl: () => Promise<string | null>;
|
|
141
|
-
|
|
161
|
+
|
|
142
162
|
/**
|
|
143
163
|
* Get the secondary connection ID for multi-connection tools
|
|
144
164
|
*/
|
|
@@ -164,6 +184,11 @@ declare namespace ToolBoxAPI {
|
|
|
164
184
|
*/
|
|
165
185
|
saveFile: (defaultPath: string, content: any) => Promise<string | null>;
|
|
166
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Open a native dialog to select either a file or a folder and return the chosen path
|
|
189
|
+
*/
|
|
190
|
+
selectPath: (options?: SelectPathOptions) => Promise<string | null>;
|
|
191
|
+
|
|
167
192
|
/**
|
|
168
193
|
* Get the current UI theme (light or dark)
|
|
169
194
|
*/
|