pptb-standard-sample-tool 0.1.4 → 0.1.5

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
@@ -16,7 +16,7 @@ const dataverse = window.dataverseAPI;
16
16
  // Application state
17
17
  let currentConnection = null;
18
18
  let currentTerminal = null;
19
- let createdAccountId = null;
19
+ let createdId = null;
20
20
  /**
21
21
  * Initialize the application
22
22
  */
@@ -128,11 +128,11 @@ function setupEventHandlers() {
128
128
  // Dataverse query button
129
129
  document.getElementById('query-accounts-btn')?.addEventListener('click', queryAccounts);
130
130
  // CRUD buttons
131
- document.getElementById('create-account-btn')?.addEventListener('click', createAccount);
132
- document.getElementById('update-account-btn')?.addEventListener('click', updateAccount);
133
- document.getElementById('delete-account-btn')?.addEventListener('click', deleteAccount);
131
+ document.getElementById('create-account-btn')?.addEventListener('click', createContact);
132
+ document.getElementById('update-account-btn')?.addEventListener('click', updateContact);
133
+ document.getElementById('delete-account-btn')?.addEventListener('click', deleteContact);
134
134
  // Metadata button
135
- document.getElementById('get-metadata-btn')?.addEventListener('click', getAccountMetadata);
135
+ document.getElementById('get-metadata-btn')?.addEventListener('click', getContactMetadata);
136
136
  // Clear log button
137
137
  document.getElementById('clear-log-btn')?.addEventListener('click', clearLog);
138
138
  }
@@ -351,116 +351,116 @@ async function queryAccounts() {
351
351
  /**
352
352
  * Create a new account
353
353
  */
354
- async function createAccount() {
354
+ async function createContact() {
355
355
  if (!currentConnection) {
356
356
  await showNotification('No Connection', 'Please connect to a Dataverse environment', 'warning');
357
357
  return;
358
358
  }
359
359
  try {
360
- const nameInput = document.getElementById('account-name');
361
- const name = nameInput?.value || 'Sample Account';
360
+ const firstnameInput = document.getElementById('contact-firstname');
361
+ const lastnameInput = document.getElementById('contact-lastname');
362
362
  const output = document.getElementById('crud-output');
363
363
  if (output)
364
- output.textContent = 'Creating account...\n';
365
- const result = await dataverse.create('account', {
366
- name: name,
367
- accountnumber: 'TST-12345',
364
+ output.textContent = 'Creating contact...\n';
365
+ const result = await dataverse.create('contact', {
366
+ firstname: firstnameInput.value,
367
+ lastname: lastnameInput.value,
368
368
  telephone1: '555-0100',
369
369
  description: 'Created by HTML Sample Tool'
370
370
  });
371
- createdAccountId = result.id;
371
+ createdId = result.id;
372
372
  if (output) {
373
- output.textContent = `Account created successfully!\n\n`;
373
+ output.textContent = `Contact created successfully!\n\n`;
374
374
  output.textContent += `ID: ${result.id}\n`;
375
- output.textContent += `Name: ${name}\n`;
375
+ output.textContent += `Name: ${firstnameInput.value} ${lastnameInput.value}\n`;
376
376
  }
377
377
  // Enable update and delete buttons
378
- const updateBtn = document.getElementById('update-account-btn');
379
- const deleteBtn = document.getElementById('delete-account-btn');
378
+ const updateBtn = document.getElementById('update-contact-btn');
379
+ const deleteBtn = document.getElementById('delete-contact-btn');
380
380
  if (updateBtn)
381
381
  updateBtn.disabled = false;
382
382
  if (deleteBtn)
383
383
  deleteBtn.disabled = false;
384
- await showNotification('Account Created', `Account "${name}" created successfully`, 'success');
385
- log(`Account created: ${result.id}`, 'success');
384
+ await showNotification('Contact Created', `Contact "${firstnameInput.value} ${lastnameInput.value}" created successfully`, 'success');
385
+ log(`Contact created: ${result.id}`, 'success');
386
386
  }
387
387
  catch (error) {
388
388
  const output = document.getElementById('crud-output');
389
389
  if (output)
390
390
  output.textContent = `Error: ${error.message}`;
391
- log(`Error creating account: ${error.message}`, 'error');
391
+ log(`Error creating contact: ${error.message}`, 'error');
392
392
  }
393
393
  }
394
394
  /**
395
- * Update the created account
395
+ * Update the created contact
396
396
  */
397
- async function updateAccount() {
398
- if (!createdAccountId) {
399
- await showNotification('No Account', 'Please create an account first', 'warning');
397
+ async function updateContact() {
398
+ if (!createdId) {
399
+ await showNotification('No Contact', 'Please create a contact first', 'warning');
400
400
  return;
401
401
  }
402
402
  try {
403
403
  const output = document.getElementById('crud-output');
404
404
  if (output)
405
- output.textContent = 'Updating account...\n';
406
- await dataverse.update('account', createdAccountId, {
405
+ output.textContent = 'Updating contact...\n';
406
+ await dataverse.update('contact', createdId, {
407
407
  description: 'Updated by HTML Sample Tool at ' + new Date().toISOString(),
408
408
  telephone1: '555-0200'
409
409
  });
410
410
  if (output) {
411
- output.textContent = `Account updated successfully!\n\n`;
412
- output.textContent += `ID: ${createdAccountId}\n`;
411
+ output.textContent = `Contact updated successfully!\n\n`;
412
+ output.textContent += `ID: ${createdId}\n`;
413
413
  output.textContent += `Updated fields: description, telephone1\n`;
414
414
  }
415
- await showNotification('Account Updated', 'Account updated successfully', 'success');
416
- log(`Account updated: ${createdAccountId}`, 'success');
415
+ await showNotification('Contact Updated', 'Contact updated successfully', 'success');
416
+ log(`Contact updated: ${createdId}`, 'success');
417
417
  }
418
418
  catch (error) {
419
419
  const output = document.getElementById('crud-output');
420
420
  if (output)
421
421
  output.textContent = `Error: ${error.message}`;
422
- log(`Error updating account: ${error.message}`, 'error');
422
+ log(`Error updating contact: ${error.message}`, 'error');
423
423
  }
424
424
  }
425
425
  /**
426
- * Delete the created account
426
+ * Delete the created contact
427
427
  */
428
- async function deleteAccount() {
429
- if (!createdAccountId) {
430
- await showNotification('No Account', 'Please create an account first', 'warning');
428
+ async function deleteContact() {
429
+ if (!createdId) {
430
+ await showNotification('No Contact', 'Please create a contact first', 'warning');
431
431
  return;
432
432
  }
433
433
  try {
434
434
  const output = document.getElementById('crud-output');
435
435
  if (output)
436
- output.textContent = 'Deleting account...\n';
437
- await dataverse.delete('account', createdAccountId);
436
+ output.textContent = 'Deleting contact...\n';
437
+ await dataverse.delete('contact', createdId);
438
438
  if (output) {
439
- output.textContent = `Account deleted successfully!\n\n`;
440
- output.textContent += `ID: ${createdAccountId}\n`;
439
+ output.textContent = `Contact deleted successfully!\n\n`;
440
+ output.textContent += `ID: ${createdId}\n`;
441
441
  }
442
442
  // Disable update and delete buttons
443
- const updateBtn = document.getElementById('update-account-btn');
444
- const deleteBtn = document.getElementById('delete-account-btn');
443
+ const updateBtn = document.getElementById('update-contact-btn');
444
+ const deleteBtn = document.getElementById('delete-contact-btn');
445
445
  if (updateBtn)
446
446
  updateBtn.disabled = true;
447
447
  if (deleteBtn)
448
448
  deleteBtn.disabled = true;
449
- await showNotification('Account Deleted', 'Account deleted successfully', 'success');
450
- log(`Account deleted: ${createdAccountId}`, 'success');
451
- createdAccountId = null;
449
+ await showNotification('Contact Deleted', 'Contact deleted successfully', 'success');
450
+ log(`Contact deleted: ${createdId}`, 'success');
451
+ createdId = null;
452
452
  }
453
453
  catch (error) {
454
454
  const output = document.getElementById('crud-output');
455
455
  if (output)
456
456
  output.textContent = `Error: ${error.message}`;
457
- log(`Error deleting account: ${error.message}`, 'error');
457
+ log(`Error deleting contact: ${error.message}`, 'error');
458
458
  }
459
459
  }
460
460
  /**
461
- * Get account metadata
461
+ * Get contact metadata
462
462
  */
463
- async function getAccountMetadata() {
463
+ async function getContactMetadata() {
464
464
  if (!currentConnection) {
465
465
  await showNotification('No Connection', 'Please connect to a Dataverse environment', 'warning');
466
466
  return;
@@ -469,21 +469,14 @@ async function getAccountMetadata() {
469
469
  const output = document.getElementById('metadata-output');
470
470
  if (output)
471
471
  output.textContent = 'Retrieving metadata...\n';
472
- const metadata = await dataverse.getEntityMetadata('account');
472
+ const metadata = await dataverse.getEntityMetadata('contact');
473
473
  if (output) {
474
- output.textContent = 'Account Entity Metadata:\n\n';
474
+ output.textContent = 'Contact Entity Metadata:\n\n';
475
475
  output.textContent += `Logical Name: ${metadata.LogicalName}\n`;
476
476
  output.textContent += `Metadata ID: ${metadata.MetadataId}\n`;
477
477
  output.textContent += `Display Name: ${metadata.DisplayName?.LocalizedLabels?.[0]?.Label || 'N/A'}\n`;
478
- output.textContent += `Attributes: ${metadata.Attributes?.length || 0}\n`;
479
- if (metadata.Attributes && metadata.Attributes.length > 0) {
480
- output.textContent += '\nSample Attributes:\n';
481
- metadata.Attributes.slice(0, 5).forEach((attr) => {
482
- output.textContent += ` - ${attr.LogicalName} (${attr.AttributeType})\n`;
483
- });
484
- }
485
478
  }
486
- log('Account metadata retrieved', 'success');
479
+ log('Contact metadata retrieved', 'success');
487
480
  }
488
481
  catch (error) {
489
482
  const output = document.getElementById('metadata-output');
package/dist/index.html CHANGED
@@ -68,20 +68,24 @@
68
68
  <div class="example-group">
69
69
  <h3>CRUD Operations</h3>
70
70
  <div class="input-group">
71
- <label for="account-name">Account Name:</label>
72
- <input type="text" id="account-name" placeholder="Enter account name" value="Sample Account">
71
+ <label for="contact-firstname">Contact First Name:</label>
72
+ <input type="text" id="contact-firstname" placeholder="Enter contact first name" value="Sample Contact">
73
+ </div>
74
+ <div class="input-group">
75
+ <label for="contact-lastname">Contact Last Name:</label>
76
+ <input type="text" id="contact-lastname" placeholder="Enter contact last name" value="Tool Box">
73
77
  </div>
74
78
  <div class="button-group">
75
- <button id="create-account-btn" class="btn btn-primary">Create Account</button>
76
- <button id="update-account-btn" class="btn" disabled>Update Account</button>
77
- <button id="delete-account-btn" class="btn btn-error" disabled>Delete Account</button>
79
+ <button id="create-contact-btn" class="btn btn-primary">Create Contact</button>
80
+ <button id="update-contact-btn" class="btn" disabled>Update Contact</button>
81
+ <button id="delete-contact-btn" class="btn btn-error" disabled>Delete Contact</button>
78
82
  </div>
79
83
  <div id="crud-output" class="output"></div>
80
84
  </div>
81
85
 
82
86
  <div class="example-group">
83
87
  <h3>Metadata</h3>
84
- <button id="get-metadata-btn" class="btn">Get Account Metadata</button>
88
+ <button id="get-metadata-btn" class="btn">Get Contact Metadata</button>
85
89
  <div id="metadata-output" class="output"></div>
86
90
  </div>
87
91
  </section>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptb-standard-sample-tool",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "displayName": "HTML Sample Tool",
5
5
  "description": "A sample Power Platform Tool Box tool built with HTML, CSS, and TypeScript",
6
6
  "main": "index.html",