@medplum/mock 0.9.2 → 0.9.3

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
@@ -6213,6 +6213,136 @@ var StructureDefinitionList = [
6213
6213
  }
6214
6214
  ]
6215
6215
  }
6216
+ },
6217
+ {
6218
+ resourceType: "StructureDefinition",
6219
+ id: "Bot",
6220
+ name: "Bot",
6221
+ description: "Bot account for automated actions.",
6222
+ snapshot: {
6223
+ element: [
6224
+ {
6225
+ id: "Bot.id",
6226
+ path: "Bot.id",
6227
+ definition: "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.",
6228
+ min: 0,
6229
+ max: "1",
6230
+ type: [
6231
+ {
6232
+ code: "string"
6233
+ }
6234
+ ]
6235
+ },
6236
+ {
6237
+ id: "Bot.meta",
6238
+ path: "Bot.meta",
6239
+ definition: "The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.",
6240
+ min: 0,
6241
+ max: "1",
6242
+ type: [
6243
+ {
6244
+ code: "Meta"
6245
+ }
6246
+ ]
6247
+ },
6248
+ {
6249
+ id: "Bot.implicitRules",
6250
+ path: "Bot.implicitRules",
6251
+ definition: "A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.",
6252
+ min: 0,
6253
+ max: "1",
6254
+ type: [
6255
+ {
6256
+ code: "uri"
6257
+ }
6258
+ ]
6259
+ },
6260
+ {
6261
+ id: "Bot.language",
6262
+ path: "Bot.language",
6263
+ definition: "The base language in which the resource is written.",
6264
+ min: 0,
6265
+ max: "1",
6266
+ type: [
6267
+ {
6268
+ code: "code"
6269
+ }
6270
+ ]
6271
+ },
6272
+ {
6273
+ id: "Bot.name",
6274
+ path: "Bot.name",
6275
+ definition: "A name associated with the Bot.",
6276
+ min: 0,
6277
+ max: "1",
6278
+ type: [
6279
+ {
6280
+ code: "string"
6281
+ }
6282
+ ]
6283
+ },
6284
+ {
6285
+ id: "Bot.description",
6286
+ path: "Bot.description",
6287
+ definition: "A summary, characterization or explanation of the Bot.",
6288
+ min: 0,
6289
+ max: "1",
6290
+ type: [
6291
+ {
6292
+ code: "string"
6293
+ }
6294
+ ]
6295
+ },
6296
+ {
6297
+ id: "Bot.runtimeVersion",
6298
+ path: "Bot.runtimeVersion",
6299
+ definition: "The identifier of the bot runtime environment (i.e., vmcontext, awslambda, etc).",
6300
+ min: 0,
6301
+ max: "1",
6302
+ type: [
6303
+ {
6304
+ code: "string"
6305
+ }
6306
+ ]
6307
+ },
6308
+ {
6309
+ id: "Bot.photo",
6310
+ path: "Bot.photo",
6311
+ definition: "Image of the bot.",
6312
+ min: 0,
6313
+ max: "1",
6314
+ type: [
6315
+ {
6316
+ code: "Attachment"
6317
+ }
6318
+ ]
6319
+ },
6320
+ {
6321
+ id: "Bot.code",
6322
+ path: "Bot.code",
6323
+ definition: "Bot logic script.",
6324
+ min: 0,
6325
+ max: "1",
6326
+ type: [
6327
+ {
6328
+ code: "string"
6329
+ }
6330
+ ]
6331
+ },
6332
+ {
6333
+ id: "Bot.runAsUser",
6334
+ path: "Bot.runAsUser",
6335
+ definition: "Optional flag to indicate that the bot should be run as the user.",
6336
+ min: 0,
6337
+ max: "1",
6338
+ type: [
6339
+ {
6340
+ code: "boolean"
6341
+ }
6342
+ ]
6343
+ }
6344
+ ]
6345
+ }
6216
6346
  }
6217
6347
  ];
6218
6348
 
@@ -9001,7 +9131,7 @@ function matchesSearchRequest(resource, searchRequest) {
9001
9131
  }
9002
9132
  if (searchRequest.filters) {
9003
9133
  for (const filter of searchRequest.filters) {
9004
- if (!matchesSearchFilter(resource, searchRequest, filter)) {
9134
+ if (!matchesSearchFilter(resource, filter)) {
9005
9135
  return false;
9006
9136
  }
9007
9137
  }
@@ -9014,7 +9144,7 @@ function matchesSearchRequest(resource, searchRequest) {
9014
9144
  * @param filter One of the filters of a subscription criteria.
9015
9145
  * @returns True if the resource satisfies the search filter.
9016
9146
  */
9017
- function matchesSearchFilter(resource, searchRequest, filter) {
9147
+ function matchesSearchFilter(resource, filter) {
9018
9148
  const expression = filter.code.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
9019
9149
  const values = evalFhirPath(expression, resource);
9020
9150
  const result = values.some((value) => JSON.stringify(value).toLowerCase().includes(filter.value.toLowerCase()));
@@ -9027,7 +9157,7 @@ class MockClient extends MedplumClient {
9027
9157
  baseUrl: 'https://example.com/',
9028
9158
  clientId: 'my-client-id',
9029
9159
  fetch: (url, options) => {
9030
- const method = options.method;
9160
+ const method = options.method || 'GET';
9031
9161
  const path = url.replace('https://example.com/', '');
9032
9162
  if (clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.debug) {
9033
9163
  console.log('MockClient', method, path);
@@ -9068,7 +9198,7 @@ class MockClient extends MedplumClient {
9068
9198
  }
9069
9199
  return super.getActiveLogin();
9070
9200
  }
9071
- createBinary(data, filename, contentType) {
9201
+ createBinary(_data, filename, contentType) {
9072
9202
  if (filename.endsWith('.exe')) {
9073
9203
  return Promise.reject(badRequest('Invalid file type'));
9074
9204
  }
@@ -9094,7 +9224,7 @@ function mockHandler(method, path, options) {
9094
9224
  return null;
9095
9225
  }
9096
9226
  }
9097
- function mockAdminHandler(method, path) {
9227
+ function mockAdminHandler(_method, path) {
9098
9228
  if (path.startsWith('admin/projects/123')) {
9099
9229
  return {
9100
9230
  project: { id: '123', name: 'Project 123' },
@@ -9131,7 +9261,7 @@ function mockAuthHandler(method, path, options) {
9131
9261
  }
9132
9262
  return null;
9133
9263
  }
9134
- function mockChangePasswordHandler(method, path, options) {
9264
+ function mockChangePasswordHandler(_method, _path, options) {
9135
9265
  const { body } = options;
9136
9266
  const { oldPassword } = JSON.parse(body);
9137
9267
  if (oldPassword === 'orange') {
@@ -9151,7 +9281,7 @@ function mockChangePasswordHandler(method, path, options) {
9151
9281
  };
9152
9282
  }
9153
9283
  }
9154
- function mockLoginHandler(method, path, options) {
9284
+ function mockLoginHandler(_method, _path, options) {
9155
9285
  const { body } = options;
9156
9286
  const { password } = JSON.parse(body);
9157
9287
  if (password === 'password') {
@@ -9173,7 +9303,7 @@ function mockLoginHandler(method, path, options) {
9173
9303
  };
9174
9304
  }
9175
9305
  }
9176
- function mockSetPasswordHandler(method, path, options) {
9306
+ function mockSetPasswordHandler(_method, _path, options) {
9177
9307
  const { body } = options;
9178
9308
  const { password } = JSON.parse(body);
9179
9309
  if (password === 'orange') {
@@ -9193,7 +9323,7 @@ function mockSetPasswordHandler(method, path, options) {
9193
9323
  };
9194
9324
  }
9195
9325
  }
9196
- function mockRegisterHandler(method, path, options) {
9326
+ function mockRegisterHandler(_method, _path, options) {
9197
9327
  const { body } = options;
9198
9328
  const { email, password } = JSON.parse(body);
9199
9329
  if (email === 'george@example.com' && password === 'password') {
@@ -9212,7 +9342,7 @@ function mockRegisterHandler(method, path, options) {
9212
9342
  };
9213
9343
  }
9214
9344
  }
9215
- function mockResetPasswordHandler(method, path, options) {
9345
+ function mockResetPasswordHandler(_method, _path, options) {
9216
9346
  const { body } = options;
9217
9347
  const { email } = JSON.parse(body);
9218
9348
  if (email === 'admin@example.com') {
@@ -9303,7 +9433,7 @@ function mockFhirHandler(method, url, options) {
9303
9433
  return mockRepo.createResource(JSON.parse(options.body));
9304
9434
  }
9305
9435
  }
9306
- function mockFhirBatchHandler(method, path, options) {
9436
+ function mockFhirBatchHandler(_method, _path, options) {
9307
9437
  var _a;
9308
9438
  const { body } = options;
9309
9439
  const request = JSON.parse(body);