codeapp-js 0.2.2 → 0.3.0

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 (43) hide show
  1. package/codeApp/.power/schemas/appschemas/dataSourcesInfo.ts +6275 -0
  2. package/codeApp/.power/schemas/jira/jira.Schema.json +6903 -0
  3. package/codeApp/.power/schemas/keyvault/keyvault.Schema.json +1600 -0
  4. package/codeApp/.power/schemas/teams/teams.Schema.json +11112 -0
  5. package/codeApp/dist/codeapp.js +757 -0
  6. package/codeApp/dist/index.js +1 -1
  7. package/codeApp/dist/power-apps-data.js +711 -176
  8. package/codeApp/src/generated/index.ts +12 -0
  9. package/codeApp/src/generated/models/AzureKeyVaultModel.ts +107 -0
  10. package/codeApp/src/generated/models/JiraModel.ts +501 -0
  11. package/codeApp/src/generated/models/Office365GroupsModel.ts +363 -0
  12. package/codeApp/src/generated/models/Office365OutlookModel.ts +2046 -0
  13. package/codeApp/src/generated/models/Office365UsersModel.ts +254 -0
  14. package/codeApp/src/generated/services/AzureKeyVaultService.ts +257 -0
  15. package/codeApp/src/generated/services/JiraService.ts +1124 -0
  16. package/codeApp/src/generated/services/Office365GroupsService.ts +326 -0
  17. package/codeApp/src/generated/services/Office365OutlookService.ts +2476 -0
  18. package/codeApp/src/generated/services/Office365UsersService.ts +358 -0
  19. package/dev files/customConnector.js +98 -0
  20. package/dev files/dataverse.js +22 -7
  21. package/dev files/environmentVar.js +1 -1
  22. package/dev files/office365groups.js +1 -1
  23. package/dev files/office365users.js +1 -1
  24. package/dev files/outlook.js +1 -1
  25. package/{examples/solution explorer/dist → dev files}/power-apps-data.js +2951 -3006
  26. package/dev files/sharepoint.js +1 -1
  27. package/examples/outlook Demo2/dist/index.js +10 -84
  28. package/package.json +1 -1
  29. package/readme.md +33 -4
  30. package/.github/instructions/wyattdave.instructions.md +0 -39
  31. package/examples/solution explorer/agent/decision-log.md +0 -27
  32. package/examples/solution explorer/agent/mockup-01-swiss-grid.html +0 -452
  33. package/examples/solution explorer/agent/mockup-02-dark-glass.html +0 -496
  34. package/examples/solution explorer/agent/mockup-03-paper-console.html +0 -510
  35. package/examples/solution explorer/agent/mockup-04-neon-noir.html +0 -546
  36. package/examples/solution explorer/agent/mockup-05-zen-garden.html +0 -534
  37. package/examples/solution explorer/dist/codeapp.js +0 -1098
  38. package/examples/solution explorer/dist/icon-512.png +0 -0
  39. package/examples/solution explorer/dist/index.html +0 -80
  40. package/examples/solution explorer/dist/index.js +0 -735
  41. package/examples/solution explorer/dist/styles.css +0 -571
  42. package/examples/solution explorer/power.config.json +0 -151
  43. package/scripts/build-power-sdk.mjs +0 -69
@@ -0,0 +1,358 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ * This file is autogenerated. Do not edit this file directly.
4
+ */
5
+
6
+ import type { ClientPhotoMetadata } from '../models/Office365UsersModel';
7
+ import type { EntityListResponse_IReadOnlyList_User } from '../models/Office365UsersModel';
8
+ import type { GraphTrending } from '../models/Office365UsersModel';
9
+ import type { GraphUserUpdateable_V1 } from '../models/Office365UsersModel';
10
+ import type { GraphUser_V1 } from '../models/Office365UsersModel';
11
+ import type { IOperationResult } from '@microsoft/power-apps/data';
12
+ import type { LinklessEntityListResponse_List_Person } from '../models/Office365UsersModel';
13
+ import type { ObjectWithoutType } from '../models/Office365UsersModel';
14
+ import type { User } from '../models/Office365UsersModel';
15
+ import { dataSourcesInfo } from '../../../.power/schemas/appschemas/dataSourcesInfo';
16
+ import { getClient } from '@microsoft/power-apps/data';
17
+
18
+ export class Office365UsersService {
19
+ private static readonly dataSourceName = 'office365users';
20
+
21
+ private static readonly client = getClient(dataSourcesInfo);
22
+
23
+ /**
24
+ * Update my profile
25
+ * Updates the profile of the current user
26
+ */
27
+ public static async UpdateMyProfile(body?: GraphUserUpdateable_V1): Promise<IOperationResult<void>> {
28
+ const params: { body?: GraphUserUpdateable_V1 } = { body };
29
+ const result = await Office365UsersService.client.executeAsync<{ body?: GraphUserUpdateable_V1 }, void>(
30
+ {
31
+ connectorOperation: {
32
+ tableName: Office365UsersService.dataSourceName,
33
+ operationName: 'UpdateMyProfile',
34
+ parameters: params
35
+ },
36
+ });
37
+ return result;
38
+ }
39
+
40
+ /**
41
+ * Get my profile (V2)
42
+ * Retrieves the profile of the current user. Learn more about available fields to select: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties
43
+ */
44
+ public static async MyProfile_V2($select?: string): Promise<IOperationResult<GraphUser_V1>> {
45
+ const params: { $select?: string } = { $select };
46
+ const result = await Office365UsersService.client.executeAsync<{ $select?: string }, GraphUser_V1>(
47
+ {
48
+ connectorOperation: {
49
+ tableName: Office365UsersService.dataSourceName,
50
+ operationName: 'MyProfile_V2',
51
+ parameters: params
52
+ },
53
+ });
54
+ return result;
55
+ }
56
+
57
+ /**
58
+ * Update my profile photo
59
+ * Updates the profile photo of the current user. The size of the photo must be less than 4 MB.
60
+ */
61
+ public static async UpdateMyPhoto(body: string, Content_Type: string): Promise<IOperationResult<void>> {
62
+ const params: { body: string, Content_Type: string } = { body, Content_Type };
63
+ const result = await Office365UsersService.client.executeAsync<{ body: string, Content_Type: string }, void>(
64
+ {
65
+ connectorOperation: {
66
+ tableName: Office365UsersService.dataSourceName,
67
+ operationName: 'UpdateMyPhoto',
68
+ parameters: params
69
+ },
70
+ });
71
+ return result;
72
+ }
73
+
74
+ /**
75
+ * Get my trending documents
76
+ * Retrieves the trending documents for the signed in user
77
+ */
78
+ public static async MyTrendingDocuments($filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean): Promise<IOperationResult<{ value: GraphTrending[] }>> {
79
+ const params: { $filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean } = { $filter, extractSensitivityLabel, fetchSensitivityLabelMetadata };
80
+ const result = await Office365UsersService.client.executeAsync<{ $filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean }, { value: GraphTrending[] }>(
81
+ {
82
+ connectorOperation: {
83
+ tableName: Office365UsersService.dataSourceName,
84
+ operationName: 'MyTrendingDocuments',
85
+ parameters: params
86
+ },
87
+ });
88
+ return result;
89
+ }
90
+
91
+ /**
92
+ * Get relevant people
93
+ * Get relevant people.
94
+ */
95
+ public static async RelevantPeople(userId: string): Promise<IOperationResult<LinklessEntityListResponse_List_Person>> {
96
+ const params: { userId: string } = { userId };
97
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, LinklessEntityListResponse_List_Person>(
98
+ {
99
+ connectorOperation: {
100
+ tableName: Office365UsersService.dataSourceName,
101
+ operationName: 'RelevantPeople',
102
+ parameters: params
103
+ },
104
+ });
105
+ return result;
106
+ }
107
+
108
+ /**
109
+ * Get my profile (V1)
110
+ * Retrieves the profile of the current user.
111
+ */
112
+ public static async MyProfile(): Promise<IOperationResult<User>> {
113
+ const result = await Office365UsersService.client.executeAsync<void, User>(
114
+ {
115
+ connectorOperation: {
116
+ tableName: Office365UsersService.dataSourceName,
117
+ operationName: 'MyProfile',
118
+ },
119
+ });
120
+ return result;
121
+ }
122
+
123
+ /**
124
+ * Get user profile (V1)
125
+ * Retrieves the profile of a specific user.
126
+ */
127
+ public static async UserProfile(userId: string): Promise<IOperationResult<User>> {
128
+ const params: { userId: string } = { userId };
129
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, User>(
130
+ {
131
+ connectorOperation: {
132
+ tableName: Office365UsersService.dataSourceName,
133
+ operationName: 'UserProfile',
134
+ parameters: params
135
+ },
136
+ });
137
+ return result;
138
+ }
139
+
140
+ /**
141
+ * Get user photo metadata
142
+ * Get user photo metadata.
143
+ */
144
+ public static async UserPhotoMetadata(userId: string): Promise<IOperationResult<ClientPhotoMetadata>> {
145
+ const params: { userId: string } = { userId };
146
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, ClientPhotoMetadata>(
147
+ {
148
+ connectorOperation: {
149
+ tableName: Office365UsersService.dataSourceName,
150
+ operationName: 'UserPhotoMetadata',
151
+ parameters: params
152
+ },
153
+ });
154
+ return result;
155
+ }
156
+
157
+ /**
158
+ * Get user photo (V1)
159
+ * Retrieves the photo of the specified user if they have one.
160
+ */
161
+ public static async UserPhoto(userId: string): Promise<IOperationResult<string>> {
162
+ const params: { userId: string } = { userId };
163
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, string>(
164
+ {
165
+ connectorOperation: {
166
+ tableName: Office365UsersService.dataSourceName,
167
+ operationName: 'UserPhoto',
168
+ parameters: params
169
+ },
170
+ });
171
+ return result;
172
+ }
173
+
174
+ /**
175
+ * Get manager (V1)
176
+ * Retrieves the profile of the specified user's manager.
177
+ */
178
+ public static async Manager(userId: string): Promise<IOperationResult<User>> {
179
+ const params: { userId: string } = { userId };
180
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, User>(
181
+ {
182
+ connectorOperation: {
183
+ tableName: Office365UsersService.dataSourceName,
184
+ operationName: 'Manager',
185
+ parameters: params
186
+ },
187
+ });
188
+ return result;
189
+ }
190
+
191
+ /**
192
+ * Get direct reports (V1)
193
+ * Retrieves the user profiles of the specified user's direct reports.
194
+ */
195
+ public static async DirectReports(userId: string): Promise<IOperationResult<User[]>> {
196
+ const params: { userId: string } = { userId };
197
+ const result = await Office365UsersService.client.executeAsync<{ userId: string }, User[]>(
198
+ {
199
+ connectorOperation: {
200
+ tableName: Office365UsersService.dataSourceName,
201
+ operationName: 'DirectReports',
202
+ parameters: params
203
+ },
204
+ });
205
+ return result;
206
+ }
207
+
208
+ /**
209
+ * Search for users
210
+ * Retrieves the user profiles that match the search term.
211
+ */
212
+ public static async SearchUser(searchTerm?: string, top?: number): Promise<IOperationResult<User[]>> {
213
+ const params: { searchTerm?: string, top?: number } = { searchTerm, top };
214
+ const result = await Office365UsersService.client.executeAsync<{ searchTerm?: string, top?: number }, User[]>(
215
+ {
216
+ connectorOperation: {
217
+ tableName: Office365UsersService.dataSourceName,
218
+ operationName: 'SearchUser',
219
+ parameters: params
220
+ },
221
+ });
222
+ return result;
223
+ }
224
+
225
+ /**
226
+ * Search for users (V2)
227
+ * Retrieves the user profiles that match the search term (V2).
228
+ */
229
+ public static async SearchUserV2(searchTerm?: string, top?: number, isSearchTermRequired?: boolean, skipToken?: string): Promise<IOperationResult<EntityListResponse_IReadOnlyList_User>> {
230
+ const params: { searchTerm?: string, top?: number, isSearchTermRequired?: boolean, skipToken?: string } = { searchTerm, top, isSearchTermRequired, skipToken };
231
+ const result = await Office365UsersService.client.executeAsync<{ searchTerm?: string, top?: number, isSearchTermRequired?: boolean, skipToken?: string }, EntityListResponse_IReadOnlyList_User>(
232
+ {
233
+ connectorOperation: {
234
+ tableName: Office365UsersService.dataSourceName,
235
+ operationName: 'SearchUserV2',
236
+ parameters: params
237
+ },
238
+ });
239
+ return result;
240
+ }
241
+
242
+ /**
243
+ * Tests the connection
244
+ * Tests the connection.
245
+ */
246
+ public static async TestConnection(): Promise<IOperationResult<void>> {
247
+ const result = await Office365UsersService.client.executeAsync<void, void>(
248
+ {
249
+ connectorOperation: {
250
+ tableName: Office365UsersService.dataSourceName,
251
+ operationName: 'TestConnection',
252
+ },
253
+ });
254
+ return result;
255
+ }
256
+
257
+ /**
258
+ * Get user profile (V2)
259
+ * Retrieves the profile of a specific user. Learn more about available fields to select: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties
260
+ */
261
+ public static async UserProfile_V2(id: string, $select?: string): Promise<IOperationResult<GraphUser_V1>> {
262
+ const params: { id: string, $select?: string } = { id, $select };
263
+ const result = await Office365UsersService.client.executeAsync<{ id: string, $select?: string }, GraphUser_V1>(
264
+ {
265
+ connectorOperation: {
266
+ tableName: Office365UsersService.dataSourceName,
267
+ operationName: 'UserProfile_V2',
268
+ parameters: params
269
+ },
270
+ });
271
+ return result;
272
+ }
273
+
274
+ /**
275
+ * Get manager (V2)
276
+ * Retrieves the profile of the specified user's manager. Learn more about available fields to select: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties
277
+ */
278
+ public static async Manager_V2(id: string, $select?: string): Promise<IOperationResult<GraphUser_V1>> {
279
+ const params: { id: string, $select?: string } = { id, $select };
280
+ const result = await Office365UsersService.client.executeAsync<{ id: string, $select?: string }, GraphUser_V1>(
281
+ {
282
+ connectorOperation: {
283
+ tableName: Office365UsersService.dataSourceName,
284
+ operationName: 'Manager_V2',
285
+ parameters: params
286
+ },
287
+ });
288
+ return result;
289
+ }
290
+
291
+ /**
292
+ * Get direct reports (V2)
293
+ * Retrieves the user profiles of the specified user's direct reports. Learn more about available fields to select: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties
294
+ */
295
+ public static async DirectReports_V2(id: string, $select?: string, $top?: number): Promise<IOperationResult<{ value: GraphUser_V1[] }>> {
296
+ const params: { id: string, $select?: string, $top?: number } = { id, $select, $top };
297
+ const result = await Office365UsersService.client.executeAsync<{ id: string, $select?: string, $top?: number }, { value: GraphUser_V1[] }>(
298
+ {
299
+ connectorOperation: {
300
+ tableName: Office365UsersService.dataSourceName,
301
+ operationName: 'DirectReports_V2',
302
+ parameters: params
303
+ },
304
+ });
305
+ return result;
306
+ }
307
+
308
+ /**
309
+ * Get user photo (V2)
310
+ * Retrieves the photo of the specified user if they have one
311
+ */
312
+ public static async UserPhoto_V2(id: string): Promise<IOperationResult<string>> {
313
+ const params: { id: string } = { id };
314
+ const result = await Office365UsersService.client.executeAsync<{ id: string }, string>(
315
+ {
316
+ connectorOperation: {
317
+ tableName: Office365UsersService.dataSourceName,
318
+ operationName: 'UserPhoto_V2',
319
+ parameters: params
320
+ },
321
+ });
322
+ return result;
323
+ }
324
+
325
+ /**
326
+ * Get trending documents
327
+ * Retrieves the trending documents for a user
328
+ */
329
+ public static async TrendingDocuments(id: string, $filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean): Promise<IOperationResult<{ value: GraphTrending[] }>> {
330
+ const params: { id: string, $filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean } = { id, $filter, extractSensitivityLabel, fetchSensitivityLabelMetadata };
331
+ const result = await Office365UsersService.client.executeAsync<{ id: string, $filter?: string, extractSensitivityLabel?: boolean, fetchSensitivityLabelMetadata?: boolean }, { value: GraphTrending[] }>(
332
+ {
333
+ connectorOperation: {
334
+ tableName: Office365UsersService.dataSourceName,
335
+ operationName: 'TrendingDocuments',
336
+ parameters: params
337
+ },
338
+ });
339
+ return result;
340
+ }
341
+
342
+ /**
343
+ * Send an HTTP request
344
+ * Construct a Microsoft Graph REST API request to invoke. These segments are supported: 1st segement: /me, /users/<userId> 2nd segment: messages, mailFolders, events, calendar, calendars, outlook, inferenceClassification. Learn more: https://docs.microsoft.com/en-us/graph/use-the-api.
345
+ */
346
+ public static async HttpRequest(Uri: string, Method: string, Body?: string, ContentType?: string, CustomHeader1?: string, CustomHeader2?: string, CustomHeader3?: string, CustomHeader4?: string, CustomHeader5?: string): Promise<IOperationResult<ObjectWithoutType>> {
347
+ const params: { Uri: string, Method: string, Body?: string, ContentType?: string, CustomHeader1?: string, CustomHeader2?: string, CustomHeader3?: string, CustomHeader4?: string, CustomHeader5?: string } = { Uri, Method, Body, ContentType, CustomHeader1, CustomHeader2, CustomHeader3, CustomHeader4, CustomHeader5 };
348
+ const result = await Office365UsersService.client.executeAsync<{ Uri: string, Method: string, Body?: string, ContentType?: string, CustomHeader1?: string, CustomHeader2?: string, CustomHeader3?: string, CustomHeader4?: string, CustomHeader5?: string }, ObjectWithoutType>(
349
+ {
350
+ connectorOperation: {
351
+ tableName: Office365UsersService.dataSourceName,
352
+ operationName: 'HttpRequest',
353
+ parameters: params
354
+ },
355
+ });
356
+ return result;
357
+ }
358
+ }
@@ -0,0 +1,98 @@
1
+ // Custom Connector Utility for Power Apps Code-First SDK
2
+ // This module provides generic functions to call any custom connector operation.
3
+ // Usage: import and use callCustomConnectorOperation or openCustomConnectorHttpRequest.
4
+
5
+ import { getClient } from "./power-apps-data.js";
6
+
7
+ // ── Data source name (set to your custom connector name) ──
8
+ const DATA_SOURCE_NAME = "<yourCustomConnectorName>"; // Replace with your connector name
9
+ const CUSTOM_CONNECTOR_APIS = {};
10
+
11
+ // ── Initialize SDK client for the custom connector ──
12
+ function initClient() {
13
+ const dataSourcesInfo = {
14
+ [DATA_SOURCE_NAME]: {
15
+ tableId: "",
16
+ version: "",
17
+ primaryKey: "",
18
+ dataSourceType: "Connector",
19
+ apis: CUSTOM_CONNECTOR_APIS,
20
+ },
21
+ };
22
+ return getClient(dataSourcesInfo);
23
+ }
24
+
25
+ function stringifyErrorDetails(oError) {
26
+ if (!oError) return "Operation failed";
27
+ if (typeof oError === "string") return oError;
28
+ if (oError instanceof Error) return oError.message || "Operation failed";
29
+ var aPropertyNames = Object.getOwnPropertyNames(oError);
30
+ var oSerializable = {};
31
+ aPropertyNames.forEach((sName) => {
32
+ oSerializable[sName] = oError[sName];
33
+ });
34
+ try {
35
+ return JSON.stringify(oSerializable);
36
+ } catch {
37
+ return String(oError);
38
+ }
39
+ }
40
+
41
+ function unwrapResult(oResult) {
42
+ if (oResult && oResult.success === false) {
43
+ var sMessage = stringifyErrorDetails(oResult.error);
44
+ if (oResult.data !== undefined) {
45
+ sMessage += " | data: " + stringifyErrorDetails(oResult.data);
46
+ }
47
+ throw new Error(sMessage);
48
+ }
49
+ if (oResult && Object.prototype.hasOwnProperty.call(oResult, "data")) {
50
+ return oResult.data;
51
+ }
52
+ return oResult;
53
+ }
54
+
55
+ // ── Internal: execute a connector operation ────────────────────
56
+ async function execOp(operationName, parameters) {
57
+ const client = await initClient();
58
+ try {
59
+ const result = await client.executeAsync({
60
+ connectorOperation: {
61
+ tableName: DATA_SOURCE_NAME,
62
+ operationName,
63
+ parameters,
64
+ },
65
+ });
66
+ return unwrapResult(result);
67
+ } catch (oErr) {
68
+ throw new Error(DATA_SOURCE_NAME + ": " + stringifyErrorDetails(oErr));
69
+ }
70
+ }
71
+
72
+ // ── Call any custom connector operation by name ───────────────
73
+ export async function callCustomConnectorOperation(operationName, parameters = {}) {
74
+ return execOp(operationName, parameters);
75
+ }
76
+
77
+ // ── Open HTTP Request (for advanced scenarios) ────────────────
78
+ export async function openCustomConnectorHttpRequest({ method = "GET", uri, headers, body }) {
79
+ const client = await initClient();
80
+ try {
81
+ const result = await client.executeAsync({
82
+ httpRequest: {
83
+ tableName: DATA_SOURCE_NAME,
84
+ method,
85
+ uri,
86
+ headers,
87
+ body,
88
+ },
89
+ });
90
+ return unwrapResult(result);
91
+ } catch (oErr) {
92
+ throw new Error(DATA_SOURCE_NAME + ": " + stringifyErrorDetails(oErr));
93
+ }
94
+ }
95
+
96
+ // ── Example Usage ─────────────────────────────────────────────
97
+ // callCustomConnectorOperation("MyAction", { param1: "value" })
98
+ // openCustomConnectorHttpRequest({ method: "POST", uri: "/myapi", body: { ... } })
@@ -1,4 +1,4 @@
1
- import { getClient } from "@microsoft/power-apps/data";
1
+ import { getClient, getContext } from "./power-apps-data.js";
2
2
 
3
3
  // ── Table Registry (populated at runtime via registerTable) ────
4
4
  let oDataSources = {};
@@ -90,16 +90,31 @@ export async function deleteItem(tableName, primaryKey, id) {
90
90
  }
91
91
 
92
92
  // ── Unbound Action ─────────────────────────────────────────────
93
+ // Calls an unbound Dataverse action by POSTing to the action endpoint.
94
+ // The actionName must be declared in power.config.json under
95
+ // databaseReferences.default.cds.dataSources, e.g.:
96
+ // "WhoAmI": { "entitySetName": "WhoAmI", "logicalName": "whoami", "isHidden": false }
93
97
  export async function callUnboundAction(tableName, primaryKey, actionName, params) {
94
- const client = getSharedClient();
95
- const result = await client.invokeActionAsync(tableName, actionName, params);
98
+ if (!oDataSources[actionName]) {
99
+ oDataSources[actionName] = {
100
+ tableId: '',
101
+ version: '',
102
+ primaryKey: '',
103
+ dataSourceType: 'Dataverse',
104
+ apis: {}
105
+ };
106
+ oSharedClient = null;
107
+ }
108
+ var client = getSharedClient();
109
+ var result = await client.createRecordAsync(actionName, params || {});
96
110
  return unwrapResult(result);
97
111
  }
98
112
 
99
113
  // ── WhoAmI ─────────────────────────────────────────────────────
100
114
  export async function whoAmI() {
101
- const client = getSharedClient();
102
- const result = await client.invokeActionAsync('', 'WhoAmI', {});
103
- var data = unwrapResult(result);
104
- return data.UserId || data.userid || data.systemuserid || data;
115
+ var oCtx = await getContext();
116
+ var sId = oCtx.UserId || oCtx.userId || oCtx.systemuserid;
117
+ if (sId) return sId;
118
+ if (oCtx.userSettings && oCtx.userSettings.userId) return oCtx.userSettings.userId;
119
+ return oCtx;
105
120
  }
@@ -1,4 +1,4 @@
1
- import { getClient } from "@microsoft/power-apps/data";
1
+ import { getClient } from "./power-apps-data.js";
2
2
 
3
3
  // ── All Table Definitions ──────────────────────────────────────
4
4
  const ALL_DATA_SOURCES = {
@@ -1,4 +1,4 @@
1
- import { getClient } from "@microsoft/power-apps/data";
1
+ import { getClient } from "./power-apps-data.js";
2
2
 
3
3
  // ── Data source name (must match connectionReferences in power.config.json) ──
4
4
  const DATA_SOURCE = "Office365Groups";
@@ -1,4 +1,4 @@
1
- import { getClient } from "@microsoft/power-apps/data";
1
+ import { getClient } from "./power-apps-data.js";
2
2
 
3
3
  // ── Data source name (must match connectionReferences in power.config.json) ──
4
4
  const DATA_SOURCE = "office365users";
@@ -1,4 +1,4 @@
1
- import { getClient } from "@microsoft/power-apps/data";
1
+ import { getClient } from "./power-apps-data.js";
2
2
 
3
3
  // ── Data source name (must match connectionReferences in power.config.json) ──
4
4
  const DATA_SOURCE_CANDIDATES = ["office365outlook", "Office365Outlook", "office365"];