@pptb/types 1.0.11 → 1.0.13

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 CHANGED
@@ -109,14 +109,14 @@ console.log("Current theme:", theme); // "light" or "dark"
109
109
 
110
110
  // Execute multiple operations in parallel
111
111
  const [account, contact, opportunities] = await toolboxAPI.utils.executeParallel(
112
- dataverseAPI.retrieve('account', accountId, ['name']),
113
- dataverseAPI.retrieve('contact', contactId, ['fullname']),
114
- dataverseAPI.fetchXmlQuery(opportunityFetchXml)
112
+ dataverseAPI.retrieve("account", accountId, ["name"]),
113
+ dataverseAPI.retrieve("contact", contactId, ["fullname"]),
114
+ dataverseAPI.fetchXmlQuery(opportunityFetchXml),
115
115
  );
116
- console.log('All data fetched:', account, contact, opportunities);
116
+ console.log("All data fetched:", account, contact, opportunities);
117
117
 
118
118
  // Show loading screen during operations
119
- await toolboxAPI.utils.showLoading('Processing data...');
119
+ await toolboxAPI.utils.showLoading("Processing data...");
120
120
  try {
121
121
  // Perform operations
122
122
  await processData();
@@ -253,6 +253,12 @@ const result = await dataverseAPI.execute({
253
253
  FieldName: "total_revenue",
254
254
  },
255
255
  });
256
+
257
+ // Publish customizations for the active environment
258
+ await dataverseAPI.publishCustomizations();
259
+
260
+ // Publish only a specific table (in this case, the account table)
261
+ await dataverseAPI.publishCustomizations("account");
256
262
  ```
257
263
 
258
264
  ## API Reference
@@ -294,9 +300,9 @@ Core platform features organized into namespaces:
294
300
  - Example:
295
301
  ```typescript
296
302
  const [account, contact, opportunities] = await toolboxAPI.utils.executeParallel(
297
- dataverseAPI.retrieve('account', id1),
298
- dataverseAPI.retrieve('contact', id2),
299
- dataverseAPI.fetchXmlQuery(fetchXml)
303
+ dataverseAPI.retrieve("account", id1),
304
+ dataverseAPI.retrieve("contact", id2),
305
+ dataverseAPI.fetchXmlQuery(fetchXml),
300
306
  );
301
307
  ```
302
308
 
@@ -407,6 +413,8 @@ Complete HTTP client for interacting with Microsoft Dataverse:
407
413
  - **execute(request: ExecuteRequest)**: Promise<Record<string, unknown>>
408
414
  - Executes a Dataverse Web API action or function
409
415
  - Supports both bound and unbound operations
416
+ - **publishCustomizations(tableLogicalName?: string)**: Promise<void>
417
+ - Publishes pending customizations. When `tableLogicalName` is omitted it runs PublishAllXml; otherwise it publishes only the specified table.
410
418
 
411
419
  ### Security Notes
412
420
 
package/dataverseAPI.d.ts CHANGED
@@ -380,6 +380,77 @@ declare namespace DataverseAPI {
380
380
  * const result = await dataverseAPI.queryData('$filter=statecode eq 0', 'secondary');
381
381
  */
382
382
  queryData: (odataQuery: string, connectionTarget?: "primary" | "secondary") => Promise<{ value: Record<string, unknown>[] }>;
383
+
384
+ /**
385
+ * Publish customizations for the current environment.
386
+ *
387
+ * When `tableLogicalName` is provided, this method publishes only that table by executing the PublishXml action with a generated payload.
388
+ * When no table name is provided, it runs PublishAllXml (equivalent to "Publish All Customizations").
389
+ *
390
+ * @param tableLogicalName - Optional table (entity) logical name to publish. If omitted, all pending customizations are published.
391
+ * @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
392
+ *
393
+ * @example
394
+ * // Publish all customizations
395
+ * await dataverseAPI.publishCustomizations();
396
+ *
397
+ * @example
398
+ * // Publish only the account table
399
+ * await dataverseAPI.publishCustomizations('account');
400
+ */
401
+ publishCustomizations: (tableLogicalName?: string, connectionTarget?: "primary" | "secondary") => Promise<void>;
402
+
403
+ /**
404
+ * Create multiple records in Dataverse
405
+ *
406
+ * @param entityLogicalName - Logical name of the entity (e.g., 'account', 'contact')
407
+ * @param records - Array of record data to create, including the "@odata.type" property for each record
408
+ * @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
409
+ * @returns Array of strings representing the created record IDs
410
+ *
411
+ * @example
412
+ * const results = await dataverseAPI.createMultiple('account', [
413
+ * { name: 'Contoso Ltd', "@odata.type": "Microsoft.Dynamics.CRM.account" },
414
+ * { name: 'Fabrikam Inc', "@odata.type": "Microsoft.Dynamics.CRM.account" }
415
+ * ]);
416
+ */
417
+ createMultiple: (entityLogicalName: string, records: Record<string, unknown>[], connectionTarget?: "primary" | "secondary") => Promise<string[]>;
418
+
419
+ /**
420
+ * Update multiple records in Dataverse
421
+ * @param entityLogicalName - Logical name of the entity
422
+ * @param records - Array of record data to update, each including the "id" property and the "odata.type" property
423
+ * @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
424
+ *
425
+ * @example
426
+ * await dataverseAPI.updateMultiple('account', [
427
+ * { accountid: 'guid-1', name: 'Updated Name 1', "@odata.type": "Microsoft.Dynamics.CRM.account" },
428
+ * { accountid: 'guid-2', name: 'Updated Name 2', "@odata.type": "Microsoft.Dynamics.CRM.account" }
429
+ * ]);
430
+ */
431
+ updateMultiple: (entityLogicalName: string, records: Record<string, unknown>[], connectionTarget?: "primary" | "secondary") => Promise<void>;
432
+
433
+ /**
434
+ * Gets the Dataverse entity set (collection) name for the specified table.
435
+ *
436
+ * This is typically used when building OData queries where the collection name
437
+ * (entity set name) is required instead of the logical table name.
438
+ *
439
+ * Note: This is a utility method that applies pluralization rules and does not
440
+ * require an active connection to Dataverse.
441
+ *
442
+ * @param entityLogicalName - The logical name of the Dataverse table (for example, "account").
443
+ * @returns The corresponding entity set name (for example, "accounts").
444
+ *
445
+ * @example
446
+ * const entitySetName = await dataverseAPI.getEntitySetName('account');
447
+ * console.log(entitySetName); // Output: "accounts"
448
+ *
449
+ * @example
450
+ * const entitySetName = await dataverseAPI.getEntitySetName('opportunity');
451
+ * console.log(entitySetName); // Output: "opportunities"
452
+ */
453
+ getEntitySetName: (entityLogicalName: string) => Promise<string>;
383
454
  }
384
455
  }
385
456
 
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
- "name": "@pptb/types",
3
- "version": "1.0.11",
4
- "description": "TypeScript type definitions for Power Platform Tool Box API",
5
- "main": "index.d.ts",
6
- "types": "index.d.ts",
7
- "keywords": [
8
- "powerplatform",
9
- "pptb",
10
- "toolbox",
11
- "types",
12
- "typescript",
13
- "dataverse"
14
- ],
15
- "author": "Power Platform Tool Box",
16
- "license": "GPL-3.0",
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/PowerPlatformToolBox/desktop-app.git",
20
- "directory": "packages"
21
- }
2
+ "name": "@pptb/types",
3
+ "version": "1.0.13",
4
+ "description": "TypeScript type definitions for Power Platform Tool Box API",
5
+ "main": "index.d.ts",
6
+ "types": "index.d.ts",
7
+ "keywords": [
8
+ "powerplatform",
9
+ "pptb",
10
+ "toolbox",
11
+ "types",
12
+ "typescript",
13
+ "dataverse"
14
+ ],
15
+ "author": "Power Platform Tool Box",
16
+ "license": "GPL-3.0",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/PowerPlatformToolBox/desktop-app.git",
20
+ "directory": "packages"
21
+ }
22
22
  }
package/toolboxAPI.d.ts CHANGED
@@ -65,6 +65,11 @@ declare namespace ToolBoxAPI {
65
65
  tenantId?: string;
66
66
  createdAt: string;
67
67
  lastUsedAt?: string;
68
+ /**
69
+ * @deprecated isActive is a legacy field that is no longer persisted.
70
+ * It may be present in older tool code but should not be relied upon.
71
+ * Use the connection context provided by the ToolBox API instead.
72
+ */
68
73
  isActive?: boolean;
69
74
  }
70
75