codeapp-js 0.2.2 → 1.0.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/codeapp.agent.md +105 -0
- package/AI/skills/connections/SKILL.md +47 -0
- package/AI/skills/dataverse/SKILL.md +99 -0
- package/AI/skills/environment-variables/SKILL.md +89 -0
- package/AI/skills/frontend-design/SKILL.md +34 -0
- package/AI/skills/jira/SKILL.md +81 -0
- package/AI/skills/office365-groups/SKILL.md +61 -0
- package/AI/skills/office365-outlook/SKILL.md +52 -0
- package/AI/skills/office365-users/SKILL.md +78 -0
- package/AI/skills/sharepoint/SKILL.md +77 -0
- package/AI/skills/sql/SKILL.md +85 -0
- package/AI/skills/start/SKILL.md +46 -0
- package/AI/skills/teams/SKILL.md +55 -0
- package/codeApp/.power/schemas/appschemas/dataSourcesInfo.ts +6275 -0
- package/codeApp/.power/schemas/jira/jira.Schema.json +6903 -0
- package/codeApp/.power/schemas/keyvault/keyvault.Schema.json +1600 -0
- package/{examples/combined demo/.power/schemas/office365groups/office365groups.Schema.json → codeApp/.power/schemas/office365groups/office365groups.Schema.json} +2203 -2203
- package/codeApp/.power/schemas/teams/teams.Schema.json +11112 -0
- package/codeApp/dist/codeapp.js +103 -1043
- package/codeApp/dist/connectors/azureKeyvault.js +459 -0
- package/codeApp/dist/connectors/jira.js +1247 -0
- package/codeApp/dist/connectors/office365groups.js +642 -0
- package/codeApp/dist/connectors/office365users.js +513 -0
- package/codeApp/dist/connectors/outlook.js +1393 -0
- package/{examples/kanban/dist → codeApp/dist/connectors}/sharepoint.js +466 -339
- package/codeApp/dist/connectors/sql.js +149 -0
- package/codeApp/dist/connectors/teams.js +280 -0
- package/codeApp/dist/index.js +1 -1
- package/codeApp/dist/power-apps-data.js +725 -176
- package/codeApp/src/generated/index.ts +12 -0
- package/codeApp/src/generated/models/AzureKeyVaultModel.ts +107 -0
- package/codeApp/src/generated/models/JiraModel.ts +501 -0
- package/codeApp/src/generated/services/AzureKeyVaultService.ts +257 -0
- package/codeApp/src/generated/services/JiraService.ts +1124 -0
- package/examples/{kanban → apps/kanban}/dist/dataverse.js +94 -94
- package/examples/{kanban → apps/kanban}/dist/index.css +605 -605
- package/examples/{kanban → apps/kanban}/dist/index.html +21 -21
- package/examples/{kanban → apps/kanban}/dist/index.js +860 -860
- package/examples/{kanban → apps/kanban}/dist/office365groups.js +97 -97
- package/examples/apps/kanban/dist/office365users.js +451 -0
- package/examples/{kanban → apps/kanban}/dist/outlook.js +162 -162
- package/examples/{planning Poker/dist/power-apps-data.js → apps/kanban/dist/power-apps-data.js} +2953 -2953
- package/{dev files/sharepoint.js → examples/apps/kanban/dist/sharepoint.js} +195 -99
- package/examples/{kanban → apps/kanban}/power.config.json +35 -35
- package/examples/{planning Poker → apps/planning Poker}/additional files/customizations (tables).xml +6428 -6428
- package/examples/{planning Poker → apps/planning Poker}/additional files/dataverse-tables.json +165 -165
- package/examples/{planning Poker → apps/planning Poker}/additional files/readme.md +122 -122
- package/examples/{planning Poker → apps/planning Poker}/dist/dataverse.js +78 -78
- package/examples/{planning Poker → apps/planning Poker}/dist/index.html +198 -198
- package/examples/{planning Poker → apps/planning Poker}/dist/index.js +954 -954
- package/examples/{kanban/dist/power-apps-data.js → apps/planning Poker/dist/power-apps-data.js } +2953 -2953
- package/examples/{planning Poker → apps/planning Poker}/dist/styles.css +815 -815
- package/examples/{planning Poker → apps/planning Poker}/power.config.json +50 -50
- package/examples/{solution explorer → apps/solution explorer}/dist/codeapp.js +1098 -1098
- package/examples/{solution explorer → apps/solution explorer}/dist/index.html +80 -80
- package/examples/{solution explorer → apps/solution explorer}/dist/index.js +735 -735
- package/examples/{solution explorer → apps/solution explorer}/dist/styles.css +571 -571
- package/examples/{solution explorer → apps/solution explorer}/power.config.json +150 -150
- package/examples/{todo → apps/todo}/dist/dataverse.js +64 -64
- package/examples/{todo → apps/todo}/dist/index.html +75 -75
- package/examples/{todo → apps/todo}/dist/index.js +8 -8
- package/examples/{todo → apps/todo}/dist/power-apps-data.js +2953 -2953
- package/examples/{todo → apps/todo}/dist/renderer.js +375 -375
- package/examples/{todo → apps/todo}/dist/styles.css +691 -691
- package/examples/{todo → apps/todo}/power.config.json +34 -34
- package/examples/combined demo/.power/schemas/appschemas/dataSourcesInfo.ts +6275 -7830
- package/examples/combined demo/.power/schemas/jira/jira.Schema.json +6903 -0
- package/examples/combined demo/.power/schemas/keyvault/keyvault.Schema.json +1600 -0
- package/examples/combined demo/.power/schemas/teams/teams.Schema.json +11112 -0
- package/examples/combined demo/dist/codeapp.js +394 -1098
- package/examples/combined demo/dist/index.html +29 -511
- package/examples/combined demo/dist/index.js +490 -470
- package/examples/combined demo/dist/office365users.js +513 -0
- package/examples/combined demo/dist/outlook.js +1393 -0
- package/examples/combined demo/dist/power-apps-data.js +3079 -3006
- package/examples/combined demo/dist/styles.css +483 -0
- package/examples/combined demo/power.config.json +33 -42
- package/examples/combined demo/src/generated/index.ts +12 -14
- package/examples/combined demo/src/generated/models/AzureKeyVaultModel.ts +107 -0
- package/examples/combined demo/src/generated/models/JiraModel.ts +501 -0
- package/examples/combined demo/src/generated/services/AzureKeyVaultService.ts +257 -0
- package/examples/combined demo/src/generated/services/JiraService.ts +1124 -0
- package/examples/dataverse Demo/dist/codeapp.js +394 -1085
- package/examples/{outlook Demo2/OutlookDemo_1_0_0_1.zip → dataverse Demo/dist/icon-512.png} +0 -0
- package/examples/dataverse Demo/dist/index.html +146 -54
- package/examples/dataverse Demo/dist/index.js +693 -83
- package/examples/dataverse Demo/dist/power-apps-data.js +3079 -2911
- package/examples/dataverse Demo/dist/styles.css +528 -0
- package/examples/dataverse Demo/power.config.json +41 -35
- package/examples/dataverse Demo/readme.md +79 -79
- package/examples/groups Demo/dist/codeapp.js +394 -1085
- package/examples/groups Demo/dist/icon-512.png +0 -0
- package/examples/groups Demo/dist/index.html +21 -25
- package/examples/groups Demo/dist/index.js +304 -113
- package/examples/groups Demo/dist/office365groups.js +642 -0
- package/examples/groups Demo/dist/power-apps-data.js +3079 -2911
- package/examples/groups Demo/dist/styles.css +509 -0
- package/examples/groups Demo/power.config.json +25 -25
- package/examples/myProfile/dist/codeapp.js +398 -0
- package/examples/myProfile/dist/index.html +21 -184
- package/examples/myProfile/dist/index.js +324 -141
- package/examples/myProfile/dist/office365users.js +517 -169
- package/examples/myProfile/dist/power-apps-data.js +3080 -2953
- package/examples/myProfile/dist/styles.css +458 -0
- package/examples/myProfile/power.config.json +24 -23
- package/examples/outlook Demo/dist/codeapp.js +394 -1085
- package/examples/outlook Demo/dist/index.html +150 -35
- package/examples/outlook Demo/dist/index.js +516 -170
- package/examples/outlook Demo/dist/outlook.js +1393 -121
- package/examples/outlook Demo/dist/power-apps-data.js +3079 -2911
- package/examples/outlook Demo/dist/styles.css +408 -84
- package/examples/outlook Demo/power.config.json +24 -23
- package/examples/outlook Demo/readme.md +92 -82
- package/examples/sharePoint Demo/dist/codeapp.js +394 -1085
- package/examples/sharePoint Demo/dist/icon-512.png +0 -0
- package/examples/sharePoint Demo/dist/index.html +22 -255
- package/examples/sharePoint Demo/dist/index.js +899 -262
- package/examples/sharePoint Demo/dist/power-apps-data.js +3079 -2911
- package/examples/sharePoint Demo/dist/sharepoint.js +466 -0
- package/examples/sharePoint Demo/dist/styles.css +587 -0
- package/examples/sharePoint Demo/power.config.json +23 -22
- package/package.json +1 -1
- package/readme.md +479 -61
- package/.github/instructions/wyattdave.instructions.md +0 -39
- package/.vscode/settings.json +0 -6
- package/dev files/dataverse.js +0 -105
- package/dev files/office365groups.js +0 -65
- package/dev files/office365users.js +0 -169
- package/dev files/outlook.js +0 -330
- package/examples/combined demo/.power/schemas/office365/office365.Schema.json +0 -21098
- package/examples/combined demo/.power/schemas/office365users/office365users.Schema.json +0 -2094
- package/examples/kanban/agent/decision-log.md +0 -9
- package/examples/kanban/agent/mockup-01-editorial-glass.html +0 -159
- package/examples/kanban/agent/mockup-02-dark-rail.html +0 -147
- package/examples/kanban/agent/mockup-03-paper-grid.html +0 -114
- package/examples/kanban/agent/mockup-04-neon-minimal.html +0 -141
- package/examples/kanban/agent/mockup-05-mono-architect.html +0 -119
- package/examples/kanban/dist/environmentVar.js +0 -55
- package/examples/kanban/dist/office365users.js +0 -169
- package/examples/kanban/src/generated/index.ts +0 -14
- package/examples/outlook Demo2/agent/decision-log.md +0 -7
- package/examples/outlook Demo2/dist/codeapp.js +0 -1334
- package/examples/outlook Demo2/dist/index.html +0 -98
- package/examples/outlook Demo2/dist/index.js +0 -346
- package/examples/outlook Demo2/dist/styles.css +0 -639
- package/examples/outlook Demo2/power.config.json +0 -23
- package/examples/planning Poker/.vscode/settings.json +0 -5
- package/examples/sharePoint Demo/agent/decision-log.md +0 -17
- package/examples/solution explorer/agent/decision-log.md +0 -27
- package/examples/solution explorer/agent/mockup-01-swiss-grid.html +0 -452
- package/examples/solution explorer/agent/mockup-02-dark-glass.html +0 -496
- package/examples/solution explorer/agent/mockup-03-paper-console.html +0 -510
- package/examples/solution explorer/agent/mockup-04-neon-noir.html +0 -546
- package/examples/solution explorer/agent/mockup-05-zen-garden.html +0 -534
- package/examples/solution explorer/dist/power-apps-data.js +0 -3007
- package/scripts/build-power-sdk.mjs +0 -69
- /package/{examples/kanban → codeApp}/src/generated/models/Office365GroupsModel.ts +0 -0
- /package/{examples/kanban → codeApp}/src/generated/models/Office365OutlookModel.ts +0 -0
- /package/{examples/kanban → codeApp}/src/generated/models/Office365UsersModel.ts +0 -0
- /package/{examples/kanban → codeApp}/src/generated/services/Office365GroupsService.ts +0 -0
- /package/{examples/kanban → codeApp}/src/generated/services/Office365OutlookService.ts +0 -0
- /package/{examples/kanban → codeApp}/src/generated/services/Office365UsersService.ts +0 -0
- /package/{dev files → examples/apps/kanban/dist}/environmentVar.js +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/index.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/models/Office365GroupsModel.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/models/Office365OutlookModel.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/models/Office365UsersModel.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/services/Office365GroupsService.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/services/Office365OutlookService.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/services/Office365UsersService.ts +0 -0
- /package/examples/{planning Poker → apps/planning Poker}/additional files/AgilePoker_1_0_0_1.zip +0 -0
- /package/examples/{planning Poker → apps/planning Poker}/additional files/PokerTables_1_0_0_1.zip +0 -0
- /package/examples/{outlook Demo2 → apps/solution explorer}/dist/icon-512.png +0 -0
- /package/examples/{outlook Demo2 → apps/solution explorer}/dist/power-apps-data.js +0 -0
- /package/examples/{todo → apps/todo}/dist/icon192.png +0 -0
- /package/examples/{solution explorer → combined demo}/dist/icon-512.png +0 -0
|
@@ -1,169 +1,517 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
+
if (!Object.prototype.hasOwnProperty.call(USERS_APIS, operationName)) {
|
|
260
|
+
throw new Error("Office 365 Users operation metadata is not registered for: " + operationName);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const client = await initUsersClient();
|
|
264
|
+
const result = await client.executeAsync({
|
|
265
|
+
connectorOperation: {
|
|
266
|
+
tableName: DATA_SOURCE_USERS,
|
|
267
|
+
operationName,
|
|
268
|
+
parameters,
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
return unwrapResult(result);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// ═══════════════════════════════════════════════════════════════
|
|
275
|
+
// GENERIC
|
|
276
|
+
// ═══════════════════════════════════════════════════════════════
|
|
277
|
+
|
|
278
|
+
// ── Call any Office 365 Users operation by name ────────────────
|
|
279
|
+
export async function callUsersOperation(operationName, parameters = {}) {
|
|
280
|
+
return _dbgWrap('callUsersOperation', [operationName, parameters], async function() {
|
|
281
|
+
return execUsersOp(operationName, parameters);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// ── Open HTTP Request ──────────────────────────────────────────
|
|
286
|
+
export async function openUsersHttpRequest({ method = "GET", uri, headers, body, contentType, customHeaders } = {}) {
|
|
287
|
+
return _dbgWrap('openUsersHttpRequest', [{ method, uri, headers, body, contentType, customHeaders }], async function() {
|
|
288
|
+
const aHeaders = normalizeUsersCustomHeaders(headers, customHeaders);
|
|
289
|
+
return execUsersOp("HttpRequest", {
|
|
290
|
+
Uri: uri,
|
|
291
|
+
Method: method,
|
|
292
|
+
Body: body,
|
|
293
|
+
ContentType: pickUsersValue(contentType, getUsersHeaderValue(headers, "Content-Type")),
|
|
294
|
+
CustomHeader1: aHeaders[0],
|
|
295
|
+
CustomHeader2: aHeaders[1],
|
|
296
|
+
CustomHeader3: aHeaders[2],
|
|
297
|
+
CustomHeader4: aHeaders[3],
|
|
298
|
+
CustomHeader5: aHeaders[4],
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// ── Update My Profile ──────────────────────────────────────────
|
|
304
|
+
export async function updateMyProfile(oProfile = {}) {
|
|
305
|
+
return _dbgWrap('updateMyProfile', [oProfile], async function() {
|
|
306
|
+
const oBody = isUsersObject(oProfile) && "body" in oProfile ? oProfile.body : oProfile;
|
|
307
|
+
return execUsersOp("UpdateMyProfile", {
|
|
308
|
+
body: oBody,
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// ═══════════════════════════════════════════════════════════════
|
|
314
|
+
// PROFILE
|
|
315
|
+
// ═══════════════════════════════════════════════════════════════
|
|
316
|
+
|
|
317
|
+
// ── Get My Profile ─────────────────────────────────────────────
|
|
318
|
+
export async function getMyProfile(oOptions) {
|
|
319
|
+
return _dbgWrap('getMyProfile', [oOptions], async function() {
|
|
320
|
+
const oResolvedOptions = normalizeUsersSelectOptions(oOptions);
|
|
321
|
+
const params = {};
|
|
322
|
+
setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(oResolvedOptions.select, oResolvedOptions.$select)));
|
|
323
|
+
return execUsersOp("MyProfile_V2", params);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// ── Get User Profile ───────────────────────────────────────────
|
|
328
|
+
export async function getUserProfile(userId, oOptions) {
|
|
329
|
+
return _dbgWrap('getUserProfile', [userId, oOptions], async function() {
|
|
330
|
+
if (isUsersObject(userId)) {
|
|
331
|
+
oOptions = userId;
|
|
332
|
+
userId = pickUsersValue(oOptions.userId, oOptions.id);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const oResolvedOptions = normalizeUsersSelectOptions(oOptions);
|
|
336
|
+
const params = {
|
|
337
|
+
id: userId,
|
|
338
|
+
};
|
|
339
|
+
setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(oResolvedOptions.select, oResolvedOptions.$select)));
|
|
340
|
+
|
|
341
|
+
return execUsersOp("UserProfile_V2", {
|
|
342
|
+
...params,
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// ═══════════════════════════════════════════════════════════════
|
|
348
|
+
// MANAGER & REPORTS
|
|
349
|
+
// ═══════════════════════════════════════════════════════════════
|
|
350
|
+
|
|
351
|
+
// ── Get Manager ────────────────────────────────────────────────
|
|
352
|
+
export async function getManager(userId, oOptions) {
|
|
353
|
+
return _dbgWrap('getManager', [userId, oOptions], async function() {
|
|
354
|
+
if (isUsersObject(userId)) {
|
|
355
|
+
oOptions = userId;
|
|
356
|
+
userId = pickUsersValue(oOptions.userId, oOptions.id);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const oResolvedOptions = normalizeUsersSelectOptions(oOptions);
|
|
360
|
+
const params = {
|
|
361
|
+
id: userId,
|
|
362
|
+
};
|
|
363
|
+
setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(oResolvedOptions.select, oResolvedOptions.$select)));
|
|
364
|
+
|
|
365
|
+
return execUsersOp("Manager_V2", {
|
|
366
|
+
...params,
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// ── Get Direct Reports ─────────────────────────────────────────
|
|
372
|
+
export async function getDirectReports(userId, oOptions) {
|
|
373
|
+
return _dbgWrap('getDirectReports', [userId, oOptions], async function() {
|
|
374
|
+
if (isUsersObject(userId)) {
|
|
375
|
+
oOptions = userId;
|
|
376
|
+
userId = pickUsersValue(oOptions.userId, oOptions.id);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
const oResolvedOptions = normalizeUsersDirectReportsOptions(oOptions);
|
|
380
|
+
const params = {
|
|
381
|
+
id: userId,
|
|
382
|
+
};
|
|
383
|
+
setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(oResolvedOptions.select, oResolvedOptions.$select)));
|
|
384
|
+
setUsersIfDefined(params, "$top", pickUsersValue(oResolvedOptions.top, oResolvedOptions.$top));
|
|
385
|
+
|
|
386
|
+
return execUsersOp("DirectReports_V2", {
|
|
387
|
+
...params,
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// ── Get My Trending Documents ──────────────────────────────────
|
|
393
|
+
export async function getMyTrendingDocuments(oOptions = {}) {
|
|
394
|
+
return _dbgWrap('getMyTrendingDocuments', [oOptions], async function() {
|
|
395
|
+
const oResolvedOptions = normalizeUsersTrendingOptions(oOptions);
|
|
396
|
+
const params = {};
|
|
397
|
+
setUsersIfDefined(params, "$filter", pickUsersValue(oResolvedOptions.filter, oResolvedOptions.$filter));
|
|
398
|
+
setUsersIfDefined(params, "extractSensitivityLabel", oResolvedOptions.extractSensitivityLabel);
|
|
399
|
+
setUsersIfDefined(params, "fetchSensitivityLabelMetadata", oResolvedOptions.fetchSensitivityLabelMetadata);
|
|
400
|
+
return execUsersOp("MyTrendingDocuments", params);
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// ── Get Relevant People ────────────────────────────────────────
|
|
405
|
+
export async function getRelevantPeople(userId) {
|
|
406
|
+
return _dbgWrap('getRelevantPeople', [userId], async function() {
|
|
407
|
+
if (isUsersObject(userId)) {
|
|
408
|
+
userId = pickUsersValue(userId.userId, userId.id);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return execUsersOp("RelevantPeople", {
|
|
412
|
+
userId,
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// ═══════════════════════════════════════════════════════════════
|
|
418
|
+
// PHOTO
|
|
419
|
+
// ═══════════════════════════════════════════════════════════════
|
|
420
|
+
|
|
421
|
+
// ── Update My Photo ────────────────────────────────────────────
|
|
422
|
+
export async function updateMyPhoto(oBodyOrOptions, sContentType) {
|
|
423
|
+
return _dbgWrap('updateMyPhoto', [oBodyOrOptions, sContentType], async function() {
|
|
424
|
+
if (isUsersObject(oBodyOrOptions)) {
|
|
425
|
+
sContentType = pickUsersValue(
|
|
426
|
+
oBodyOrOptions.contentType,
|
|
427
|
+
oBodyOrOptions.Content_Type,
|
|
428
|
+
oBodyOrOptions.mimeType
|
|
429
|
+
);
|
|
430
|
+
oBodyOrOptions = pickUsersValue(
|
|
431
|
+
oBodyOrOptions.body,
|
|
432
|
+
oBodyOrOptions.content,
|
|
433
|
+
oBodyOrOptions.photo,
|
|
434
|
+
oBodyOrOptions.fileContent
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
return execUsersOp("UpdateMyPhoto", {
|
|
439
|
+
body: oBodyOrOptions,
|
|
440
|
+
Content_Type: sContentType,
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// ── Get User Photo Metadata ────────────────────────────────────
|
|
446
|
+
export async function getUserPhotoMetadata(userId) {
|
|
447
|
+
return _dbgWrap('getUserPhotoMetadata', [userId], async function() {
|
|
448
|
+
if (isUsersObject(userId)) {
|
|
449
|
+
userId = pickUsersValue(userId.userId, userId.id);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return execUsersOp("UserPhotoMetadata", {
|
|
453
|
+
userId,
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// ── Get User Photo ─────────────────────────────────────────────
|
|
459
|
+
export async function getUserPhoto(userId) {
|
|
460
|
+
return _dbgWrap('getUserPhoto', [userId], async function() {
|
|
461
|
+
if (isUsersObject(userId)) {
|
|
462
|
+
userId = pickUsersValue(userId.userId, userId.id);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
return execUsersOp("UserPhoto_V2", {
|
|
466
|
+
id: userId,
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// ── Get Trending Documents ─────────────────────────────────────
|
|
472
|
+
export async function getTrendingDocuments(userId, oOptions = {}) {
|
|
473
|
+
return _dbgWrap('getTrendingDocuments', [userId, oOptions], async function() {
|
|
474
|
+
if (isUsersObject(userId)) {
|
|
475
|
+
oOptions = userId;
|
|
476
|
+
userId = pickUsersValue(oOptions.userId, oOptions.id);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
const oResolvedOptions = normalizeUsersTrendingOptions(oOptions);
|
|
480
|
+
const params = {
|
|
481
|
+
id: userId,
|
|
482
|
+
};
|
|
483
|
+
setUsersIfDefined(params, "$filter", pickUsersValue(oResolvedOptions.filter, oResolvedOptions.$filter));
|
|
484
|
+
setUsersIfDefined(params, "extractSensitivityLabel", oResolvedOptions.extractSensitivityLabel);
|
|
485
|
+
setUsersIfDefined(params, "fetchSensitivityLabelMetadata", oResolvedOptions.fetchSensitivityLabelMetadata);
|
|
486
|
+
return execUsersOp("TrendingDocuments", params);
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// ═══════════════════════════════════════════════════════════════
|
|
491
|
+
// SEARCH
|
|
492
|
+
// ═══════════════════════════════════════════════════════════════
|
|
493
|
+
|
|
494
|
+
// ── Search for Users ───────────────────────────────────────────
|
|
495
|
+
export async function searchForUsers(oOptions = {}) {
|
|
496
|
+
return _dbgWrap('searchForUsers', [oOptions], async function() {
|
|
497
|
+
const oResolvedOptions = normalizeUsersSearchOptions(oOptions);
|
|
498
|
+
const params = {};
|
|
499
|
+
setUsersIfDefined(params, "searchTerm", oResolvedOptions.searchTerm);
|
|
500
|
+
setUsersIfDefined(params, "top", pickUsersValue(oResolvedOptions.top, oResolvedOptions.$top));
|
|
501
|
+
setUsersIfDefined(params, "isSearchTermRequired", oResolvedOptions.isSearchTermRequired);
|
|
502
|
+
|
|
503
|
+
const oSkipToken = pickUsersValue(
|
|
504
|
+
oResolvedOptions.skipToken,
|
|
505
|
+
oResolvedOptions.$skipToken,
|
|
506
|
+
oResolvedOptions.$skiptoken,
|
|
507
|
+
extractUsersSkipToken(oResolvedOptions.nextLink),
|
|
508
|
+
oResolvedOptions.skip
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
if (oSkipToken !== undefined && oSkipToken !== null) {
|
|
512
|
+
params.skipToken = String(oSkipToken);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
return execUsersOp("SearchUserV2", params);
|
|
516
|
+
});
|
|
517
|
+
}
|