@pptb/types 1.0.16 → 1.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/toolboxAPI.d.ts +64 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pptb/types",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "TypeScript type definitions for Power Platform ToolBox API",
5
5
  "main": "index.d.ts",
6
6
  "types": "index.d.ts",
package/toolboxAPI.d.ts CHANGED
@@ -179,16 +179,6 @@ declare namespace ToolBoxAPI {
179
179
  */
180
180
  copyToClipboard: (text: string) => Promise<void>;
181
181
 
182
- /**
183
- * Open a save file dialog and write content
184
- */
185
- saveFile: (defaultPath: string, content: any) => Promise<string | null>;
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
-
192
182
  /**
193
183
  * Get the current UI theme (light or dark)
194
184
  */
@@ -220,6 +210,65 @@ declare namespace ToolBoxAPI {
220
210
  hideLoading: () => Promise<void>;
221
211
  }
222
212
 
213
+ /**
214
+ * FileSystem namespace - filesystem operations for tools
215
+ */
216
+ export interface FileSystemAPI {
217
+ /**
218
+ * Read a file as UTF-8 text
219
+ * Ideal for configs (pcfconfig.json, package.json)
220
+ */
221
+ readText: (path: string) => Promise<string>;
222
+
223
+ /**
224
+ * Read a file as raw binary data (Buffer)
225
+ * For images, ZIPs, manifests that need to be hashed, uploaded, or parsed as non-text
226
+ * Returns a Node.js Buffer which Electron can properly serialize over IPC
227
+ * Tools can convert to ArrayBuffer using buffer.buffer if needed
228
+ */
229
+ readBinary: (path: string) => Promise<Buffer>;
230
+
231
+ /**
232
+ * Check if a file or directory exists
233
+ * Lightweight existence check before attempting reads/writes
234
+ */
235
+ exists: (path: string) => Promise<boolean>;
236
+
237
+ /**
238
+ * Get file or directory metadata
239
+ * Confirms users picked the correct folder/file and shows info in UI
240
+ */
241
+ stat: (path: string) => Promise<{ type: "file" | "directory"; size: number; mtime: string }>;
242
+
243
+ /**
244
+ * Read directory contents
245
+ * Enumerate folder contents when tools need to show selectable files or validate structure
246
+ */
247
+ readDirectory: (path: string) => Promise<Array<{ name: string; type: "file" | "directory" }>>;
248
+
249
+ /**
250
+ * Write text content to a file
251
+ * Save generated files (manifests, logs) without forcing users through save dialog
252
+ */
253
+ writeText: (path: string, content: string) => Promise<void>;
254
+
255
+ /**
256
+ * Create a directory (recursive)
257
+ * Ensure target folders exist before writing scaffolding artifacts
258
+ */
259
+ createDirectory: (path: string) => Promise<void>;
260
+
261
+ /**
262
+ * Open a save file dialog and write content
263
+ */
264
+ saveFile: (defaultPath: string, content: any) => Promise<string | null>;
265
+
266
+ /**
267
+ * Open a native dialog to select either a file or a folder and return the chosen path
268
+ */
269
+ selectPath: (options?: SelectPathOptions) => Promise<string | null>;
270
+ }
271
+
223
272
  /**
224
273
  * Terminal namespace - context-aware terminal operations
225
274
  */
@@ -323,6 +372,11 @@ declare namespace ToolBoxAPI {
323
372
  */
324
373
  utils: UtilsAPI;
325
374
 
375
+ /**
376
+ * Filesystem operations
377
+ */
378
+ fileSystem: FileSystemAPI;
379
+
326
380
  /**
327
381
  * Tool-specific settings (context-aware)
328
382
  */