pptb-standard-sample-tool 0.0.5 → 0.0.7

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/types/index.d.ts +168 -140
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptb-standard-sample-tool",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "displayName": "Power Platform Standard Sample Tool",
5
5
  "description": "Example tool demonstrating HTML-first architecture with TypeScript",
6
6
  "author": "Power Platform ToolBox",
package/types/index.d.ts CHANGED
@@ -1,154 +1,182 @@
1
1
  /**
2
- * PowerPlatform ToolBox API Type Definitions
3
- *
2
+ * Power Platform Tool Box API Type Definitions
3
+ *
4
4
  * Tools running in ToolBox webviews can access the ToolBox API via window.toolboxAPI
5
5
  */
6
6
 
7
7
  declare namespace ToolBox {
8
- /**
9
- * Tool context containing connection information
10
- */
11
- export interface ToolContext {
12
- toolId: string | null;
13
- connectionUrl: string | null;
14
- accessToken: string | null;
15
- }
16
-
17
- /**
18
- * Notification options
19
- */
20
- export interface NotificationOptions {
21
- title: string;
22
- body: string;
23
- type?: 'info' | 'success' | 'warning' | 'error';
24
- duration?: number; // Duration in milliseconds, 0 for persistent
25
- }
26
-
27
- /**
28
- * Event types that can be emitted by the ToolBox
29
- */
30
- export type ToolBoxEvent =
31
- | 'tool:loaded'
32
- | 'tool:unloaded'
33
- | 'connection:created'
34
- | 'connection:updated'
35
- | 'connection:deleted'
36
- | 'settings:updated'
37
- | 'notification:shown';
38
-
39
- /**
40
- * Event payload for ToolBox events
41
- */
42
- export interface ToolBoxEventPayload {
43
- event: ToolBoxEvent;
44
- data: unknown;
45
- timestamp: string;
46
- }
47
-
48
- /**
49
- * Dataverse connection configuration
50
- */
51
- export interface DataverseConnection {
52
- id: string;
53
- name: string;
54
- url: string;
55
- environment: 'Dev' | 'Test' | 'UAT' | 'Production';
56
- clientId?: string;
57
- tenantId?: string;
58
- createdAt: string;
59
- lastUsedAt?: string;
60
- isActive?: boolean;
61
- }
62
-
63
- /**
64
- * Tool information
65
- */
66
- export interface Tool {
67
- id: string;
68
- name: string;
69
- version: string;
70
- description: string;
71
- author: string;
72
- icon?: string;
73
- }
74
-
75
- /**
76
- * ToolBox API exposed to tools via window.toolboxAPI
77
- */
78
- export interface ToolBoxAPI {
79
- // Settings
80
- getUserSettings: () => Promise<any>;
81
- updateUserSettings: (settings: any) => Promise<void>;
82
- getSetting: (key: string) => Promise<any>;
83
- setSetting: (key: string, value: any) => Promise<void>;
84
-
85
- // Connections
86
- addConnection: (connection: any) => Promise<void>;
87
- updateConnection: (id: string, updates: any) => Promise<void>;
88
- deleteConnection: (id: string) => Promise<void>;
89
- getConnections: () => Promise<DataverseConnection[]>;
90
- setActiveConnection: (id: string) => Promise<void>;
91
- getActiveConnection: () => Promise<DataverseConnection | null>;
92
- disconnectConnection: () => Promise<void>;
93
-
94
- // Tools
95
- getAllTools: () => Promise<Tool[]>;
96
- getTool: (toolId: string) => Promise<Tool>;
97
- loadTool: (packageName: string) => Promise<Tool>;
98
- unloadTool: (toolId: string) => Promise<void>;
99
- installTool: (packageName: string) => Promise<Tool>;
100
- uninstallTool: (packageName: string, toolId: string) => Promise<void>;
101
- getToolWebviewHtml: (
102
- packageName: string,
103
- connectionUrl?: string,
104
- accessToken?: string
105
- ) => Promise<string | null>;
106
- getToolContext: () => Promise<ToolContext>;
107
-
108
- // Tool Settings
109
- getToolSettings: (toolId: string) => Promise<any>;
110
- updateToolSettings: (toolId: string, settings: any) => Promise<void>;
111
-
112
- // Notifications
113
- showNotification: (options: NotificationOptions) => Promise<void>;
114
-
115
- // Clipboard
116
- copyToClipboard: (text: string) => Promise<void>;
117
-
118
- // File operations
119
- saveFile: (defaultPath: string, content: any) => Promise<string | null>;
120
-
121
- // Events
122
- getEventHistory: (limit?: number) => Promise<ToolBoxEventPayload[]>;
123
- onToolboxEvent: (
124
- callback: (event: any, payload: ToolBoxEventPayload) => void
125
- ) => void;
126
- removeToolboxEventListener: (
127
- callback: (event: any, payload: ToolBoxEventPayload) => void
128
- ) => void;
129
-
130
- // Auto-update
131
- checkForUpdates: () => Promise<void>;
132
- downloadUpdate: () => Promise<void>;
133
- quitAndInstall: () => Promise<void>;
134
- getAppVersion: () => Promise<string>;
135
- onUpdateChecking: (callback: () => void) => void;
136
- onUpdateAvailable: (callback: (info: any) => void) => void;
137
- onUpdateNotAvailable: (callback: () => void) => void;
138
- onUpdateDownloadProgress: (callback: (progress: any) => void) => void;
139
- onUpdateDownloaded: (callback: (info: any) => void) => void;
140
- onUpdateError: (callback: (error: string) => void) => void;
141
- }
8
+ /**
9
+ * Tool context containing connection information
10
+ */
11
+ export interface ToolContext {
12
+ toolId: string | null;
13
+ connectionUrl: string | null;
14
+ accessToken: string | null;
15
+ }
16
+
17
+ /**
18
+ * Notification options
19
+ */
20
+ export interface NotificationOptions {
21
+ title: string;
22
+ body: string;
23
+ type?: "info" | "success" | "warning" | "error";
24
+ duration?: number; // Duration in milliseconds, 0 for persistent
25
+ }
26
+
27
+ /**
28
+ * Event types that can be emitted by the ToolBox
29
+ */
30
+ export type ToolBoxEvent = "tool:loaded" | "tool:unloaded" | "connection:created" | "connection:updated" | "connection:deleted" | "settings:updated" | "notification:shown" | "terminal:created" | "terminal:closed" | "terminal:output" | "terminal:command:completed" | "terminal:error";
31
+
32
+ /**
33
+ * Event payload for ToolBox events
34
+ */
35
+ export interface ToolBoxEventPayload {
36
+ event: ToolBoxEvent;
37
+ data: unknown;
38
+ timestamp: string;
39
+ }
40
+
41
+ /**
42
+ * Dataverse connection configuration
43
+ */
44
+ export interface DataverseConnection {
45
+ id: string;
46
+ name: string;
47
+ url: string;
48
+ environment: "Dev" | "Test" | "UAT" | "Production";
49
+ clientId?: string;
50
+ tenantId?: string;
51
+ createdAt: string;
52
+ lastUsedAt?: string;
53
+ isActive?: boolean;
54
+ }
55
+
56
+ /**
57
+ * Tool information
58
+ */
59
+ export interface Tool {
60
+ id: string;
61
+ name: string;
62
+ version: string;
63
+ description: string;
64
+ author: string;
65
+ icon?: string;
66
+ }
67
+
68
+ /**
69
+ * Terminal configuration options
70
+ */
71
+ export interface TerminalOptions {
72
+ name: string;
73
+ shell?: string;
74
+ cwd?: string;
75
+ env?: Record<string, string>;
76
+ }
77
+
78
+ /**
79
+ * Terminal instance
80
+ */
81
+ export interface Terminal {
82
+ id: string;
83
+ name: string;
84
+ toolId: string;
85
+ shell: string;
86
+ cwd: string;
87
+ isVisible: boolean;
88
+ createdAt: string;
89
+ }
90
+
91
+ /**
92
+ * Terminal command execution result
93
+ */
94
+ export interface TerminalCommandResult {
95
+ terminalId: string;
96
+ commandId: string;
97
+ output?: string;
98
+ exitCode?: number;
99
+ error?: string;
100
+ }
101
+
102
+ /**
103
+ * ToolBox API exposed to tools via window.toolboxAPI
104
+ */
105
+ export interface ToolBoxAPI {
106
+ // Settings
107
+ getUserSettings: () => Promise<any>;
108
+ updateUserSettings: (settings: any) => Promise<void>;
109
+ getSetting: (key: string) => Promise<any>;
110
+ setSetting: (key: string, value: any) => Promise<void>;
111
+
112
+ // Connections
113
+ addConnection: (connection: any) => Promise<void>;
114
+ updateConnection: (id: string, updates: any) => Promise<void>;
115
+ deleteConnection: (id: string) => Promise<void>;
116
+ getConnections: () => Promise<DataverseConnection[]>;
117
+ setActiveConnection: (id: string) => Promise<void>;
118
+ getActiveConnection: () => Promise<DataverseConnection | null>;
119
+ disconnectConnection: () => Promise<void>;
120
+
121
+ // Tools
122
+ getAllTools: () => Promise<Tool[]>;
123
+ getTool: (toolId: string) => Promise<Tool>;
124
+ loadTool: (packageName: string) => Promise<Tool>;
125
+ unloadTool: (toolId: string) => Promise<void>;
126
+ installTool: (packageName: string) => Promise<Tool>;
127
+ uninstallTool: (packageName: string, toolId: string) => Promise<void>;
128
+ getToolWebviewHtml: (packageName: string, connectionUrl?: string, accessToken?: string) => Promise<string | null>;
129
+ getToolContext: () => Promise<ToolContext>;
130
+
131
+ // Tool Settings
132
+ getToolSettings: (toolId: string) => Promise<any>;
133
+ updateToolSettings: (toolId: string, settings: any) => Promise<void>;
134
+
135
+ // Notifications
136
+ showNotification: (options: NotificationOptions) => Promise<void>;
137
+
138
+ // Clipboard
139
+ copyToClipboard: (text: string) => Promise<void>;
140
+
141
+ // File operations
142
+ saveFile: (defaultPath: string, content: any) => Promise<string | null>;
143
+
144
+ // Terminal operations
145
+ createTerminal: (toolId: string, options: TerminalOptions) => Promise<Terminal>;
146
+ executeTerminalCommand: (terminalId: string, command: string) => Promise<TerminalCommandResult>;
147
+ closeTerminal: (terminalId: string) => Promise<void>;
148
+ getTerminal: (terminalId: string) => Promise<Terminal | undefined>;
149
+ getToolTerminals: (toolId: string) => Promise<Terminal[]>;
150
+ getAllTerminals: () => Promise<Terminal[]>;
151
+ setTerminalVisibility: (terminalId: string, visible: boolean) => Promise<void>;
152
+
153
+ // Events
154
+ getEventHistory: (limit?: number) => Promise<ToolBoxEventPayload[]>;
155
+ onToolboxEvent: (callback: (event: any, payload: ToolBoxEventPayload) => void) => void;
156
+ removeToolboxEventListener: (callback: (event: any, payload: ToolBoxEventPayload) => void) => void;
157
+
158
+ // Auto-update
159
+ checkForUpdates: () => Promise<void>;
160
+ downloadUpdate: () => Promise<void>;
161
+ quitAndInstall: () => Promise<void>;
162
+ getAppVersion: () => Promise<string>;
163
+ onUpdateChecking: (callback: () => void) => void;
164
+ onUpdateAvailable: (callback: (info: any) => void) => void;
165
+ onUpdateNotAvailable: (callback: () => void) => void;
166
+ onUpdateDownloadProgress: (callback: (progress: any) => void) => void;
167
+ onUpdateDownloaded: (callback: (info: any) => void) => void;
168
+ onUpdateError: (callback: (error: string) => void) => void;
169
+ }
142
170
  }
143
171
 
144
172
  /**
145
173
  * Global window interface extension for ToolBox tools
146
174
  */
147
175
  declare global {
148
- interface Window {
149
- toolboxAPI: ToolBox.ToolBoxAPI;
150
- TOOLBOX_CONTEXT?: ToolBox.ToolContext;
151
- }
176
+ interface Window {
177
+ toolboxAPI: ToolBox.ToolBoxAPI;
178
+ TOOLBOX_CONTEXT?: ToolBox.ToolContext;
179
+ }
152
180
  }
153
181
 
154
182
  export = ToolBox;