@medplum/core 0.9.5 → 0.9.6

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/dist/cjs/index.js CHANGED
@@ -1554,23 +1554,13 @@
1554
1554
  }
1555
1555
  /**
1556
1556
  * Initiates a user login flow.
1557
- * @param email The email address of the user.
1558
- * @param password The password of the user.
1559
- * @param remember Optional flag to remember the user.
1557
+ * @param loginRequest Login request including email and password.
1560
1558
  * @returns Promise to the authentication response.
1561
1559
  */
1562
- startLogin(email, password, remember) {
1560
+ startLogin(loginRequest) {
1563
1561
  return __awaiter(this, void 0, void 0, function* () {
1564
1562
  yield __classPrivateFieldGet(this, _MedplumClient_instances, "m", _MedplumClient_startPkce).call(this);
1565
- return this.post('auth/login', {
1566
- clientId: __classPrivateFieldGet(this, _MedplumClient_clientId, "f"),
1567
- scope: DEFAULT_SCOPE,
1568
- codeChallengeMethod: 'S256',
1569
- codeChallenge: __classPrivateFieldGet(this, _MedplumClient_storage, "f").getString('codeChallenge'),
1570
- email,
1571
- password,
1572
- remember: !!remember,
1573
- });
1563
+ return this.post('auth/login', Object.assign(Object.assign({}, loginRequest), { clientId: __classPrivateFieldGet(this, _MedplumClient_clientId, "f"), scope: DEFAULT_SCOPE, codeChallengeMethod: 'S256', codeChallenge: __classPrivateFieldGet(this, _MedplumClient_storage, "f").getString('codeChallenge') }));
1574
1564
  });
1575
1565
  }
1576
1566
  /**
@@ -2177,6 +2167,46 @@
2177
2167
  deleteResource(resourceType, id) {
2178
2168
  return this.delete(this.fhirUrl(resourceType, id));
2179
2169
  }
2170
+ /**
2171
+ * Sends an email using the Medplum Email API.
2172
+ *
2173
+ * Builds the email using nodemailer MailComposer.
2174
+ *
2175
+ * Examples:
2176
+ *
2177
+ * Send a simple text email:
2178
+ *
2179
+ * ```typescript
2180
+ * await medplum.sendEmail({
2181
+ * to: 'alice@example.com',
2182
+ * cc: 'bob@example.com',
2183
+ * subject: 'Hello',
2184
+ * text: 'Hello Alice',
2185
+ * });
2186
+ * ```
2187
+ *
2188
+ * Send an email with a `Binary` attachment:
2189
+ *
2190
+ * ```typescript
2191
+ * await medplum.sendEmail({
2192
+ * to: 'alice@example.com',
2193
+ * subject: 'Email with attachment',
2194
+ * text: 'See the attached report',
2195
+ * attachments: [{
2196
+ * filename: 'report.pdf',
2197
+ * path: "Binary/" + binary.id
2198
+ * }]
2199
+ * });
2200
+ * ```
2201
+ *
2202
+ * See options here: https://nodemailer.com/extras/mailcomposer/
2203
+ *
2204
+ * @param options The MailComposer options.
2205
+ * @returns Promise to the operation outcome.
2206
+ */
2207
+ sendEmail(email) {
2208
+ return this.post('email/v1/send', email);
2209
+ }
2180
2210
  graphql(query, options) {
2181
2211
  return this.post(this.fhirUrl('$graphql'), { query }, JSON_CONTENT_TYPE, options);
2182
2212
  }