pptb-standard-sample-tool 1.0.9 → 1.0.10
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 +1 -7
- package/dist/app.js +0 -74
- package/dist/index.html +0 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ This sample demonstrates:
|
|
|
18
18
|
|
|
19
19
|
- ✅ **Dataverse API Usage**
|
|
20
20
|
- FetchXML queries
|
|
21
|
-
|
|
21
|
+
- Multi-connection queries (primary and secondary)
|
|
22
22
|
- CRUD operations (Create, Read, Update, Delete)
|
|
23
23
|
- Entity metadata retrieval
|
|
24
24
|
- Error handling
|
|
@@ -242,12 +242,6 @@ const secondaryResult = await dataverse.fetchXmlQuery(`
|
|
|
242
242
|
</fetch>
|
|
243
243
|
`, 'secondary');
|
|
244
244
|
|
|
245
|
-
// Query via OData (secondary)
|
|
246
|
-
const odataResult = await (dataverse as any).queryData(
|
|
247
|
-
'$select=name,accountid&$filter=statecode eq 0&$orderby=name&$top=5',
|
|
248
|
-
'secondary'
|
|
249
|
-
);
|
|
250
|
-
|
|
251
245
|
// Create record
|
|
252
246
|
const account = await dataverse.create('account', {
|
|
253
247
|
name: 'Contoso Ltd',
|
package/dist/app.js
CHANGED
|
@@ -167,9 +167,7 @@ function setupEventHandlers() {
|
|
|
167
167
|
document.getElementById('close-terminal-btn')?.addEventListener('click', closeTerminal);
|
|
168
168
|
// Dataverse query button
|
|
169
169
|
document.getElementById('query-accounts-btn')?.addEventListener('click', queryAccounts);
|
|
170
|
-
document.getElementById('query-odata-btn')?.addEventListener('click', queryODataAccounts);
|
|
171
170
|
document.getElementById('query-accounts-secondary-btn')?.addEventListener('click', queryAccountsSecondary);
|
|
172
|
-
document.getElementById('query-odata-secondary-btn')?.addEventListener('click', queryODataSecondary);
|
|
173
171
|
// CRUD buttons
|
|
174
172
|
document.getElementById('create-contact-btn')?.addEventListener('click', createContact);
|
|
175
173
|
document.getElementById('update-contact-btn')?.addEventListener('click', updateContact);
|
|
@@ -399,42 +397,6 @@ async function queryAccounts() {
|
|
|
399
397
|
log(`Error querying accounts: ${error.message}`, 'error');
|
|
400
398
|
}
|
|
401
399
|
}
|
|
402
|
-
/**
|
|
403
|
-
* Query accounts from Dataverse using OData
|
|
404
|
-
*/
|
|
405
|
-
async function queryODataAccounts() {
|
|
406
|
-
if (!currentConnection) {
|
|
407
|
-
await showNotification('No Connection', 'Please connect to a Dataverse environment', 'warning');
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
try {
|
|
411
|
-
const output = document.getElementById('query-odata-output');
|
|
412
|
-
if (output)
|
|
413
|
-
output.textContent = 'Querying accounts via OData...\n';
|
|
414
|
-
// Example OData query: top 5 active accounts with basic fields
|
|
415
|
-
const odata = `$select=name,accountid,emailaddress1,telephone1&$filter=statecode eq 0&$orderby=name&$top=5`;
|
|
416
|
-
const result = await dataverse.queryData(odata);
|
|
417
|
-
if (output) {
|
|
418
|
-
output.textContent = `Found ${result.value.length} active account(s) (OData):\n\n`;
|
|
419
|
-
result.value.forEach((account, index) => {
|
|
420
|
-
output.textContent += `${index + 1}. ${account.name}\n`;
|
|
421
|
-
output.textContent += ` ID: ${account.accountid}\n`;
|
|
422
|
-
if (account.emailaddress1)
|
|
423
|
-
output.textContent += ` Email: ${account.emailaddress1}\n`;
|
|
424
|
-
if (account.telephone1)
|
|
425
|
-
output.textContent += ` Phone: ${account.telephone1}\n`;
|
|
426
|
-
output.textContent += '\n';
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
log(`Queried ${result.value.length} accounts via OData`, 'success');
|
|
430
|
-
}
|
|
431
|
-
catch (error) {
|
|
432
|
-
const output = document.getElementById('query-odata-output');
|
|
433
|
-
if (output)
|
|
434
|
-
output.textContent = `Error (OData): ${error.message}`;
|
|
435
|
-
log(`Error OData querying accounts: ${error.message}`, 'error');
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
400
|
/**
|
|
439
401
|
* Query accounts from Dataverse using the secondary connection (FetchXML)
|
|
440
402
|
*/
|
|
@@ -483,42 +445,6 @@ async function queryAccountsSecondary() {
|
|
|
483
445
|
log(`Error querying accounts (secondary): ${error.message}`, 'error');
|
|
484
446
|
}
|
|
485
447
|
}
|
|
486
|
-
/**
|
|
487
|
-
* Query accounts from Dataverse using OData against the secondary connection
|
|
488
|
-
*/
|
|
489
|
-
async function queryODataSecondary() {
|
|
490
|
-
if (!secondaryConnection) {
|
|
491
|
-
await showNotification('No Secondary Connection', 'Please configure a secondary Dataverse connection', 'warning');
|
|
492
|
-
return;
|
|
493
|
-
}
|
|
494
|
-
try {
|
|
495
|
-
const output = document.getElementById('query-odata-secondary-output');
|
|
496
|
-
if (output)
|
|
497
|
-
output.textContent = 'Querying accounts via OData on secondary...\n';
|
|
498
|
-
// Example OData query: top 5 active accounts with basic fields
|
|
499
|
-
const odata = `$select=name,accountid,emailaddress1,telephone1&$filter=statecode eq 0&$orderby=name&$top=5`;
|
|
500
|
-
const result = await dataverse.queryData(odata, 'secondary');
|
|
501
|
-
if (output) {
|
|
502
|
-
output.textContent = `Found ${result.value.length} active account(s) on secondary (OData):\n\n`;
|
|
503
|
-
result.value.forEach((account, index) => {
|
|
504
|
-
output.textContent += `${index + 1}. ${account.name}\n`;
|
|
505
|
-
output.textContent += ` ID: ${account.accountid}\n`;
|
|
506
|
-
if (account.emailaddress1)
|
|
507
|
-
output.textContent += ` Email: ${account.emailaddress1}\n`;
|
|
508
|
-
if (account.telephone1)
|
|
509
|
-
output.textContent += ` Phone: ${account.telephone1}\n`;
|
|
510
|
-
output.textContent += '\n';
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
log(`Queried ${result.value.length} accounts via OData on secondary`, 'success');
|
|
514
|
-
}
|
|
515
|
-
catch (error) {
|
|
516
|
-
const output = document.getElementById('query-odata-secondary-output');
|
|
517
|
-
if (output)
|
|
518
|
-
output.textContent = `Error (OData secondary): ${error.message}`;
|
|
519
|
-
log(`Error OData querying accounts (secondary): ${error.message}`, 'error');
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
448
|
/**
|
|
523
449
|
* Create a new account
|
|
524
450
|
*/
|
package/dist/index.html
CHANGED
|
@@ -94,14 +94,10 @@
|
|
|
94
94
|
<h3>Query Records</h3>
|
|
95
95
|
<div class="button-group">
|
|
96
96
|
<button id="query-accounts-btn" class="btn btn-primary">Query Top 10 Accounts (Primary)</button>
|
|
97
|
-
<button id="query-odata-btn" class="btn btn-primary">Query Active Accounts via OData (Primary)</button>
|
|
98
97
|
<button id="query-accounts-secondary-btn" class="btn">Query Top 10 Accounts (Secondary)</button>
|
|
99
|
-
<button id="query-odata-secondary-btn" class="btn">Query Active Accounts via OData (Secondary)</button>
|
|
100
98
|
</div>
|
|
101
99
|
<div id="query-output" class="output"></div>
|
|
102
|
-
<div id="query-odata-output" class="output"></div>
|
|
103
100
|
<div id="query-output-secondary" class="output"></div>
|
|
104
|
-
<div id="query-odata-secondary-output" class="output"></div>
|
|
105
101
|
</div>
|
|
106
102
|
|
|
107
103
|
<div class="example-group">
|
package/package.json
CHANGED