@medplum/core 0.9.18 → 0.9.19

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/esm/index.js CHANGED
@@ -6998,8 +6998,55 @@ class MedplumClient extends EventTarget {
6998
6998
  sendEmail(email) {
6999
6999
  return this.post('email/v1/send', email, 'application/json');
7000
7000
  }
7001
- graphql(query, options) {
7002
- return this.post(this.fhirUrl('$graphql'), { query }, JSON_CONTENT_TYPE, options);
7001
+ /**
7002
+ * Executes a GraphQL query.
7003
+ *
7004
+ * Example:
7005
+ *
7006
+ * ```typescript
7007
+ * const result = await medplum.graphql(`{
7008
+ * Patient(id: "123") {
7009
+ * resourceType
7010
+ * id
7011
+ * name {
7012
+ * given
7013
+ * family
7014
+ * }
7015
+ * }
7016
+ * }`);
7017
+ * ```
7018
+ *
7019
+ * Advanced queries such as named operations and variable substitution are supported:
7020
+ *
7021
+ * ```typescript
7022
+ * const result = await medplum.graphql(
7023
+ * `query GetPatientById($patientId: ID!) {
7024
+ * Patient(id: $patientId) {
7025
+ * resourceType
7026
+ * id
7027
+ * name {
7028
+ * given
7029
+ * family
7030
+ * }
7031
+ * }
7032
+ * }`,
7033
+ * 'GetPatientById',
7034
+ * { patientId: '123' }
7035
+ * );
7036
+ * ```
7037
+ *
7038
+ * See the GraphQL documentation for more details: https://graphql.org/learn/
7039
+ *
7040
+ * See the FHIR GraphQL documentation for FHIR specific details: https://www.hl7.org/fhir/graphql.html
7041
+ *
7042
+ * @param query The GraphQL query.
7043
+ * @param operationName Optional GraphQL operation name.
7044
+ * @param variables Optional GraphQL variables.
7045
+ * @param options Optional fetch options.
7046
+ * @returns The GraphQL result.
7047
+ */
7048
+ graphql(query, operationName, variables, options) {
7049
+ return this.post(this.fhirUrl('$graphql'), { query, operationName, variables }, JSON_CONTENT_TYPE, options);
7003
7050
  }
7004
7051
  getActiveLogin() {
7005
7052
  return __classPrivateFieldGet(this, _MedplumClient_storage, "f").getObject('activeLogin');