fern-api 0.38.1 → 0.39.1

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.
Files changed (2) hide show
  1. package/bundle.cjs +37 -9
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -104616,10 +104616,10 @@ var require_isDate = __commonJS({
104616
104616
  "use strict";
104617
104617
  Object.defineProperty(exports2, "__esModule", { value: true });
104618
104618
  exports2.isValidDate = void 0;
104619
- function isValidDate(value) {
104619
+ function isValidDate2(value) {
104620
104620
  return value instanceof Date && !isNaN(value);
104621
104621
  }
104622
- exports2.isValidDate = isValidDate;
104622
+ exports2.isValidDate = isValidDate2;
104623
104623
  }
104624
104624
  });
104625
104625
 
@@ -1187791,6 +1187791,14 @@ function isEqual(value, other) {
1187791
1187791
  }
1187792
1187792
  var isEqual_default = isEqual;
1187793
1187793
 
1187794
+ // ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEqualWith.js
1187795
+ function isEqualWith(value, other, customizer) {
1187796
+ customizer = typeof customizer == "function" ? customizer : void 0;
1187797
+ var result = customizer ? customizer(value, other) : void 0;
1187798
+ return result === void 0 ? baseIsEqual_default(value, other, void 0, customizer) : !!result;
1187799
+ }
1187800
+ var isEqualWith_default = isEqualWith;
1187801
+
1187794
1187802
  // ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isNull.js
1187795
1187803
  function isNull2(value) {
1187796
1187804
  return value === null;
@@ -1192517,7 +1192525,7 @@ var AccessTokenPosthogManager = class {
1192517
1192525
  properties: {
1192518
1192526
  ...event,
1192519
1192527
  ...event.properties,
1192520
- version: "0.38.1",
1192528
+ version: "0.39.1",
1192521
1192529
  usingAccessToken: true
1192522
1192530
  }
1192523
1192531
  });
@@ -1192579,7 +1192587,7 @@ var UserPosthogManager = class {
1192579
1192587
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
1192580
1192588
  event: "CLI",
1192581
1192589
  properties: {
1192582
- version: "0.38.1",
1192590
+ version: "0.39.1",
1192583
1192591
  ...event,
1192584
1192592
  ...event.properties
1192585
1192593
  }
@@ -1222603,10 +1222611,10 @@ var CliContext = class {
1222603
1222611
  return "fern-api";
1222604
1222612
  }
1222605
1222613
  getPackageVersion() {
1222606
- if ("0.38.1" == null) {
1222614
+ if ("0.39.1" == null) {
1222607
1222615
  this.logger.error("CLI_VERSION is not defined");
1222608
1222616
  }
1222609
- return "0.38.1";
1222617
+ return "0.39.1";
1222610
1222618
  }
1222611
1222619
  getCliName() {
1222612
1222620
  if ("fern" == null) {
@@ -1307464,6 +1307472,26 @@ function getRequestHandler(endpoints) {
1307464
1307472
  res.status(404).send(`Unrecognized example request: ${JSON.stringify(req2.headers)} ${JSON.stringify(req2.params)} ${JSON.stringify(req2.query)} ${JSON.stringify(req2.body)}`);
1307465
1307473
  };
1307466
1307474
  }
1307475
+ function isValidDate(value) {
1307476
+ const date4 = new Date(value);
1307477
+ return !isNaN(date4.getTime());
1307478
+ }
1307479
+ function dateishCustomizer(value, other) {
1307480
+ if (isPlainObject(value) || isPlainObject(other)) {
1307481
+ return void 0;
1307482
+ }
1307483
+ if (typeof value === "string" && typeof other === "string") {
1307484
+ if (value === other) {
1307485
+ return true;
1307486
+ }
1307487
+ if (isValidDate(value) && isValidDate(other)) {
1307488
+ const valueDate = new Date(value);
1307489
+ const otherDate = new Date(other);
1307490
+ return Math.abs(valueDate.getTime() - otherDate.getTime()) <= 12 * 60 * 60 * 1e3;
1307491
+ }
1307492
+ }
1307493
+ return void 0;
1307494
+ }
1307467
1307495
  function isRequestMatch(req2, example) {
1307468
1307496
  return validatePathParameters(example, req2) && validateQueryParameters(example, req2) && validateHeaders(example, req2.headers) && validateRequestBody(example, req2);
1307469
1307497
  }
@@ -1307477,7 +1307505,7 @@ function validatePathParameters(example, req2) {
1307477
1307505
  return false;
1307478
1307506
  }
1307479
1307507
  if (Object.keys(examplePathParameters).length > 0) {
1307480
- if (!isEqual_default(req2.params, examplePathParameters)) {
1307508
+ if (!isEqualWith_default(req2.params, examplePathParameters, dateishCustomizer)) {
1307481
1307509
  return false;
1307482
1307510
  }
1307483
1307511
  }
@@ -1307496,7 +1307524,7 @@ function validateQueryParameters(example, req2) {
1307496
1307524
  stringifiedQueryParams[key] = value;
1307497
1307525
  }
1307498
1307526
  }
1307499
- return isEqual_default(req2.query, stringifiedQueryParams);
1307527
+ return isEqualWith_default(exampleQueryParameters, stringifiedQueryParams, dateishCustomizer);
1307500
1307528
  }
1307501
1307529
  function validateHeaders(example, headers) {
1307502
1307530
  const exampleHeaders = examplesWithWireValueToRecord([...example.serviceHeaders, ...example.endpointHeaders]);
@@ -1307517,7 +1307545,7 @@ function validateRequestBody(example, req2) {
1307517
1307545
  req2.body[key] = value.toISOString();
1307518
1307546
  }
1307519
1307547
  }
1307520
- return isEqual_default(req2.body, example.request.jsonExample);
1307548
+ return isEqualWith_default(req2.body, example.request.jsonExample, dateishCustomizer);
1307521
1307549
  }
1307522
1307550
  function examplesWithWireValueToRecord(examplesWithWireValue) {
1307523
1307551
  const result = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.38.1",
3
+ "version": "0.39.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",