codeapp-js 0.2.1 → 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 (100) 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 +992 -4
  6. package/codeApp/dist/power-apps-data.js +145 -31
  7. package/codeApp/src/generated/index.ts +12 -0
  8. package/codeApp/src/generated/models/AzureKeyVaultModel.ts +107 -0
  9. package/codeApp/src/generated/models/JiraModel.ts +501 -0
  10. package/codeApp/src/generated/models/Office365GroupsModel.ts +363 -0
  11. package/codeApp/src/generated/models/Office365OutlookModel.ts +2046 -0
  12. package/codeApp/src/generated/models/Office365UsersModel.ts +254 -0
  13. package/codeApp/src/generated/services/AzureKeyVaultService.ts +257 -0
  14. package/codeApp/src/generated/services/JiraService.ts +1124 -0
  15. package/codeApp/src/generated/services/Office365GroupsService.ts +326 -0
  16. package/codeApp/src/generated/services/Office365OutlookService.ts +2476 -0
  17. package/codeApp/src/generated/services/Office365UsersService.ts +358 -0
  18. package/dev files/outlook.js +218 -9
  19. package/examples/combined demo/dist/codeapp.js +1098 -1098
  20. package/examples/combined demo/dist/index.js +470 -470
  21. package/examples/combined demo/dist/power-apps-data.js +3006 -3006
  22. package/examples/combined demo/power.config.json +42 -42
  23. package/examples/dataverse Demo/dist/codeapp.js +1085 -1085
  24. package/examples/dataverse Demo/dist/index.html +54 -54
  25. package/examples/dataverse Demo/dist/index.js +82 -82
  26. package/examples/dataverse Demo/dist/power-apps-data.js +2911 -2911
  27. package/examples/dataverse Demo/power.config.json +34 -34
  28. package/examples/dataverse Demo/readme.md +79 -79
  29. package/examples/groups Demo/dist/codeapp.js +1085 -1085
  30. package/examples/groups Demo/dist/index.js +113 -113
  31. package/examples/groups Demo/dist/power-apps-data.js +2911 -2911
  32. package/examples/kanban/dist/dataverse.js +94 -94
  33. package/examples/kanban/dist/environmentVar.js +55 -55
  34. package/examples/kanban/dist/office365groups.js +97 -97
  35. package/examples/kanban/dist/office365users.js +169 -169
  36. package/examples/kanban/dist/outlook.js +162 -162
  37. package/examples/kanban/dist/power-apps-data.js +2953 -2953
  38. package/examples/kanban/dist/sharepoint.js +339 -339
  39. package/examples/myProfile/dist/index.html +184 -184
  40. package/examples/myProfile/dist/index.js +141 -141
  41. package/examples/myProfile/dist/office365users.js +169 -169
  42. package/examples/myProfile/dist/power-apps-data.js +2953 -2953
  43. package/examples/myProfile/power.config.json +22 -22
  44. package/examples/myProfile/readme.md +79 -79
  45. package/examples/outlook Demo/dist/codeapp.js +1085 -1085
  46. package/examples/outlook Demo/dist/index.html +35 -35
  47. package/examples/outlook Demo/dist/index.js +170 -170
  48. package/examples/outlook Demo/dist/outlook.js +121 -121
  49. package/examples/outlook Demo/dist/power-apps-data.js +2911 -2911
  50. package/examples/outlook Demo/dist/styles.css +84 -84
  51. package/examples/outlook Demo/readme.md +82 -82
  52. package/examples/outlook Demo2/OutlookDemo_1_0_0_1.zip +0 -0
  53. package/examples/outlook Demo2/agent/decision-log.md +7 -0
  54. package/examples/{solution explorer → outlook Demo2}/dist/codeapp.js +245 -9
  55. package/examples/outlook Demo2/dist/index.html +98 -0
  56. package/examples/outlook Demo2/dist/index.js +272 -0
  57. package/examples/outlook Demo2/dist/styles.css +639 -0
  58. package/examples/outlook Demo2/power.config.json +23 -0
  59. package/examples/outlook Demo2/src/generated/index.ts +14 -0
  60. package/examples/outlook Demo2/src/generated/models/Office365GroupsModel.ts +363 -0
  61. package/examples/outlook Demo2/src/generated/models/Office365OutlookModel.ts +2046 -0
  62. package/examples/outlook Demo2/src/generated/models/Office365UsersModel.ts +254 -0
  63. package/examples/outlook Demo2/src/generated/services/Office365GroupsService.ts +326 -0
  64. package/examples/outlook Demo2/src/generated/services/Office365OutlookService.ts +2476 -0
  65. package/examples/outlook Demo2/src/generated/services/Office365UsersService.ts +358 -0
  66. package/examples/planning Poker/.vscode/settings.json +4 -4
  67. package/examples/planning Poker/additional files/customizations (tables).xml +6428 -6428
  68. package/examples/planning Poker/additional files/dataverse-tables.json +165 -165
  69. package/examples/planning Poker/additional files/readme.md +122 -122
  70. package/examples/planning Poker/dist/dataverse.js +78 -78
  71. package/examples/planning Poker/dist/index.html +198 -198
  72. package/examples/planning Poker/dist/index.js +954 -954
  73. package/examples/planning Poker/dist/power-apps-data.js +2953 -2953
  74. package/examples/planning Poker/dist/styles.css +815 -815
  75. package/examples/sharePoint Demo/agent/decision-log.md +5 -5
  76. package/examples/sharePoint Demo/dist/codeapp.js +1085 -1085
  77. package/examples/sharePoint Demo/dist/index.js +262 -262
  78. package/examples/sharePoint Demo/dist/power-apps-data.js +2911 -2911
  79. package/examples/sharePoint Demo/power.config.json +22 -22
  80. package/examples/todo/dist/dataverse.js +64 -64
  81. package/examples/todo/dist/index.html +75 -75
  82. package/examples/todo/dist/index.js +8 -8
  83. package/examples/todo/dist/power-apps-data.js +2953 -2953
  84. package/examples/todo/dist/renderer.js +375 -375
  85. package/examples/todo/dist/styles.css +691 -691
  86. package/examples/todo/power.config.json +34 -34
  87. package/package.json +1 -1
  88. package/readme.md +33 -4
  89. package/examples/solution explorer/agent/decision-log.md +0 -27
  90. package/examples/solution explorer/agent/mockup-01-swiss-grid.html +0 -452
  91. package/examples/solution explorer/agent/mockup-02-dark-glass.html +0 -496
  92. package/examples/solution explorer/agent/mockup-03-paper-console.html +0 -510
  93. package/examples/solution explorer/agent/mockup-04-neon-noir.html +0 -546
  94. package/examples/solution explorer/agent/mockup-05-zen-garden.html +0 -534
  95. package/examples/solution explorer/dist/index.html +0 -80
  96. package/examples/solution explorer/dist/index.js +0 -735
  97. package/examples/solution explorer/dist/styles.css +0 -571
  98. package/examples/solution explorer/power.config.json +0 -151
  99. /package/examples/{solution explorer → outlook Demo2}/dist/icon-512.png +0 -0
  100. /package/examples/{solution explorer → outlook Demo2}/dist/power-apps-data.js +0 -0
@@ -1,94 +1,94 @@
1
- import { getClient } from "@microsoft/power-apps/data";
2
-
3
- // ── Table Registry (populated at runtime via registerTable) ────
4
- let oDataSources = {};
5
-
6
- // ── Register a Dataverse table for use by the library ──────────
7
- export function registerTable(sTableName, sPrimaryKey) {
8
- oDataSources[sTableName] = {
9
- tableId: '',
10
- version: '',
11
- primaryKey: sPrimaryKey,
12
- dataSourceType: 'Dataverse',
13
- apis: {}
14
- };
15
- // reset client so it picks up the new table on next call
16
- oSharedClient = null;
17
- }
18
-
19
- // ── Initialize SDK & Client ────────────────────────────────────
20
- let oSharedClient = null;
21
-
22
- function getSharedClient() {
23
- if (!oSharedClient) {
24
- oSharedClient = getClient(oDataSources);
25
- }
26
- return oSharedClient;
27
- }
28
-
29
- // ── Unwrap SDK response ────────────────────────────────────────
30
- function unwrapResult(result) {
31
- if (result && result.success === false) {
32
- var sMsg = result.error ? (result.error.message || JSON.stringify(result.error)) : 'Operation failed';
33
- throw new Error(sMsg);
34
- }
35
- return result && 'data' in result ? result.data : result;
36
- }
37
-
38
- // ── Create ─────────────────────────────────────────────────────
39
- export async function createItem(tableName, primaryKey, record) {
40
- const client = getSharedClient();
41
- const result = await client.createRecordAsync(tableName, record);
42
- return unwrapResult(result);
43
- }
44
-
45
- // ── Read (single) ──────────────────────────────────────────────
46
- export async function getItem(tableName, primaryKey, id, select) {
47
- const client = getSharedClient();
48
- const options = select ? { select } : undefined;
49
- const result = await client.retrieveRecordAsync(tableName, id, options);
50
- return unwrapResult(result);
51
- }
52
-
53
- // ── List (multiple) ────────────────────────────────────────────
54
- export async function listItems(tableName, primaryKey, { filter, select, orderBy, top, skip } = {}) {
55
- const client = getSharedClient();
56
- const result = await client.retrieveMultipleRecordsAsync(tableName, {
57
- filter,
58
- select,
59
- orderBy,
60
- top,
61
- skip,
62
- });
63
- var unwrapped = unwrapResult(result);
64
- return { entities: Array.isArray(unwrapped) ? unwrapped : [] };
65
- }
66
-
67
- // ── Update ─────────────────────────────────────────────────────
68
- export async function updateItem(tableName, primaryKey, id, changedFields) {
69
- const client = getSharedClient();
70
- const result = await client.updateRecordAsync(tableName, id, changedFields);
71
- return unwrapResult(result);
72
- }
73
-
74
- // ── Delete ─────────────────────────────────────────────────────
75
- export async function deleteItem(tableName, primaryKey, id) {
76
- const client = getSharedClient();
77
- const result = await client.deleteRecordAsync(tableName, id);
78
- return unwrapResult(result);
79
- }
80
-
81
- // ── Unbound Action ─────────────────────────────────────────────
82
- export async function callUnboundAction(tableName, primaryKey, actionName, params) {
83
- const client = getSharedClient();
84
- const result = await client.invokeActionAsync(tableName, actionName, params);
85
- return unwrapResult(result);
86
- }
87
-
88
- // ── WhoAmI ─────────────────────────────────────────────────────
89
- export async function whoAmI() {
90
- const client = getSharedClient();
91
- const result = await client.invokeActionAsync('', 'WhoAmI', {});
92
- var data = unwrapResult(result);
93
- return data.UserId || data.userid || data.systemuserid || data;
94
- }
1
+ import { getClient } from "@microsoft/power-apps/data";
2
+
3
+ // ── Table Registry (populated at runtime via registerTable) ────
4
+ let oDataSources = {};
5
+
6
+ // ── Register a Dataverse table for use by the library ──────────
7
+ export function registerTable(sTableName, sPrimaryKey) {
8
+ oDataSources[sTableName] = {
9
+ tableId: '',
10
+ version: '',
11
+ primaryKey: sPrimaryKey,
12
+ dataSourceType: 'Dataverse',
13
+ apis: {}
14
+ };
15
+ // reset client so it picks up the new table on next call
16
+ oSharedClient = null;
17
+ }
18
+
19
+ // ── Initialize SDK & Client ────────────────────────────────────
20
+ let oSharedClient = null;
21
+
22
+ function getSharedClient() {
23
+ if (!oSharedClient) {
24
+ oSharedClient = getClient(oDataSources);
25
+ }
26
+ return oSharedClient;
27
+ }
28
+
29
+ // ── Unwrap SDK response ────────────────────────────────────────
30
+ function unwrapResult(result) {
31
+ if (result && result.success === false) {
32
+ var sMsg = result.error ? (result.error.message || JSON.stringify(result.error)) : 'Operation failed';
33
+ throw new Error(sMsg);
34
+ }
35
+ return result && 'data' in result ? result.data : result;
36
+ }
37
+
38
+ // ── Create ─────────────────────────────────────────────────────
39
+ export async function createItem(tableName, primaryKey, record) {
40
+ const client = getSharedClient();
41
+ const result = await client.createRecordAsync(tableName, record);
42
+ return unwrapResult(result);
43
+ }
44
+
45
+ // ── Read (single) ──────────────────────────────────────────────
46
+ export async function getItem(tableName, primaryKey, id, select) {
47
+ const client = getSharedClient();
48
+ const options = select ? { select } : undefined;
49
+ const result = await client.retrieveRecordAsync(tableName, id, options);
50
+ return unwrapResult(result);
51
+ }
52
+
53
+ // ── List (multiple) ────────────────────────────────────────────
54
+ export async function listItems(tableName, primaryKey, { filter, select, orderBy, top, skip } = {}) {
55
+ const client = getSharedClient();
56
+ const result = await client.retrieveMultipleRecordsAsync(tableName, {
57
+ filter,
58
+ select,
59
+ orderBy,
60
+ top,
61
+ skip,
62
+ });
63
+ var unwrapped = unwrapResult(result);
64
+ return { entities: Array.isArray(unwrapped) ? unwrapped : [] };
65
+ }
66
+
67
+ // ── Update ─────────────────────────────────────────────────────
68
+ export async function updateItem(tableName, primaryKey, id, changedFields) {
69
+ const client = getSharedClient();
70
+ const result = await client.updateRecordAsync(tableName, id, changedFields);
71
+ return unwrapResult(result);
72
+ }
73
+
74
+ // ── Delete ─────────────────────────────────────────────────────
75
+ export async function deleteItem(tableName, primaryKey, id) {
76
+ const client = getSharedClient();
77
+ const result = await client.deleteRecordAsync(tableName, id);
78
+ return unwrapResult(result);
79
+ }
80
+
81
+ // ── Unbound Action ─────────────────────────────────────────────
82
+ export async function callUnboundAction(tableName, primaryKey, actionName, params) {
83
+ const client = getSharedClient();
84
+ const result = await client.invokeActionAsync(tableName, actionName, params);
85
+ return unwrapResult(result);
86
+ }
87
+
88
+ // ── WhoAmI ─────────────────────────────────────────────────────
89
+ export async function whoAmI() {
90
+ const client = getSharedClient();
91
+ const result = await client.invokeActionAsync('', 'WhoAmI', {});
92
+ var data = unwrapResult(result);
93
+ return data.UserId || data.userid || data.systemuserid || data;
94
+ }
@@ -1,55 +1,55 @@
1
- import { getClient } from "@microsoft/power-apps/data";
2
-
3
- // ── All Table Definitions ──────────────────────────────────────
4
- const ALL_DATA_SOURCES = {
5
- environmentvariabledefinitions: { tableId: "", version: "", primaryKey: "environmentvariabledefinitionid", dataSourceType: "Dataverse", apis: {} },
6
- environmentvariablevalues: { tableId: "", version: "", primaryKey: "environmentvariablevalueid", dataSourceType: "Dataverse", apis: {} },
7
- };
8
-
9
- // ── Initialize SDK & Client ────────────────────────────────────
10
- let oSharedClient = null;
11
-
12
- function getSharedClient() {
13
- if (!oSharedClient) {
14
- oSharedClient = getClient(ALL_DATA_SOURCES);
15
- }
16
- return oSharedClient;
17
- }
18
-
19
- // ── Unwrap SDK response ────────────────────────────────────────
20
- function unwrapResult(result) {
21
- if (result && result.success === false) {
22
- let sMsg = result.error ? (result.error.message || JSON.stringify(result.error)) : "Operation failed";
23
- throw new Error(sMsg);
24
- }
25
- return result && "data" in result ? result.data : result;
26
- }
27
-
28
- // ── Get Environment Variable (single query with expand) ────────
29
- export async function getEnvironmentVariable(sSchemaName) {
30
- let client = getSharedClient();
31
-
32
- // Try single query: filter values by expanded definition schema name
33
- let valResult = await client.retrieveMultipleRecordsAsync("environmentvariablevalues", {
34
- filter: "EnvironmentVariableDefinitionId/schemaname eq '" + sSchemaName + "'",
35
- select: ["value"],
36
- expand: [{ name: "EnvironmentVariableDefinitionId", select: ["defaultvalue", "schemaname"] }],
37
- });
38
- let aVals = unwrapResult(valResult);
39
-
40
- // If value record exists, return it
41
- if (Array.isArray(aVals) && aVals.length > 0 && aVals[0].value) {
42
- return aVals[0].value;
43
- }
44
-
45
- // No value record — fall back to definition default value
46
- let defResult = await client.retrieveMultipleRecordsAsync("environmentvariabledefinitions", {
47
- filter: "schemaname eq '" + sSchemaName + "'",
48
- select: ["defaultvalue"],
49
- });
50
- let aDefs = unwrapResult(defResult);
51
- if (!Array.isArray(aDefs) || aDefs.length === 0) {
52
- throw new Error("Environment variable not found: " + sSchemaName);
53
- }
54
- return aDefs[0].defaultvalue || "";
55
- }
1
+ import { getClient } from "@microsoft/power-apps/data";
2
+
3
+ // ── All Table Definitions ──────────────────────────────────────
4
+ const ALL_DATA_SOURCES = {
5
+ environmentvariabledefinitions: { tableId: "", version: "", primaryKey: "environmentvariabledefinitionid", dataSourceType: "Dataverse", apis: {} },
6
+ environmentvariablevalues: { tableId: "", version: "", primaryKey: "environmentvariablevalueid", dataSourceType: "Dataverse", apis: {} },
7
+ };
8
+
9
+ // ── Initialize SDK & Client ────────────────────────────────────
10
+ let oSharedClient = null;
11
+
12
+ function getSharedClient() {
13
+ if (!oSharedClient) {
14
+ oSharedClient = getClient(ALL_DATA_SOURCES);
15
+ }
16
+ return oSharedClient;
17
+ }
18
+
19
+ // ── Unwrap SDK response ────────────────────────────────────────
20
+ function unwrapResult(result) {
21
+ if (result && result.success === false) {
22
+ let sMsg = result.error ? (result.error.message || JSON.stringify(result.error)) : "Operation failed";
23
+ throw new Error(sMsg);
24
+ }
25
+ return result && "data" in result ? result.data : result;
26
+ }
27
+
28
+ // ── Get Environment Variable (single query with expand) ────────
29
+ export async function getEnvironmentVariable(sSchemaName) {
30
+ let client = getSharedClient();
31
+
32
+ // Try single query: filter values by expanded definition schema name
33
+ let valResult = await client.retrieveMultipleRecordsAsync("environmentvariablevalues", {
34
+ filter: "EnvironmentVariableDefinitionId/schemaname eq '" + sSchemaName + "'",
35
+ select: ["value"],
36
+ expand: [{ name: "EnvironmentVariableDefinitionId", select: ["defaultvalue", "schemaname"] }],
37
+ });
38
+ let aVals = unwrapResult(valResult);
39
+
40
+ // If value record exists, return it
41
+ if (Array.isArray(aVals) && aVals.length > 0 && aVals[0].value) {
42
+ return aVals[0].value;
43
+ }
44
+
45
+ // No value record — fall back to definition default value
46
+ let defResult = await client.retrieveMultipleRecordsAsync("environmentvariabledefinitions", {
47
+ filter: "schemaname eq '" + sSchemaName + "'",
48
+ select: ["defaultvalue"],
49
+ });
50
+ let aDefs = unwrapResult(defResult);
51
+ if (!Array.isArray(aDefs) || aDefs.length === 0) {
52
+ throw new Error("Environment variable not found: " + sSchemaName);
53
+ }
54
+ return aDefs[0].defaultvalue || "";
55
+ }
@@ -1,97 +1,97 @@
1
- import { getClient } from "@microsoft/power-apps/data";
2
-
3
- // ── Data source name (must match the generated connector data source name) ──
4
- const DATA_SOURCE = "office365groups";
5
-
6
- const GROUPS_APIS = {
7
- ListOwnedGroups: {
8
- path: "/{connectionId}/v1.0/me/memberOf/$/microsoft.graph.group",
9
- method: "GET",
10
- parameters: [
11
- { name: "connectionId", in: "path", required: true },
12
- ],
13
- },
14
- ListGroupMembers: {
15
- path: "/{connectionId}/v1.0/groups/{groupId}/members",
16
- method: "GET",
17
- parameters: [
18
- { name: "connectionId", in: "path", required: true },
19
- { name: "groupId", in: "path", required: true },
20
- { name: "$top", in: "query", required: false },
21
- ],
22
- },
23
- HttpRequest: {
24
- path: "/{connectionId}/httprequest",
25
- method: "POST",
26
- parameters: [
27
- { name: "connectionId", in: "path", required: true },
28
- ],
29
- },
30
- };
31
-
32
- // ── Initialize SDK client for the Office 365 Groups connector ──
33
- function initClient() {
34
- const dataSourcesInfo = {
35
- [DATA_SOURCE]: {
36
- tableId: "",
37
- version: "",
38
- primaryKey: "",
39
- dataSourceType: "Connector",
40
- apis: GROUPS_APIS,
41
- },
42
- };
43
- return getClient(dataSourcesInfo);
44
- }
45
-
46
- // ── Internal: execute a connector operation ────────────────────
47
- async function execOp(operationName, parameters) {
48
- const client = await initClient();
49
- const result = await client.executeAsync({
50
- connectorOperation: {
51
- tableName: DATA_SOURCE,
52
- operationName,
53
- parameters,
54
- },
55
- });
56
-
57
- if (!result.success) {
58
- throw new Error(result.error?.message || "Operation failed");
59
- }
60
-
61
- return Object.prototype.hasOwnProperty.call(result, "data") ? result.data : result;
62
- }
63
-
64
- // ═══════════════════════════════════════════════════════════════
65
- // GENERIC
66
- // ═══════════════════════════════════════════════════════════════
67
-
68
- // ── Call any Office 365 Groups operation by name ───────────────
69
- export async function callGroupsOperation(operationName, parameters = {}) {
70
- return execOp(operationName, parameters);
71
- }
72
-
73
- // ── Open HTTP Request ──────────────────────────────────────────
74
- export async function openHttpRequest({ method = "GET", uri, headers, body }) {
75
- return execOp("HttpRequest", {
76
- method,
77
- uri,
78
- headers: headers || {},
79
- body: body || "",
80
- });
81
- }
82
-
83
- // ═══════════════════════════════════════════════════════════════
84
- // GROUPS
85
- // ═══════════════════════════════════════════════════════════════
86
-
87
- // ── List My Groups ─────────────────────────────────────────────
88
- export async function listMyGroups() {
89
- return execOp("ListOwnedGroups", {});
90
- }
91
-
92
- // ── List Members of a Group ────────────────────────────────────
93
- export async function listGroupMembers(groupId) {
94
- return execOp("ListGroupMembers", {
95
- groupId,
96
- });
97
- }
1
+ import { getClient } from "@microsoft/power-apps/data";
2
+
3
+ // ── Data source name (must match the generated connector data source name) ──
4
+ const DATA_SOURCE = "office365groups";
5
+
6
+ const GROUPS_APIS = {
7
+ ListOwnedGroups: {
8
+ path: "/{connectionId}/v1.0/me/memberOf/$/microsoft.graph.group",
9
+ method: "GET",
10
+ parameters: [
11
+ { name: "connectionId", in: "path", required: true },
12
+ ],
13
+ },
14
+ ListGroupMembers: {
15
+ path: "/{connectionId}/v1.0/groups/{groupId}/members",
16
+ method: "GET",
17
+ parameters: [
18
+ { name: "connectionId", in: "path", required: true },
19
+ { name: "groupId", in: "path", required: true },
20
+ { name: "$top", in: "query", required: false },
21
+ ],
22
+ },
23
+ HttpRequest: {
24
+ path: "/{connectionId}/httprequest",
25
+ method: "POST",
26
+ parameters: [
27
+ { name: "connectionId", in: "path", required: true },
28
+ ],
29
+ },
30
+ };
31
+
32
+ // ── Initialize SDK client for the Office 365 Groups connector ──
33
+ function initClient() {
34
+ const dataSourcesInfo = {
35
+ [DATA_SOURCE]: {
36
+ tableId: "",
37
+ version: "",
38
+ primaryKey: "",
39
+ dataSourceType: "Connector",
40
+ apis: GROUPS_APIS,
41
+ },
42
+ };
43
+ return getClient(dataSourcesInfo);
44
+ }
45
+
46
+ // ── Internal: execute a connector operation ────────────────────
47
+ async function execOp(operationName, parameters) {
48
+ const client = await initClient();
49
+ const result = await client.executeAsync({
50
+ connectorOperation: {
51
+ tableName: DATA_SOURCE,
52
+ operationName,
53
+ parameters,
54
+ },
55
+ });
56
+
57
+ if (!result.success) {
58
+ throw new Error(result.error?.message || "Operation failed");
59
+ }
60
+
61
+ return Object.prototype.hasOwnProperty.call(result, "data") ? result.data : result;
62
+ }
63
+
64
+ // ═══════════════════════════════════════════════════════════════
65
+ // GENERIC
66
+ // ═══════════════════════════════════════════════════════════════
67
+
68
+ // ── Call any Office 365 Groups operation by name ───────────────
69
+ export async function callGroupsOperation(operationName, parameters = {}) {
70
+ return execOp(operationName, parameters);
71
+ }
72
+
73
+ // ── Open HTTP Request ──────────────────────────────────────────
74
+ export async function openHttpRequest({ method = "GET", uri, headers, body }) {
75
+ return execOp("HttpRequest", {
76
+ method,
77
+ uri,
78
+ headers: headers || {},
79
+ body: body || "",
80
+ });
81
+ }
82
+
83
+ // ═══════════════════════════════════════════════════════════════
84
+ // GROUPS
85
+ // ═══════════════════════════════════════════════════════════════
86
+
87
+ // ── List My Groups ─────────────────────────────────────────────
88
+ export async function listMyGroups() {
89
+ return execOp("ListOwnedGroups", {});
90
+ }
91
+
92
+ // ── List Members of a Group ────────────────────────────────────
93
+ export async function listGroupMembers(groupId) {
94
+ return execOp("ListGroupMembers", {
95
+ groupId,
96
+ });
97
+ }