@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/cjs/index.js CHANGED
@@ -6217,6 +6217,136 @@
6217
6217
  }
6218
6218
  ]
6219
6219
  }
6220
+ },
6221
+ {
6222
+ resourceType: "StructureDefinition",
6223
+ id: "Bot",
6224
+ name: "Bot",
6225
+ description: "Bot account for automated actions.",
6226
+ snapshot: {
6227
+ element: [
6228
+ {
6229
+ id: "Bot.id",
6230
+ path: "Bot.id",
6231
+ definition: "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.",
6232
+ min: 0,
6233
+ max: "1",
6234
+ type: [
6235
+ {
6236
+ code: "string"
6237
+ }
6238
+ ]
6239
+ },
6240
+ {
6241
+ id: "Bot.meta",
6242
+ path: "Bot.meta",
6243
+ 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.",
6244
+ min: 0,
6245
+ max: "1",
6246
+ type: [
6247
+ {
6248
+ code: "Meta"
6249
+ }
6250
+ ]
6251
+ },
6252
+ {
6253
+ id: "Bot.implicitRules",
6254
+ path: "Bot.implicitRules",
6255
+ 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.",
6256
+ min: 0,
6257
+ max: "1",
6258
+ type: [
6259
+ {
6260
+ code: "uri"
6261
+ }
6262
+ ]
6263
+ },
6264
+ {
6265
+ id: "Bot.language",
6266
+ path: "Bot.language",
6267
+ definition: "The base language in which the resource is written.",
6268
+ min: 0,
6269
+ max: "1",
6270
+ type: [
6271
+ {
6272
+ code: "code"
6273
+ }
6274
+ ]
6275
+ },
6276
+ {
6277
+ id: "Bot.name",
6278
+ path: "Bot.name",
6279
+ definition: "A name associated with the Bot.",
6280
+ min: 0,
6281
+ max: "1",
6282
+ type: [
6283
+ {
6284
+ code: "string"
6285
+ }
6286
+ ]
6287
+ },
6288
+ {
6289
+ id: "Bot.description",
6290
+ path: "Bot.description",
6291
+ definition: "A summary, characterization or explanation of the Bot.",
6292
+ min: 0,
6293
+ max: "1",
6294
+ type: [
6295
+ {
6296
+ code: "string"
6297
+ }
6298
+ ]
6299
+ },
6300
+ {
6301
+ id: "Bot.runtimeVersion",
6302
+ path: "Bot.runtimeVersion",
6303
+ definition: "The identifier of the bot runtime environment (i.e., vmcontext, awslambda, etc).",
6304
+ min: 0,
6305
+ max: "1",
6306
+ type: [
6307
+ {
6308
+ code: "string"
6309
+ }
6310
+ ]
6311
+ },
6312
+ {
6313
+ id: "Bot.photo",
6314
+ path: "Bot.photo",
6315
+ definition: "Image of the bot.",
6316
+ min: 0,
6317
+ max: "1",
6318
+ type: [
6319
+ {
6320
+ code: "Attachment"
6321
+ }
6322
+ ]
6323
+ },
6324
+ {
6325
+ id: "Bot.code",
6326
+ path: "Bot.code",
6327
+ definition: "Bot logic script.",
6328
+ min: 0,
6329
+ max: "1",
6330
+ type: [
6331
+ {
6332
+ code: "string"
6333
+ }
6334
+ ]
6335
+ },
6336
+ {
6337
+ id: "Bot.runAsUser",
6338
+ path: "Bot.runAsUser",
6339
+ definition: "Optional flag to indicate that the bot should be run as the user.",
6340
+ min: 0,
6341
+ max: "1",
6342
+ type: [
6343
+ {
6344
+ code: "boolean"
6345
+ }
6346
+ ]
6347
+ }
6348
+ ]
6349
+ }
6220
6350
  }
6221
6351
  ];
6222
6352
 
@@ -9005,7 +9135,7 @@
9005
9135
  }
9006
9136
  if (searchRequest.filters) {
9007
9137
  for (const filter of searchRequest.filters) {
9008
- if (!matchesSearchFilter(resource, searchRequest, filter)) {
9138
+ if (!matchesSearchFilter(resource, filter)) {
9009
9139
  return false;
9010
9140
  }
9011
9141
  }
@@ -9018,7 +9148,7 @@
9018
9148
  * @param filter One of the filters of a subscription criteria.
9019
9149
  * @returns True if the resource satisfies the search filter.
9020
9150
  */
9021
- function matchesSearchFilter(resource, searchRequest, filter) {
9151
+ function matchesSearchFilter(resource, filter) {
9022
9152
  const expression = filter.code.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
9023
9153
  const values = evalFhirPath(expression, resource);
9024
9154
  const result = values.some((value) => JSON.stringify(value).toLowerCase().includes(filter.value.toLowerCase()));
@@ -9031,7 +9161,7 @@
9031
9161
  baseUrl: 'https://example.com/',
9032
9162
  clientId: 'my-client-id',
9033
9163
  fetch: (url, options) => {
9034
- const method = options.method;
9164
+ const method = options.method || 'GET';
9035
9165
  const path = url.replace('https://example.com/', '');
9036
9166
  if (clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.debug) {
9037
9167
  console.log('MockClient', method, path);
@@ -9072,7 +9202,7 @@
9072
9202
  }
9073
9203
  return super.getActiveLogin();
9074
9204
  }
9075
- createBinary(data, filename, contentType) {
9205
+ createBinary(_data, filename, contentType) {
9076
9206
  if (filename.endsWith('.exe')) {
9077
9207
  return Promise.reject(core.badRequest('Invalid file type'));
9078
9208
  }
@@ -9098,7 +9228,7 @@
9098
9228
  return null;
9099
9229
  }
9100
9230
  }
9101
- function mockAdminHandler(method, path) {
9231
+ function mockAdminHandler(_method, path) {
9102
9232
  if (path.startsWith('admin/projects/123')) {
9103
9233
  return {
9104
9234
  project: { id: '123', name: 'Project 123' },
@@ -9135,7 +9265,7 @@
9135
9265
  }
9136
9266
  return null;
9137
9267
  }
9138
- function mockChangePasswordHandler(method, path, options) {
9268
+ function mockChangePasswordHandler(_method, _path, options) {
9139
9269
  const { body } = options;
9140
9270
  const { oldPassword } = JSON.parse(body);
9141
9271
  if (oldPassword === 'orange') {
@@ -9155,7 +9285,7 @@
9155
9285
  };
9156
9286
  }
9157
9287
  }
9158
- function mockLoginHandler(method, path, options) {
9288
+ function mockLoginHandler(_method, _path, options) {
9159
9289
  const { body } = options;
9160
9290
  const { password } = JSON.parse(body);
9161
9291
  if (password === 'password') {
@@ -9177,7 +9307,7 @@
9177
9307
  };
9178
9308
  }
9179
9309
  }
9180
- function mockSetPasswordHandler(method, path, options) {
9310
+ function mockSetPasswordHandler(_method, _path, options) {
9181
9311
  const { body } = options;
9182
9312
  const { password } = JSON.parse(body);
9183
9313
  if (password === 'orange') {
@@ -9197,7 +9327,7 @@
9197
9327
  };
9198
9328
  }
9199
9329
  }
9200
- function mockRegisterHandler(method, path, options) {
9330
+ function mockRegisterHandler(_method, _path, options) {
9201
9331
  const { body } = options;
9202
9332
  const { email, password } = JSON.parse(body);
9203
9333
  if (email === 'george@example.com' && password === 'password') {
@@ -9216,7 +9346,7 @@
9216
9346
  };
9217
9347
  }
9218
9348
  }
9219
- function mockResetPasswordHandler(method, path, options) {
9349
+ function mockResetPasswordHandler(_method, _path, options) {
9220
9350
  const { body } = options;
9221
9351
  const { email } = JSON.parse(body);
9222
9352
  if (email === 'admin@example.com') {
@@ -9307,7 +9437,7 @@
9307
9437
  return mockRepo.createResource(JSON.parse(options.body));
9308
9438
  }
9309
9439
  }
9310
- function mockFhirBatchHandler(method, path, options) {
9440
+ function mockFhirBatchHandler(_method, _path, options) {
9311
9441
  var _a;
9312
9442
  const { body } = options;
9313
9443
  const request = JSON.parse(body);