@pptb/types 1.0.2 → 1.0.4

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/dataverseAPI.d.ts +94 -1
  2. package/package.json +1 -1
package/dataverseAPI.d.ts CHANGED
@@ -205,14 +205,20 @@ declare namespace DataverseAPI {
205
205
  * Get metadata for a specific entity
206
206
  *
207
207
  * @param entityLogicalName - Logical name of the entity
208
+ * @param selectColumns - Optional array of column names to retrieve (retrieves all if not specified)
208
209
  * @returns Object containing entity metadata
209
210
  *
210
211
  * @example
211
212
  * const metadata = await dataverseAPI.getEntityMetadata('account');
212
213
  * console.log('Display Name:', metadata.DisplayName?.LocalizedLabels[0]?.Label);
213
214
  * console.log('Attributes:', metadata.Attributes?.length);
215
+ *
216
+ * @example
217
+ * // Get only specific metadata columns
218
+ * const metadata = await dataverseAPI.getEntityMetadata('account', ['LogicalName', 'DisplayName']);
219
+ * console.log('Display Name:', metadata.DisplayName?.LocalizedLabels[0]?.Label);
214
220
  */
215
- getEntityMetadata: (entityLogicalName: string) => Promise<EntityMetadata>;
221
+ getEntityMetadata: (entityLogicalName: string, selectColumns?: string[]) => Promise<EntityMetadata>;
216
222
 
217
223
  /**
218
224
  * Get metadata for all entities
@@ -227,6 +233,93 @@ declare namespace DataverseAPI {
227
233
  * });
228
234
  */
229
235
  getAllEntitiesMetadata: () => Promise<EntityMetadataCollection>;
236
+
237
+ /**
238
+ * Get related metadata for a specific entity (attributes, relationships, etc.)
239
+ *
240
+ * @param entityLogicalName - Logical name of the entity
241
+ * @param relatedPath - Path after EntityDefinitions(LogicalName='name') (e.g., 'Attributes', 'OneToManyRelationships', 'ManyToOneRelationships', 'ManyToManyRelationships', 'Keys')
242
+ * @param selectColumns - Optional array of column names to retrieve (retrieves all if not specified)
243
+ * @returns Object containing the related metadata
244
+ *
245
+ * @example
246
+ * // Get all attributes for an entity
247
+ * const attributes = await dataverseAPI.getEntityRelatedMetadata('account', 'Attributes');
248
+ * console.log('Attributes:', attributes.value);
249
+ *
250
+ * @example
251
+ * // Get specific attributes with select
252
+ * const attributes = await dataverseAPI.getEntityRelatedMetadata(
253
+ * 'account',
254
+ * 'Attributes',
255
+ * ['LogicalName', 'DisplayName', 'AttributeType']
256
+ * );
257
+ * console.log('Filtered attributes:', attributes.value);
258
+ *
259
+ * @example
260
+ * // Get one-to-many relationships
261
+ * const relationships = await dataverseAPI.getEntityRelatedMetadata(
262
+ * 'account',
263
+ * 'OneToManyRelationships'
264
+ * );
265
+ * console.log('One-to-many relationships:', relationships.value);
266
+ */
267
+ getEntityRelatedMetadata: (entityLogicalName: string, relatedPath: string, selectColumns?: string[]) => Promise<Record<string, unknown>>;
268
+
269
+ /**
270
+ * Get solutions from the environment
271
+ *
272
+ * @param selectColumns - Required array of column names to retrieve (must contain at least one column)
273
+ * @returns Object with value array containing solutions
274
+ *
275
+ * @example
276
+ * const solutions = await dataverseAPI.getSolutions([
277
+ * 'solutionid',
278
+ * 'uniquename',
279
+ * 'friendlyname',
280
+ * 'version',
281
+ * 'ismanaged'
282
+ * ]);
283
+ * console.log(`Total solutions: ${solutions.value.length}`);
284
+ * solutions.value.forEach(solution => {
285
+ * console.log(`${solution.friendlyname} (${solution.uniquename}) - v${solution.version}`);
286
+ * });
287
+ */
288
+ getSolutions: (selectColumns: string[]) => Promise<{ value: Record<string, unknown>[] }>;
289
+
290
+ /**
291
+ * Query data from Dataverse using OData query parameters
292
+ *
293
+ * @param entityLogicalName - Logical name of the entity to query (e.g., 'account', 'contact')
294
+ * @param odataQuery - OData query string with parameters like $select, $filter, $orderby, $top, $skip, $expand
295
+ * @returns Object with value array containing matching records
296
+ *
297
+ * @example
298
+ * // Get top 10 active accounts with specific fields
299
+ * const result = await dataverseAPI.queryData(
300
+ * 'account',
301
+ * '$select=name,emailaddress1,telephone1&$filter=statecode eq 0&$orderby=name&$top=10'
302
+ * );
303
+ * console.log(`Found ${result.value.length} records`);
304
+ * result.value.forEach(record => {
305
+ * console.log(`${record.name} - ${record.emailaddress1}`);
306
+ * });
307
+ *
308
+ * @example
309
+ * // Query with expand to include related records
310
+ * const result = await dataverseAPI.queryData(
311
+ * 'account',
312
+ * '$select=name,accountid&$expand=contact_customer_accounts($select=fullname,emailaddress1)&$top=5'
313
+ * );
314
+ *
315
+ * @example
316
+ * // Simple query with just a filter
317
+ * const result = await dataverseAPI.queryData(
318
+ * 'contact',
319
+ * '$filter=contains(fullname, \'Smith\')&$top=20'
320
+ * );
321
+ */
322
+ queryData: (entityLogicalName: string, odataQuery: string) => Promise<{ value: Record<string, unknown>[] }>;
230
323
  }
231
324
  }
232
325
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pptb/types",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "TypeScript type definitions for Power Platform Tool Box API",
5
5
  "main": "index.d.ts",
6
6
  "types": "index.d.ts",