pptb-standard-sample-tool 1.2.0 → 1.2.1

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/dist/app.js CHANGED
@@ -21,9 +21,11 @@ let currentConnection = null;
21
21
  let secondaryConnection = null;
22
22
  let currentTerminal = null;
23
23
  let createdId = null;
24
+ let currentLaunchContext = null;
24
25
  let securitySuites = null;
25
26
  let terminalFeature = null;
26
27
  let fileSystemFeature = null;
28
+ let inputEntityName = null;
27
29
  /**
28
30
  * Initialize the application
29
31
  */
@@ -61,6 +63,7 @@ async function initialize() {
61
63
  showNotification,
62
64
  log,
63
65
  });
66
+ await identifyLaunchContext();
64
67
  // Setup UI event handlers
65
68
  setupEventHandlers();
66
69
  // Apply theme
@@ -73,6 +76,41 @@ async function initialize() {
73
76
  log(`Initialization error: ${error.message}`, "error");
74
77
  }
75
78
  }
79
+ /**
80
+ * Identifying Launch Context
81
+ */
82
+ async function identifyLaunchContext() {
83
+ try {
84
+ const ctx = await toolbox.invocation.getLaunchContext();
85
+ log(`Launch context: ${ctx}`, "info");
86
+ if (ctx !== null) {
87
+ // Tool was launched via inter-tool invocation
88
+ inputEntityName = ctx.entityName;
89
+ currentLaunchContext = ctx;
90
+ log(`Launched with context for entity: ${inputEntityName}`, "success");
91
+ // Set iti-entity-name value with the entity name from the launch context
92
+ const entityNameInput = document.getElementById("iti-entity-name");
93
+ if (entityNameInput) {
94
+ entityNameInput.value = inputEntityName;
95
+ }
96
+ // Set default fetchXML to query the launched entity
97
+ const defaultFetchOutput = document.getElementById("iti-default-fetch-output");
98
+ if (defaultFetchOutput) {
99
+ defaultFetchOutput.textContent = `
100
+ <fetch top="10">
101
+ <entity name="${inputEntityName}">
102
+ <attribute name="name" />
103
+ <attribute name="${inputEntityName}id" />
104
+ <order attribute="name" />
105
+ </entity>
106
+ </fetch>`;
107
+ }
108
+ }
109
+ }
110
+ catch (error) {
111
+ log(`Error getting launch context: ${error.message}`, "error");
112
+ }
113
+ }
76
114
  /**
77
115
  * Refresh connection information
78
116
  */
@@ -239,6 +277,21 @@ function setupEventHandlers() {
239
277
  // Settings buttons
240
278
  document.getElementById("load-setting-btn")?.addEventListener("click", loadToolSetting);
241
279
  document.getElementById("save-setting-btn")?.addEventListener("click", saveToolSetting);
280
+ // Inter-tool invocation buttons
281
+ document.getElementById("iti-return-value-btn")?.addEventListener("click", async () => {
282
+ const fetchXML = document.getElementById("iti-default-fetch-output")?.textContent;
283
+ await toolbox.invocation.returnData({
284
+ fetchXml: fetchXML,
285
+ });
286
+ log(`Returned data to caller: ${fetchXML}`, "info");
287
+ // PPTB automatically closes this window after delivering the result.
288
+ });
289
+ document.getElementById("iti-launch-fetchxml-btn")?.addEventListener("click", async () => {
290
+ const entityName = document.getElementById("iti-entity-logical-name").value;
291
+ const result = await toolbox.invocation.launchTool("@mohsinonxrm/pptb-fetchxml-studio", // npm package name of the target tool
292
+ { entityName: entityName });
293
+ log(`Launched entity picker with result: ${JSON.stringify(result)}`, "info");
294
+ });
242
295
  }
243
296
  /**
244
297
  * Show notification
package/dist/index.html CHANGED
@@ -222,6 +222,36 @@
222
222
  </div>
223
223
  </section>
224
224
 
225
+ <!-- Inter-tool Invocation Example -->
226
+ <section class="card">
227
+ <h2>⚡ Inter-tool Invocation Example</h2>
228
+ <p style="margin: 4px 0 15px; font-size: 12px; opacity: 0.85">Demonstrates how to invoke other tools or read invoked values within the Power Platform ToolBox.</p>
229
+
230
+ <div class="example-group">
231
+ <h3>Tool Launched by Another Tool or Agent</h3>
232
+ <div class="input-group">
233
+ <label for="iti-entity-name">Entity Name:</label>
234
+ <input type="text" id="iti-entity-name" readonly />
235
+ </div>
236
+ <div class="button-group">
237
+ <button id="iti-return-value-btn" class="btn">Return Default FetchXml (shown below)</button>
238
+ </div>
239
+ <div id="iti-default-fetch-output" class="output"></div>
240
+ </div>
241
+ <div class="example-group">
242
+ <h3>Launch Fetch XML Studio</h3>
243
+ <div class="input-group">
244
+ <label for="iti-entity-logical-name">Entity Logical Name:</label>
245
+ <input type="text" id="iti-entity-logical-name" placeholder="account" />
246
+ </div>
247
+ <div class="button-group">
248
+ <button id="iti-launch-fetchxml-btn" class="btn">Launch Fetch XML Studio</button>
249
+ </div>
250
+ <h4>Returned FetchXML:</h4>
251
+ <div id="iti-returned-fetch-output" class="output"></div>
252
+ </div>
253
+ </section>
254
+
225
255
  <!-- Event Log -->
226
256
  <section class="card">
227
257
  <h2>📋 Event Log</h2>
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "pptb-standard-sample-tool",
3
- "version": "1.1.12",
3
+ "version": "1.2.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pptb-standard-sample-tool",
9
- "version": "1.1.12",
9
+ "version": "1.2.0",
10
10
  "license": "GPL-3.0",
11
11
  "devDependencies": {
12
- "@pptb/types": "^1.2.4-beta.0",
12
+ "@pptb/types": "^1.2.4-beta.4",
13
13
  "shx": "^0.4.0",
14
14
  "typescript": "^5.0.0"
15
15
  },
@@ -17,6 +17,19 @@
17
17
  "node": ">=18.0.0"
18
18
  }
19
19
  },
20
+ "node_modules/@isaacs/fs-minipass": {
21
+ "version": "4.0.1",
22
+ "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
23
+ "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
24
+ "dev": true,
25
+ "license": "ISC",
26
+ "dependencies": {
27
+ "minipass": "^7.0.4"
28
+ },
29
+ "engines": {
30
+ "node": ">=18.0.0"
31
+ }
32
+ },
20
33
  "node_modules/@nodelib/fs.scandir": {
21
34
  "version": "2.1.5",
22
35
  "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -56,15 +69,31 @@
56
69
  }
57
70
  },
58
71
  "node_modules/@pptb/types": {
59
- "version": "1.2.4-beta.0",
60
- "resolved": "https://registry.npmjs.org/@pptb/types/-/types-1.2.4-beta.0.tgz",
61
- "integrity": "sha512-KEY2RjPkxaMkv3XOF48pzGlTiGT2bWdseUgsr2YA9itGkjMj8zegSUiqU6Rb2SA6omdPy1HzD2v5iEB3G4R7ZQ==",
72
+ "version": "1.2.4-beta.4",
73
+ "resolved": "https://registry.npmjs.org/@pptb/types/-/types-1.2.4-beta.4.tgz",
74
+ "integrity": "sha512-ipoQFehrZ6ndWAsIFZF1MBInM5hY0epUOsNf513oURnfie0Orcx2+7alt6B09LR2OG0egLf0BFxxg4iVDwMvNw==",
62
75
  "dev": true,
63
76
  "license": "GPL-3.0",
77
+ "dependencies": {
78
+ "@pptb/validate": "^0.0.2"
79
+ },
64
80
  "bin": {
65
81
  "pptb-validate": "bin/pptb-validate.js"
66
82
  }
67
83
  },
84
+ "node_modules/@pptb/validate": {
85
+ "version": "0.0.2",
86
+ "resolved": "https://registry.npmjs.org/@pptb/validate/-/validate-0.0.2.tgz",
87
+ "integrity": "sha512-QsuimcuDgEbblqC4uAeXE+ONm5KJ5twKbGFh9d8e4leF2jsISgVpVzYPgivSLUA9iomDGmMnXcklHPgb4jEf1A==",
88
+ "dev": true,
89
+ "license": "GPL-3.0",
90
+ "dependencies": {
91
+ "tar": "^7.5.16"
92
+ },
93
+ "bin": {
94
+ "pptb-validate": "dist/cli.js"
95
+ }
96
+ },
68
97
  "node_modules/braces": {
69
98
  "version": "3.0.3",
70
99
  "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
@@ -78,6 +107,16 @@
78
107
  "node": ">=8"
79
108
  }
80
109
  },
110
+ "node_modules/chownr": {
111
+ "version": "3.0.0",
112
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
113
+ "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
114
+ "dev": true,
115
+ "license": "BlueOak-1.0.0",
116
+ "engines": {
117
+ "node": ">=18"
118
+ }
119
+ },
81
120
  "node_modules/cross-spawn": {
82
121
  "version": "6.0.6",
83
122
  "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz",
@@ -323,6 +362,29 @@
323
362
  "url": "https://github.com/sponsors/ljharb"
324
363
  }
325
364
  },
365
+ "node_modules/minipass": {
366
+ "version": "7.1.3",
367
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
368
+ "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
369
+ "dev": true,
370
+ "license": "BlueOak-1.0.0",
371
+ "engines": {
372
+ "node": ">=16 || 14 >=14.17"
373
+ }
374
+ },
375
+ "node_modules/minizlib": {
376
+ "version": "3.1.0",
377
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz",
378
+ "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==",
379
+ "dev": true,
380
+ "license": "MIT",
381
+ "dependencies": {
382
+ "minipass": "^7.1.2"
383
+ },
384
+ "engines": {
385
+ "node": ">= 18"
386
+ }
387
+ },
326
388
  "node_modules/nice-try": {
327
389
  "version": "1.0.5",
328
390
  "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
@@ -592,6 +654,23 @@
592
654
  "url": "https://github.com/sponsors/ljharb"
593
655
  }
594
656
  },
657
+ "node_modules/tar": {
658
+ "version": "7.5.16",
659
+ "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.16.tgz",
660
+ "integrity": "sha512-56adEpPMouktRlBLXiaYFFzZ/3+JXa8P9n7WbR+ibIjtviN55mEaOkiysCnPnWm+7kkui1Dn8J9l+g6zV8731w==",
661
+ "dev": true,
662
+ "license": "BlueOak-1.0.0",
663
+ "dependencies": {
664
+ "@isaacs/fs-minipass": "^4.0.0",
665
+ "chownr": "^3.0.0",
666
+ "minipass": "^7.1.2",
667
+ "minizlib": "^3.1.0",
668
+ "yallist": "^5.0.0"
669
+ },
670
+ "engines": {
671
+ "node": ">=18"
672
+ }
673
+ },
595
674
  "node_modules/to-regex-range": {
596
675
  "version": "5.0.1",
597
676
  "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
@@ -638,6 +717,16 @@
638
717
  "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
639
718
  "dev": true,
640
719
  "license": "ISC"
720
+ },
721
+ "node_modules/yallist": {
722
+ "version": "5.0.0",
723
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
724
+ "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
725
+ "dev": true,
726
+ "license": "BlueOak-1.0.0",
727
+ "engines": {
728
+ "node": ">=18"
729
+ }
641
730
  }
642
731
  }
643
732
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptb-standard-sample-tool",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "displayName": "HTML Sample Tool",
5
5
  "description": "A sample Power Platform ToolBox tool built with HTML, CSS, and TypeScript",
6
6
  "main": "index.html",
@@ -45,15 +45,16 @@
45
45
  "copy-css": "shx cp src/styles.css dist/",
46
46
  "copy-icon": "shx cp -r icon/ dist/icon/",
47
47
  "finalize-package": "npm shrinkwrap",
48
- "watch": "tsc --watch"
48
+ "validate": "pptb-validate"
49
49
  },
50
50
  "devDependencies": {
51
- "@pptb/types": "^1.2.4-beta.0",
51
+ "@pptb/types": "^1.2.4-beta.4",
52
52
  "shx": "^0.4.0",
53
53
  "typescript": "^5.0.0"
54
54
  },
55
55
  "files": [
56
56
  "dist",
57
- "npm-shrinkwrap.json"
57
+ "npm-shrinkwrap.json",
58
+ "pptb.config.json"
58
59
  ]
59
60
  }
@@ -0,0 +1,23 @@
1
+ {
2
+ "invocation": {
3
+ "version": "1.0.0",
4
+ "agentInvokable": true,
5
+ "capabilities": [
6
+ "fetchxml"
7
+ ],
8
+ "prefill": {
9
+ "properties": {
10
+ "entityName": {
11
+ "type": "string"
12
+ }
13
+ }
14
+ },
15
+ "returnTopic": {
16
+ "properties": {
17
+ "fetchXml": {
18
+ "type": "string"
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }