@pallasoft/ps-mail 1.6.0 → 1.7.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.
@@ -0,0 +1,4 @@
1
+ export declare enum GraphMailBodyFormat {
2
+ Html = "html",
3
+ Text = "text"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GraphMailBodyFormat = void 0;
4
+ var GraphMailBodyFormat;
5
+ (function (GraphMailBodyFormat) {
6
+ GraphMailBodyFormat["Html"] = "html";
7
+ GraphMailBodyFormat["Text"] = "text";
8
+ })(GraphMailBodyFormat || (exports.GraphMailBodyFormat = GraphMailBodyFormat = {}));
@@ -1,3 +1,4 @@
1
+ export * from './graph-mail-body-format';
1
2
  export * from './graph-mail-body-type';
2
3
  export * from './graph-mail-config';
3
4
  export * from './graph-mail-error-messages';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./graph-mail-body-format"), exports);
17
18
  __exportStar(require("./graph-mail-body-type"), exports);
18
19
  __exportStar(require("./graph-mail-config"), exports);
19
20
  __exportStar(require("./graph-mail-error-messages"), exports);
@@ -1,3 +1,3 @@
1
- export { GraphMailBodyType, GraphMailErrorReason, GraphMailFolder, GraphMailLifecycleEvent, } from './constants';
1
+ export { GraphMailBodyFormat, GraphMailBodyType, GraphMailErrorReason, GraphMailFolder, GraphMailLifecycleEvent, } from './constants';
2
2
  export { GraphMailErrorService, GraphMailService, GraphTokenService, GraphUserDirectoryService, } from './services';
3
- export type { GraphCredentials, GraphDirectoryOptions, GraphDirectoryUserData, GraphMailBodyData, GraphMailConnection, GraphMailDeltaData, GraphMailDeltaOptions, GraphMailDeltaPageData, GraphMailDraftData, GraphMailErrorData, GraphMailFileData, GraphMailHeaderData, GraphMailLocatedData, GraphMailMessageData, GraphMailNotificationData, GraphMailNotificationPayloadData, GraphMailRecipientData, GraphMailRemovedData, GraphMailReplyData, GraphMailSubscriptionData, GraphMailSubscriptionOptions, GraphMailUploadSessionData, GraphUserData, } from './models';
3
+ export type { GraphCredentials, GraphDirectoryOptions, GraphDirectoryUserData, GraphMailBodyData, GraphMailConnection, GraphMailDeltaData, GraphMailDeltaOptions, GraphMailGetOptions, GraphMailDeltaPageData, GraphMailDraftData, GraphMailErrorData, GraphMailFileData, GraphMailHeaderData, GraphMailLocatedData, GraphMailMessageData, GraphMailNotificationData, GraphMailNotificationPayloadData, GraphMailRecipientData, GraphMailRemovedData, GraphMailReplyData, GraphMailSubscriptionData, GraphMailSubscriptionOptions, GraphMailUploadSessionData, GraphUserData, } from './models';
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GraphUserDirectoryService = exports.GraphTokenService = exports.GraphMailService = exports.GraphMailErrorService = exports.GraphMailLifecycleEvent = exports.GraphMailFolder = exports.GraphMailErrorReason = exports.GraphMailBodyType = void 0;
3
+ exports.GraphUserDirectoryService = exports.GraphTokenService = exports.GraphMailService = exports.GraphMailErrorService = exports.GraphMailLifecycleEvent = exports.GraphMailFolder = exports.GraphMailErrorReason = exports.GraphMailBodyType = exports.GraphMailBodyFormat = void 0;
4
4
  var constants_1 = require("./constants");
5
+ Object.defineProperty(exports, "GraphMailBodyFormat", { enumerable: true, get: function () { return constants_1.GraphMailBodyFormat; } });
5
6
  Object.defineProperty(exports, "GraphMailBodyType", { enumerable: true, get: function () { return constants_1.GraphMailBodyType; } });
6
7
  Object.defineProperty(exports, "GraphMailErrorReason", { enumerable: true, get: function () { return constants_1.GraphMailErrorReason; } });
7
8
  Object.defineProperty(exports, "GraphMailFolder", { enumerable: true, get: function () { return constants_1.GraphMailFolder; } });
@@ -0,0 +1,4 @@
1
+ import type { GraphMailBodyFormat } from '../constants/graph-mail-body-format';
2
+ export interface GraphMailGetOptions {
3
+ bodyFormat?: GraphMailBodyFormat;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -9,6 +9,7 @@ export type { GraphMailCategoriesRequest } from './graph-mail-categories-request
9
9
  export type { GraphMailConnection } from './graph-mail-connection';
10
10
  export type { GraphMailDeltaData } from './graph-mail-delta-data';
11
11
  export type { GraphMailDeltaOptions } from './graph-mail-delta-options';
12
+ export type { GraphMailGetOptions } from './graph-mail-get-options';
12
13
  export type { GraphMailDeltaPageData } from './graph-mail-delta-page-data';
13
14
  export type { GraphMailDraftData } from './graph-mail-draft-data';
14
15
  export type { GraphMailErrorData } from './graph-mail-error-data';
@@ -8,6 +8,7 @@ import type { GraphMailDeltaOptions } from '../models/graph-mail-delta-options';
8
8
  import type { GraphMailDeltaPageData } from '../models/graph-mail-delta-page-data';
9
9
  import type { GraphMailDraftData } from '../models/graph-mail-draft-data';
10
10
  import type { GraphMailFileData } from '../models/graph-mail-file-data';
11
+ import type { GraphMailGetOptions } from '../models/graph-mail-get-options';
11
12
  import type { GraphMailLocatedData } from '../models/graph-mail-located-data';
12
13
  import type { GraphMailMessageData } from '../models/graph-mail-message-data';
13
14
  import type { GraphMailReplyData } from '../models/graph-mail-reply-data';
@@ -17,7 +18,7 @@ import type { GraphMailUploadSessionData } from '../models/graph-mail-upload-ses
17
18
  export declare class GraphMailService {
18
19
  static deltaPage(connection: GraphMailConnection, folder: GraphMailFolder, link: string | null, options?: GraphMailDeltaOptions): Promise<GraphMailDeltaPageData>;
19
20
  static delta(connection: GraphMailConnection, folder: GraphMailFolder, deltaLink: string | null, options?: GraphMailDeltaOptions): Promise<GraphMailDeltaData>;
20
- static getMessage(connection: GraphMailConnection, messageId: string): Promise<GraphMailMessageData>;
21
+ static getMessage(connection: GraphMailConnection, messageId: string, options?: GraphMailGetOptions): Promise<GraphMailMessageData>;
21
22
  static listAttachments(connection: GraphMailConnection, messageId: string): Promise<MailAttachmentData[]>;
22
23
  static downloadAttachment(connection: GraphMailConnection, messageId: string, attachmentId: string): Promise<MailAttachmentContentData>;
23
24
  static sendMail(connection: GraphMailConnection, draft: GraphMailDraftData): Promise<void>;
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -74,6 +85,7 @@ var Attributes = __importStar(require("@pallasoft/ps-attributes"));
74
85
  var ps_utilities_1 = require("@pallasoft/ps-utilities");
75
86
  var mail_http_config_1 = require("../../constants/mail-http-config");
76
87
  var mail_url_service_1 = require("../../services/mail-url-service");
88
+ var graph_mail_body_format_1 = require("../constants/graph-mail-body-format");
77
89
  var graph_mail_config_1 = require("../constants/graph-mail-config");
78
90
  var graph_mail_error_reason_1 = require("../constants/graph-mail-error-reason");
79
91
  var graph_mail_error_service_1 = require("./graph-mail-error-service");
@@ -139,14 +151,13 @@ var GraphMailService = /** @class */ (function () {
139
151
  });
140
152
  });
141
153
  };
142
- GraphMailService.getMessage = function (connection, messageId) {
143
- return graph_request_service_1.GraphRequestService.json(connection, {
144
- method: ps_utilities_1.HttpMethod.Get,
145
- url: mail_url_service_1.MailUrlService.withQuery(this._messagePath(connection, messageId), [
154
+ GraphMailService.getMessage = function (connection, messageId, options) {
155
+ if (options === void 0) { options = {}; }
156
+ return graph_request_service_1.GraphRequestService.json(connection, __assign({ method: ps_utilities_1.HttpMethod.Get, url: mail_url_service_1.MailUrlService.withQuery(this._messagePath(connection, messageId), [
146
157
  this._select(graph_mail_config_1.GraphMailConfig.messageFields),
147
- ]),
148
- prefer: [graph_mail_config_1.GraphMailConfig.prefer.textBody],
149
- });
158
+ ]) }, (options.bodyFormat === graph_mail_body_format_1.GraphMailBodyFormat.Html
159
+ ? {}
160
+ : { prefer: [graph_mail_config_1.GraphMailConfig.prefer.textBody] })));
150
161
  };
151
162
  GraphMailService.listAttachments = function (connection, messageId) {
152
163
  return __awaiter(this, void 0, void 0, function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pallasoft/ps-mail",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -86,7 +86,7 @@
86
86
  },
87
87
  "dependencies": {
88
88
  "@pallasoft/ps-attributes": "^1.3.0",
89
- "@pallasoft/ps-utilities": "^2.16.0"
89
+ "@pallasoft/ps-utilities": "^2.23.0"
90
90
  },
91
91
  "publishConfig": {
92
92
  "access": "public",