@pptb/types 1.0.9 → 1.0.11
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/dataverseAPI.d.ts +76 -15
- package/package.json +1 -1
- package/toolboxAPI.d.ts +18 -0
package/dataverseAPI.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ declare namespace DataverseAPI {
|
|
|
81
81
|
*
|
|
82
82
|
* @param entityLogicalName - Logical name of the entity (e.g., 'account', 'contact')
|
|
83
83
|
* @param record - Record data to create
|
|
84
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
84
85
|
* @returns Object containing the created record ID and any returned fields
|
|
85
86
|
*
|
|
86
87
|
* @example
|
|
@@ -90,8 +91,14 @@ declare namespace DataverseAPI {
|
|
|
90
91
|
* telephone1: '555-0100'
|
|
91
92
|
* });
|
|
92
93
|
* console.log('Created account ID:', result.id);
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* // Multi-connection tool using secondary connection
|
|
97
|
+
* const result = await dataverseAPI.create('account', {
|
|
98
|
+
* name: 'Contoso Ltd'
|
|
99
|
+
* }, 'secondary');
|
|
93
100
|
*/
|
|
94
|
-
create: (entityLogicalName: string, record: Record<string, unknown
|
|
101
|
+
create: (entityLogicalName: string, record: Record<string, unknown>, connectionTarget?: "primary" | "secondary") => Promise<CreateResult>;
|
|
95
102
|
|
|
96
103
|
/**
|
|
97
104
|
* Retrieve a single record by ID
|
|
@@ -99,6 +106,7 @@ declare namespace DataverseAPI {
|
|
|
99
106
|
* @param entityLogicalName - Logical name of the entity
|
|
100
107
|
* @param id - GUID of the record
|
|
101
108
|
* @param columns - Optional array of column names to retrieve (retrieves all if not specified)
|
|
109
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
102
110
|
* @returns Object containing the requested record
|
|
103
111
|
*
|
|
104
112
|
* @example
|
|
@@ -108,8 +116,12 @@ declare namespace DataverseAPI {
|
|
|
108
116
|
* ['name', 'emailaddress1', 'telephone1']
|
|
109
117
|
* );
|
|
110
118
|
* console.log('Account name:', account.name);
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* // Multi-connection tool using secondary connection
|
|
122
|
+
* const account = await dataverseAPI.retrieve('account', 'guid-here', ['name'], 'secondary');
|
|
111
123
|
*/
|
|
112
|
-
retrieve: (entityLogicalName: string, id: string, columns?: string[]) => Promise<Record<string, unknown>>;
|
|
124
|
+
retrieve: (entityLogicalName: string, id: string, columns?: string[], connectionTarget?: "primary" | "secondary") => Promise<Record<string, unknown>>;
|
|
113
125
|
|
|
114
126
|
/**
|
|
115
127
|
* Update an existing record
|
|
@@ -117,30 +129,41 @@ declare namespace DataverseAPI {
|
|
|
117
129
|
* @param entityLogicalName - Logical name of the entity
|
|
118
130
|
* @param id - GUID of the record
|
|
119
131
|
* @param record - Fields to update
|
|
132
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
120
133
|
*
|
|
121
134
|
* @example
|
|
122
135
|
* await dataverseAPI.update('account', 'guid-here', {
|
|
123
136
|
* name: 'Updated Account Name',
|
|
124
137
|
* description: 'Updated description'
|
|
125
138
|
* });
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* // Multi-connection tool using secondary connection
|
|
142
|
+
* await dataverseAPI.update('account', 'guid-here', { name: 'Updated' }, 'secondary');
|
|
126
143
|
*/
|
|
127
|
-
update: (entityLogicalName: string, id: string, record: Record<string, unknown
|
|
144
|
+
update: (entityLogicalName: string, id: string, record: Record<string, unknown>, connectionTarget?: "primary" | "secondary") => Promise<void>;
|
|
128
145
|
|
|
129
146
|
/**
|
|
130
147
|
* Delete a record
|
|
131
148
|
*
|
|
132
149
|
* @param entityLogicalName - Logical name of the entity
|
|
133
150
|
* @param id - GUID of the record
|
|
151
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
134
152
|
*
|
|
135
153
|
* @example
|
|
136
154
|
* await dataverseAPI.delete('account', 'guid-here');
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* // Multi-connection tool using secondary connection
|
|
158
|
+
* await dataverseAPI.delete('account', 'guid-here', 'secondary');
|
|
137
159
|
*/
|
|
138
|
-
delete: (entityLogicalName: string, id: string) => Promise<void>;
|
|
160
|
+
delete: (entityLogicalName: string, id: string, connectionTarget?: "primary" | "secondary") => Promise<void>;
|
|
139
161
|
|
|
140
162
|
/**
|
|
141
163
|
* Execute a FetchXML query
|
|
142
164
|
*
|
|
143
165
|
* @param fetchXml - FetchXML query string
|
|
166
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
144
167
|
* @returns Object with value array containing matching records
|
|
145
168
|
*
|
|
146
169
|
* @example
|
|
@@ -162,21 +185,27 @@ declare namespace DataverseAPI {
|
|
|
162
185
|
* result.value.forEach(record => {
|
|
163
186
|
* console.log(record.name);
|
|
164
187
|
* });
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* // Multi-connection tool using secondary connection
|
|
191
|
+
* const result = await dataverseAPI.fetchXmlQuery(fetchXml, 'secondary');
|
|
165
192
|
*/
|
|
166
|
-
fetchXmlQuery: (fetchXml: string) => Promise<FetchXmlResult>;
|
|
193
|
+
fetchXmlQuery: (fetchXml: string, connectionTarget?: "primary" | "secondary") => Promise<FetchXmlResult>;
|
|
167
194
|
|
|
168
195
|
/**
|
|
169
196
|
* Retrieve multiple records (alias for fetchXmlQuery for backward compatibility)
|
|
170
197
|
*
|
|
171
198
|
* @param fetchXml - FetchXML query string
|
|
199
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
172
200
|
* @returns Object with value array containing matching records
|
|
173
201
|
*/
|
|
174
|
-
retrieveMultiple: (fetchXml: string) => Promise<FetchXmlResult>;
|
|
202
|
+
retrieveMultiple: (fetchXml: string, connectionTarget?: "primary" | "secondary") => Promise<FetchXmlResult>;
|
|
175
203
|
|
|
176
204
|
/**
|
|
177
205
|
* Execute a Dataverse Web API action or function
|
|
178
206
|
*
|
|
179
207
|
* @param request - Execute request configuration
|
|
208
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
180
209
|
* @returns Object containing the operation result
|
|
181
210
|
*
|
|
182
211
|
* @example
|
|
@@ -198,8 +227,15 @@ declare namespace DataverseAPI {
|
|
|
198
227
|
* FieldName: 'total_revenue'
|
|
199
228
|
* }
|
|
200
229
|
* });
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* // Multi-connection tool using secondary connection
|
|
233
|
+
* const result = await dataverseAPI.execute({
|
|
234
|
+
* operationName: 'WhoAmI',
|
|
235
|
+
* operationType: 'function'
|
|
236
|
+
* }, 'secondary');
|
|
201
237
|
*/
|
|
202
|
-
execute: (request: ExecuteRequest) => Promise<Record<string, unknown>>;
|
|
238
|
+
execute: (request: ExecuteRequest, connectionTarget?: "primary" | "secondary") => Promise<Record<string, unknown>>;
|
|
203
239
|
|
|
204
240
|
/**
|
|
205
241
|
* Get metadata for a specific entity
|
|
@@ -207,10 +243,11 @@ declare namespace DataverseAPI {
|
|
|
207
243
|
* @param entityLogicalName - Logical name of the entity
|
|
208
244
|
* @param searchByLogicalName - Whether to search by logical name (true) or metadata ID (false)
|
|
209
245
|
* @param selectColumns - Optional array of column names to retrieve (retrieves all if not specified)
|
|
246
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
210
247
|
* @returns Object containing entity metadata
|
|
211
248
|
*
|
|
212
249
|
* @example
|
|
213
|
-
* const metadata = await dataverseAPI.getEntityMetadata('account', true, ['LogicalName', 'DisplayName']);
|
|
250
|
+
* const metadata = await dataverseAPI.getEntityMetadata('account', true, ['LogicalName', 'DisplayName', 'EntitySetName']);
|
|
214
251
|
* console.log('Logical Name:', metadata.LogicalName);
|
|
215
252
|
* console.log('Display Name:', metadata.DisplayName?.LocalizedLabels[0]?.Label);
|
|
216
253
|
*
|
|
@@ -220,22 +257,31 @@ declare namespace DataverseAPI {
|
|
|
220
257
|
* console.log('Entity Metadata ID:', metadata.MetadataId);
|
|
221
258
|
* console.log('Logical Name:', metadata.LogicalName);
|
|
222
259
|
* console.log('Display Name:', metadata.DisplayName?.LocalizedLabels[0]?.Label);
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* // Multi-connection tool using secondary connection
|
|
263
|
+
* const metadata = await dataverseAPI.getEntityMetadata('account', true, ['LogicalName'], 'secondary');
|
|
223
264
|
*/
|
|
224
|
-
getEntityMetadata: (entityLogicalName: string, searchByLogicalName: boolean, selectColumns?: string[]) => Promise<EntityMetadata>;
|
|
265
|
+
getEntityMetadata: (entityLogicalName: string, searchByLogicalName: boolean, selectColumns?: string[], connectionTarget?: "primary" | "secondary") => Promise<EntityMetadata>;
|
|
225
266
|
|
|
226
267
|
/**
|
|
227
268
|
* Get metadata for all entities
|
|
228
|
-
*
|
|
269
|
+
* @param selectColumns - Optional array of column names to retrieve (retrieves LogicalName, DisplayName, MetadataId by default)
|
|
270
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
229
271
|
* @returns Object with value array containing all entity metadata
|
|
230
272
|
*
|
|
231
273
|
* @example
|
|
232
|
-
* const allEntities = await dataverseAPI.getAllEntitiesMetadata();
|
|
274
|
+
* const allEntities = await dataverseAPI.getAllEntitiesMetadata(['LogicalName', 'DisplayName', 'EntitySetName'] );
|
|
233
275
|
* console.log(`Total entities: ${allEntities.value.length}`);
|
|
234
276
|
* allEntities.value.forEach(entity => {
|
|
235
277
|
* console.log(`${entity.LogicalName} - ${entity.DisplayName?.LocalizedLabels[0]?.Label}`);
|
|
236
278
|
* });
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* // Multi-connection tool using secondary connection
|
|
282
|
+
* const allEntities = await dataverseAPI.getAllEntitiesMetadata(['LogicalName'], 'secondary');
|
|
237
283
|
*/
|
|
238
|
-
getAllEntitiesMetadata: () => Promise<EntityMetadataCollection>;
|
|
284
|
+
getAllEntitiesMetadata: (selectColumns?: string[], connectionTarget?: "primary" | "secondary") => Promise<EntityMetadataCollection>;
|
|
239
285
|
|
|
240
286
|
/**
|
|
241
287
|
* Get related metadata for a specific entity (attributes, relationships, etc.)
|
|
@@ -243,6 +289,7 @@ declare namespace DataverseAPI {
|
|
|
243
289
|
* @param entityLogicalName - Logical name of the entity
|
|
244
290
|
* @param relatedPath - Path after EntityDefinitions(LogicalName='name') (e.g., 'Attributes', 'OneToManyRelationships', 'ManyToOneRelationships', 'ManyToManyRelationships', 'Keys')
|
|
245
291
|
* @param selectColumns - Optional array of column names to retrieve (retrieves all if not specified)
|
|
292
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
246
293
|
* @returns Object containing the related metadata
|
|
247
294
|
*
|
|
248
295
|
* @example
|
|
@@ -266,13 +313,18 @@ declare namespace DataverseAPI {
|
|
|
266
313
|
* 'OneToManyRelationships'
|
|
267
314
|
* );
|
|
268
315
|
* console.log('One-to-many relationships:', relationships.value);
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* // Multi-connection tool using secondary connection
|
|
319
|
+
* const attributes = await dataverseAPI.getEntityRelatedMetadata('account', 'Attributes', ['LogicalName'], 'secondary');
|
|
269
320
|
*/
|
|
270
|
-
getEntityRelatedMetadata: (entityLogicalName: string, relatedPath: string, selectColumns?: string[]) => Promise<Record<string, unknown>>;
|
|
321
|
+
getEntityRelatedMetadata: (entityLogicalName: string, relatedPath: string, selectColumns?: string[], connectionTarget?: "primary" | "secondary") => Promise<Record<string, unknown>>;
|
|
271
322
|
|
|
272
323
|
/**
|
|
273
324
|
* Get solutions from the environment
|
|
274
325
|
*
|
|
275
326
|
* @param selectColumns - Required array of column names to retrieve (must contain at least one column)
|
|
327
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
276
328
|
* @returns Object with value array containing solutions
|
|
277
329
|
*
|
|
278
330
|
* @example
|
|
@@ -287,13 +339,18 @@ declare namespace DataverseAPI {
|
|
|
287
339
|
* solutions.value.forEach(solution => {
|
|
288
340
|
* console.log(`${solution.friendlyname} (${solution.uniquename}) - v${solution.version}`);
|
|
289
341
|
* });
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* // Multi-connection tool using secondary connection
|
|
345
|
+
* const solutions = await dataverseAPI.getSolutions(['uniquename'], 'secondary');
|
|
290
346
|
*/
|
|
291
|
-
getSolutions: (selectColumns: string[]) => Promise<{ value: Record<string, unknown>[] }>;
|
|
347
|
+
getSolutions: (selectColumns: string[], connectionTarget?: "primary" | "secondary") => Promise<{ value: Record<string, unknown>[] }>;
|
|
292
348
|
|
|
293
349
|
/**
|
|
294
350
|
* Query data from Dataverse using OData query parameters
|
|
295
351
|
*
|
|
296
352
|
* @param odataQuery - OData query string with parameters like $select, $filter, $orderby, $top, $skip, $expand
|
|
353
|
+
* @param connectionTarget - Optional connection target for multi-connection tools ('primary' or 'secondary'). Defaults to 'primary'.
|
|
297
354
|
* @returns Object with value array containing matching records
|
|
298
355
|
*
|
|
299
356
|
* @example
|
|
@@ -317,8 +374,12 @@ declare namespace DataverseAPI {
|
|
|
317
374
|
* const result = await dataverseAPI.queryData(
|
|
318
375
|
* '$filter=contains(fullname, \'Smith\')&$top=20'
|
|
319
376
|
* );
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* // Multi-connection tool using secondary connection
|
|
380
|
+
* const result = await dataverseAPI.queryData('$filter=statecode eq 0', 'secondary');
|
|
320
381
|
*/
|
|
321
|
-
queryData: (odataQuery: string) => Promise<{ value: Record<string, unknown>[] }>;
|
|
382
|
+
queryData: (odataQuery: string, connectionTarget?: "primary" | "secondary") => Promise<{ value: Record<string, unknown>[] }>;
|
|
322
383
|
}
|
|
323
384
|
}
|
|
324
385
|
|
package/package.json
CHANGED
package/toolboxAPI.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ declare namespace ToolBoxAPI {
|
|
|
12
12
|
export interface ToolContext {
|
|
13
13
|
toolId: string | null;
|
|
14
14
|
connectionUrl: string | null;
|
|
15
|
+
connectionId?: string | null;
|
|
16
|
+
secondaryConnectionUrl?: string | null;
|
|
17
|
+
secondaryConnectionId?: string | null;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
/**
|
|
@@ -120,6 +123,21 @@ declare namespace ToolBoxAPI {
|
|
|
120
123
|
* Get the currently active Dataverse connection
|
|
121
124
|
*/
|
|
122
125
|
getActiveConnection: () => Promise<DataverseConnection | null>;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Get the secondary connection for multi-connection tools
|
|
129
|
+
*/
|
|
130
|
+
getSecondaryConnection: () => Promise<DataverseConnection | null>;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Get the secondary connection URL for multi-connection tools
|
|
134
|
+
*/
|
|
135
|
+
getSecondaryConnectionUrl: () => Promise<string | null>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Get the secondary connection ID for multi-connection tools
|
|
139
|
+
*/
|
|
140
|
+
getSecondaryConnectionId: () => Promise<string | null>;
|
|
123
141
|
}
|
|
124
142
|
|
|
125
143
|
/**
|