codeapp-js 0.2.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.
Files changed (95) hide show
  1. package/.github/instructions/wyattdave.instructions.md +39 -0
  2. package/codeApp/dist/codeapp.js +235 -4
  3. package/codeApp/dist/index.js +1 -1
  4. package/codeApp/dist/power-apps-data.js +170 -591
  5. package/dev files/dataverse.js +7 -22
  6. package/dev files/environmentVar.js +1 -1
  7. package/dev files/office365groups.js +1 -1
  8. package/dev files/office365users.js +1 -1
  9. package/dev files/outlook.js +219 -10
  10. package/dev files/sharepoint.js +1 -1
  11. package/examples/combined demo/dist/codeapp.js +1098 -1098
  12. package/examples/combined demo/dist/index.js +470 -470
  13. package/examples/combined demo/dist/power-apps-data.js +3006 -3006
  14. package/examples/combined demo/power.config.json +42 -42
  15. package/examples/dataverse Demo/dist/codeapp.js +1085 -1085
  16. package/examples/dataverse Demo/dist/index.html +54 -54
  17. package/examples/dataverse Demo/dist/index.js +82 -82
  18. package/examples/dataverse Demo/dist/power-apps-data.js +2911 -2911
  19. package/examples/dataverse Demo/power.config.json +34 -34
  20. package/examples/dataverse Demo/readme.md +79 -79
  21. package/examples/groups Demo/dist/codeapp.js +1085 -1085
  22. package/examples/groups Demo/dist/index.js +113 -113
  23. package/examples/groups Demo/dist/power-apps-data.js +2911 -2911
  24. package/examples/kanban/dist/dataverse.js +94 -94
  25. package/examples/kanban/dist/environmentVar.js +55 -55
  26. package/examples/kanban/dist/office365groups.js +97 -97
  27. package/examples/kanban/dist/office365users.js +169 -169
  28. package/examples/kanban/dist/outlook.js +162 -162
  29. package/examples/kanban/dist/power-apps-data.js +2953 -2953
  30. package/examples/kanban/dist/sharepoint.js +339 -339
  31. package/examples/myProfile/dist/index.html +184 -184
  32. package/examples/myProfile/dist/index.js +141 -141
  33. package/examples/myProfile/dist/office365users.js +169 -169
  34. package/examples/myProfile/dist/power-apps-data.js +2953 -2953
  35. package/examples/myProfile/power.config.json +22 -22
  36. package/examples/myProfile/readme.md +79 -79
  37. package/examples/outlook Demo/dist/codeapp.js +1085 -1085
  38. package/examples/outlook Demo/dist/index.html +35 -35
  39. package/examples/outlook Demo/dist/index.js +170 -170
  40. package/examples/outlook Demo/dist/outlook.js +121 -121
  41. package/examples/outlook Demo/dist/power-apps-data.js +2911 -2911
  42. package/examples/outlook Demo/dist/styles.css +84 -84
  43. package/examples/outlook Demo/readme.md +82 -82
  44. package/examples/outlook Demo2/OutlookDemo_1_0_0_1.zip +0 -0
  45. package/examples/outlook Demo2/agent/decision-log.md +7 -0
  46. package/examples/outlook Demo2/dist/codeapp.js +1334 -0
  47. package/examples/outlook Demo2/dist/icon-512.png +0 -0
  48. package/examples/outlook Demo2/dist/index.html +98 -0
  49. package/examples/outlook Demo2/dist/index.js +346 -0
  50. package/{dev files → examples/outlook Demo2/dist}/power-apps-data.js +73 -18
  51. package/examples/outlook Demo2/dist/styles.css +639 -0
  52. package/examples/outlook Demo2/power.config.json +23 -0
  53. package/examples/outlook Demo2/src/generated/index.ts +14 -0
  54. package/examples/outlook Demo2/src/generated/models/Office365GroupsModel.ts +363 -0
  55. package/examples/outlook Demo2/src/generated/models/Office365OutlookModel.ts +2046 -0
  56. package/examples/outlook Demo2/src/generated/models/Office365UsersModel.ts +254 -0
  57. package/examples/outlook Demo2/src/generated/services/Office365GroupsService.ts +326 -0
  58. package/examples/outlook Demo2/src/generated/services/Office365OutlookService.ts +2476 -0
  59. package/examples/outlook Demo2/src/generated/services/Office365UsersService.ts +358 -0
  60. package/examples/planning Poker/.vscode/settings.json +4 -4
  61. package/examples/planning Poker/additional files/customizations (tables).xml +6428 -6428
  62. package/examples/planning Poker/additional files/dataverse-tables.json +165 -165
  63. package/examples/planning Poker/additional files/readme.md +122 -122
  64. package/examples/planning Poker/dist/dataverse.js +78 -78
  65. package/examples/planning Poker/dist/index.html +198 -198
  66. package/examples/planning Poker/dist/index.js +954 -954
  67. package/examples/planning Poker/dist/power-apps-data.js +2953 -2953
  68. package/examples/planning Poker/dist/styles.css +815 -815
  69. package/examples/sharePoint Demo/agent/decision-log.md +5 -5
  70. package/examples/sharePoint Demo/dist/codeapp.js +1085 -1085
  71. package/examples/sharePoint Demo/dist/index.js +262 -262
  72. package/examples/sharePoint Demo/dist/power-apps-data.js +2911 -2911
  73. package/examples/sharePoint Demo/power.config.json +22 -22
  74. package/examples/solution explorer/agent/decision-log.md +27 -27
  75. package/examples/solution explorer/agent/mockup-01-swiss-grid.html +452 -452
  76. package/examples/solution explorer/agent/mockup-02-dark-glass.html +496 -496
  77. package/examples/solution explorer/agent/mockup-03-paper-console.html +510 -510
  78. package/examples/solution explorer/agent/mockup-04-neon-noir.html +546 -546
  79. package/examples/solution explorer/agent/mockup-05-zen-garden.html +534 -534
  80. package/examples/solution explorer/dist/codeapp.js +1098 -1098
  81. package/examples/solution explorer/dist/index.html +80 -80
  82. package/examples/solution explorer/dist/index.js +735 -735
  83. package/examples/solution explorer/dist/power-apps-data.js +3006 -3006
  84. package/examples/solution explorer/dist/styles.css +571 -571
  85. package/examples/solution explorer/power.config.json +150 -150
  86. package/examples/todo/dist/dataverse.js +64 -64
  87. package/examples/todo/dist/index.html +75 -75
  88. package/examples/todo/dist/index.js +8 -8
  89. package/examples/todo/dist/power-apps-data.js +2953 -2953
  90. package/examples/todo/dist/renderer.js +375 -375
  91. package/examples/todo/dist/styles.css +691 -691
  92. package/examples/todo/power.config.json +34 -34
  93. package/package.json +1 -1
  94. package/scripts/build-power-sdk.mjs +69 -0
  95. package/dev files/customConnector.js +0 -98
@@ -0,0 +1,39 @@
1
+ # Copilot Instructions
2
+
3
+ These instructions guide AI coding agents working in this repository to be immediately productive and consistent with project conventions.
4
+
5
+ ## Project Overview
6
+ - standard web technologies: HTML, CSS, JavaScript (ES6+).
7
+ - Core files:
8
+ - `index.html`: Structure, assets, and script/style inclusions.
9
+ - `styles.css`: responsive and built to light/dark themes using CSS custom properties.
10
+ - `script.js`: key functionality of the site
11
+ - `dom.js`: dom manipulation functions
12
+ - `imgs/`: image files for UI icons.
13
+ - `README.md`: Features, usage, and future enhancements.
14
+ - `Sitemap.xml`: for search engine indexing.
15
+ - No build step or backend;
16
+ - Create as a Progressive Web App (PWA) with service worker for offline support and caching, but with always fetching latest data when online.
17
+ - cloudflare hosting
18
+
19
+ - Follow `wyattdave.instructions.md` conventions:
20
+ - Use camelCase for variables and functions.
21
+ - Prefix variable names: `b` boolean, `i` number, `s` string, `a` array, `o` object, `e` element.
22
+ - Ensure variables are type consistent and avoid implicit type coercion by using naming conventions.
23
+ - CSS should be in a separate file, avoid inline styles unless for dynamic styling.
24
+ - JavaScript should be in a separate file, avoid inline event handlers and scripts in html.
25
+ - JavaScript files should follow: script.js for main logic, dom.js for dom manipulation functions, specific js files for large logic, and per html page for page-specific logic.
26
+ - Function-first approach; avoid classes unless necessary.
27
+ - Build functions for reusability and testability; avoid inline code blocks.
28
+ - Use descriptive names for variables and functions, avoiding abbreviations.
29
+ - Use let and const, avoid var.
30
+ - Use const for dom elements where possible.
31
+ - Use strict equality `===` and inequality `!==`.
32
+ - Use `//` for single-line comments and `/* */` for multi-line comments.
33
+ - Use forEach, map, filter, reduce for array operations instead of for loops where appropriate.
34
+ - Use arrow functions for anonymous functions and callbacks.
35
+ - Use " for html attributes and ' for js strings, ` for template literals.
36
+ - Use `new RegExp("pattern","flags")` (avoid literal `/.../flags`).
37
+ - Use `fetch` for API calls, with async/await syntax.
38
+ - Handle errors gracefully with try/catch and user-friendly messages.
39
+ - Prefer string concatenation `"a"+variable+"b"` over template literals.
@@ -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
  }
@@ -1,4 +1,4 @@
1
- //import { initDataSources, createItem, listItems } from './codeapp.js';
1
+ ///import { createItem } from "./dataverse.js";
2
2
  async function boot() {
3
3
  //on load code
4
4
  }