codeapp-js 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/codeApp/.power/schemas/teams/teams.Schema.json +11112 -0
- package/codeApp/dist/codeapp.js +992 -4
- package/codeApp/dist/power-apps-data.js +145 -31
- 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/models/Office365GroupsModel.ts +363 -0
- package/codeApp/src/generated/models/Office365OutlookModel.ts +2046 -0
- package/codeApp/src/generated/models/Office365UsersModel.ts +254 -0
- package/codeApp/src/generated/services/AzureKeyVaultService.ts +257 -0
- package/codeApp/src/generated/services/JiraService.ts +1124 -0
- package/codeApp/src/generated/services/Office365GroupsService.ts +326 -0
- package/codeApp/src/generated/services/Office365OutlookService.ts +2476 -0
- package/codeApp/src/generated/services/Office365UsersService.ts +358 -0
- package/dev files/outlook.js +218 -9
- package/examples/combined demo/dist/codeapp.js +1098 -1098
- package/examples/combined demo/dist/index.js +470 -470
- package/examples/combined demo/dist/power-apps-data.js +3006 -3006
- package/examples/combined demo/power.config.json +42 -42
- package/examples/dataverse Demo/dist/codeapp.js +1085 -1085
- package/examples/dataverse Demo/dist/index.html +54 -54
- package/examples/dataverse Demo/dist/index.js +82 -82
- package/examples/dataverse Demo/dist/power-apps-data.js +2911 -2911
- 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 -1085
- package/examples/groups Demo/dist/index.js +113 -113
- package/examples/groups Demo/dist/power-apps-data.js +2911 -2911
- 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 +2953 -2953
- 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 +2953 -2953
- package/examples/myProfile/power.config.json +22 -22
- package/examples/myProfile/readme.md +79 -79
- package/examples/outlook Demo/dist/codeapp.js +1085 -1085
- package/examples/outlook Demo/dist/index.html +35 -35
- package/examples/outlook Demo/dist/index.js +170 -170
- package/examples/outlook Demo/dist/outlook.js +121 -121
- package/examples/outlook Demo/dist/power-apps-data.js +2911 -2911
- 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/{solution explorer → outlook Demo2}/dist/codeapp.js +245 -9
- package/examples/outlook Demo2/dist/index.html +98 -0
- package/examples/outlook Demo2/dist/index.js +272 -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 +2953 -2953
- 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 -1085
- package/examples/sharePoint Demo/dist/index.js +262 -262
- package/examples/sharePoint Demo/dist/power-apps-data.js +2911 -2911
- package/examples/sharePoint Demo/power.config.json +22 -22
- 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 +2953 -2953
- 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 -1
- package/readme.md +33 -4
- 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/index.html +0 -80
- package/examples/solution explorer/dist/index.js +0 -735
- package/examples/solution explorer/dist/styles.css +0 -571
- package/examples/solution explorer/power.config.json +0 -151
- /package/examples/{solution explorer → outlook Demo2}/dist/icon-512.png +0 -0
- /package/examples/{solution explorer → outlook Demo2}/dist/power-apps-data.js +0 -0
package/codeApp/dist/codeapp.js
CHANGED
|
@@ -718,6 +718,7 @@ export async function getFileMetadata(sSiteUrl, sFileId) {
|
|
|
718
718
|
// ── Data source name (must match connectionReferences in power.config.json) ──
|
|
719
719
|
const DATA_SOURCE_CANDIDATES = ["office365outlook", "Office365Outlook", "office365"];
|
|
720
720
|
const OUTLOOK_APIS = {
|
|
721
|
+
// ── Email operations ──
|
|
721
722
|
GetEmailsV3: {
|
|
722
723
|
path: "/{connectionId}/v3/Mail",
|
|
723
724
|
method: "GET",
|
|
@@ -739,6 +740,100 @@ const OUTLOOK_APIS = {
|
|
|
739
740
|
{ name: "top", in: "query", required: false },
|
|
740
741
|
],
|
|
741
742
|
},
|
|
743
|
+
SendEmailV2: {
|
|
744
|
+
path: "/{connectionId}/v2/Mail",
|
|
745
|
+
method: "POST",
|
|
746
|
+
parameters: [
|
|
747
|
+
{ name: "connectionId", in: "path", required: true },
|
|
748
|
+
{ name: "emailMessage", in: "body", required: true },
|
|
749
|
+
],
|
|
750
|
+
},
|
|
751
|
+
ForwardEmail: {
|
|
752
|
+
path: "/{connectionId}/codeless/api/v2.0/me/messages/{message_id}/forward",
|
|
753
|
+
method: "POST",
|
|
754
|
+
parameters: [
|
|
755
|
+
{ name: "connectionId", in: "path", required: true },
|
|
756
|
+
{ name: "message_id", in: "path", required: true },
|
|
757
|
+
{ name: "body", in: "body", required: true },
|
|
758
|
+
],
|
|
759
|
+
},
|
|
760
|
+
ReplyToV3: {
|
|
761
|
+
path: "/{connectionId}/v3/Mail/ReplyTo/{messageId}",
|
|
762
|
+
method: "POST",
|
|
763
|
+
parameters: [
|
|
764
|
+
{ name: "connectionId", in: "path", required: true },
|
|
765
|
+
{ name: "messageId", in: "path", required: true },
|
|
766
|
+
{ name: "replyParameters", in: "body", required: true },
|
|
767
|
+
{ name: "mailboxAddress", in: "query", required: false },
|
|
768
|
+
],
|
|
769
|
+
},
|
|
770
|
+
MoveV2: {
|
|
771
|
+
path: "/{connectionId}/v2/Mail/Move/{messageId}",
|
|
772
|
+
method: "POST",
|
|
773
|
+
parameters: [
|
|
774
|
+
{ name: "connectionId", in: "path", required: true },
|
|
775
|
+
{ name: "messageId", in: "path", required: true },
|
|
776
|
+
{ name: "folderPath", in: "query", required: true },
|
|
777
|
+
{ name: "mailboxAddress", in: "query", required: false },
|
|
778
|
+
],
|
|
779
|
+
},
|
|
780
|
+
DeleteEmail: {
|
|
781
|
+
path: "/{connectionId}/Mail/{messageId}",
|
|
782
|
+
method: "DELETE",
|
|
783
|
+
parameters: [
|
|
784
|
+
{ name: "connectionId", in: "path", required: true },
|
|
785
|
+
{ name: "messageId", in: "path", required: true },
|
|
786
|
+
],
|
|
787
|
+
},
|
|
788
|
+
SharedMailboxSendEmailV2: {
|
|
789
|
+
path: "/{connectionId}/v2/SharedMailbox/Mail",
|
|
790
|
+
method: "POST",
|
|
791
|
+
parameters: [
|
|
792
|
+
{ name: "connectionId", in: "path", required: true },
|
|
793
|
+
{ name: "emailMessage", in: "body", required: true },
|
|
794
|
+
],
|
|
795
|
+
},
|
|
796
|
+
// ── Calendar operations ──
|
|
797
|
+
V4CalendarGetItems: {
|
|
798
|
+
path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items",
|
|
799
|
+
method: "GET",
|
|
800
|
+
parameters: [
|
|
801
|
+
{ name: "connectionId", in: "path", required: true },
|
|
802
|
+
{ name: "table", in: "path", required: true },
|
|
803
|
+
{ name: "$filter", in: "query", required: false },
|
|
804
|
+
{ name: "$orderby", in: "query", required: false },
|
|
805
|
+
{ name: "$top", in: "query", required: false },
|
|
806
|
+
{ name: "$skip", in: "query", required: false },
|
|
807
|
+
],
|
|
808
|
+
},
|
|
809
|
+
V4CalendarPostItem: {
|
|
810
|
+
path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items",
|
|
811
|
+
method: "POST",
|
|
812
|
+
parameters: [
|
|
813
|
+
{ name: "connectionId", in: "path", required: true },
|
|
814
|
+
{ name: "table", in: "path", required: true },
|
|
815
|
+
{ name: "item", in: "body", required: true },
|
|
816
|
+
],
|
|
817
|
+
},
|
|
818
|
+
V4CalendarPatchItem: {
|
|
819
|
+
path: "/{connectionId}/datasets/calendars/v4/tables/{table}/items/{id}",
|
|
820
|
+
method: "PATCH",
|
|
821
|
+
parameters: [
|
|
822
|
+
{ name: "connectionId", in: "path", required: true },
|
|
823
|
+
{ name: "table", in: "path", required: true },
|
|
824
|
+
{ name: "id", in: "path", required: true },
|
|
825
|
+
{ name: "item", in: "body", required: true },
|
|
826
|
+
],
|
|
827
|
+
},
|
|
828
|
+
CalendarDeleteItem: {
|
|
829
|
+
path: "/{connectionId}/datasets/calendars/tables/{table}/items/{id}",
|
|
830
|
+
method: "DELETE",
|
|
831
|
+
parameters: [
|
|
832
|
+
{ name: "connectionId", in: "path", required: true },
|
|
833
|
+
{ name: "table", in: "path", required: true },
|
|
834
|
+
{ name: "id", in: "path", required: true },
|
|
835
|
+
],
|
|
836
|
+
},
|
|
742
837
|
};
|
|
743
838
|
|
|
744
839
|
// ── Initialize SDK client for the Office 365 Outlook connector ──
|
|
@@ -823,16 +918,152 @@ async function execOutlookOp(operationName, parameters) {
|
|
|
823
918
|
throw new Error("No Outlook connection reference matched. Tried: " + aErrors.join(" || "));
|
|
824
919
|
}
|
|
825
920
|
|
|
921
|
+
// ── Generic: call any Outlook connector operation ──────────────
|
|
922
|
+
export async function callOutlookOperation(sOperationName, oParameters) {
|
|
923
|
+
return _dbgWrap('callOutlookOperation', [sOperationName, oParameters], async function() {
|
|
924
|
+
return execOutlookOp(sOperationName, oParameters);
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
// ── Send Email ─────────────────────────────────────────────────
|
|
929
|
+
export async function sendEmail({ to, cc, bcc, subject, body, isHtml, importance, attachments } = {}) {
|
|
930
|
+
return _dbgWrap('sendEmail', [{ to, cc, bcc, subject, body, isHtml, importance, attachments }], async function() {
|
|
931
|
+
var oMessage = {
|
|
932
|
+
To: to,
|
|
933
|
+
Subject: subject,
|
|
934
|
+
Body: body,
|
|
935
|
+
};
|
|
936
|
+
if (cc) oMessage.Cc = cc;
|
|
937
|
+
if (bcc) oMessage.Bcc = bcc;
|
|
938
|
+
if (importance) oMessage.Importance = importance;
|
|
939
|
+
if (attachments) oMessage.Attachments = attachments;
|
|
940
|
+
if (isHtml === false) oMessage.IsHtml = false;
|
|
941
|
+
|
|
942
|
+
return execOutlookOp("SendEmailV2", { emailMessage: oMessage });
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// ── Forward Email ──────────────────────────────────────────────
|
|
947
|
+
export async function forwardEmail(sMessageId, { to, comment } = {}) {
|
|
948
|
+
return _dbgWrap('forwardEmail', [sMessageId, { to, comment }], async function() {
|
|
949
|
+
return execOutlookOp("ForwardEmail", {
|
|
950
|
+
message_id: sMessageId,
|
|
951
|
+
body: { ToRecipients: to, Comment: comment },
|
|
952
|
+
});
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
// ── Reply to Email ─────────────────────────────────────────────
|
|
957
|
+
export async function replyToEmail(sMessageId, { comment, replyAll } = {}) {
|
|
958
|
+
return _dbgWrap('replyToEmail', [sMessageId, { comment, replyAll }], async function() {
|
|
959
|
+
return execOutlookOp("ReplyToV3", {
|
|
960
|
+
messageId: sMessageId,
|
|
961
|
+
replyParameters: { Body: comment, ReplyAll: replyAll === true },
|
|
962
|
+
});
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
|
|
826
966
|
// ── List Emails ────────────────────────────────────────────────
|
|
827
967
|
export async function listEmails({ folderId = "Inbox", fetchOnlyUnread, searchQuery, top, skip } = {}) {
|
|
828
968
|
return _dbgWrap('listEmails', [{ folderId, fetchOnlyUnread, searchQuery, top, skip }], async function() {
|
|
829
|
-
void skip;
|
|
830
|
-
|
|
831
969
|
return execOutlookOp("GetEmailsV3", {
|
|
832
970
|
folderPath: folderId,
|
|
833
|
-
fetchOnlyUnread,
|
|
834
|
-
searchQuery,
|
|
971
|
+
fetchOnlyUnread: fetchOnlyUnread,
|
|
972
|
+
searchQuery: searchQuery,
|
|
835
973
|
top: top != null ? top : 10,
|
|
974
|
+
skip: skip,
|
|
975
|
+
});
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// ── Send from Shared Mailbox ───────────────────────────────────
|
|
980
|
+
export async function sendFromSharedMailbox(sSharedMailbox, { to, cc, bcc, subject, body, importance, attachments } = {}) {
|
|
981
|
+
return _dbgWrap('sendFromSharedMailbox', [sSharedMailbox, { to, cc, bcc, subject, body, importance, attachments }], async function() {
|
|
982
|
+
var oMessage = {
|
|
983
|
+
MailboxAddress: sSharedMailbox,
|
|
984
|
+
To: to,
|
|
985
|
+
Subject: subject,
|
|
986
|
+
Body: body,
|
|
987
|
+
};
|
|
988
|
+
if (cc) oMessage.Cc = cc;
|
|
989
|
+
if (bcc) oMessage.Bcc = bcc;
|
|
990
|
+
if (importance) oMessage.Importance = importance;
|
|
991
|
+
if (attachments) oMessage.Attachments = attachments;
|
|
992
|
+
|
|
993
|
+
return execOutlookOp("SharedMailboxSendEmailV2", { emailMessage: oMessage });
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
// ── Move Email ─────────────────────────────────────────────────
|
|
998
|
+
export async function moveEmail(sMessageId, sDestinationFolderId) {
|
|
999
|
+
return _dbgWrap('moveEmail', [sMessageId, sDestinationFolderId], async function() {
|
|
1000
|
+
return execOutlookOp("MoveV2", {
|
|
1001
|
+
messageId: sMessageId,
|
|
1002
|
+
folderPath: sDestinationFolderId,
|
|
1003
|
+
});
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// ── Delete Email ───────────────────────────────────────────────
|
|
1008
|
+
export async function deleteEmail(sMessageId) {
|
|
1009
|
+
return _dbgWrap('deleteEmail', [sMessageId], async function() {
|
|
1010
|
+
return execOutlookOp("DeleteEmail", { messageId: sMessageId });
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// ── Create Event ───────────────────────────────────────────────
|
|
1015
|
+
export async function createEvent({ subject, start, end, attendees, body, location, importance, isAllDay, timeZone, calendarId } = {}) {
|
|
1016
|
+
return _dbgWrap('createEvent', [{ subject, start, end, attendees, body, location, importance, isAllDay, timeZone, calendarId }], async function() {
|
|
1017
|
+
var sAttendees = Array.isArray(attendees) ? attendees.join(";") : attendees;
|
|
1018
|
+
var oItem = {
|
|
1019
|
+
subject: subject,
|
|
1020
|
+
start: start,
|
|
1021
|
+
end: end,
|
|
1022
|
+
timeZone: timeZone || "",
|
|
1023
|
+
};
|
|
1024
|
+
if (sAttendees) oItem.requiredAttendees = sAttendees;
|
|
1025
|
+
if (body) oItem.body = body;
|
|
1026
|
+
if (location) oItem.location = location;
|
|
1027
|
+
if (importance) oItem.importance = importance;
|
|
1028
|
+
if (isAllDay) oItem.isAllDay = true;
|
|
1029
|
+
|
|
1030
|
+
return execOutlookOp("V4CalendarPostItem", {
|
|
1031
|
+
table: calendarId || "Calendar",
|
|
1032
|
+
item: oItem,
|
|
1033
|
+
});
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// ── List Events ────────────────────────────────────────────────
|
|
1038
|
+
export async function listEvents({ calendarId = "Calendar", filter, orderBy, top, skip } = {}) {
|
|
1039
|
+
return _dbgWrap('listEvents', [{ calendarId, filter, orderBy, top, skip }], async function() {
|
|
1040
|
+
return execOutlookOp("V4CalendarGetItems", {
|
|
1041
|
+
table: calendarId,
|
|
1042
|
+
$filter: filter,
|
|
1043
|
+
$orderby: orderBy,
|
|
1044
|
+
$top: top,
|
|
1045
|
+
$skip: skip,
|
|
1046
|
+
});
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
// ── Edit Event ─────────────────────────────────────────────────
|
|
1051
|
+
export async function editEvent(sEventId, oChangedFields, sCalendarId) {
|
|
1052
|
+
return _dbgWrap('editEvent', [sEventId, oChangedFields, sCalendarId], async function() {
|
|
1053
|
+
return execOutlookOp("V4CalendarPatchItem", {
|
|
1054
|
+
table: sCalendarId || "Calendar",
|
|
1055
|
+
id: sEventId,
|
|
1056
|
+
item: oChangedFields,
|
|
1057
|
+
});
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// ── Delete Event ───────────────────────────────────────────────
|
|
1062
|
+
export async function deleteEvent(sEventId, sCalendarId) {
|
|
1063
|
+
return _dbgWrap('deleteEvent', [sEventId, sCalendarId], async function() {
|
|
1064
|
+
return execOutlookOp("CalendarDeleteItem", {
|
|
1065
|
+
table: sCalendarId || "Calendar",
|
|
1066
|
+
id: sEventId,
|
|
836
1067
|
});
|
|
837
1068
|
});
|
|
838
1069
|
}
|
|
@@ -1101,3 +1332,760 @@ export async function listGroupMembers(groupId) {
|
|
|
1101
1332
|
});
|
|
1102
1333
|
});
|
|
1103
1334
|
}
|
|
1335
|
+
|
|
1336
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
1337
|
+
// ───────────────────────── Connector Helpers ────────────────────────────────
|
|
1338
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
1339
|
+
|
|
1340
|
+
function initConnectorClientWithCandidates(aDataSourceCandidates, oApis) {
|
|
1341
|
+
const dataSourcesInfo = {};
|
|
1342
|
+
|
|
1343
|
+
aDataSourceCandidates.forEach(function(sDataSourceName) {
|
|
1344
|
+
dataSourcesInfo[sDataSourceName] = {
|
|
1345
|
+
tableId: "",
|
|
1346
|
+
version: "",
|
|
1347
|
+
primaryKey: "",
|
|
1348
|
+
dataSourceType: "Connector",
|
|
1349
|
+
apis: oApis,
|
|
1350
|
+
};
|
|
1351
|
+
});
|
|
1352
|
+
|
|
1353
|
+
return getClient(dataSourcesInfo);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
async function execConnectorOpWithCandidates(aDataSourceCandidates, oApis, sConnectorName, operationName, parameters) {
|
|
1357
|
+
const client = await initConnectorClientWithCandidates(aDataSourceCandidates, oApis);
|
|
1358
|
+
const aErrors = [];
|
|
1359
|
+
|
|
1360
|
+
for (let iIndex = 0; iIndex < aDataSourceCandidates.length; iIndex += 1) {
|
|
1361
|
+
const sDataSourceName = aDataSourceCandidates[iIndex];
|
|
1362
|
+
|
|
1363
|
+
try {
|
|
1364
|
+
const result = await client.executeAsync({
|
|
1365
|
+
connectorOperation: {
|
|
1366
|
+
tableName: sDataSourceName,
|
|
1367
|
+
operationName,
|
|
1368
|
+
parameters,
|
|
1369
|
+
},
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
return unwrapOutlookResult(result);
|
|
1373
|
+
} catch (oErr) {
|
|
1374
|
+
const sMessage = stringifyOutlookError(oErr);
|
|
1375
|
+
aErrors.push(sDataSourceName + ": " + sMessage);
|
|
1376
|
+
|
|
1377
|
+
if (sMessage.indexOf("Connection reference not found") === -1) {
|
|
1378
|
+
throw oErr;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
throw new Error("No " + sConnectorName + " connection reference matched. Tried: " + aErrors.join(" || "));
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
1387
|
+
// ─────────────────────────────────── Jira ───────────────────────────────────
|
|
1388
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
1389
|
+
|
|
1390
|
+
const JIRA_DATA_SOURCE_CANDIDATES = ["jira", "Jira", "JIRA"];
|
|
1391
|
+
const JIRA_APIS = {
|
|
1392
|
+
AddComment_V2: {
|
|
1393
|
+
path: "/{connectionId}/v2/issue/{issueKey}/comment",
|
|
1394
|
+
method: "POST",
|
|
1395
|
+
parameters: [
|
|
1396
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1397
|
+
{ name: "X-Request-Jirainstance", in: "header", required: true },
|
|
1398
|
+
{ name: "issueKey", in: "path", required: true },
|
|
1399
|
+
{ name: "body", in: "body", required: true },
|
|
1400
|
+
],
|
|
1401
|
+
},
|
|
1402
|
+
CancelTask_V2: {
|
|
1403
|
+
path: "/{connectionId}/v2/task/{taskId}/cancel",
|
|
1404
|
+
method: "POST",
|
|
1405
|
+
parameters: [
|
|
1406
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1407
|
+
{ name: "X-Request-Jirainstance", in: "header", required: true },
|
|
1408
|
+
{ name: "taskId", in: "path", required: true },
|
|
1409
|
+
{ name: "X-Atlassian-Token", in: "header", required: true },
|
|
1410
|
+
],
|
|
1411
|
+
},
|
|
1412
|
+
CreateIssue_V3: {
|
|
1413
|
+
path: "/{connectionId}/v3/issue",
|
|
1414
|
+
method: "POST",
|
|
1415
|
+
parameters: [
|
|
1416
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1417
|
+
{ name: "X-Request-Jirainstance", in: "header", required: true },
|
|
1418
|
+
{ name: "projectKey", in: "query", required: true },
|
|
1419
|
+
{ name: "issueTypeIds", in: "query", required: true },
|
|
1420
|
+
{ name: "item", in: "body", required: false },
|
|
1421
|
+
],
|
|
1422
|
+
},
|
|
1423
|
+
EditIssue_V2: {
|
|
1424
|
+
path: "/{connectionId}/v2/3/issue/{issueIdOrKey}",
|
|
1425
|
+
method: "PUT",
|
|
1426
|
+
parameters: [
|
|
1427
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1428
|
+
{ name: "X-Request-Jirainstance", in: "header", required: true },
|
|
1429
|
+
{ name: "issueIdOrKey", in: "path", required: true },
|
|
1430
|
+
{ name: "notifyUsers", in: "query", required: false },
|
|
1431
|
+
{ name: "overrideScreenSecurity", in: "query", required: false },
|
|
1432
|
+
{ name: "overrideEditableFlag", in: "query", required: false },
|
|
1433
|
+
{ name: "body", in: "body", required: false },
|
|
1434
|
+
],
|
|
1435
|
+
},
|
|
1436
|
+
GetCurrentUser: {
|
|
1437
|
+
path: "/{connectionId}/3/myself",
|
|
1438
|
+
method: "GET",
|
|
1439
|
+
parameters: [
|
|
1440
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1441
|
+
{ name: "X-Request-Jirainstance", in: "header", required: true },
|
|
1442
|
+
{ name: "expand", in: "query", required: false },
|
|
1443
|
+
],
|
|
1444
|
+
},
|
|
1445
|
+
GetIssue_V2: {
|
|
1446
|
+
path: "/{connectionId}/v2/issue/{issueKey}",
|
|
1447
|
+
method: "GET",
|
|
1448
|
+
parameters: [
|
|
1449
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1450
|
+
{ name: "X-Request-Jirainstance", in: "header", required: true },
|
|
1451
|
+
{ name: "issueKey", in: "path", required: true },
|
|
1452
|
+
],
|
|
1453
|
+
},
|
|
1454
|
+
ListFilters_V2: {
|
|
1455
|
+
path: "/{connectionId}/v2/filter/search",
|
|
1456
|
+
method: "GET",
|
|
1457
|
+
parameters: [
|
|
1458
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1459
|
+
{ name: "X-Request-Jirainstance", in: "header", required: true },
|
|
1460
|
+
],
|
|
1461
|
+
},
|
|
1462
|
+
ListIssues: {
|
|
1463
|
+
path: "/{connectionId}/2/search",
|
|
1464
|
+
method: "GET",
|
|
1465
|
+
parameters: [
|
|
1466
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1467
|
+
{ name: "X-Request-Jirainstance", in: "header", required: true },
|
|
1468
|
+
{ name: "jql", in: "query", required: false },
|
|
1469
|
+
{ name: "expand", in: "query", required: false },
|
|
1470
|
+
{ name: "fields", in: "query", required: false },
|
|
1471
|
+
],
|
|
1472
|
+
},
|
|
1473
|
+
ListProjects_V2: {
|
|
1474
|
+
path: "/{connectionId}/project/search",
|
|
1475
|
+
method: "GET",
|
|
1476
|
+
parameters: [
|
|
1477
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1478
|
+
],
|
|
1479
|
+
},
|
|
1480
|
+
GetTask_V2: {
|
|
1481
|
+
path: "/{connectionId}/v2/task/{taskId}",
|
|
1482
|
+
method: "GET",
|
|
1483
|
+
parameters: [
|
|
1484
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1485
|
+
{ name: "X-Request-Jirainstance", in: "header", required: true },
|
|
1486
|
+
{ name: "taskId", in: "path", required: true },
|
|
1487
|
+
],
|
|
1488
|
+
},
|
|
1489
|
+
GetUser_V2: {
|
|
1490
|
+
path: "/{connectionId}/v2/user",
|
|
1491
|
+
method: "GET",
|
|
1492
|
+
parameters: [
|
|
1493
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1494
|
+
{ name: "X-Request-Jirainstance", in: "header", required: true },
|
|
1495
|
+
{ name: "accountId", in: "query", required: true },
|
|
1496
|
+
{ name: "expand", in: "query", required: false },
|
|
1497
|
+
],
|
|
1498
|
+
},
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
async function execJiraOp(operationName, parameters) {
|
|
1502
|
+
return execConnectorOpWithCandidates(JIRA_DATA_SOURCE_CANDIDATES, JIRA_APIS, "Jira", operationName, parameters);
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
export async function callJiraOperation(operationName, parameters = {}) {
|
|
1506
|
+
return _dbgWrap('callJiraOperation', [operationName, parameters], async function() {
|
|
1507
|
+
return execJiraOp(operationName, parameters);
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
export async function addJiraComment(sIssueKey, body, sJiraInstance) {
|
|
1512
|
+
return _dbgWrap('addJiraComment', [sIssueKey, body, sJiraInstance], async function() {
|
|
1513
|
+
return execJiraOp("AddComment_V2", {
|
|
1514
|
+
"X-Request-Jirainstance": sJiraInstance,
|
|
1515
|
+
issueKey: sIssueKey,
|
|
1516
|
+
body,
|
|
1517
|
+
});
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
export async function cancelJiraTask(sTaskId, sJiraInstance, sToken) {
|
|
1522
|
+
return _dbgWrap('cancelJiraTask', [sTaskId, sJiraInstance, sToken], async function() {
|
|
1523
|
+
return execJiraOp("CancelTask_V2", {
|
|
1524
|
+
"X-Request-Jirainstance": sJiraInstance,
|
|
1525
|
+
taskId: sTaskId,
|
|
1526
|
+
"X-Atlassian-Token": sToken || "nocheck",
|
|
1527
|
+
});
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
export async function createJiraIssueV3({ jiraInstance, projectKey, issueTypeIds, item } = {}) {
|
|
1532
|
+
return _dbgWrap('createJiraIssueV3', [{ jiraInstance, projectKey, issueTypeIds, item }], async function() {
|
|
1533
|
+
return execJiraOp("CreateIssue_V3", {
|
|
1534
|
+
"X-Request-Jirainstance": jiraInstance,
|
|
1535
|
+
projectKey,
|
|
1536
|
+
issueTypeIds,
|
|
1537
|
+
item,
|
|
1538
|
+
});
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
export async function editJiraIssueV2(sIssueIdOrKey, { jiraInstance, body, notifyUsers, overrideScreenSecurity, overrideEditableFlag } = {}) {
|
|
1543
|
+
return _dbgWrap('editJiraIssueV2', [sIssueIdOrKey, { jiraInstance, body, notifyUsers, overrideScreenSecurity, overrideEditableFlag }], async function() {
|
|
1544
|
+
return execJiraOp("EditIssue_V2", {
|
|
1545
|
+
"X-Request-Jirainstance": jiraInstance,
|
|
1546
|
+
issueIdOrKey: sIssueIdOrKey,
|
|
1547
|
+
notifyUsers,
|
|
1548
|
+
overrideScreenSecurity,
|
|
1549
|
+
overrideEditableFlag,
|
|
1550
|
+
body,
|
|
1551
|
+
});
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
export async function getCurrentJiraUser({ jiraInstance, expand } = {}) {
|
|
1556
|
+
return _dbgWrap('getCurrentJiraUser', [{ jiraInstance, expand }], async function() {
|
|
1557
|
+
return execJiraOp("GetCurrentUser", {
|
|
1558
|
+
"X-Request-Jirainstance": jiraInstance,
|
|
1559
|
+
expand,
|
|
1560
|
+
});
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
export async function getJiraIssueByKey(sIssueKey, sJiraInstance) {
|
|
1565
|
+
return _dbgWrap('getJiraIssueByKey', [sIssueKey, sJiraInstance], async function() {
|
|
1566
|
+
return execJiraOp("GetIssue_V2", {
|
|
1567
|
+
"X-Request-Jirainstance": sJiraInstance,
|
|
1568
|
+
issueKey: sIssueKey,
|
|
1569
|
+
});
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
export async function listJiraFilters(sJiraInstance) {
|
|
1574
|
+
return _dbgWrap('listJiraFilters', [sJiraInstance], async function() {
|
|
1575
|
+
return execJiraOp("ListFilters_V2", {
|
|
1576
|
+
"X-Request-Jirainstance": sJiraInstance,
|
|
1577
|
+
});
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
export async function listJiraIssues({ jiraInstance, jql, fields, expand } = {}) {
|
|
1582
|
+
return _dbgWrap('listJiraIssues', [{ jiraInstance, jql, fields, expand }], async function() {
|
|
1583
|
+
return execJiraOp("ListIssues", {
|
|
1584
|
+
"X-Request-Jirainstance": jiraInstance,
|
|
1585
|
+
jql,
|
|
1586
|
+
fields,
|
|
1587
|
+
expand,
|
|
1588
|
+
});
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
export async function listJiraProjects() {
|
|
1593
|
+
return _dbgWrap('listJiraProjects', [], async function() {
|
|
1594
|
+
return execJiraOp("ListProjects_V2", {});
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
export async function getJiraTask(sTaskId, sJiraInstance) {
|
|
1599
|
+
return _dbgWrap('getJiraTask', [sTaskId, sJiraInstance], async function() {
|
|
1600
|
+
return execJiraOp("GetTask_V2", {
|
|
1601
|
+
"X-Request-Jirainstance": sJiraInstance,
|
|
1602
|
+
taskId: sTaskId,
|
|
1603
|
+
});
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
export async function getJiraUser(sAccountId, { jiraInstance, expand } = {}) {
|
|
1608
|
+
return _dbgWrap('getJiraUser', [sAccountId, { jiraInstance, expand }], async function() {
|
|
1609
|
+
return execJiraOp("GetUser_V2", {
|
|
1610
|
+
"X-Request-Jirainstance": jiraInstance,
|
|
1611
|
+
accountId: sAccountId,
|
|
1612
|
+
expand,
|
|
1613
|
+
});
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
1618
|
+
// ───────────────────────────── Azure Key Vault ──────────────────────────────
|
|
1619
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
1620
|
+
|
|
1621
|
+
const KEY_VAULT_DATA_SOURCE_CANDIDATES = ["keyvault", "KeyVault", "azurekeyvault", "azureKeyVault", "AzureKeyVault"];
|
|
1622
|
+
const KEY_VAULT_APIS = {
|
|
1623
|
+
GetSecret: {
|
|
1624
|
+
path: "/{connectionId}/secrets/{secretName}/value",
|
|
1625
|
+
method: "GET",
|
|
1626
|
+
parameters: [
|
|
1627
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1628
|
+
{ name: "secretName", in: "path", required: true },
|
|
1629
|
+
],
|
|
1630
|
+
},
|
|
1631
|
+
ListSecrets: {
|
|
1632
|
+
path: "/{connectionId}/secrets",
|
|
1633
|
+
method: "GET",
|
|
1634
|
+
parameters: [
|
|
1635
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1636
|
+
],
|
|
1637
|
+
},
|
|
1638
|
+
};
|
|
1639
|
+
|
|
1640
|
+
async function execKeyVaultOp(operationName, parameters) {
|
|
1641
|
+
return execConnectorOpWithCandidates(KEY_VAULT_DATA_SOURCE_CANDIDATES, KEY_VAULT_APIS, "Azure Key Vault", operationName, parameters);
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
export async function callKeyVaultOperation(operationName, parameters = {}) {
|
|
1645
|
+
return _dbgWrap('callKeyVaultOperation', [operationName, parameters], async function() {
|
|
1646
|
+
return execKeyVaultOp(operationName, parameters);
|
|
1647
|
+
});
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
export async function getSecret(sSecretName, sApiVersion) {
|
|
1651
|
+
return _dbgWrap('getSecret', [sSecretName, sApiVersion], async function() {
|
|
1652
|
+
return execKeyVaultOp("GetSecret", {
|
|
1653
|
+
secretName: sSecretName,
|
|
1654
|
+
});
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
export async function listSecrets({ maxresults, apiVersion } = {}) {
|
|
1659
|
+
return _dbgWrap('listSecrets', [{ maxresults, apiVersion }], async function() {
|
|
1660
|
+
return execKeyVaultOp("ListSecrets", {});
|
|
1661
|
+
});
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
1665
|
+
// ─────────────────────────────────── SQL ────────────────────────────────────
|
|
1666
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
1667
|
+
|
|
1668
|
+
const SQL_DATA_SOURCE_CANDIDATES = ["sql", "Sql", "SQL"];
|
|
1669
|
+
const SQL_APIS = {
|
|
1670
|
+
GetTables_V2: {
|
|
1671
|
+
path: "/GetTables_V2",
|
|
1672
|
+
method: "POST",
|
|
1673
|
+
parameters: [
|
|
1674
|
+
{ name: "body", in: "body", required: true },
|
|
1675
|
+
],
|
|
1676
|
+
},
|
|
1677
|
+
GetItems_V2: {
|
|
1678
|
+
path: "/GetItems_V2",
|
|
1679
|
+
method: "POST",
|
|
1680
|
+
parameters: [
|
|
1681
|
+
{ name: "body", in: "body", required: true },
|
|
1682
|
+
],
|
|
1683
|
+
},
|
|
1684
|
+
GetItem_V2: {
|
|
1685
|
+
path: "/GetItem_V2",
|
|
1686
|
+
method: "POST",
|
|
1687
|
+
parameters: [
|
|
1688
|
+
{ name: "body", in: "body", required: true },
|
|
1689
|
+
],
|
|
1690
|
+
},
|
|
1691
|
+
PostItem_V2: {
|
|
1692
|
+
path: "/PostItem_V2",
|
|
1693
|
+
method: "POST",
|
|
1694
|
+
parameters: [
|
|
1695
|
+
{ name: "body", in: "body", required: true },
|
|
1696
|
+
],
|
|
1697
|
+
},
|
|
1698
|
+
PatchItem_V2: {
|
|
1699
|
+
path: "/PatchItem_V2",
|
|
1700
|
+
method: "POST",
|
|
1701
|
+
parameters: [
|
|
1702
|
+
{ name: "body", in: "body", required: true },
|
|
1703
|
+
],
|
|
1704
|
+
},
|
|
1705
|
+
DeleteItem_V2: {
|
|
1706
|
+
path: "/DeleteItem_V2",
|
|
1707
|
+
method: "POST",
|
|
1708
|
+
parameters: [
|
|
1709
|
+
{ name: "body", in: "body", required: true },
|
|
1710
|
+
],
|
|
1711
|
+
},
|
|
1712
|
+
ExecutePassThroughNativeQuery_V2: {
|
|
1713
|
+
path: "/ExecutePassThroughNativeQuery_V2",
|
|
1714
|
+
method: "POST",
|
|
1715
|
+
parameters: [
|
|
1716
|
+
{ name: "body", in: "body", required: true },
|
|
1717
|
+
],
|
|
1718
|
+
},
|
|
1719
|
+
ExecuteProcedure_V2: {
|
|
1720
|
+
path: "/ExecuteProcedure_V2",
|
|
1721
|
+
method: "POST",
|
|
1722
|
+
parameters: [
|
|
1723
|
+
{ name: "body", in: "body", required: true },
|
|
1724
|
+
],
|
|
1725
|
+
},
|
|
1726
|
+
};
|
|
1727
|
+
|
|
1728
|
+
async function execSqlOp(operationName, parameters) {
|
|
1729
|
+
return execConnectorOpWithCandidates(SQL_DATA_SOURCE_CANDIDATES, SQL_APIS, "SQL Server", operationName, parameters);
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
export async function callSqlOperation(operationName, parameters = {}) {
|
|
1733
|
+
return _dbgWrap('callSqlOperation', [operationName, parameters], async function() {
|
|
1734
|
+
return execSqlOp(operationName, parameters);
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
export async function getSqlTables({ server = "default", database = "default" } = {}) {
|
|
1739
|
+
return _dbgWrap('getSqlTables', [{ server, database }], async function() {
|
|
1740
|
+
return execSqlOp("GetTables_V2", {
|
|
1741
|
+
body: { server, database },
|
|
1742
|
+
});
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
export async function getSqlRows({ server = "default", database = "default", table, apply, filter, orderBy, skip, top, select } = {}) {
|
|
1747
|
+
return _dbgWrap('getSqlRows', [{ server, database, table, apply, filter, orderBy, skip, top, select }], async function() {
|
|
1748
|
+
const body = { server, database, table };
|
|
1749
|
+
if (apply) body.$apply = apply;
|
|
1750
|
+
if (filter) body.$filter = filter;
|
|
1751
|
+
if (orderBy) body.$orderby = orderBy;
|
|
1752
|
+
if (skip != null) body.$skip = skip;
|
|
1753
|
+
if (top != null) body.$top = top;
|
|
1754
|
+
if (select) body.$select = select;
|
|
1755
|
+
|
|
1756
|
+
return execSqlOp("GetItems_V2", { body });
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
export async function getSqlRow({ server = "default", database = "default", table, id } = {}) {
|
|
1761
|
+
return _dbgWrap('getSqlRow', [{ server, database, table, id }], async function() {
|
|
1762
|
+
return execSqlOp("GetItem_V2", {
|
|
1763
|
+
body: { server, database, table, id },
|
|
1764
|
+
});
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
export async function insertSqlRow({ server = "default", database = "default", table, item } = {}) {
|
|
1769
|
+
return _dbgWrap('insertSqlRow', [{ server, database, table, item }], async function() {
|
|
1770
|
+
return execSqlOp("PostItem_V2", {
|
|
1771
|
+
body: { server, database, table, item },
|
|
1772
|
+
});
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
export async function updateSqlRow({ server = "default", database = "default", table, id, item } = {}) {
|
|
1777
|
+
return _dbgWrap('updateSqlRow', [{ server, database, table, id, item }], async function() {
|
|
1778
|
+
return execSqlOp("PatchItem_V2", {
|
|
1779
|
+
body: { server, database, table, id, item },
|
|
1780
|
+
});
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
export async function deleteSqlRow({ server = "default", database = "default", table, id } = {}) {
|
|
1785
|
+
return _dbgWrap('deleteSqlRow', [{ server, database, table, id }], async function() {
|
|
1786
|
+
return execSqlOp("DeleteItem_V2", {
|
|
1787
|
+
body: { server, database, table, id },
|
|
1788
|
+
});
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
export async function executeSqlQuery({ server = "default", database = "default", query } = {}) {
|
|
1793
|
+
return _dbgWrap('executeSqlQuery', [{ server, database, query }], async function() {
|
|
1794
|
+
return execSqlOp("ExecutePassThroughNativeQuery_V2", {
|
|
1795
|
+
body: { server, database, query },
|
|
1796
|
+
});
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
export async function executeSqlStoredProcedure({ server = "default", database = "default", procedure, parameters } = {}) {
|
|
1801
|
+
return _dbgWrap('executeSqlStoredProcedure', [{ server, database, procedure, parameters }], async function() {
|
|
1802
|
+
return execSqlOp("ExecuteProcedure_V2", {
|
|
1803
|
+
body: {
|
|
1804
|
+
server,
|
|
1805
|
+
database,
|
|
1806
|
+
procedure,
|
|
1807
|
+
parameters: parameters || {},
|
|
1808
|
+
},
|
|
1809
|
+
});
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
1814
|
+
// ────────────────────────────────── Teams ───────────────────────────────────
|
|
1815
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
1816
|
+
|
|
1817
|
+
const TEAMS_DATA_SOURCE_CANDIDATES = ["teams", "Teams", "microsoftteams", "MicrosoftTeams"];
|
|
1818
|
+
const TEAMS_APIS = {
|
|
1819
|
+
GetAllTeams: {
|
|
1820
|
+
path: "/{connectionId}/GetAllTeams",
|
|
1821
|
+
method: "GET",
|
|
1822
|
+
parameters: [
|
|
1823
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1824
|
+
],
|
|
1825
|
+
},
|
|
1826
|
+
GetChannelsForGroup: {
|
|
1827
|
+
path: "/{connectionId}/GetChannelsForGroup",
|
|
1828
|
+
method: "GET",
|
|
1829
|
+
parameters: [
|
|
1830
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1831
|
+
{ name: "groupId", in: "query", required: true },
|
|
1832
|
+
],
|
|
1833
|
+
},
|
|
1834
|
+
GetTeam: {
|
|
1835
|
+
path: "/{connectionId}/GetTeam",
|
|
1836
|
+
method: "GET",
|
|
1837
|
+
parameters: [
|
|
1838
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1839
|
+
{ name: "teamId", in: "query", required: true },
|
|
1840
|
+
],
|
|
1841
|
+
},
|
|
1842
|
+
GetChannel: {
|
|
1843
|
+
path: "/{connectionId}/GetChannel",
|
|
1844
|
+
method: "GET",
|
|
1845
|
+
parameters: [
|
|
1846
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1847
|
+
{ name: "groupId", in: "query", required: true },
|
|
1848
|
+
{ name: "channelId", in: "query", required: true },
|
|
1849
|
+
],
|
|
1850
|
+
},
|
|
1851
|
+
AddMemberToTeam: {
|
|
1852
|
+
path: "/{connectionId}/AddMemberToTeam",
|
|
1853
|
+
method: "POST",
|
|
1854
|
+
parameters: [
|
|
1855
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1856
|
+
{ name: "teamId", in: "query", required: true },
|
|
1857
|
+
{ name: "body", in: "body", required: true },
|
|
1858
|
+
],
|
|
1859
|
+
},
|
|
1860
|
+
AddMemberToChannel: {
|
|
1861
|
+
path: "/{connectionId}/AddMemberToChannel",
|
|
1862
|
+
method: "POST",
|
|
1863
|
+
parameters: [
|
|
1864
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1865
|
+
{ name: "groupId", in: "query", required: true },
|
|
1866
|
+
{ name: "channelId", in: "query", required: true },
|
|
1867
|
+
{ name: "body", in: "body", required: true },
|
|
1868
|
+
],
|
|
1869
|
+
},
|
|
1870
|
+
AtMentionUser: {
|
|
1871
|
+
path: "/{connectionId}/AtMentionUser",
|
|
1872
|
+
method: "GET",
|
|
1873
|
+
parameters: [
|
|
1874
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1875
|
+
{ name: "userId", in: "query", required: true },
|
|
1876
|
+
],
|
|
1877
|
+
},
|
|
1878
|
+
AtMentionTag: {
|
|
1879
|
+
path: "/{connectionId}/AtMentionTag",
|
|
1880
|
+
method: "GET",
|
|
1881
|
+
parameters: [
|
|
1882
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1883
|
+
{ name: "teamId", in: "query", required: true },
|
|
1884
|
+
{ name: "tagId", in: "query", required: true },
|
|
1885
|
+
],
|
|
1886
|
+
},
|
|
1887
|
+
ListChats: {
|
|
1888
|
+
path: "/{connectionId}/ListChats",
|
|
1889
|
+
method: "GET",
|
|
1890
|
+
parameters: [
|
|
1891
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1892
|
+
{ name: "$top", in: "query", required: false },
|
|
1893
|
+
{ name: "$skip", in: "query", required: false },
|
|
1894
|
+
],
|
|
1895
|
+
},
|
|
1896
|
+
ListMembers: {
|
|
1897
|
+
path: "/{connectionId}/ListMembers",
|
|
1898
|
+
method: "GET",
|
|
1899
|
+
parameters: [
|
|
1900
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1901
|
+
{ name: "groupId", in: "query", required: true },
|
|
1902
|
+
{ name: "channelId", in: "query", required: false },
|
|
1903
|
+
],
|
|
1904
|
+
},
|
|
1905
|
+
PostUserNotification: {
|
|
1906
|
+
path: "/{connectionId}/PostUserNotification",
|
|
1907
|
+
method: "POST",
|
|
1908
|
+
parameters: [
|
|
1909
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1910
|
+
{ name: "PostNotificationRequest", in: "body", required: true },
|
|
1911
|
+
],
|
|
1912
|
+
},
|
|
1913
|
+
PostChannelNotification: {
|
|
1914
|
+
path: "/{connectionId}/PostChannelNotification",
|
|
1915
|
+
method: "POST",
|
|
1916
|
+
parameters: [
|
|
1917
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1918
|
+
{ name: "groupId", in: "query", required: true },
|
|
1919
|
+
{ name: "PostNotificationRequest", in: "body", required: true },
|
|
1920
|
+
],
|
|
1921
|
+
},
|
|
1922
|
+
PostCardToConversation: {
|
|
1923
|
+
path: "/{connectionId}/PostCardToConversation",
|
|
1924
|
+
method: "POST",
|
|
1925
|
+
parameters: [
|
|
1926
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1927
|
+
{ name: "poster", in: "query", required: true },
|
|
1928
|
+
{ name: "location", in: "query", required: true },
|
|
1929
|
+
{ name: "body", in: "body", required: true },
|
|
1930
|
+
],
|
|
1931
|
+
},
|
|
1932
|
+
PostMessageToConversation: {
|
|
1933
|
+
path: "/{connectionId}/PostMessageToConversation",
|
|
1934
|
+
method: "POST",
|
|
1935
|
+
parameters: [
|
|
1936
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1937
|
+
{ name: "poster", in: "query", required: true },
|
|
1938
|
+
{ name: "location", in: "query", required: true },
|
|
1939
|
+
{ name: "body", in: "body", required: true },
|
|
1940
|
+
],
|
|
1941
|
+
},
|
|
1942
|
+
HttpRequest: {
|
|
1943
|
+
path: "/{connectionId}/codeless/v1.0/httprequest",
|
|
1944
|
+
method: "POST",
|
|
1945
|
+
parameters: [
|
|
1946
|
+
{ name: "connectionId", in: "path", required: true },
|
|
1947
|
+
],
|
|
1948
|
+
},
|
|
1949
|
+
};
|
|
1950
|
+
|
|
1951
|
+
async function execTeamsOp(operationName, parameters) {
|
|
1952
|
+
return execConnectorOpWithCandidates(TEAMS_DATA_SOURCE_CANDIDATES, TEAMS_APIS, "Microsoft Teams", operationName, parameters);
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
export async function callTeamsOperation(operationName, parameters = {}) {
|
|
1956
|
+
return _dbgWrap('callTeamsOperation', [operationName, parameters], async function() {
|
|
1957
|
+
return execTeamsOp(operationName, parameters);
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
export async function sendTeamsGraphHttpRequest({ method = "GET", uri, headers, body } = {}) {
|
|
1962
|
+
return _dbgWrap('sendTeamsGraphHttpRequest', [{ method, uri, headers, body }], async function() {
|
|
1963
|
+
return execTeamsOp("HttpRequest", {
|
|
1964
|
+
method,
|
|
1965
|
+
uri,
|
|
1966
|
+
headers: headers || {},
|
|
1967
|
+
body: body || "",
|
|
1968
|
+
});
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
export async function listTeams() {
|
|
1973
|
+
return _dbgWrap('listTeams', [], async function() {
|
|
1974
|
+
return execTeamsOp("GetAllTeams", {});
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
export async function listChannels(sTeamId) {
|
|
1979
|
+
return _dbgWrap('listChannels', [sTeamId], async function() {
|
|
1980
|
+
return execTeamsOp("GetChannelsForGroup", {
|
|
1981
|
+
groupId: sTeamId,
|
|
1982
|
+
});
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
export async function getTeam(sTeamId) {
|
|
1987
|
+
return _dbgWrap('getTeam', [sTeamId], async function() {
|
|
1988
|
+
return execTeamsOp("GetTeam", {
|
|
1989
|
+
teamId: sTeamId,
|
|
1990
|
+
});
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
export async function getChannelDetails(sTeamId, sChannelId) {
|
|
1995
|
+
return _dbgWrap('getChannelDetails', [sTeamId, sChannelId], async function() {
|
|
1996
|
+
return execTeamsOp("GetChannel", {
|
|
1997
|
+
groupId: sTeamId,
|
|
1998
|
+
channelId: sChannelId,
|
|
1999
|
+
});
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
export async function addMemberToTeam(sTeamId, body) {
|
|
2004
|
+
return _dbgWrap('addMemberToTeam', [sTeamId, body], async function() {
|
|
2005
|
+
return execTeamsOp("AddMemberToTeam", {
|
|
2006
|
+
teamId: sTeamId,
|
|
2007
|
+
body,
|
|
2008
|
+
});
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
export async function addMemberToChannel(sTeamId, sChannelId, body) {
|
|
2013
|
+
return _dbgWrap('addMemberToChannel', [sTeamId, sChannelId, body], async function() {
|
|
2014
|
+
return execTeamsOp("AddMemberToChannel", {
|
|
2015
|
+
groupId: sTeamId,
|
|
2016
|
+
channelId: sChannelId,
|
|
2017
|
+
body,
|
|
2018
|
+
});
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
export async function getUserMentionToken(sUserId) {
|
|
2023
|
+
return _dbgWrap('getUserMentionToken', [sUserId], async function() {
|
|
2024
|
+
return execTeamsOp("AtMentionUser", {
|
|
2025
|
+
userId: sUserId,
|
|
2026
|
+
});
|
|
2027
|
+
});
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
export async function getTeamTagMentionToken(sTeamId, sTagId) {
|
|
2031
|
+
return _dbgWrap('getTeamTagMentionToken', [sTeamId, sTagId], async function() {
|
|
2032
|
+
return execTeamsOp("AtMentionTag", {
|
|
2033
|
+
teamId: sTeamId,
|
|
2034
|
+
tagId: sTagId,
|
|
2035
|
+
});
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
export async function listChats({ top, skip } = {}) {
|
|
2040
|
+
return _dbgWrap('listChats', [{ top, skip }], async function() {
|
|
2041
|
+
return execTeamsOp("ListChats", {
|
|
2042
|
+
$top: top,
|
|
2043
|
+
$skip: skip,
|
|
2044
|
+
});
|
|
2045
|
+
});
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
export async function listMembers(sTeamId, sChannelId) {
|
|
2049
|
+
return _dbgWrap('listMembers', [sTeamId, sChannelId], async function() {
|
|
2050
|
+
return execTeamsOp("ListMembers", {
|
|
2051
|
+
groupId: sTeamId,
|
|
2052
|
+
channelId: sChannelId,
|
|
2053
|
+
});
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
export async function postFeedNotification({ groupId, body } = {}) {
|
|
2058
|
+
return _dbgWrap('postFeedNotification', [{ groupId, body }], async function() {
|
|
2059
|
+
if (groupId) {
|
|
2060
|
+
return execTeamsOp("PostChannelNotification", {
|
|
2061
|
+
groupId,
|
|
2062
|
+
PostNotificationRequest: body,
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
return execTeamsOp("PostUserNotification", {
|
|
2067
|
+
PostNotificationRequest: body,
|
|
2068
|
+
});
|
|
2069
|
+
});
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
export async function postCardInChatOrChannel({ poster = "Flow bot", location, body } = {}) {
|
|
2073
|
+
return _dbgWrap('postCardInChatOrChannel', [{ poster, location, body }], async function() {
|
|
2074
|
+
return execTeamsOp("PostCardToConversation", {
|
|
2075
|
+
poster,
|
|
2076
|
+
location,
|
|
2077
|
+
body,
|
|
2078
|
+
});
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
export async function postMessageInChatOrChannel({ poster = "Flow bot", location, body } = {}) {
|
|
2083
|
+
return _dbgWrap('postMessageInChatOrChannel', [{ poster, location, body }], async function() {
|
|
2084
|
+
return execTeamsOp("PostMessageToConversation", {
|
|
2085
|
+
poster,
|
|
2086
|
+
location,
|
|
2087
|
+
body,
|
|
2088
|
+
});
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2091
|
+
|