codeapp-js 0.1.1 → 0.2.2
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/codeApp/dist/codeapp.js +552 -78
- package/codeApp/dist/power-apps-data.js +2531 -2531
- package/dev files/outlook.js +218 -9
- package/examples/combined demo/dist/codeapp.js +1098 -0
- package/examples/combined demo/dist/index.js +69 -114
- package/examples/combined demo/dist/power-apps-data.js +646 -170
- package/examples/combined demo/power.config.json +42 -42
- package/examples/dataverse Demo/dist/codeapp.js +1085 -0
- package/examples/dataverse Demo/dist/index.html +54 -54
- package/examples/dataverse Demo/dist/index.js +82 -70
- package/examples/dataverse Demo/dist/power-apps-data.js +551 -170
- package/examples/dataverse Demo/power.config.json +34 -34
- package/examples/dataverse Demo/readme.md +79 -79
- package/examples/groups Demo/dist/codeapp.js +1085 -0
- package/examples/groups Demo/dist/index.js +27 -27
- package/examples/groups Demo/dist/power-apps-data.js +551 -170
- package/examples/kanban/dist/dataverse.js +94 -94
- package/examples/kanban/dist/environmentVar.js +55 -55
- package/examples/kanban/dist/office365groups.js +97 -97
- package/examples/kanban/dist/office365users.js +169 -169
- package/examples/kanban/dist/outlook.js +162 -162
- package/examples/kanban/dist/power-apps-data.js +560 -138
- package/examples/kanban/dist/sharepoint.js +339 -339
- package/examples/myProfile/dist/index.html +184 -184
- package/examples/myProfile/dist/index.js +141 -141
- package/examples/myProfile/dist/office365users.js +169 -169
- package/examples/myProfile/dist/power-apps-data.js +560 -138
- package/examples/myProfile/power.config.json +22 -22
- package/examples/myProfile/readme.md +79 -79
- package/examples/outlook Demo/dist/codeapp.js +1085 -0
- package/examples/outlook Demo/dist/index.html +35 -35
- package/examples/outlook Demo/dist/index.js +170 -166
- package/examples/outlook Demo/dist/outlook.js +121 -121
- package/examples/outlook Demo/dist/power-apps-data.js +551 -170
- package/examples/outlook Demo/dist/styles.css +84 -84
- package/examples/outlook Demo/readme.md +82 -82
- package/examples/outlook Demo2/OutlookDemo_1_0_0_1.zip +0 -0
- package/examples/outlook Demo2/agent/decision-log.md +7 -0
- package/examples/outlook Demo2/dist/codeapp.js +1334 -0
- package/examples/outlook Demo2/dist/icon-512.png +0 -0
- package/examples/outlook Demo2/dist/index.html +98 -0
- package/examples/outlook Demo2/dist/index.js +346 -0
- package/examples/outlook Demo2/dist/power-apps-data.js +3007 -0
- package/examples/outlook Demo2/dist/styles.css +639 -0
- package/examples/outlook Demo2/power.config.json +23 -0
- package/examples/outlook Demo2/src/generated/index.ts +14 -0
- package/examples/outlook Demo2/src/generated/models/Office365GroupsModel.ts +363 -0
- package/examples/outlook Demo2/src/generated/models/Office365OutlookModel.ts +2046 -0
- package/examples/outlook Demo2/src/generated/models/Office365UsersModel.ts +254 -0
- package/examples/outlook Demo2/src/generated/services/Office365GroupsService.ts +326 -0
- package/examples/outlook Demo2/src/generated/services/Office365OutlookService.ts +2476 -0
- package/examples/outlook Demo2/src/generated/services/Office365UsersService.ts +358 -0
- package/examples/planning Poker/.vscode/settings.json +4 -4
- package/examples/planning Poker/additional files/customizations (tables).xml +6428 -6428
- package/examples/planning Poker/additional files/dataverse-tables.json +165 -165
- package/examples/planning Poker/additional files/readme.md +122 -122
- package/examples/planning Poker/dist/dataverse.js +78 -78
- package/examples/planning Poker/dist/index.html +198 -198
- package/examples/planning Poker/dist/index.js +954 -954
- package/examples/planning Poker/dist/power-apps-data.js +560 -138
- package/examples/planning Poker/dist/styles.css +815 -815
- package/examples/sharePoint Demo/agent/decision-log.md +5 -5
- package/examples/sharePoint Demo/dist/codeapp.js +1085 -0
- package/examples/sharePoint Demo/dist/index.js +44 -51
- package/examples/sharePoint Demo/dist/power-apps-data.js +551 -170
- package/examples/sharePoint Demo/power.config.json +22 -22
- package/examples/solution explorer/agent/decision-log.md +27 -0
- package/examples/solution explorer/agent/mockup-01-swiss-grid.html +452 -0
- package/examples/solution explorer/agent/mockup-02-dark-glass.html +496 -0
- package/examples/solution explorer/agent/mockup-03-paper-console.html +510 -0
- package/examples/solution explorer/agent/mockup-04-neon-noir.html +546 -0
- package/examples/solution explorer/agent/mockup-05-zen-garden.html +534 -0
- package/examples/solution explorer/dist/codeapp.js +1098 -0
- package/examples/solution explorer/dist/icon-512.png +0 -0
- package/examples/solution explorer/dist/index.html +80 -0
- package/examples/solution explorer/dist/index.js +735 -0
- package/examples/solution explorer/dist/power-apps-data.js +3007 -0
- package/examples/solution explorer/dist/styles.css +571 -0
- package/examples/solution explorer/power.config.json +151 -0
- package/examples/todo/dist/dataverse.js +64 -64
- package/examples/todo/dist/index.html +75 -75
- package/examples/todo/dist/index.js +8 -8
- package/examples/todo/dist/power-apps-data.js +560 -138
- package/examples/todo/dist/renderer.js +375 -375
- package/examples/todo/dist/styles.css +691 -691
- package/examples/todo/power.config.json +34 -34
- package/package.json +1 -8
- package/docs-mockups/atelier/index.html +0 -120
- package/docs-mockups/atelier/script.js +0 -23
- package/docs-mockups/atelier/styles.css +0 -361
- package/docs-mockups/field-guide/index.html +0 -112
- package/docs-mockups/field-guide/script.js +0 -20
- package/docs-mockups/field-guide/styles.css +0 -272
- package/docs-mockups/index.html +0 -80
- package/docs-mockups/maker-hub/index.html +0 -178
- package/docs-mockups/maker-hub/script.js +0 -20
- package/docs-mockups/maker-hub/styles.css +0 -404
- package/docs-mockups/script.js +0 -26
- package/docs-mockups/signal/index.html +0 -146
- package/docs-mockups/signal/script.js +0 -20
- package/docs-mockups/signal/styles.css +0 -314
- package/docs-mockups/styles.css +0 -287
- package/examples/combined demo/dist/dataverse.js +0 -86
- package/examples/combined demo/dist/environmentVar.js +0 -55
- package/examples/combined demo/dist/office365groups.js +0 -97
- package/examples/combined demo/dist/office365users.js +0 -169
- package/examples/combined demo/dist/outlook.js +0 -162
- package/examples/combined demo/dist/sharepoint.js +0 -339
- package/examples/dataverse Demo/dist/dataverse.js +0 -86
- package/examples/groups Demo/dist/dataverse.js +0 -86
- package/examples/groups Demo/dist/environmentVar.js +0 -55
- package/examples/groups Demo/dist/office365groups.js +0 -97
- package/examples/groups Demo/dist/office365users.js +0 -169
- package/examples/groups Demo/dist/outlook.js +0 -162
- package/examples/groups Demo/dist/sharepoint.js +0 -339
- package/examples/sharePoint Demo/dist/dataverse.js +0 -94
- package/examples/sharePoint Demo/dist/environmentVar.js +0 -55
- package/examples/sharePoint Demo/dist/office365groups.js +0 -97
- package/examples/sharePoint Demo/dist/office365users.js +0 -169
- package/examples/sharePoint Demo/dist/outlook.js +0 -162
- package/examples/sharePoint Demo/dist/sharepoint.js +0 -339
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
import { getClient } from "@microsoft/power-apps/data";
|
|
2
|
-
|
|
3
|
-
// ── Data source name (must match connectionReferences in power.config.json) ──
|
|
4
|
-
const DATA_SOURCE = "sharepointonline";
|
|
5
|
-
|
|
6
|
-
// ── Initialize SDK client for the SharePoint connector ─────────
|
|
7
|
-
function initClient() {
|
|
8
|
-
const dataSourcesInfo = {
|
|
9
|
-
[DATA_SOURCE]: {
|
|
10
|
-
tableId: "",
|
|
11
|
-
version: "",
|
|
12
|
-
primaryKey: "",
|
|
13
|
-
dataSourceType: "Connector",
|
|
14
|
-
apis: {
|
|
15
|
-
GetItems: {
|
|
16
|
-
path: "/{connectionId}/datasets/{siteUrl}/tables/{table}/items",
|
|
17
|
-
method: "GET",
|
|
18
|
-
parameters: [
|
|
19
|
-
{ name: "connectionId", in: "path", required: true },
|
|
20
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
21
|
-
{ name: "table", in: "path", required: true },
|
|
22
|
-
{ name: "$filter", in: "query", required: false },
|
|
23
|
-
{ name: "$orderby", in: "query", required: false },
|
|
24
|
-
{ name: "$top", in: "query", required: false },
|
|
25
|
-
{ name: "$skip", in: "query", required: false },
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
GetItem: {
|
|
29
|
-
path: "/{connectionId}/datasets/{siteUrl}/tables/{table}/items/{id}",
|
|
30
|
-
method: "GET",
|
|
31
|
-
parameters: [
|
|
32
|
-
{ name: "connectionId", in: "path", required: true },
|
|
33
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
34
|
-
{ name: "table", in: "path", required: true },
|
|
35
|
-
{ name: "id", in: "path", required: true },
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
PostItem: {
|
|
39
|
-
path: "/{connectionId}/datasets/{siteUrl}/tables/{table}/items",
|
|
40
|
-
method: "POST",
|
|
41
|
-
parameters: [
|
|
42
|
-
{ name: "connectionId", in: "path", required: true },
|
|
43
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
44
|
-
{ name: "table", in: "path", required: true },
|
|
45
|
-
{ name: "item", in: "body", required: true },
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
PatchItem: {
|
|
49
|
-
path: "/{connectionId}/datasets/{siteUrl}/tables/{table}/items/{id}",
|
|
50
|
-
method: "PATCH",
|
|
51
|
-
parameters: [
|
|
52
|
-
{ name: "connectionId", in: "path", required: true },
|
|
53
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
54
|
-
{ name: "table", in: "path", required: true },
|
|
55
|
-
{ name: "id", in: "path", required: true },
|
|
56
|
-
{ name: "item", in: "body", required: true },
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
DeleteItem: {
|
|
60
|
-
path: "/{connectionId}/datasets/{siteUrl}/tables/{table}/items/{id}",
|
|
61
|
-
method: "DELETE",
|
|
62
|
-
parameters: [
|
|
63
|
-
{ name: "connectionId", in: "path", required: true },
|
|
64
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
65
|
-
{ name: "table", in: "path", required: true },
|
|
66
|
-
{ name: "id", in: "path", required: true },
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
GetTables: {
|
|
70
|
-
path: "/{connectionId}/datasets/{siteUrl}/tables",
|
|
71
|
-
method: "GET",
|
|
72
|
-
parameters: [
|
|
73
|
-
{ name: "connectionId", in: "path", required: true },
|
|
74
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
GetDataSetsMetadata: {
|
|
78
|
-
path: "/{connectionId}/datasets/{siteUrl}",
|
|
79
|
-
method: "GET",
|
|
80
|
-
parameters: [
|
|
81
|
-
{ name: "connectionId", in: "path", required: true },
|
|
82
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
CreateFile: {
|
|
86
|
-
path: "/{connectionId}/datasets/{siteUrl}/files",
|
|
87
|
-
method: "POST",
|
|
88
|
-
parameters: [
|
|
89
|
-
{ name: "connectionId", in: "path", required: true },
|
|
90
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
91
|
-
{ name: "folderPath", in: "query", required: true },
|
|
92
|
-
{ name: "name", in: "query", required: true },
|
|
93
|
-
{ name: "body", in: "body", required: true },
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
UpdateFile: {
|
|
97
|
-
path: "/{connectionId}/datasets/{siteUrl}/files/{id}",
|
|
98
|
-
method: "PUT",
|
|
99
|
-
parameters: [
|
|
100
|
-
{ name: "connectionId", in: "path", required: true },
|
|
101
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
102
|
-
{ name: "id", in: "path", required: true },
|
|
103
|
-
{ name: "body", in: "body", required: true },
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
DeleteFile: {
|
|
107
|
-
path: "/{connectionId}/datasets/{siteUrl}/files/{id}",
|
|
108
|
-
method: "DELETE",
|
|
109
|
-
parameters: [
|
|
110
|
-
{ name: "connectionId", in: "path", required: true },
|
|
111
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
112
|
-
{ name: "id", in: "path", required: true },
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
MoveFile: {
|
|
116
|
-
path: "/{connectionId}/datasets/{siteUrl}/files/{id}/moveto",
|
|
117
|
-
method: "POST",
|
|
118
|
-
parameters: [
|
|
119
|
-
{ name: "connectionId", in: "path", required: true },
|
|
120
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
121
|
-
{ name: "id", in: "path", required: true },
|
|
122
|
-
{ name: "destinationFolderPath", in: "query", required: true },
|
|
123
|
-
{ name: "newFileName", in: "query", required: false },
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
GetFileMetadata: {
|
|
127
|
-
path: "/{connectionId}/datasets/{siteUrl}/files/{id}",
|
|
128
|
-
method: "GET",
|
|
129
|
-
parameters: [
|
|
130
|
-
{ name: "connectionId", in: "path", required: true },
|
|
131
|
-
{ name: "siteUrl", in: "path", required: true },
|
|
132
|
-
{ name: "id", in: "path", required: true },
|
|
133
|
-
],
|
|
134
|
-
},
|
|
135
|
-
HttpRequest: {
|
|
136
|
-
path: "/{connectionId}/httprequest",
|
|
137
|
-
method: "POST",
|
|
138
|
-
parameters: [
|
|
139
|
-
{ name: "connectionId", in: "path", required: true },
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
return getClient(dataSourcesInfo);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// ── Internal: execute a connector operation ────────────────────
|
|
149
|
-
async function execOp(operationName, parameters) {
|
|
150
|
-
const client = await initClient();
|
|
151
|
-
const result = await client.executeAsync({
|
|
152
|
-
connectorOperation: {
|
|
153
|
-
tableName: DATA_SOURCE,
|
|
154
|
-
operationName,
|
|
155
|
-
parameters,
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
if (!result.success) {
|
|
159
|
-
throw new Error(result.error?.message || "Operation failed");
|
|
160
|
-
}
|
|
161
|
-
return result.data;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// ═══════════════════════════════════════════════════════════════
|
|
165
|
-
// GENERIC
|
|
166
|
-
// ═══════════════════════════════════════════════════════════════
|
|
167
|
-
|
|
168
|
-
// ── Call any SharePoint connector operation by name ─────────────
|
|
169
|
-
export async function callSharePointOperation(operationName, parameters = {}) {
|
|
170
|
-
return execOp(operationName, parameters);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// ── Send HTTP Request (for list-name-based operations) ─────────
|
|
174
|
-
export async function sendHttpRequest({ method = "GET", uri, headers, body }) {
|
|
175
|
-
return execOp("HttpRequest", {
|
|
176
|
-
method,
|
|
177
|
-
uri,
|
|
178
|
-
headers: headers || {},
|
|
179
|
-
body: body || "",
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// ═══════════════════════════════════════════════════════════════
|
|
184
|
-
// ITEMS (standard API — uses list ID)
|
|
185
|
-
// ═══════════════════════════════════════════════════════════════
|
|
186
|
-
|
|
187
|
-
// ── Get Items ──────────────────────────────────────────────────
|
|
188
|
-
export async function getItems(sSiteUrl, sListId, { filter, orderBy, top, skip } = {}) {
|
|
189
|
-
let params = { siteUrl: encodeURIComponent(sSiteUrl), table: sListId };
|
|
190
|
-
if (filter) params.$filter = filter;
|
|
191
|
-
if (orderBy) params.$orderby = orderBy;
|
|
192
|
-
if (top != null) params.$top = top;
|
|
193
|
-
if (skip != null) params.$skip = skip;
|
|
194
|
-
return execOp("GetItems", params);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// ── Get Item ───────────────────────────────────────────────────
|
|
198
|
-
export async function getItem(sSiteUrl, sListId, iItemId) {
|
|
199
|
-
return execOp("GetItem", {
|
|
200
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
201
|
-
table: sListId,
|
|
202
|
-
id: iItemId,
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// ── Create Item ────────────────────────────────────────────────
|
|
207
|
-
export async function createItem(sSiteUrl, sListId, oFields) {
|
|
208
|
-
return execOp("PostItem", {
|
|
209
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
210
|
-
table: sListId,
|
|
211
|
-
item: oFields,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// ── Update Item ────────────────────────────────────────────────
|
|
216
|
-
export async function updateItem(sSiteUrl, sListId, iItemId, oChangedFields) {
|
|
217
|
-
return execOp("PatchItem", {
|
|
218
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
219
|
-
table: sListId,
|
|
220
|
-
id: iItemId,
|
|
221
|
-
item: oChangedFields,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// ── Delete Item ────────────────────────────────────────────────
|
|
226
|
-
export async function deleteItem(sSiteUrl, sListId, iItemId) {
|
|
227
|
-
return execOp("DeleteItem", {
|
|
228
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
229
|
-
table: sListId,
|
|
230
|
-
id: iItemId,
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// ═══════════════════════════════════════════════════════════════
|
|
235
|
-
// ITEMS (HTTP API — uses list name)
|
|
236
|
-
// ═══════════════════════════════════════════════════════════════
|
|
237
|
-
|
|
238
|
-
// ── Get Items by List Name ─────────────────────────────────────
|
|
239
|
-
export async function getItemsByName(sSiteUrl, sListName, { filter, orderBy, top, skip } = {}) {
|
|
240
|
-
let sUri = sSiteUrl + "/_api/web/lists/getbytitle('" + sListName + "')/items";
|
|
241
|
-
let aQuery = [];
|
|
242
|
-
if (filter) aQuery.push("$filter=" + filter);
|
|
243
|
-
if (orderBy) aQuery.push("$orderby=" + orderBy);
|
|
244
|
-
if (top != null) aQuery.push("$top=" + top);
|
|
245
|
-
if (skip != null) aQuery.push("$skip=" + skip);
|
|
246
|
-
if (aQuery.length > 0) sUri = sUri + "?" + aQuery.join("&");
|
|
247
|
-
return sendHttpRequest({ method: "GET", uri: sUri, headers: { Accept: "application/json;odata=nometadata" } });
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// ── Get Item by List Name ──────────────────────────────────────
|
|
251
|
-
export async function getItemByName(sSiteUrl, sListName, iItemId) {
|
|
252
|
-
let sUri = sSiteUrl + "/_api/web/lists/getbytitle('" + sListName + "')/items(" + iItemId + ")";
|
|
253
|
-
return sendHttpRequest({ method: "GET", uri: sUri, headers: { Accept: "application/json;odata=nometadata" } });
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// ── Create Item by List Name ───────────────────────────────────
|
|
257
|
-
export async function createItemByName(sSiteUrl, sListName, oFields) {
|
|
258
|
-
let sUri = sSiteUrl + "/_api/web/lists/getbytitle('" + sListName + "')/items";
|
|
259
|
-
return sendHttpRequest({ method: "POST", uri: sUri, headers: { Accept: "application/json;odata=nometadata", "Content-Type": "application/json;odata=nometadata" }, body: JSON.stringify(oFields) });
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// ── Update Item by List Name ───────────────────────────────────
|
|
263
|
-
export async function updateItemByName(sSiteUrl, sListName, iItemId, oChangedFields) {
|
|
264
|
-
let sUri = sSiteUrl + "/_api/web/lists/getbytitle('" + sListName + "')/items(" + iItemId + ")";
|
|
265
|
-
return sendHttpRequest({ method: "PATCH", uri: sUri, headers: { Accept: "application/json;odata=nometadata", "Content-Type": "application/json;odata=nometadata", "If-Match": "*" }, body: JSON.stringify(oChangedFields) });
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// ── Delete Item by List Name ───────────────────────────────────
|
|
269
|
-
export async function deleteItemByName(sSiteUrl, sListName, iItemId) {
|
|
270
|
-
let sUri = sSiteUrl + "/_api/web/lists/getbytitle('" + sListName + "')/items(" + iItemId + ")";
|
|
271
|
-
return sendHttpRequest({ method: "DELETE", uri: sUri, headers: { Accept: "application/json;odata=nometadata", "If-Match": "*" } });
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// ═══════════════════════════════════════════════════════════════
|
|
275
|
-
// TABLES / LISTS
|
|
276
|
-
// ═══════════════════════════════════════════════════════════════
|
|
277
|
-
|
|
278
|
-
// ── List Tables (Lists) ────────────────────────────────────────
|
|
279
|
-
export async function listTables(sSiteUrl) {
|
|
280
|
-
return execOp("GetTables", {
|
|
281
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// ── List Library (Document Libraries) ──────────────────────────
|
|
286
|
-
export async function listLibrary(sSiteUrl) {
|
|
287
|
-
return execOp("GetDataSetsMetadata", {
|
|
288
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
// ═══════════════════════════════════════════════════════════════
|
|
293
|
-
// FILES
|
|
294
|
-
// ═══════════════════════════════════════════════════════════════
|
|
295
|
-
|
|
296
|
-
// ── Create File ────────────────────────────────────────────────
|
|
297
|
-
export async function createFile(sSiteUrl, sLibraryName, sFileName, fileContent) {
|
|
298
|
-
return execOp("CreateFile", {
|
|
299
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
300
|
-
folderPath: sLibraryName,
|
|
301
|
-
name: sFileName,
|
|
302
|
-
body: fileContent,
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// ── Update File ────────────────────────────────────────────────
|
|
307
|
-
export async function updateFile(sSiteUrl, sFileId, fileContent) {
|
|
308
|
-
return execOp("UpdateFile", {
|
|
309
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
310
|
-
id: sFileId,
|
|
311
|
-
body: fileContent,
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// ── Delete File ────────────────────────────────────────────────
|
|
316
|
-
export async function deleteFile(sSiteUrl, sFileId) {
|
|
317
|
-
return execOp("DeleteFile", {
|
|
318
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
319
|
-
id: sFileId,
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// ── Move File ──────────────────────────────────────────────────
|
|
324
|
-
export async function moveFile(sSiteUrl, sSourceFileId, sDestinationFolderPath, sNewFileName) {
|
|
325
|
-
return execOp("MoveFile", {
|
|
326
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
327
|
-
id: sSourceFileId,
|
|
328
|
-
destinationFolderPath: sDestinationFolderPath,
|
|
329
|
-
newFileName: sNewFileName || "",
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
// ── Get File Metadata ──────────────────────────────────────────
|
|
334
|
-
export async function getFileMetadata(sSiteUrl, sFileId) {
|
|
335
|
-
return execOp("GetFileMetadata", {
|
|
336
|
-
siteUrl: encodeURIComponent(sSiteUrl),
|
|
337
|
-
id: sFileId,
|
|
338
|
-
});
|
|
339
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { getClient } from "@microsoft/power-apps/data";
|
|
2
|
-
|
|
3
|
-
// ── All Table Definitions ──────────────────────────────────────
|
|
4
|
-
const ALL_DATA_SOURCES = {
|
|
5
|
-
wd_pokersessions: { tableId: '', version: '', primaryKey: 'wd_pokersessionid', dataSourceType: 'Dataverse', apis: {} },
|
|
6
|
-
wd_pokerparticipants: { tableId: '', version: '', primaryKey: 'wd_pokerparticipantid', dataSourceType: 'Dataverse', apis: {} },
|
|
7
|
-
wd_pokerrounds: { tableId: '', version: '', primaryKey: 'wd_pokerroundid', dataSourceType: 'Dataverse', apis: {} },
|
|
8
|
-
wd_pokervotes: { tableId: '', version: '', primaryKey: 'wd_pokervoteid', dataSourceType: 'Dataverse', apis: {} },
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// ── Initialize SDK & Client ────────────────────────────────────
|
|
12
|
-
let oSharedClient = null;
|
|
13
|
-
|
|
14
|
-
function getSharedClient() {
|
|
15
|
-
if (!oSharedClient) {
|
|
16
|
-
oSharedClient = getClient(ALL_DATA_SOURCES);
|
|
17
|
-
}
|
|
18
|
-
return oSharedClient;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// ── Unwrap SDK response ────────────────────────────────────────
|
|
22
|
-
function unwrapResult(result) {
|
|
23
|
-
if (result && result.success === false) {
|
|
24
|
-
var sMsg = result.error ? (result.error.message || JSON.stringify(result.error)) : 'Operation failed';
|
|
25
|
-
throw new Error(sMsg);
|
|
26
|
-
}
|
|
27
|
-
return result && 'data' in result ? result.data : result;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// ── Create ─────────────────────────────────────────────────────
|
|
31
|
-
export async function createItem(tableName, primaryKey, record) {
|
|
32
|
-
const client = getSharedClient();
|
|
33
|
-
const result = await client.createRecordAsync(tableName, record);
|
|
34
|
-
return unwrapResult(result);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ── Read (single) ──────────────────────────────────────────────
|
|
38
|
-
export async function getItem(tableName, primaryKey, id, select) {
|
|
39
|
-
const client = getSharedClient();
|
|
40
|
-
const options = select ? { select } : undefined;
|
|
41
|
-
const result = await client.retrieveRecordAsync(tableName, id, options);
|
|
42
|
-
return unwrapResult(result);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// ── List (multiple) ────────────────────────────────────────────
|
|
46
|
-
export async function listItems(tableName, primaryKey, { filter, select, orderBy, top, skip } = {}) {
|
|
47
|
-
const client = getSharedClient();
|
|
48
|
-
const result = await client.retrieveMultipleRecordsAsync(tableName, {
|
|
49
|
-
filter,
|
|
50
|
-
select,
|
|
51
|
-
orderBy,
|
|
52
|
-
top,
|
|
53
|
-
skip,
|
|
54
|
-
});
|
|
55
|
-
var unwrapped = unwrapResult(result);
|
|
56
|
-
return { entities: Array.isArray(unwrapped) ? unwrapped : [] };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// ── Update ─────────────────────────────────────────────────────
|
|
60
|
-
export async function updateItem(tableName, primaryKey, id, changedFields) {
|
|
61
|
-
const client = getSharedClient();
|
|
62
|
-
const result = await client.updateRecordAsync(tableName, id, changedFields);
|
|
63
|
-
return unwrapResult(result);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ── Delete ─────────────────────────────────────────────────────
|
|
67
|
-
export async function deleteItem(tableName, primaryKey, id) {
|
|
68
|
-
const client = getSharedClient();
|
|
69
|
-
const result = await client.deleteRecordAsync(tableName, id);
|
|
70
|
-
return unwrapResult(result);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// ── Unbound Action ─────────────────────────────────────────────
|
|
74
|
-
export async function callUnboundAction(tableName, primaryKey, actionName, params) {
|
|
75
|
-
const client = getSharedClient();
|
|
76
|
-
const result = await client.invokeActionAsync(tableName, actionName, params);
|
|
77
|
-
return unwrapResult(result);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// ── WhoAmI ─────────────────────────────────────────────────────
|
|
81
|
-
export async function whoAmI() {
|
|
82
|
-
const client = getSharedClient();
|
|
83
|
-
const result = await client.invokeActionAsync('', 'WhoAmI', {});
|
|
84
|
-
var data = unwrapResult(result);
|
|
85
|
-
return data.UserId || data.userid || data.systemuserid || data;
|
|
86
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { getClient } from "@microsoft/power-apps/data";
|
|
2
|
-
|
|
3
|
-
// ── All Table Definitions ──────────────────────────────────────
|
|
4
|
-
const ALL_DATA_SOURCES = {
|
|
5
|
-
wd_pokersessions: { tableId: '', version: '', primaryKey: 'wd_pokersessionid', dataSourceType: 'Dataverse', apis: {} },
|
|
6
|
-
wd_pokerparticipants: { tableId: '', version: '', primaryKey: 'wd_pokerparticipantid', dataSourceType: 'Dataverse', apis: {} },
|
|
7
|
-
wd_pokerrounds: { tableId: '', version: '', primaryKey: 'wd_pokerroundid', dataSourceType: 'Dataverse', apis: {} },
|
|
8
|
-
wd_pokervotes: { tableId: '', version: '', primaryKey: 'wd_pokervoteid', dataSourceType: 'Dataverse', apis: {} },
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// ── Initialize SDK & Client ────────────────────────────────────
|
|
12
|
-
let oSharedClient = null;
|
|
13
|
-
|
|
14
|
-
function getSharedClient() {
|
|
15
|
-
if (!oSharedClient) {
|
|
16
|
-
oSharedClient = getClient(ALL_DATA_SOURCES);
|
|
17
|
-
}
|
|
18
|
-
return oSharedClient;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// ── Unwrap SDK response ────────────────────────────────────────
|
|
22
|
-
function unwrapResult(result) {
|
|
23
|
-
if (result && result.success === false) {
|
|
24
|
-
var sMsg = result.error ? (result.error.message || JSON.stringify(result.error)) : 'Operation failed';
|
|
25
|
-
throw new Error(sMsg);
|
|
26
|
-
}
|
|
27
|
-
return result && 'data' in result ? result.data : result;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// ── Create ─────────────────────────────────────────────────────
|
|
31
|
-
export async function createItem(tableName, primaryKey, record) {
|
|
32
|
-
const client = getSharedClient();
|
|
33
|
-
const result = await client.createRecordAsync(tableName, record);
|
|
34
|
-
return unwrapResult(result);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ── Read (single) ──────────────────────────────────────────────
|
|
38
|
-
export async function getItem(tableName, primaryKey, id, select) {
|
|
39
|
-
const client = getSharedClient();
|
|
40
|
-
const options = select ? { select } : undefined;
|
|
41
|
-
const result = await client.retrieveRecordAsync(tableName, id, options);
|
|
42
|
-
return unwrapResult(result);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// ── List (multiple) ────────────────────────────────────────────
|
|
46
|
-
export async function listItems(tableName, primaryKey, { filter, select, orderBy, top, skip } = {}) {
|
|
47
|
-
const client = getSharedClient();
|
|
48
|
-
const result = await client.retrieveMultipleRecordsAsync(tableName, {
|
|
49
|
-
filter,
|
|
50
|
-
select,
|
|
51
|
-
orderBy,
|
|
52
|
-
top,
|
|
53
|
-
skip,
|
|
54
|
-
});
|
|
55
|
-
var unwrapped = unwrapResult(result);
|
|
56
|
-
return { entities: Array.isArray(unwrapped) ? unwrapped : [] };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// ── Update ─────────────────────────────────────────────────────
|
|
60
|
-
export async function updateItem(tableName, primaryKey, id, changedFields) {
|
|
61
|
-
const client = getSharedClient();
|
|
62
|
-
const result = await client.updateRecordAsync(tableName, id, changedFields);
|
|
63
|
-
return unwrapResult(result);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ── Delete ─────────────────────────────────────────────────────
|
|
67
|
-
export async function deleteItem(tableName, primaryKey, id) {
|
|
68
|
-
const client = getSharedClient();
|
|
69
|
-
const result = await client.deleteRecordAsync(tableName, id);
|
|
70
|
-
return unwrapResult(result);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// ── Unbound Action ─────────────────────────────────────────────
|
|
74
|
-
export async function callUnboundAction(tableName, primaryKey, actionName, params) {
|
|
75
|
-
const client = getSharedClient();
|
|
76
|
-
const result = await client.invokeActionAsync(tableName, actionName, params);
|
|
77
|
-
return unwrapResult(result);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// ── WhoAmI ─────────────────────────────────────────────────────
|
|
81
|
-
export async function whoAmI() {
|
|
82
|
-
const client = getSharedClient();
|
|
83
|
-
const result = await client.invokeActionAsync('', 'WhoAmI', {});
|
|
84
|
-
var data = unwrapResult(result);
|
|
85
|
-
return data.UserId || data.userid || data.systemuserid || data;
|
|
86
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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
|
-
}
|