@financial-times/dotcom-server-app-context 11.2.1 → 12.0.0

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.
@@ -1,5 +1,5 @@
1
1
  import { TAppContext } from './types';
2
- export declare type TAppContextOptions = {
2
+ export type TAppContextOptions = {
3
3
  appContext?: Partial<TAppContext>;
4
4
  };
5
5
  export declare class AppContext {
@@ -9,7 +9,7 @@ const filterEmptyData_1 = __importDefault(require("./filterEmptyData"));
9
9
  class AppContext {
10
10
  constructor(options = {}) {
11
11
  this.data = {};
12
- const data = filterEmptyData_1.default({ ...options.appContext });
12
+ const data = (0, filterEmptyData_1.default)({ ...options.appContext });
13
13
  for (const [property, value] of Object.entries(data)) {
14
14
  this.set(property, value);
15
15
  }
@@ -18,7 +18,7 @@ class AppContext {
18
18
  return this.data[property];
19
19
  }
20
20
  set(property, value) {
21
- if (validate_1.default(property, value)) {
21
+ if ((0, validate_1.default)(property, value)) {
22
22
  this.data[property] = value;
23
23
  }
24
24
  }
@@ -1,4 +1,4 @@
1
- declare type AnyObject = {
1
+ type AnyObject = {
2
2
  [key: string]: any;
3
3
  };
4
4
  export default function filterEmptyProperties(properties: AnyObject): AnyObject;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = filterEmptyProperties;
3
4
  const isEmptyString = (value) => typeof value === 'string' && value.trim().length === 0;
4
5
  const isDefined = (value) => value !== undefined && value !== null;
5
6
  function filterEmptyProperties(properties) {
@@ -11,4 +12,3 @@ function filterEmptyProperties(properties) {
11
12
  }
12
13
  return result;
13
14
  }
14
- exports.default = filterEmptyProperties;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = validate;
6
7
  const ajv_1 = __importDefault(require("ajv"));
7
8
  const schema_json_1 = __importDefault(require("./schema.json"));
8
9
  const ajv = new ajv_1.default();
@@ -22,4 +23,3 @@ function validate(field, value) {
22
23
  throw Error(errorMessage);
23
24
  }
24
25
  }
25
- exports.default = validate;