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
package/dev files/dataverse.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { getClient } from "@microsoft/power-apps/data";
|
|
2
|
-
|
|
3
|
-
// ── Table Registry (populated at runtime via registerTable) ────
|
|
4
|
-
let oDataSources = {};
|
|
5
|
-
|
|
6
|
-
// ── Register a Dataverse table for use by the library ──────────
|
|
7
|
-
export function registerTable(sTableName, sPrimaryKey) {
|
|
8
|
-
oDataSources[sTableName] = {
|
|
9
|
-
tableId: '',
|
|
10
|
-
version: '',
|
|
11
|
-
primaryKey: sPrimaryKey,
|
|
12
|
-
dataSourceType: 'Dataverse',
|
|
13
|
-
apis: {}
|
|
14
|
-
};
|
|
15
|
-
// reset client so it picks up the new table on next call
|
|
16
|
-
oSharedClient = null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// ── Initialize SDK & Client ────────────────────────────────────
|
|
20
|
-
let oSharedClient = null;
|
|
21
|
-
|
|
22
|
-
function getSharedClient() {
|
|
23
|
-
if (!oSharedClient) {
|
|
24
|
-
oSharedClient = getClient(oDataSources);
|
|
25
|
-
}
|
|
26
|
-
return oSharedClient;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ── Ensure value is an array (accepts array or comma-separated string)
|
|
30
|
-
function ensureArray(value) {
|
|
31
|
-
if (!value) return value;
|
|
32
|
-
if (Array.isArray(value)) return value;
|
|
33
|
-
if (typeof value === 'string') return value.split(',').map(function (s) { return s.trim(); });
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ── Unwrap SDK response ────────────────────────────────────────
|
|
38
|
-
function unwrapResult(result) {
|
|
39
|
-
if (result && result.success === false) {
|
|
40
|
-
var sMsg = result.error ? (result.error.message || JSON.stringify(result.error)) : 'Operation failed';
|
|
41
|
-
throw new Error(sMsg);
|
|
42
|
-
}
|
|
43
|
-
return result && 'data' in result ? result.data : result;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// ── Create ─────────────────────────────────────────────────────
|
|
47
|
-
export async function createItem(tableName, primaryKey, record) {
|
|
48
|
-
const client = getSharedClient();
|
|
49
|
-
const result = await client.createRecordAsync(tableName, record);
|
|
50
|
-
return unwrapResult(result);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// ── Read (single) ──────────────────────────────────────────────
|
|
54
|
-
export async function getItem(tableName, primaryKey, id, select) {
|
|
55
|
-
const client = getSharedClient();
|
|
56
|
-
select = ensureArray(select);
|
|
57
|
-
const options = select ? { select } : undefined;
|
|
58
|
-
const result = await client.retrieveRecordAsync(tableName, id, options);
|
|
59
|
-
return unwrapResult(result);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ── List (multiple) ────────────────────────────────────────────
|
|
63
|
-
export async function listItems(tableName, primaryKey, { filter, select, orderBy, top, skip } = {}) {
|
|
64
|
-
const client = getSharedClient();
|
|
65
|
-
select = ensureArray(select);
|
|
66
|
-
orderBy = ensureArray(orderBy);
|
|
67
|
-
const result = await client.retrieveMultipleRecordsAsync(tableName, {
|
|
68
|
-
filter,
|
|
69
|
-
select,
|
|
70
|
-
orderBy,
|
|
71
|
-
top,
|
|
72
|
-
skip,
|
|
73
|
-
});
|
|
74
|
-
var unwrapped = unwrapResult(result);
|
|
75
|
-
return { entities: Array.isArray(unwrapped) ? unwrapped : [] };
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// ── Update ─────────────────────────────────────────────────────
|
|
79
|
-
export async function updateItem(tableName, primaryKey, id, changedFields) {
|
|
80
|
-
const client = getSharedClient();
|
|
81
|
-
const result = await client.updateRecordAsync(tableName, id, changedFields);
|
|
82
|
-
return unwrapResult(result);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// ── Delete ─────────────────────────────────────────────────────
|
|
86
|
-
export async function deleteItem(tableName, primaryKey, id) {
|
|
87
|
-
const client = getSharedClient();
|
|
88
|
-
const result = await client.deleteRecordAsync(tableName, id);
|
|
89
|
-
return unwrapResult(result);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// ── Unbound Action ─────────────────────────────────────────────
|
|
93
|
-
export async function callUnboundAction(tableName, primaryKey, actionName, params) {
|
|
94
|
-
const client = getSharedClient();
|
|
95
|
-
const result = await client.invokeActionAsync(tableName, actionName, params);
|
|
96
|
-
return unwrapResult(result);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// ── WhoAmI ─────────────────────────────────────────────────────
|
|
100
|
-
export async function whoAmI() {
|
|
101
|
-
const client = getSharedClient();
|
|
102
|
-
const result = await client.invokeActionAsync('', 'WhoAmI', {});
|
|
103
|
-
var data = unwrapResult(result);
|
|
104
|
-
return data.UserId || data.userid || data.systemuserid || data;
|
|
105
|
-
}
|
|
@@ -1,65 +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 = "Office365Groups";
|
|
5
|
-
|
|
6
|
-
// ── Initialize SDK client for the Office 365 Groups connector ──
|
|
7
|
-
function initClient() {
|
|
8
|
-
const dataSourcesInfo = {
|
|
9
|
-
[DATA_SOURCE]: {
|
|
10
|
-
tableId: "",
|
|
11
|
-
version: "",
|
|
12
|
-
primaryKey: "",
|
|
13
|
-
dataSourceType: "Connector",
|
|
14
|
-
apis: {},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
return getClient(dataSourcesInfo);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// ── Internal: execute a connector operation ────────────────────
|
|
21
|
-
async function execOp(operationName, parameters) {
|
|
22
|
-
const client = await initClient();
|
|
23
|
-
return client.executeAsync({
|
|
24
|
-
connectorOperation: {
|
|
25
|
-
tableName: DATA_SOURCE,
|
|
26
|
-
operationName,
|
|
27
|
-
parameters,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// ═══════════════════════════════════════════════════════════════
|
|
33
|
-
// GENERIC
|
|
34
|
-
// ═══════════════════════════════════════════════════════════════
|
|
35
|
-
|
|
36
|
-
// ── Call any Office 365 Groups operation by name ───────────────
|
|
37
|
-
export async function callGroupsOperation(operationName, parameters = {}) {
|
|
38
|
-
return execOp(operationName, parameters);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// ── Open HTTP Request ──────────────────────────────────────────
|
|
42
|
-
export async function openHttpRequest({ method = "GET", uri, headers, body }) {
|
|
43
|
-
return execOp("HttpRequest", {
|
|
44
|
-
method,
|
|
45
|
-
uri,
|
|
46
|
-
headers: headers || {},
|
|
47
|
-
body: body || "",
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// ═══════════════════════════════════════════════════════════════
|
|
52
|
-
// GROUPS
|
|
53
|
-
// ═══════════════════════════════════════════════════════════════
|
|
54
|
-
|
|
55
|
-
// ── List My Groups ─────────────────────────────────────────────
|
|
56
|
-
export async function listMyGroups() {
|
|
57
|
-
return execOp("ListOwnedGroups", {});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// ── List Members of a Group ────────────────────────────────────
|
|
61
|
-
export async function listGroupMembers(groupId) {
|
|
62
|
-
return execOp("ListGroupMembers", {
|
|
63
|
-
groupId,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
@@ -1,169 +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 = "office365users";
|
|
5
|
-
|
|
6
|
-
// ── Initialize SDK client for the Office 365 Users connector ───
|
|
7
|
-
function initClient() {
|
|
8
|
-
const dataSourcesInfo = {
|
|
9
|
-
[DATA_SOURCE]: {
|
|
10
|
-
tableId: "",
|
|
11
|
-
version: "",
|
|
12
|
-
primaryKey: "",
|
|
13
|
-
dataSourceType: "Connector",
|
|
14
|
-
apis: {
|
|
15
|
-
MyProfile_V2: {
|
|
16
|
-
path: "/{connectionId}/codeless/v1.0/me",
|
|
17
|
-
method: "GET",
|
|
18
|
-
parameters: [
|
|
19
|
-
{ name: "connectionId", in: "path", required: true },
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
UserProfile_V2: {
|
|
23
|
-
path: "/{connectionId}/codeless/v1.0/users/{id}",
|
|
24
|
-
method: "GET",
|
|
25
|
-
parameters: [
|
|
26
|
-
{ name: "connectionId", in: "path", required: true },
|
|
27
|
-
{ name: "id", in: "path", required: true },
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
Manager_V2: {
|
|
31
|
-
path: "/{connectionId}/codeless/v1.0/users/{id}/manager",
|
|
32
|
-
method: "GET",
|
|
33
|
-
parameters: [
|
|
34
|
-
{ name: "connectionId", in: "path", required: true },
|
|
35
|
-
{ name: "id", in: "path", required: true },
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
DirectReports_V2: {
|
|
39
|
-
path: "/{connectionId}/codeless/v1.0/users/{id}/directReports",
|
|
40
|
-
method: "GET",
|
|
41
|
-
parameters: [
|
|
42
|
-
{ name: "connectionId", in: "path", required: true },
|
|
43
|
-
{ name: "id", in: "path", required: true },
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
UserPhoto_V2: {
|
|
47
|
-
path: "/{connectionId}/codeless/v1.0/users/{id}/photo/$value",
|
|
48
|
-
method: "GET",
|
|
49
|
-
parameters: [
|
|
50
|
-
{ name: "connectionId", in: "path", required: true },
|
|
51
|
-
{ name: "id", in: "path", required: true },
|
|
52
|
-
],
|
|
53
|
-
responseInfo: { "200": "image/jpeg" },
|
|
54
|
-
},
|
|
55
|
-
SearchUser_V2: {
|
|
56
|
-
path: "/{connectionId}/codeless/v1.0/users",
|
|
57
|
-
method: "GET",
|
|
58
|
-
parameters: [
|
|
59
|
-
{ name: "connectionId", in: "path", required: true },
|
|
60
|
-
{ name: "searchTerm", in: "query", required: false },
|
|
61
|
-
{ name: "$top", in: "query", required: false },
|
|
62
|
-
{ name: "$skip", in: "query", required: false },
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
HttpRequest: {
|
|
66
|
-
path: "/{connectionId}/codeless/v1.0/httprequest",
|
|
67
|
-
method: "POST",
|
|
68
|
-
parameters: [
|
|
69
|
-
{ name: "connectionId", in: "path", required: true },
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
return getClient(dataSourcesInfo);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// ── Internal: execute a connector operation ────────────────────
|
|
79
|
-
async function execOp(operationName, parameters) {
|
|
80
|
-
const client = await initClient();
|
|
81
|
-
const result = await client.executeAsync({
|
|
82
|
-
connectorOperation: {
|
|
83
|
-
tableName: DATA_SOURCE,
|
|
84
|
-
operationName,
|
|
85
|
-
parameters,
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
if (!result.success) {
|
|
89
|
-
throw new Error(result.error?.message || "Operation failed");
|
|
90
|
-
}
|
|
91
|
-
return result.data;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// ═══════════════════════════════════════════════════════════════
|
|
95
|
-
// GENERIC
|
|
96
|
-
// ═══════════════════════════════════════════════════════════════
|
|
97
|
-
|
|
98
|
-
// ── Call any Office 365 Users operation by name ────────────────
|
|
99
|
-
export async function callUsersOperation(operationName, parameters = {}) {
|
|
100
|
-
return execOp(operationName, parameters);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// ── Open HTTP Request ──────────────────────────────────────────
|
|
104
|
-
export async function openHttpRequest({ method = "GET", uri, headers, body }) {
|
|
105
|
-
return execOp("HttpRequest", {
|
|
106
|
-
method,
|
|
107
|
-
uri,
|
|
108
|
-
headers: headers || {},
|
|
109
|
-
body: body || "",
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// ═══════════════════════════════════════════════════════════════
|
|
114
|
-
// PROFILE
|
|
115
|
-
// ═══════════════════════════════════════════════════════════════
|
|
116
|
-
|
|
117
|
-
// ── Get My Profile ─────────────────────────────────────────────
|
|
118
|
-
export async function getMyProfile() {
|
|
119
|
-
return execOp("MyProfile_V2", {});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// ── Get User Profile ───────────────────────────────────────────
|
|
123
|
-
export async function getUserProfile(userId) {
|
|
124
|
-
return execOp("UserProfile_V2", {
|
|
125
|
-
id: userId,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// ═══════════════════════════════════════════════════════════════
|
|
130
|
-
// MANAGER & REPORTS
|
|
131
|
-
// ═══════════════════════════════════════════════════════════════
|
|
132
|
-
|
|
133
|
-
// ── Get Manager ────────────────────────────────────────────────
|
|
134
|
-
export async function getManager(userId) {
|
|
135
|
-
return execOp("Manager_V2", {
|
|
136
|
-
id: userId,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// ── Get Direct Reports ─────────────────────────────────────────
|
|
141
|
-
export async function getDirectReports(userId) {
|
|
142
|
-
return execOp("DirectReports_V2", {
|
|
143
|
-
id: userId,
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// ═══════════════════════════════════════════════════════════════
|
|
148
|
-
// PHOTO
|
|
149
|
-
// ═══════════════════════════════════════════════════════════════
|
|
150
|
-
|
|
151
|
-
// ── Get User Photo ─────────────────────────────────────────────
|
|
152
|
-
export async function getUserPhoto(userId) {
|
|
153
|
-
return execOp("UserPhoto_V2", {
|
|
154
|
-
id: userId,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// ═══════════════════════════════════════════════════════════════
|
|
159
|
-
// SEARCH
|
|
160
|
-
// ═══════════════════════════════════════════════════════════════
|
|
161
|
-
|
|
162
|
-
// ── Search for Users ───────────────────────────────────────────
|
|
163
|
-
export async function searchForUsers({ searchTerm, top, skip } = {}) {
|
|
164
|
-
const params = {};
|
|
165
|
-
if (searchTerm) params.searchTerm = searchTerm;
|
|
166
|
-
if (top != null) params.$top = top;
|
|
167
|
-
if (skip != null) params.$skip = skip;
|
|
168
|
-
return execOp("SearchUser_V2", params);
|
|
169
|
-
}
|
package/dev files/outlook.js
DELETED
|
@@ -1,330 +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_CANDIDATES = ["office365outlook", "Office365Outlook", "office365"];
|
|
5
|
-
const OUTLOOK_APIS = {
|
|
6
|
-
// ── Email operations ──
|
|
7
|
-
GetEmailsV3: {
|
|
8
|
-
path: "/{connectionId}/v3/Mail",
|
|
9
|
-
method: "GET",
|
|
10
|
-
parameters: [
|
|
11
|
-
{ name: "connectionId", in: "path", required: true },
|
|
12
|
-
{ name: "folderPath", in: "query", required: false },
|
|
13
|
-
{ name: "to", in: "query", required: false },
|
|
14
|
-
{ name: "cc", in: "query", required: false },
|
|
15
|
-
{ name: "toOrCc", in: "query", required: false },
|
|
16
|
-
{ name: "from", in: "query", required: false },
|
|
17
|
-
{ name: "importance", in: "query", required: false },
|
|
18
|
-
{ name: "fetchOnlyWithAttachment", in: "query", required: false },
|
|
19
|
-
{ name: "subjectFilter", in: "query", required: false },
|
|
20
|
-
{ name: "fetchOnlyUnread", in: "query", required: false },
|
|
21
|
-
{ name: "fetchOnlyFlagged", in: "query", required: false },
|
|
22
|
-
{ name: "mailboxAddress", in: "query", required: false },
|
|
23
|
-
{ name: "includeAttachments", in: "query", required: false },
|
|
24
|
-
{ name: "searchQuery", in: "query", required: false },
|
|
25
|
-
{ name: "top", in: "query", required: false },
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
SendEmailV2: {
|
|
29
|
-
path: "/{connectionId}/v2/Mail",
|
|
30
|
-
method: "POST",
|
|
31
|
-
parameters: [
|
|
32
|
-
{ name: "connectionId", in: "path", required: true },
|
|
33
|
-
{ name: "emailMessage", in: "body", required: true },
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
ForwardEmail: {
|
|
37
|
-
path: "/{connectionId}/codeless/api/v2.0/me/messages/{message_id}/forward",
|
|
38
|
-
method: "POST",
|
|
39
|
-
parameters: [
|
|
40
|
-
{ name: "connectionId", in: "path", required: true },
|
|
41
|
-
{ name: "message_id", in: "path", required: true },
|
|
42
|
-
{ name: "body", in: "body", required: true },
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
ReplyToV3: {
|
|
46
|
-
path: "/{connectionId}/v3/Mail/ReplyTo/{messageId}",
|
|
47
|
-
method: "POST",
|
|
48
|
-
parameters: [
|
|
49
|
-
{ name: "connectionId", in: "path", required: true },
|
|
50
|
-
{ name: "messageId", in: "path", required: true },
|
|
51
|
-
{ name: "replyParameters", in: "body", required: true },
|
|
52
|
-
{ name: "mailboxAddress", in: "query", required: false },
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
MoveV2: {
|
|
56
|
-
path: "/{connectionId}/v2/Mail/Move/{messageId}",
|
|
57
|
-
method: "POST",
|
|
58
|
-
parameters: [
|
|
59
|
-
{ name: "connectionId", in: "path", required: true },
|
|
60
|
-
{ name: "messageId", in: "path", required: true },
|
|
61
|
-
{ name: "folderPath", in: "query", required: true },
|
|
62
|
-
{ name: "mailboxAddress", in: "query", required: false },
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
DeleteEmail: {
|
|
66
|
-
path: "/{connectionId}/Mail/{messageId}",
|
|
67
|
-
method: "DELETE",
|
|
68
|
-
parameters: [
|
|
69
|
-
{ name: "connectionId", in: "path", required: true },
|
|
70
|
-
{ name: "messageId", in: "path", required: true },
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
SharedMailboxSendEmailV2: {
|
|
74
|
-
path: "/{connectionId}/v2/SharedMailbox/Mail",
|
|
75
|
-
method: "POST",
|
|
76
|
-
parameters: [
|
|
77
|
-
{ name: "connectionId", in: "path", required: true },
|
|
78
|
-
{ name: "emailMessage", in: "body", required: true },
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
// ── Calendar operations ──
|
|
82
|
-
V4CalendarGetItems: {
|
|
83
|
-
path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items",
|
|
84
|
-
method: "GET",
|
|
85
|
-
parameters: [
|
|
86
|
-
{ name: "connectionId", in: "path", required: true },
|
|
87
|
-
{ name: "table", in: "path", required: true },
|
|
88
|
-
{ name: "$filter", in: "query", required: false },
|
|
89
|
-
{ name: "$orderby", in: "query", required: false },
|
|
90
|
-
{ name: "$top", in: "query", required: false },
|
|
91
|
-
{ name: "$skip", in: "query", required: false },
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
V4CalendarPostItem: {
|
|
95
|
-
path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items",
|
|
96
|
-
method: "POST",
|
|
97
|
-
parameters: [
|
|
98
|
-
{ name: "connectionId", in: "path", required: true },
|
|
99
|
-
{ name: "table", in: "path", required: true },
|
|
100
|
-
{ name: "item", in: "body", required: true },
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
V4CalendarPatchItem: {
|
|
104
|
-
path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items/{id}",
|
|
105
|
-
method: "PATCH",
|
|
106
|
-
parameters: [
|
|
107
|
-
{ name: "connectionId", in: "path", required: true },
|
|
108
|
-
{ name: "table", in: "path", required: true },
|
|
109
|
-
{ name: "id", in: "path", required: true },
|
|
110
|
-
{ name: "item", in: "body", required: true },
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
CalendarDeleteItem: {
|
|
114
|
-
path: "/{connectionId}/datasets/calendars/tables/{table}/items/{id}",
|
|
115
|
-
method: "DELETE",
|
|
116
|
-
parameters: [
|
|
117
|
-
{ name: "connectionId", in: "path", required: true },
|
|
118
|
-
{ name: "table", in: "path", required: true },
|
|
119
|
-
{ name: "id", in: "path", required: true },
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// ── Initialize SDK client for the Office 365 Outlook connector ──
|
|
125
|
-
function initClient() {
|
|
126
|
-
const dataSourcesInfo = {};
|
|
127
|
-
|
|
128
|
-
DATA_SOURCE_CANDIDATES.forEach((sDataSourceName) => {
|
|
129
|
-
dataSourcesInfo[sDataSourceName] = {
|
|
130
|
-
tableId: "",
|
|
131
|
-
version: "",
|
|
132
|
-
primaryKey: "",
|
|
133
|
-
dataSourceType: "Connector",
|
|
134
|
-
apis: OUTLOOK_APIS,
|
|
135
|
-
};
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
return getClient(dataSourcesInfo);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function stringifyErrorDetails(oError) {
|
|
142
|
-
if (!oError) return "Operation failed";
|
|
143
|
-
if (typeof oError === "string") return oError;
|
|
144
|
-
if (oError instanceof Error) return oError.message || "Operation failed";
|
|
145
|
-
|
|
146
|
-
var aPropertyNames = Object.getOwnPropertyNames(oError);
|
|
147
|
-
var oSerializable = {};
|
|
148
|
-
aPropertyNames.forEach((sName) => {
|
|
149
|
-
oSerializable[sName] = oError[sName];
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
try {
|
|
153
|
-
return JSON.stringify(oSerializable);
|
|
154
|
-
} catch {
|
|
155
|
-
return String(oError);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function unwrapResult(oResult) {
|
|
160
|
-
if (oResult && oResult.success === false) {
|
|
161
|
-
var sMessage = stringifyErrorDetails(oResult.error);
|
|
162
|
-
if (oResult.data !== undefined) {
|
|
163
|
-
sMessage += " | data: " + stringifyErrorDetails(oResult.data);
|
|
164
|
-
}
|
|
165
|
-
throw new Error(sMessage);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (oResult && Object.prototype.hasOwnProperty.call(oResult, "data")) {
|
|
169
|
-
return oResult.data;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return oResult;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// ── Internal: execute a connector operation ────────────────────
|
|
176
|
-
async function execOp(sOperationName, oParameters) {
|
|
177
|
-
const client = await initClient();
|
|
178
|
-
const aErrors = [];
|
|
179
|
-
|
|
180
|
-
for (let iIndex = 0; iIndex < DATA_SOURCE_CANDIDATES.length; iIndex += 1) {
|
|
181
|
-
const sDataSourceName = DATA_SOURCE_CANDIDATES[iIndex];
|
|
182
|
-
|
|
183
|
-
try {
|
|
184
|
-
const oResult = await client.executeAsync({
|
|
185
|
-
connectorOperation: {
|
|
186
|
-
tableName: sDataSourceName,
|
|
187
|
-
operationName: sOperationName,
|
|
188
|
-
parameters: oParameters,
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
return unwrapResult(oResult);
|
|
193
|
-
} catch (oErr) {
|
|
194
|
-
const sMessage = stringifyErrorDetails(oErr);
|
|
195
|
-
aErrors.push(sDataSourceName + ": " + sMessage);
|
|
196
|
-
|
|
197
|
-
if (sMessage.indexOf("Connection reference not found") === -1) {
|
|
198
|
-
throw oErr;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
throw new Error("No Outlook connection reference matched. Tried: " + aErrors.join(" || "));
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// ── Generic: call any Outlook connector operation ──────────────
|
|
207
|
-
export async function callOutlookOperation(sOperationName, oParameters) {
|
|
208
|
-
return execOp(sOperationName, oParameters);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// ── Send Email ─────────────────────────────────────────────────
|
|
212
|
-
export async function sendEmail({ to, cc, bcc, subject, body, isHtml, importance, attachments } = {}) {
|
|
213
|
-
var oMessage = {
|
|
214
|
-
To: to,
|
|
215
|
-
Subject: subject,
|
|
216
|
-
Body: body,
|
|
217
|
-
};
|
|
218
|
-
if (cc) oMessage.Cc = cc;
|
|
219
|
-
if (bcc) oMessage.Bcc = bcc;
|
|
220
|
-
if (importance) oMessage.Importance = importance;
|
|
221
|
-
if (attachments) oMessage.Attachments = attachments;
|
|
222
|
-
if (isHtml === false) oMessage.IsHtml = false;
|
|
223
|
-
|
|
224
|
-
return execOp("SendEmailV2", { emailMessage: oMessage });
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// ── Forward Email ──────────────────────────────────────────────
|
|
228
|
-
export async function forwardEmail(sMessageId, { to, comment } = {}) {
|
|
229
|
-
return execOp("ForwardEmail", {
|
|
230
|
-
message_id: sMessageId,
|
|
231
|
-
body: { ToRecipients: to, Comment: comment },
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// ── Reply to Email ─────────────────────────────────────────────
|
|
236
|
-
export async function replyToEmail(sMessageId, { comment, replyAll } = {}) {
|
|
237
|
-
return execOp("ReplyToV3", {
|
|
238
|
-
messageId: sMessageId,
|
|
239
|
-
replyParameters: { Body: comment, ReplyAll: replyAll === true },
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// ── List Emails ────────────────────────────────────────────────
|
|
244
|
-
export async function listEmails({ folderId = "Inbox", fetchOnlyUnread, searchQuery, top, skip } = {}) {
|
|
245
|
-
return execOp("GetEmailsV3", {
|
|
246
|
-
folderPath: folderId,
|
|
247
|
-
fetchOnlyUnread: fetchOnlyUnread,
|
|
248
|
-
searchQuery: searchQuery,
|
|
249
|
-
top: top != null ? top : 10,
|
|
250
|
-
skip: skip,
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// ── Send from Shared Mailbox ───────────────────────────────────
|
|
255
|
-
export async function sendFromSharedMailbox(sSharedMailbox, { to, cc, bcc, subject, body, importance, attachments } = {}) {
|
|
256
|
-
var oMessage = {
|
|
257
|
-
MailboxAddress: sSharedMailbox,
|
|
258
|
-
To: to,
|
|
259
|
-
Subject: subject,
|
|
260
|
-
Body: body,
|
|
261
|
-
};
|
|
262
|
-
if (cc) oMessage.Cc = cc;
|
|
263
|
-
if (bcc) oMessage.Bcc = bcc;
|
|
264
|
-
if (importance) oMessage.Importance = importance;
|
|
265
|
-
if (attachments) oMessage.Attachments = attachments;
|
|
266
|
-
|
|
267
|
-
return execOp("SharedMailboxSendEmailV2", { emailMessage: oMessage });
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// ── Move Email ─────────────────────────────────────────────────
|
|
271
|
-
export async function moveEmail(sMessageId, sDestinationFolderId) {
|
|
272
|
-
return execOp("MoveV2", {
|
|
273
|
-
messageId: sMessageId,
|
|
274
|
-
folderPath: sDestinationFolderId,
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// ── Delete Email ───────────────────────────────────────────────
|
|
279
|
-
export async function deleteEmail(sMessageId) {
|
|
280
|
-
return execOp("DeleteEmail", { messageId: sMessageId });
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// ── Create Event ───────────────────────────────────────────────
|
|
284
|
-
export async function createEvent({ subject, start, end, attendees, body, location, importance, isAllDay, timeZone, calendarId } = {}) {
|
|
285
|
-
var sAttendees = Array.isArray(attendees) ? attendees.join(";") : attendees;
|
|
286
|
-
var oItem = {
|
|
287
|
-
subject: subject,
|
|
288
|
-
start: start,
|
|
289
|
-
end: end,
|
|
290
|
-
timeZone: timeZone || "",
|
|
291
|
-
};
|
|
292
|
-
if (sAttendees) oItem.requiredAttendees = sAttendees;
|
|
293
|
-
if (body) oItem.body = body;
|
|
294
|
-
if (location) oItem.location = location;
|
|
295
|
-
if (importance) oItem.importance = importance;
|
|
296
|
-
if (isAllDay) oItem.isAllDay = true;
|
|
297
|
-
|
|
298
|
-
return execOp("V4CalendarPostItem", {
|
|
299
|
-
table: calendarId || "Calendar",
|
|
300
|
-
item: oItem,
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// ── List Events ────────────────────────────────────────────────
|
|
305
|
-
export async function listEvents({ calendarId = "Calendar", filter, orderBy, top, skip } = {}) {
|
|
306
|
-
return execOp("V4CalendarGetItems", {
|
|
307
|
-
table: calendarId,
|
|
308
|
-
$filter: filter,
|
|
309
|
-
$orderby: orderBy,
|
|
310
|
-
$top: top,
|
|
311
|
-
$skip: skip,
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// ── Edit Event ─────────────────────────────────────────────────
|
|
316
|
-
export async function editEvent(sEventId, oChangedFields, sCalendarId) {
|
|
317
|
-
return execOp("V4CalendarPatchItem", {
|
|
318
|
-
table: sCalendarId || "Calendar",
|
|
319
|
-
id: sEventId,
|
|
320
|
-
item: oChangedFields,
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// ── Delete Event ───────────────────────────────────────────────
|
|
325
|
-
export async function deleteEvent(sEventId, sCalendarId) {
|
|
326
|
-
return execOp("CalendarDeleteItem", {
|
|
327
|
-
table: sCalendarId || "Calendar",
|
|
328
|
-
id: sEventId,
|
|
329
|
-
});
|
|
330
|
-
}
|