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