codeapp-js 1.0.2 → 1.1.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.
- package/AI/skills/autoreview/SKILL.md +69 -0
- package/AI/skills/connections/SKILL.md +4 -4
- package/AI/skills/dataverse/SKILL.md +4 -2
- package/AI/skills/keyvault/SKILL.md +139 -0
- package/AI/skills/office365-groups/SKILL.md +46 -25
- package/AI/skills/office365-outlook/SKILL.md +56 -25
- package/AI/skills/office365-users/SKILL.md +41 -36
- package/AI/skills/sharepoint/SKILL.md +174 -31
- package/AI/skills/start/SKILL.md +1 -0
- package/codeApp/dist/connectors/autoreview.js +1654 -0
- package/codeApp/dist/connectors/office365groups.js +2995 -432
- package/{examples/outlook Demo/.power/schemas/office365/office365.Schema.json → codeApp/dist/connectors/office365outlook.js} +7439 -16
- package/codeApp/dist/connectors/office365users.js +2990 -349
- package/codeApp/dist/connectors/sharepoint.js +529 -308
- package/examples/combined demo/dist/connectors/office365outlook.js +28521 -0
- package/examples/combined demo/dist/connectors/office365users.js +3154 -0
- package/examples/combined demo/dist/index.js +2 -6
- package/examples/combined demo/power.config.json +1 -1
- package/examples/groups Demo/{.power/schemas/office365groups/office365groups.Schema.json → dist/connectors/office365groups.js } +3205 -2204
- package/examples/groups Demo/dist/index.js +1 -5
- package/examples/groups Demo/power.config.json +1 -1
- package/examples/myProfile/dist/connectors/office365users.js +3154 -0
- package/examples/myProfile/dist/index.js +1 -5
- package/examples/myProfile/power.config.json +1 -1
- package/examples/outlook Demo/dist/connectors/office365outlook.js +28521 -0
- package/examples/outlook Demo/dist/index.js +2 -5
- package/examples/outlook Demo/power.config.json +1 -1
- package/examples/sharePoint Demo/dist/connectors/sharepoint.js +687 -0
- package/examples/sharePoint Demo/dist/index.js +86 -127
- package/examples/sharePoint Demo/power.config.json +1 -1
- package/package.json +1 -1
- package/codeApp/.power/schemas/appschemas/dataSourcesInfo.ts +0 -6275
- package/codeApp/.power/schemas/jira/jira.Schema.json +0 -6903
- package/codeApp/.power/schemas/keyvault/keyvault.Schema.json +0 -1600
- package/codeApp/.power/schemas/office365groups/office365groups.Schema.json +0 -2204
- package/codeApp/.power/schemas/teams/teams.Schema.json +0 -11112
- package/codeApp/dist/connectors/outlook.js +0 -1393
- package/codeApp/src/generated/models/AzureKeyVaultModel.ts +0 -107
- package/codeApp/src/generated/models/JiraModel.ts +0 -501
- package/codeApp/src/generated/models/Office365GroupsModel.ts +0 -363
- package/codeApp/src/generated/models/Office365OutlookModel.ts +0 -2046
- package/codeApp/src/generated/models/Office365UsersModel.ts +0 -254
- package/codeApp/src/generated/services/AzureKeyVaultService.ts +0 -257
- package/codeApp/src/generated/services/JiraService.ts +0 -1124
- package/codeApp/src/generated/services/Office365GroupsService.ts +0 -326
- package/codeApp/src/generated/services/Office365OutlookService.ts +0 -2476
- package/codeApp/src/generated/services/Office365UsersService.ts +0 -358
- package/examples/apps/kanban/dist/dataverse.js +0 -94
- package/examples/apps/kanban/dist/environmentVar.js +0 -55
- package/examples/apps/kanban/dist/index.css +0 -605
- package/examples/apps/kanban/dist/index.html +0 -21
- package/examples/apps/kanban/dist/index.js +0 -860
- package/examples/apps/kanban/dist/office365groups.js +0 -97
- package/examples/apps/kanban/dist/office365users.js +0 -451
- package/examples/apps/kanban/dist/outlook.js +0 -162
- package/examples/apps/kanban/dist/power-apps-data.js +0 -2953
- package/examples/apps/kanban/dist/sharepoint.js +0 -435
- package/examples/apps/kanban/power.config.json +0 -35
- package/examples/apps/kanban/src/generated/index.ts +0 -14
- package/examples/apps/kanban/src/generated/models/Office365GroupsModel.ts +0 -363
- package/examples/apps/kanban/src/generated/models/Office365OutlookModel.ts +0 -2046
- package/examples/apps/kanban/src/generated/models/Office365UsersModel.ts +0 -254
- package/examples/apps/kanban/src/generated/services/Office365GroupsService.ts +0 -326
- package/examples/apps/kanban/src/generated/services/Office365OutlookService.ts +0 -2476
- package/examples/apps/kanban/src/generated/services/Office365UsersService.ts +0 -358
- package/examples/apps/planning Poker/additional files/AgilePoker_1_0_0_1.zip +0 -0
- package/examples/apps/planning Poker/additional files/PokerTables_1_0_0_1.zip +0 -0
- package/examples/apps/planning Poker/additional files/customizations (tables).xml +0 -6429
- package/examples/apps/planning Poker/additional files/dataverse-tables.json +0 -165
- package/examples/apps/planning Poker/additional files/readme.md +0 -122
- package/examples/apps/planning Poker/dist/dataverse.js +0 -78
- package/examples/apps/planning Poker/dist/index.html +0 -198
- package/examples/apps/planning Poker/dist/index.js +0 -955
- package/examples/apps/planning Poker/dist/power-apps-data.js +0 -2953
- package/examples/apps/planning Poker/dist/styles.css +0 -815
- package/examples/apps/planning Poker/power.config.json +0 -50
- package/examples/apps/solution explorer/dist/codeapp.js +0 -1098
- package/examples/apps/solution explorer/dist/icon-512.png +0 -0
- package/examples/apps/solution explorer/dist/index.html +0 -80
- package/examples/apps/solution explorer/dist/index.js +0 -735
- package/examples/apps/solution explorer/dist/power-apps-data.js +0 -3007
- package/examples/apps/solution explorer/dist/styles.css +0 -571
- package/examples/apps/solution explorer/power.config.json +0 -151
- package/examples/apps/todo/dist/dataverse.js +0 -64
- package/examples/apps/todo/dist/icon192.png +0 -0
- package/examples/apps/todo/dist/index.html +0 -75
- package/examples/apps/todo/dist/index.js +0 -9
- package/examples/apps/todo/dist/power-apps-data.js +0 -2953
- package/examples/apps/todo/dist/renderer.js +0 -375
- package/examples/apps/todo/dist/styles.css +0 -691
- package/examples/apps/todo/power.config.json +0 -35
- package/examples/combined demo/.power/schemas/appschemas/dataSourcesInfo.ts +0 -6275
- package/examples/combined demo/.power/schemas/jira/jira.Schema.json +0 -6903
- package/examples/combined demo/.power/schemas/keyvault/keyvault.Schema.json +0 -1600
- package/examples/combined demo/.power/schemas/teams/teams.Schema.json +0 -11112
- package/examples/combined demo/dist/office365users.js +0 -513
- package/examples/combined demo/dist/outlook.js +0 -1393
- package/examples/combined demo/src/generated/index.ts +0 -12
- package/examples/combined demo/src/generated/models/AzureKeyVaultModel.ts +0 -107
- package/examples/combined demo/src/generated/models/JiraModel.ts +0 -501
- package/examples/combined demo/src/generated/models/Office365GroupsModel.ts +0 -363
- package/examples/combined demo/src/generated/models/Office365OutlookModel.ts +0 -2046
- package/examples/combined demo/src/generated/models/Office365UsersModel.ts +0 -254
- package/examples/combined demo/src/generated/services/AzureKeyVaultService.ts +0 -257
- package/examples/combined demo/src/generated/services/JiraService.ts +0 -1124
- package/examples/combined demo/src/generated/services/Office365GroupsService.ts +0 -326
- package/examples/combined demo/src/generated/services/Office365OutlookService.ts +0 -2476
- package/examples/combined demo/src/generated/services/Office365UsersService.ts +0 -358
- package/examples/groups Demo/.power/schemas/appschemas/dataSourcesInfo.ts +0 -613
- package/examples/groups Demo/dist/office365groups.js +0 -642
- package/examples/groups Demo/src/generated/index.ts +0 -10
- package/examples/groups Demo/src/generated/models/Office365GroupsModel.ts +0 -363
- package/examples/groups Demo/src/generated/services/Office365GroupsService.ts +0 -326
- package/examples/myProfile/dist/office365users.js +0 -517
- package/examples/outlook Demo/.power/schemas/appschemas/dataSourcesInfo.ts +0 -6512
- package/examples/outlook Demo/dist/outlook.js +0 -1393
- package/examples/outlook Demo/src/generated/index.ts +0 -10
- package/examples/outlook Demo/src/generated/models/Office365OutlookModel.ts +0 -2046
- package/examples/outlook Demo/src/generated/services/Office365OutlookService.ts +0 -2476
- package/examples/sharePoint Demo/dist/sharepoint.js +0 -466
- package/examples/sharePoint Demo/src/generated/index.ts +0 -14
- package/examples/sharePoint Demo/src/generated/models/Office365GroupsModel.ts +0 -363
- package/examples/sharePoint Demo/src/generated/models/Office365OutlookModel.ts +0 -2046
- package/examples/sharePoint Demo/src/generated/models/Office365UsersModel.ts +0 -254
- package/examples/sharePoint Demo/src/generated/services/Office365GroupsService.ts +0 -326
- package/examples/sharePoint Demo/src/generated/services/Office365OutlookService.ts +0 -2476
- package/examples/sharePoint Demo/src/generated/services/Office365UsersService.ts +0 -358
- package/readme.md +0 -590
|
@@ -1,513 +0,0 @@
|
|
|
1
|
-
// ────────────────────────────────────────────────────────────────────────────
|
|
2
|
-
// ─────────────────────────────── O365 User ──────────────────────────────────
|
|
3
|
-
// ────────────────────────────────────────────────────────────────────────────
|
|
4
|
-
|
|
5
|
-
// ── Data source name (must match connectionReferences in power.config.json) ──
|
|
6
|
-
import {unwrapResult,_dbgWrap } from "./codeapp.js";
|
|
7
|
-
import {getClient } from "./power-apps-data.js";
|
|
8
|
-
const DATA_SOURCE_USERS = "office365users";
|
|
9
|
-
|
|
10
|
-
const USERS_APIS = {
|
|
11
|
-
UpdateMyProfile: {
|
|
12
|
-
path: "/{connectionId}/codeless/v1.0/me",
|
|
13
|
-
method: "PATCH",
|
|
14
|
-
parameters: [
|
|
15
|
-
{ name: "connectionId", in: "path", required: true },
|
|
16
|
-
{ name: "body", in: "body", required: false },
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
MyProfile_V2: {
|
|
20
|
-
path: "/{connectionId}/codeless/v1.0/me",
|
|
21
|
-
method: "GET",
|
|
22
|
-
parameters: [
|
|
23
|
-
{ name: "connectionId", in: "path", required: true },
|
|
24
|
-
{ name: "$select", in: "query", required: false },
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
UpdateMyPhoto: {
|
|
28
|
-
path: "/{connectionId}/codeless/v1.0/me/photo/$value",
|
|
29
|
-
method: "PUT",
|
|
30
|
-
parameters: [
|
|
31
|
-
{ name: "connectionId", in: "path", required: true },
|
|
32
|
-
{ name: "body", in: "body", required: true },
|
|
33
|
-
{ name: "Content_Type", in: "header", required: true },
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
MyTrendingDocuments: {
|
|
37
|
-
path: "/{connectionId}/codeless/v1.0/me/insights/trending",
|
|
38
|
-
method: "GET",
|
|
39
|
-
parameters: [
|
|
40
|
-
{ name: "connectionId", in: "path", required: true },
|
|
41
|
-
{ name: "$filter", in: "query", required: false },
|
|
42
|
-
{ name: "extractSensitivityLabel", in: "query", required: false },
|
|
43
|
-
{ name: "fetchSensitivityLabelMetadata", in: "query", required: false },
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
RelevantPeople: {
|
|
47
|
-
path: "/{connectionId}/codeless/v1.0/users/{userId}/people",
|
|
48
|
-
method: "GET",
|
|
49
|
-
parameters: [
|
|
50
|
-
{ name: "connectionId", in: "path", required: true },
|
|
51
|
-
{ name: "userId", in: "path", required: true },
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
UserProfile_V2: {
|
|
55
|
-
path: "/{connectionId}/codeless/v1.0/users/{id}",
|
|
56
|
-
method: "GET",
|
|
57
|
-
parameters: [
|
|
58
|
-
{ name: "connectionId", in: "path", required: true },
|
|
59
|
-
{ name: "id", in: "path", required: true },
|
|
60
|
-
{ name: "$select", in: "query", required: false },
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
UserPhotoMetadata: {
|
|
64
|
-
path: "/{connectionId}/codeless/v1.0/users/{userId}/photo",
|
|
65
|
-
method: "GET",
|
|
66
|
-
parameters: [
|
|
67
|
-
{ name: "connectionId", in: "path", required: true },
|
|
68
|
-
{ name: "userId", in: "path", required: true },
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
Manager_V2: {
|
|
72
|
-
path: "/{connectionId}/codeless/v1.0/users/{id}/manager",
|
|
73
|
-
method: "GET",
|
|
74
|
-
parameters: [
|
|
75
|
-
{ name: "connectionId", in: "path", required: true },
|
|
76
|
-
{ name: "id", in: "path", required: true },
|
|
77
|
-
{ name: "$select", in: "query", required: false },
|
|
78
|
-
],
|
|
79
|
-
},
|
|
80
|
-
DirectReports_V2: {
|
|
81
|
-
path: "/{connectionId}/codeless/v1.0/users/{id}/directReports",
|
|
82
|
-
method: "GET",
|
|
83
|
-
parameters: [
|
|
84
|
-
{ name: "connectionId", in: "path", required: true },
|
|
85
|
-
{ name: "id", in: "path", required: true },
|
|
86
|
-
{ name: "$select", in: "query", required: false },
|
|
87
|
-
{ name: "$top", in: "query", required: false },
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
UserPhoto_V2: {
|
|
91
|
-
path: "/{connectionId}/codeless/v1.0/users/{id}/photo/$value",
|
|
92
|
-
method: "GET",
|
|
93
|
-
parameters: [
|
|
94
|
-
{ name: "connectionId", in: "path", required: true },
|
|
95
|
-
{ name: "id", in: "path", required: true },
|
|
96
|
-
],
|
|
97
|
-
responseInfo: { "200": "image/jpeg" },
|
|
98
|
-
},
|
|
99
|
-
TrendingDocuments: {
|
|
100
|
-
path: "/{connectionId}/codeless/v1.0/users/{id}/insights/trending",
|
|
101
|
-
method: "GET",
|
|
102
|
-
parameters: [
|
|
103
|
-
{ name: "connectionId", in: "path", required: true },
|
|
104
|
-
{ name: "id", in: "path", required: true },
|
|
105
|
-
{ name: "$filter", in: "query", required: false },
|
|
106
|
-
{ name: "extractSensitivityLabel", in: "query", required: false },
|
|
107
|
-
{ name: "fetchSensitivityLabelMetadata", in: "query", required: false },
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
SearchUserV2: {
|
|
111
|
-
path: "/{connectionId}/codeless/v1.0/users",
|
|
112
|
-
method: "GET",
|
|
113
|
-
parameters: [
|
|
114
|
-
{ name: "connectionId", in: "path", required: true },
|
|
115
|
-
{ name: "searchTerm", in: "query", required: false },
|
|
116
|
-
{ name: "top", in: "query", required: false },
|
|
117
|
-
{ name: "isSearchTermRequired", in: "query", required: false },
|
|
118
|
-
{ name: "skipToken", in: "query", required: false },
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
SearchUser_V2: {
|
|
122
|
-
path: "/{connectionId}/codeless/v1.0/users",
|
|
123
|
-
method: "GET",
|
|
124
|
-
parameters: [
|
|
125
|
-
{ name: "connectionId", in: "path", required: true },
|
|
126
|
-
{ name: "searchTerm", in: "query", required: false },
|
|
127
|
-
{ name: "top", in: "query", required: false },
|
|
128
|
-
{ name: "isSearchTermRequired", in: "query", required: false },
|
|
129
|
-
{ name: "skipToken", in: "query", required: false },
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
HttpRequest: {
|
|
133
|
-
path: "/{connectionId}/codeless/v1.0/httprequest",
|
|
134
|
-
method: "POST",
|
|
135
|
-
parameters: [
|
|
136
|
-
{ name: "connectionId", in: "path", required: true },
|
|
137
|
-
{ name: "Uri", in: "header", required: true },
|
|
138
|
-
{ name: "Method", in: "header", required: true },
|
|
139
|
-
{ name: "Body", in: "body", required: false },
|
|
140
|
-
{ name: "ContentType", in: "header", required: false },
|
|
141
|
-
{ name: "CustomHeader1", in: "header", required: false },
|
|
142
|
-
{ name: "CustomHeader2", in: "header", required: false },
|
|
143
|
-
{ name: "CustomHeader3", in: "header", required: false },
|
|
144
|
-
{ name: "CustomHeader4", in: "header", required: false },
|
|
145
|
-
{ name: "CustomHeader5", in: "header", required: false },
|
|
146
|
-
],
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// ── Initialize SDK client for the Office 365 Users connector ───
|
|
151
|
-
function initUsersClient() {
|
|
152
|
-
const dataSourcesInfo = {
|
|
153
|
-
[DATA_SOURCE_USERS]: {
|
|
154
|
-
tableId: "",
|
|
155
|
-
version: "",
|
|
156
|
-
primaryKey: "",
|
|
157
|
-
dataSourceType: "Connector",
|
|
158
|
-
apis: USERS_APIS,
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
return getClient(dataSourcesInfo);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function isUsersObject(oValue) {
|
|
165
|
-
return !!oValue && typeof oValue === "object" && !Array.isArray(oValue);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function pickUsersValue() {
|
|
169
|
-
for (let iIndex = 0; iIndex < arguments.length; iIndex += 1) {
|
|
170
|
-
const oValue = arguments[iIndex];
|
|
171
|
-
if (oValue !== undefined && oValue !== null) return oValue;
|
|
172
|
-
}
|
|
173
|
-
return undefined;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function setUsersIfDefined(oTarget, sKey, oValue) {
|
|
177
|
-
if (oValue !== undefined && oValue !== null) {
|
|
178
|
-
oTarget[sKey] = oValue;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function normalizeUsersSelect(oValue) {
|
|
183
|
-
if (Array.isArray(oValue)) return oValue.join(",");
|
|
184
|
-
return oValue;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function normalizeUsersSelectOptions(oOptions) {
|
|
188
|
-
if (isUsersObject(oOptions)) return oOptions;
|
|
189
|
-
if (oOptions === undefined || oOptions === null) return {};
|
|
190
|
-
return { select: oOptions };
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function normalizeUsersDirectReportsOptions(oOptions) {
|
|
194
|
-
if (isUsersObject(oOptions)) return oOptions;
|
|
195
|
-
if (typeof oOptions === "number") return { top: oOptions };
|
|
196
|
-
if (oOptions === undefined || oOptions === null) return {};
|
|
197
|
-
return { select: oOptions };
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function normalizeUsersSearchOptions(oOptions) {
|
|
201
|
-
if (typeof oOptions === "string") return { searchTerm: oOptions };
|
|
202
|
-
return isUsersObject(oOptions) ? oOptions : {};
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function normalizeUsersTrendingOptions(oOptions) {
|
|
206
|
-
if (typeof oOptions === "string") return { filter: oOptions };
|
|
207
|
-
return isUsersObject(oOptions) ? oOptions : {};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
function extractUsersSkipToken(sNextLink) {
|
|
211
|
-
if (!sNextLink || typeof sNextLink !== "string") return undefined;
|
|
212
|
-
|
|
213
|
-
try {
|
|
214
|
-
const oUrl = new URL(sNextLink);
|
|
215
|
-
return pickUsersValue(
|
|
216
|
-
oUrl.searchParams.get("skipToken"),
|
|
217
|
-
oUrl.searchParams.get("$skiptoken"),
|
|
218
|
-
oUrl.searchParams.get("$skipToken"),
|
|
219
|
-
oUrl.searchParams.get("skiptoken")
|
|
220
|
-
);
|
|
221
|
-
} catch (oError) {
|
|
222
|
-
return undefined;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function getUsersHeaderValue(oHeaders, sName) {
|
|
227
|
-
if (!isUsersObject(oHeaders)) return undefined;
|
|
228
|
-
|
|
229
|
-
const sMatch = String(sName).toLowerCase();
|
|
230
|
-
const aEntries = Object.entries(oHeaders);
|
|
231
|
-
for (let iIndex = 0; iIndex < aEntries.length; iIndex += 1) {
|
|
232
|
-
const [sHeaderName, oValue] = aEntries[iIndex];
|
|
233
|
-
if (String(sHeaderName).toLowerCase() === sMatch) {
|
|
234
|
-
return oValue;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return undefined;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function normalizeUsersCustomHeaders(oHeaders, aCustomHeaders) {
|
|
241
|
-
const aResolved = Array.isArray(aCustomHeaders) ? aCustomHeaders.filter((oValue) => oValue != null) : [];
|
|
242
|
-
|
|
243
|
-
if (!isUsersObject(oHeaders)) return aResolved.slice(0, 5);
|
|
244
|
-
|
|
245
|
-
const aEntries = Object.entries(oHeaders);
|
|
246
|
-
for (let iIndex = 0; iIndex < aEntries.length; iIndex += 1) {
|
|
247
|
-
const [sHeaderName, oValue] = aEntries[iIndex];
|
|
248
|
-
if (oValue === undefined || oValue === null) continue;
|
|
249
|
-
if (String(sHeaderName).toLowerCase() === "content-type") continue;
|
|
250
|
-
aResolved.push(String(sHeaderName) + ": " + String(oValue));
|
|
251
|
-
if (aResolved.length >= 5) break;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return aResolved.slice(0, 5);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// ── Internal: execute a connector operation ────────────────────
|
|
258
|
-
async function execUsersOp(operationName, parameters) {
|
|
259
|
-
const client = await initUsersClient();
|
|
260
|
-
const result = await client.executeAsync({
|
|
261
|
-
connectorOperation: {
|
|
262
|
-
tableName: DATA_SOURCE_USERS,
|
|
263
|
-
operationName,
|
|
264
|
-
parameters,
|
|
265
|
-
},
|
|
266
|
-
});
|
|
267
|
-
return unwrapResult(result);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// ═══════════════════════════════════════════════════════════════
|
|
271
|
-
// GENERIC
|
|
272
|
-
// ═══════════════════════════════════════════════════════════════
|
|
273
|
-
|
|
274
|
-
// ── Call any Office 365 Users operation by name ────────────────
|
|
275
|
-
export async function callUsersOperation(operationName, parameters = {}) {
|
|
276
|
-
return _dbgWrap('callUsersOperation', [operationName, parameters], async function() {
|
|
277
|
-
return execUsersOp(operationName, parameters);
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// ── Open HTTP Request ──────────────────────────────────────────
|
|
282
|
-
export async function openUsersHttpRequest({ method = "GET", uri, headers, body, contentType, customHeaders } = {}) {
|
|
283
|
-
return _dbgWrap('openUsersHttpRequest', [{ method, uri, headers, body, contentType, customHeaders }], async function() {
|
|
284
|
-
const aHeaders = normalizeUsersCustomHeaders(headers, customHeaders);
|
|
285
|
-
return execUsersOp("HttpRequest", {
|
|
286
|
-
Uri: uri,
|
|
287
|
-
Method: method,
|
|
288
|
-
Body: body,
|
|
289
|
-
ContentType: pickUsersValue(contentType, getUsersHeaderValue(headers, "Content-Type")),
|
|
290
|
-
CustomHeader1: aHeaders[0],
|
|
291
|
-
CustomHeader2: aHeaders[1],
|
|
292
|
-
CustomHeader3: aHeaders[2],
|
|
293
|
-
CustomHeader4: aHeaders[3],
|
|
294
|
-
CustomHeader5: aHeaders[4],
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// ── Update My Profile ──────────────────────────────────────────
|
|
300
|
-
export async function updateMyProfile(oProfile = {}) {
|
|
301
|
-
return _dbgWrap('updateMyProfile', [oProfile], async function() {
|
|
302
|
-
const oBody = isUsersObject(oProfile) && "body" in oProfile ? oProfile.body : oProfile;
|
|
303
|
-
return execUsersOp("UpdateMyProfile", {
|
|
304
|
-
body: oBody,
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// ═══════════════════════════════════════════════════════════════
|
|
310
|
-
// PROFILE
|
|
311
|
-
// ═══════════════════════════════════════════════════════════════
|
|
312
|
-
|
|
313
|
-
// ── Get My Profile ─────────────────────────────────────────────
|
|
314
|
-
export async function getMyProfile(oOptions) {
|
|
315
|
-
return _dbgWrap('getMyProfile', [oOptions], async function() {
|
|
316
|
-
const oResolvedOptions = normalizeUsersSelectOptions(oOptions);
|
|
317
|
-
const params = {};
|
|
318
|
-
setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(oResolvedOptions.select, oResolvedOptions.$select)));
|
|
319
|
-
return execUsersOp("MyProfile_V2", params);
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// ── Get User Profile ───────────────────────────────────────────
|
|
324
|
-
export async function getUserProfile(userId, oOptions) {
|
|
325
|
-
return _dbgWrap('getUserProfile', [userId, oOptions], async function() {
|
|
326
|
-
if (isUsersObject(userId)) {
|
|
327
|
-
oOptions = userId;
|
|
328
|
-
userId = pickUsersValue(oOptions.userId, oOptions.id);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
const oResolvedOptions = normalizeUsersSelectOptions(oOptions);
|
|
332
|
-
const params = {
|
|
333
|
-
id: userId,
|
|
334
|
-
};
|
|
335
|
-
setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(oResolvedOptions.select, oResolvedOptions.$select)));
|
|
336
|
-
|
|
337
|
-
return execUsersOp("UserProfile_V2", {
|
|
338
|
-
...params,
|
|
339
|
-
});
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// ═══════════════════════════════════════════════════════════════
|
|
344
|
-
// MANAGER & REPORTS
|
|
345
|
-
// ═══════════════════════════════════════════════════════════════
|
|
346
|
-
|
|
347
|
-
// ── Get Manager ────────────────────────────────────────────────
|
|
348
|
-
export async function getManager(userId, oOptions) {
|
|
349
|
-
return _dbgWrap('getManager', [userId, oOptions], async function() {
|
|
350
|
-
if (isUsersObject(userId)) {
|
|
351
|
-
oOptions = userId;
|
|
352
|
-
userId = pickUsersValue(oOptions.userId, oOptions.id);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
const oResolvedOptions = normalizeUsersSelectOptions(oOptions);
|
|
356
|
-
const params = {
|
|
357
|
-
id: userId,
|
|
358
|
-
};
|
|
359
|
-
setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(oResolvedOptions.select, oResolvedOptions.$select)));
|
|
360
|
-
|
|
361
|
-
return execUsersOp("Manager_V2", {
|
|
362
|
-
...params,
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// ── Get Direct Reports ─────────────────────────────────────────
|
|
368
|
-
export async function getDirectReports(userId, oOptions) {
|
|
369
|
-
return _dbgWrap('getDirectReports', [userId, oOptions], async function() {
|
|
370
|
-
if (isUsersObject(userId)) {
|
|
371
|
-
oOptions = userId;
|
|
372
|
-
userId = pickUsersValue(oOptions.userId, oOptions.id);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
const oResolvedOptions = normalizeUsersDirectReportsOptions(oOptions);
|
|
376
|
-
const params = {
|
|
377
|
-
id: userId,
|
|
378
|
-
};
|
|
379
|
-
setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(oResolvedOptions.select, oResolvedOptions.$select)));
|
|
380
|
-
setUsersIfDefined(params, "$top", pickUsersValue(oResolvedOptions.top, oResolvedOptions.$top));
|
|
381
|
-
|
|
382
|
-
return execUsersOp("DirectReports_V2", {
|
|
383
|
-
...params,
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// ── Get My Trending Documents ──────────────────────────────────
|
|
389
|
-
export async function getMyTrendingDocuments(oOptions = {}) {
|
|
390
|
-
return _dbgWrap('getMyTrendingDocuments', [oOptions], async function() {
|
|
391
|
-
const oResolvedOptions = normalizeUsersTrendingOptions(oOptions);
|
|
392
|
-
const params = {};
|
|
393
|
-
setUsersIfDefined(params, "$filter", pickUsersValue(oResolvedOptions.filter, oResolvedOptions.$filter));
|
|
394
|
-
setUsersIfDefined(params, "extractSensitivityLabel", oResolvedOptions.extractSensitivityLabel);
|
|
395
|
-
setUsersIfDefined(params, "fetchSensitivityLabelMetadata", oResolvedOptions.fetchSensitivityLabelMetadata);
|
|
396
|
-
return execUsersOp("MyTrendingDocuments", params);
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// ── Get Relevant People ────────────────────────────────────────
|
|
401
|
-
export async function getRelevantPeople(userId) {
|
|
402
|
-
return _dbgWrap('getRelevantPeople', [userId], async function() {
|
|
403
|
-
if (isUsersObject(userId)) {
|
|
404
|
-
userId = pickUsersValue(userId.userId, userId.id);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
return execUsersOp("RelevantPeople", {
|
|
408
|
-
userId,
|
|
409
|
-
});
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// ═══════════════════════════════════════════════════════════════
|
|
414
|
-
// PHOTO
|
|
415
|
-
// ═══════════════════════════════════════════════════════════════
|
|
416
|
-
|
|
417
|
-
// ── Update My Photo ────────────────────────────────────────────
|
|
418
|
-
export async function updateMyPhoto(oBodyOrOptions, sContentType) {
|
|
419
|
-
return _dbgWrap('updateMyPhoto', [oBodyOrOptions, sContentType], async function() {
|
|
420
|
-
if (isUsersObject(oBodyOrOptions)) {
|
|
421
|
-
sContentType = pickUsersValue(
|
|
422
|
-
oBodyOrOptions.contentType,
|
|
423
|
-
oBodyOrOptions.Content_Type,
|
|
424
|
-
oBodyOrOptions.mimeType
|
|
425
|
-
);
|
|
426
|
-
oBodyOrOptions = pickUsersValue(
|
|
427
|
-
oBodyOrOptions.body,
|
|
428
|
-
oBodyOrOptions.content,
|
|
429
|
-
oBodyOrOptions.photo,
|
|
430
|
-
oBodyOrOptions.fileContent
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
return execUsersOp("UpdateMyPhoto", {
|
|
435
|
-
body: oBodyOrOptions,
|
|
436
|
-
Content_Type: sContentType,
|
|
437
|
-
});
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
// ── Get User Photo Metadata ────────────────────────────────────
|
|
442
|
-
export async function getUserPhotoMetadata(userId) {
|
|
443
|
-
return _dbgWrap('getUserPhotoMetadata', [userId], async function() {
|
|
444
|
-
if (isUsersObject(userId)) {
|
|
445
|
-
userId = pickUsersValue(userId.userId, userId.id);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
return execUsersOp("UserPhotoMetadata", {
|
|
449
|
-
userId,
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// ── Get User Photo ─────────────────────────────────────────────
|
|
455
|
-
export async function getUserPhoto(userId) {
|
|
456
|
-
return _dbgWrap('getUserPhoto', [userId], async function() {
|
|
457
|
-
if (isUsersObject(userId)) {
|
|
458
|
-
userId = pickUsersValue(userId.userId, userId.id);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
return execUsersOp("UserPhoto_V2", {
|
|
462
|
-
id: userId,
|
|
463
|
-
});
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// ── Get Trending Documents ─────────────────────────────────────
|
|
468
|
-
export async function getTrendingDocuments(userId, oOptions = {}) {
|
|
469
|
-
return _dbgWrap('getTrendingDocuments', [userId, oOptions], async function() {
|
|
470
|
-
if (isUsersObject(userId)) {
|
|
471
|
-
oOptions = userId;
|
|
472
|
-
userId = pickUsersValue(oOptions.userId, oOptions.id);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
const oResolvedOptions = normalizeUsersTrendingOptions(oOptions);
|
|
476
|
-
const params = {
|
|
477
|
-
id: userId,
|
|
478
|
-
};
|
|
479
|
-
setUsersIfDefined(params, "$filter", pickUsersValue(oResolvedOptions.filter, oResolvedOptions.$filter));
|
|
480
|
-
setUsersIfDefined(params, "extractSensitivityLabel", oResolvedOptions.extractSensitivityLabel);
|
|
481
|
-
setUsersIfDefined(params, "fetchSensitivityLabelMetadata", oResolvedOptions.fetchSensitivityLabelMetadata);
|
|
482
|
-
return execUsersOp("TrendingDocuments", params);
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
// ═══════════════════════════════════════════════════════════════
|
|
487
|
-
// SEARCH
|
|
488
|
-
// ═══════════════════════════════════════════════════════════════
|
|
489
|
-
|
|
490
|
-
// ── Search for Users ───────────────────────────────────────────
|
|
491
|
-
export async function searchForUsers(oOptions = {}) {
|
|
492
|
-
return _dbgWrap('searchForUsers', [oOptions], async function() {
|
|
493
|
-
const oResolvedOptions = normalizeUsersSearchOptions(oOptions);
|
|
494
|
-
const params = {};
|
|
495
|
-
setUsersIfDefined(params, "searchTerm", oResolvedOptions.searchTerm);
|
|
496
|
-
setUsersIfDefined(params, "top", pickUsersValue(oResolvedOptions.top, oResolvedOptions.$top));
|
|
497
|
-
setUsersIfDefined(params, "isSearchTermRequired", oResolvedOptions.isSearchTermRequired);
|
|
498
|
-
|
|
499
|
-
const oSkipToken = pickUsersValue(
|
|
500
|
-
oResolvedOptions.skipToken,
|
|
501
|
-
oResolvedOptions.$skipToken,
|
|
502
|
-
oResolvedOptions.$skiptoken,
|
|
503
|
-
extractUsersSkipToken(oResolvedOptions.nextLink),
|
|
504
|
-
oResolvedOptions.skip
|
|
505
|
-
);
|
|
506
|
-
|
|
507
|
-
if (oSkipToken !== undefined && oSkipToken !== null) {
|
|
508
|
-
params.skipToken = String(oSkipToken);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
return execUsersOp("SearchUserV2", params);
|
|
512
|
-
});
|
|
513
|
-
}
|