@lighthouse/common 6.10.0 → 6.10.1-canary.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.
- package/.mise.toml +6 -6
- package/CHANGELOG.md +758 -758
- package/README.md +1 -1
- package/dist/errors/FetchImageError.js +3 -3
- package/dist/helpers/fetch-image-for-pdf-generator-service/index.js +7 -7
- package/dist/helpers/floatify/index.js +6 -6
- package/dist/helpers/get-audit-items-data/index.js +47 -36
- package/dist/helpers/validate-url/index.js +4 -4
- package/dist/pdf/activity-report/index.js +32 -32
- package/dist/pdf/audit/index.js +23 -23
- package/dist/pdf/helpers/fields/index.js +47 -27
- package/dist/pdf/issue/index.js +23 -23
- package/dist/pdf/job/index.js +22 -22
- package/dist/pdf/shift-report/index.js +28 -28
- package/dist/pdf/task/index.js +23 -23
- package/dist/scheduling/generators/occurrenceIntervalsGenerator.js +2 -2
- package/dist/scheduling/generators/scheduleIntervalsGenerator.js +2 -2
- package/dist/scheduling/generators/serviceIntervalsGenerator.js +2 -2
- package/dist/scheduling/helpers/convertToTimezone.js +6 -6
- package/dist/scheduling/helpers/generateNonRepeatingSchedule.js +2 -2
- package/dist/scheduling/helpers/generateRepeatingSchedule.js +2 -2
- package/dist/scheduling/helpers/generateScheduleEnd.js +2 -2
- package/dist/scheduling/helpers/hasValidStartAndEnd.js +5 -5
- package/dist/scheduling/helpers/intervalCovers.js +6 -6
- package/dist/scheduling/helpers/intervalIntersectsEnd.js +6 -6
- package/dist/scheduling/helpers/intervalIntersectsStart.js +6 -6
- package/dist/scheduling/helpers/intervalOnlyIntersectsEnd.js +6 -6
- package/dist/scheduling/helpers/intervalOnlyIntersectsStart.js +6 -6
- package/dist/scheduling/helpers/intervalOutside.js +6 -6
- package/dist/scheduling/helpers/intervalWithin.js +6 -6
- package/dist/scheduling/helpers/mergeIntervals.js +6 -6
- package/dist/scheduling/helpers/splitIntervals.js +6 -6
- package/dist/scheduling/strategies/getNext.js +2 -2
- package/dist/scheduling/strategies/getNextExactDateOfMonth.js +2 -2
- package/dist/scheduling/strategies/getNextLastDayOfMonth.js +2 -2
- package/dist/scheduling/strategies/getNextLastWeekdayOfMonth.js +2 -2
- package/dist/scheduling/strategies/getNextNoRepeat.js +2 -2
- package/dist/scheduling/strategies/getNextWeekday.js +2 -2
- package/dist/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +2 -2
- package/dist/service-hours/__helpers__/calculate-hours.js +4 -4
- package/dist/service-hours/__helpers__/isOpen.js +2 -2
- package/dist/service-hours/schema.js +4 -4
- package/lib/constants.js +12 -6
- package/lib/constants.js.map +1 -1
- package/lib/errors/DomainError.js +14 -21
- package/lib/errors/DomainError.js.map +1 -1
- package/lib/errors/FetchImageError.js +17 -24
- package/lib/errors/FetchImageError.js.map +1 -1
- package/lib/errors/ValidationError.js +30 -36
- package/lib/errors/ValidationError.js.map +1 -1
- package/lib/errors/index.js +23 -5
- package/lib/errors/index.js.map +1 -1
- package/lib/helpers/build-fetch-url/index.js +43 -47
- package/lib/helpers/build-fetch-url/index.js.map +1 -1
- package/lib/helpers/fetch-image/index.js +83 -82
- package/lib/helpers/fetch-image/index.js.map +1 -1
- package/lib/helpers/fetch-image-for-pdf-generator-service/index.js +168 -243
- package/lib/helpers/fetch-image-for-pdf-generator-service/index.js.map +1 -1
- package/lib/helpers/fetch-image-for-web/index.js +71 -94
- package/lib/helpers/fetch-image-for-web/index.js.map +1 -1
- package/lib/helpers/fetch-lighthouse-logo/index.js +36 -61
- package/lib/helpers/fetch-lighthouse-logo/index.js.map +1 -1
- package/lib/helpers/floatify/index.js +13 -7
- package/lib/helpers/floatify/index.js.map +1 -1
- package/lib/helpers/get-assignees-full-names/index.js +11 -7
- package/lib/helpers/get-assignees-full-names/index.js.map +1 -1
- package/lib/helpers/get-audit-entry-details/index.js +42 -32
- package/lib/helpers/get-audit-entry-details/index.js.map +1 -1
- package/lib/helpers/get-audit-items-data/index.js +104 -83
- package/lib/helpers/get-audit-items-data/index.js.map +1 -1
- package/lib/helpers/get-geometry-geocoded-string/index.js +10 -5
- package/lib/helpers/get-geometry-geocoded-string/index.js.map +1 -1
- package/lib/helpers/get-issue-details/index.js +53 -43
- package/lib/helpers/get-issue-details/index.js.map +1 -1
- package/lib/helpers/get-job-details/index.js +49 -41
- package/lib/helpers/get-job-details/index.js.map +1 -1
- package/lib/helpers/get-location-reference/index.js +32 -34
- package/lib/helpers/get-location-reference/index.js.map +1 -1
- package/lib/helpers/get-pretty-duration/index.js +16 -10
- package/lib/helpers/get-pretty-duration/index.js.map +1 -1
- package/lib/helpers/get-reference-details/index.js +20 -10
- package/lib/helpers/get-reference-details/index.js.map +1 -1
- package/lib/helpers/get-status-details/index.js +8 -2
- package/lib/helpers/get-status-details/index.js.map +1 -1
- package/lib/helpers/get-task-entry-details/index.js +32 -23
- package/lib/helpers/get-task-entry-details/index.js.map +1 -1
- package/lib/helpers/get-timezone-abbr/index.js +11 -4
- package/lib/helpers/get-timezone-abbr/index.js.map +1 -1
- package/lib/helpers/get-timezone-datetime/index.js +20 -13
- package/lib/helpers/get-timezone-datetime/index.js.map +1 -1
- package/lib/helpers/get-user-full-name/index.js +9 -3
- package/lib/helpers/get-user-full-name/index.js.map +1 -1
- package/lib/helpers/get-value-as-percentage/index.js +9 -4
- package/lib/helpers/get-value-as-percentage/index.js.map +1 -1
- package/lib/helpers/image-validators/index.js +18 -12
- package/lib/helpers/image-validators/index.js.map +1 -1
- package/lib/helpers/index.js +130 -18
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/validate-url/index.js +11 -5
- package/lib/helpers/validate-url/index.js.map +1 -1
- package/lib/images/index.js +10 -4
- package/lib/images/index.js.map +1 -1
- package/lib/index.js +66 -10
- package/lib/index.js.map +1 -1
- package/lib/pdf/activity-report/index.js +407 -537
- package/lib/pdf/activity-report/index.js.map +1 -1
- package/lib/pdf/audit/index.js +137 -134
- package/lib/pdf/audit/index.js.map +1 -1
- package/lib/pdf/fonts/index.js +4 -2
- package/lib/pdf/fonts/index.js.map +1 -1
- package/lib/pdf/helpers/build-audit-content/index.js +57 -51
- package/lib/pdf/helpers/build-audit-content/index.js.map +1 -1
- package/lib/pdf/helpers/build-audit-follow-ups/index.js +52 -50
- package/lib/pdf/helpers/build-audit-follow-ups/index.js.map +1 -1
- package/lib/pdf/helpers/build-location-scans-content/index.js +22 -16
- package/lib/pdf/helpers/build-location-scans-content/index.js.map +1 -1
- package/lib/pdf/helpers/build-template-content/index.js +52 -51
- package/lib/pdf/helpers/build-template-content/index.js.map +1 -1
- package/lib/pdf/helpers/default-footer/index.js +38 -35
- package/lib/pdf/helpers/default-footer/index.js.map +1 -1
- package/lib/pdf/helpers/default-header/index.js +40 -35
- package/lib/pdf/helpers/default-header/index.js.map +1 -1
- package/lib/pdf/helpers/default-styles/index.js +7 -1
- package/lib/pdf/helpers/default-styles/index.js.map +1 -1
- package/lib/pdf/helpers/fields/index.js +225 -214
- package/lib/pdf/helpers/fields/index.js.map +1 -1
- package/lib/pdf/helpers/format-location-address/index.js +14 -8
- package/lib/pdf/helpers/format-location-address/index.js.map +1 -1
- package/lib/pdf/helpers/generate-definition/index.js +60 -65
- package/lib/pdf/helpers/generate-definition/index.js.map +1 -1
- package/lib/pdf/helpers/horizontal-line/index.js +14 -14
- package/lib/pdf/helpers/horizontal-line/index.js.map +1 -1
- package/lib/pdf/helpers/html-transformer/index.js +45 -35
- package/lib/pdf/helpers/html-transformer/index.js.map +1 -1
- package/lib/pdf/helpers/index.js +194 -15
- package/lib/pdf/helpers/index.js.map +1 -1
- package/lib/pdf/helpers/parse-value/index.js +10 -4
- package/lib/pdf/helpers/parse-value/index.js.map +1 -1
- package/lib/pdf/helpers/table/index.js +136 -205
- package/lib/pdf/helpers/table/index.js.map +1 -1
- package/lib/pdf/helpers/text/index.js +11 -8
- package/lib/pdf/helpers/text/index.js.map +1 -1
- package/lib/pdf/icons/index.js +8 -2
- package/lib/pdf/icons/index.js.map +1 -1
- package/lib/pdf/index.js +47 -6
- package/lib/pdf/index.js.map +1 -1
- package/lib/pdf/issue/index.js +141 -135
- package/lib/pdf/issue/index.js.map +1 -1
- package/lib/pdf/job/index.js +95 -81
- package/lib/pdf/job/index.js.map +1 -1
- package/lib/pdf/shift-report/emptyFixtures.js +8 -2
- package/lib/pdf/shift-report/emptyFixtures.js.map +1 -1
- package/lib/pdf/shift-report/index.js +399 -521
- package/lib/pdf/shift-report/index.js.map +1 -1
- package/lib/pdf/task/index.js +89 -83
- package/lib/pdf/task/index.js.map +1 -1
- package/lib/scheduling/generators/index.js +38 -3
- package/lib/scheduling/generators/index.js.map +1 -1
- package/lib/scheduling/generators/occurrenceIntervalsGenerator.js +44 -37
- package/lib/scheduling/generators/occurrenceIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/generators/scheduleIntervalsGenerator.js +20 -28
- package/lib/scheduling/generators/scheduleIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/generators/serviceIntervalsGenerator.js +120 -150
- package/lib/scheduling/generators/serviceIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/helpers/convertToTimezone.js +18 -11
- package/lib/scheduling/helpers/convertToTimezone.js.map +1 -1
- package/lib/scheduling/helpers/generateNonRepeatingSchedule.js +57 -95
- package/lib/scheduling/helpers/generateNonRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateRepeatingSchedule.js +80 -119
- package/lib/scheduling/helpers/generateRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateScheduleEnd.js +24 -14
- package/lib/scheduling/helpers/generateScheduleEnd.js.map +1 -1
- package/lib/scheduling/helpers/hasValidStartAndEnd.js +19 -11
- package/lib/scheduling/helpers/hasValidStartAndEnd.js.map +1 -1
- package/lib/scheduling/helpers/index.js +159 -14
- package/lib/scheduling/helpers/index.js.map +1 -1
- package/lib/scheduling/helpers/intervalCovers.js +13 -7
- package/lib/scheduling/helpers/intervalCovers.js.map +1 -1
- package/lib/scheduling/helpers/intervalIntersectsEnd.js +13 -7
- package/lib/scheduling/helpers/intervalIntersectsEnd.js.map +1 -1
- package/lib/scheduling/helpers/intervalIntersectsStart.js +13 -7
- package/lib/scheduling/helpers/intervalIntersectsStart.js.map +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js +15 -10
- package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js.map +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js +15 -10
- package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js.map +1 -1
- package/lib/scheduling/helpers/intervalOutside.js +15 -9
- package/lib/scheduling/helpers/intervalOutside.js.map +1 -1
- package/lib/scheduling/helpers/intervalWithin.js +13 -7
- package/lib/scheduling/helpers/intervalWithin.js.map +1 -1
- package/lib/scheduling/helpers/mergeIntervals.js +21 -17
- package/lib/scheduling/helpers/mergeIntervals.js.map +1 -1
- package/lib/scheduling/helpers/splitIntervals.js +24 -23
- package/lib/scheduling/helpers/splitIntervals.js.map +1 -1
- package/lib/scheduling/index.js +38 -3
- package/lib/scheduling/index.js.map +1 -1
- package/lib/scheduling/scheduling.types.js +9 -3
- package/lib/scheduling/scheduling.types.js.map +1 -1
- package/lib/scheduling/strategies/getNext.js +57 -63
- package/lib/scheduling/strategies/getNext.js.map +1 -1
- package/lib/scheduling/strategies/getNextExactDateOfMonth.js +47 -56
- package/lib/scheduling/strategies/getNextExactDateOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextLastDayOfMonth.js +43 -51
- package/lib/scheduling/strategies/getNextLastDayOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js +49 -56
- package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextNoRepeat.js +25 -36
- package/lib/scheduling/strategies/getNextNoRepeat.js.map +1 -1
- package/lib/scheduling/strategies/getNextWeekday.js +47 -79
- package/lib/scheduling/strategies/getNextWeekday.js.map +1 -1
- package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +52 -58
- package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/index.js +82 -7
- package/lib/scheduling/strategies/index.js.map +1 -1
- package/lib/schema/index.js +16 -1
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/schema.js +28 -34
- package/lib/schema/schema.js.map +1 -1
- package/lib/service-hours/__helpers__/calculate-hours.js +24 -22
- package/lib/service-hours/__helpers__/calculate-hours.js.map +1 -1
- package/lib/service-hours/__helpers__/isOpen.js +25 -24
- package/lib/service-hours/__helpers__/isOpen.js.map +1 -1
- package/lib/service-hours/index.js +27 -2
- package/lib/service-hours/index.js.map +1 -1
- package/lib/service-hours/schema.js +68 -55
- package/lib/service-hours/schema.js.map +1 -1
- package/package.json +86 -86
- package/vitest.config.ts +23 -23
- package/vitest.setup.js +7 -7
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.scheduleIntervalsGenerator = scheduleIntervalsGenerator;
|
|
7
7
|
var _helpers = require("../helpers");
|
|
8
8
|
var _scheduling = require("../scheduling.types");
|
|
9
|
-
/**
|
|
10
|
-
* Generates schedule service and occurrence intervals
|
|
9
|
+
/**
|
|
10
|
+
* Generates schedule service and occurrence intervals
|
|
11
11
|
*/
|
|
12
12
|
function* scheduleIntervalsGenerator(props) {
|
|
13
13
|
const {
|
|
@@ -10,8 +10,8 @@ var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
|
10
10
|
var _serviceHours = require("../../service-hours");
|
|
11
11
|
var _scheduling = require("../scheduling.types");
|
|
12
12
|
var _helpers = require("../helpers");
|
|
13
|
-
/**
|
|
14
|
-
* Generates service intervals between start and end range for service hours
|
|
13
|
+
/**
|
|
14
|
+
* Generates service intervals between start and end range for service hours
|
|
15
15
|
*/
|
|
16
16
|
function* serviceIntervalsGenerator(props) {
|
|
17
17
|
const {
|
|
@@ -8,12 +8,12 @@ exports.convertToTimezone = convertToTimezone;
|
|
|
8
8
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
9
|
const DATE_FORMAT = 'YYYY-MM-DD HH:mm';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Accepts a timestamp and returns the same timestamp but in the timezone
|
|
13
|
-
* provided
|
|
14
|
-
*
|
|
15
|
-
* convertToTimezone(1561248000000, 'Australia/Melbourne') // 2019-06-23T00:00:00+00:00
|
|
16
|
-
* returns 1561212000000 // 2019-06-23T00:00:00+10:00
|
|
11
|
+
/**
|
|
12
|
+
* Accepts a timestamp and returns the same timestamp but in the timezone
|
|
13
|
+
* provided
|
|
14
|
+
*
|
|
15
|
+
* convertToTimezone(1561248000000, 'Australia/Melbourne') // 2019-06-23T00:00:00+00:00
|
|
16
|
+
* returns 1561212000000 // 2019-06-23T00:00:00+10:00
|
|
17
17
|
*/
|
|
18
18
|
function convertToTimezone(timestamp, timezone) {
|
|
19
19
|
const datestring = _momentTimezone.default.utc(timestamp).format(DATE_FORMAT);
|
|
@@ -8,8 +8,8 @@ var _fp = require("lodash/fp");
|
|
|
8
8
|
var _ = require(".");
|
|
9
9
|
var _scheduling = require("../scheduling.types");
|
|
10
10
|
var _generators = require("../generators");
|
|
11
|
-
/**
|
|
12
|
-
* Generates non repeating schedule service and occurrence intervals
|
|
11
|
+
/**
|
|
12
|
+
* Generates non repeating schedule service and occurrence intervals
|
|
13
13
|
*/
|
|
14
14
|
function* generateNonRepeatingSchedule(props) {
|
|
15
15
|
const {
|
|
@@ -11,8 +11,8 @@ var _scheduling = require("../scheduling.types");
|
|
|
11
11
|
var _generators = require("../generators");
|
|
12
12
|
const complyingServiceIntervalUnits = exports.complyingServiceIntervalUnits = [_scheduling.Unit.Second, _scheduling.Unit.Minute, _scheduling.Unit.Hour];
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Generates repeating schedule service and occurrence intervals
|
|
14
|
+
/**
|
|
15
|
+
* Generates repeating schedule service and occurrence intervals
|
|
16
16
|
*/
|
|
17
17
|
function* generateRepeatingSchedule(props) {
|
|
18
18
|
const {
|
|
@@ -8,8 +8,8 @@ exports.generateScheduleEnd = generateScheduleEnd;
|
|
|
8
8
|
var _fp = require("lodash/fp");
|
|
9
9
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
10
10
|
var _scheduling = require("../scheduling.types");
|
|
11
|
-
/**
|
|
12
|
-
* Generates a schedule end datetime based on the start and frequency
|
|
11
|
+
/**
|
|
12
|
+
* Generates a schedule end datetime based on the start and frequency
|
|
13
13
|
*/
|
|
14
14
|
function generateScheduleEnd({
|
|
15
15
|
frequency,
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.hasValidStartAndEnd = hasValidStartAndEnd;
|
|
8
8
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
|
-
/**
|
|
10
|
-
* Checks if start and end are valid datetimes
|
|
11
|
-
*
|
|
12
|
-
* hasValidStartAndEnd({ end: 1566970473988, start: 1566970464839 })
|
|
13
|
-
* returns true
|
|
9
|
+
/**
|
|
10
|
+
* Checks if start and end are valid datetimes
|
|
11
|
+
*
|
|
12
|
+
* hasValidStartAndEnd({ end: 1566970473988, start: 1566970464839 })
|
|
13
|
+
* returns true
|
|
14
14
|
*/
|
|
15
15
|
function hasValidStartAndEnd({
|
|
16
16
|
start,
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.intervalCovers = intervalCovers;
|
|
7
|
-
/**
|
|
8
|
-
* Checks if interval covers another
|
|
9
|
-
* Accepts two intervals and checks whether the first covers the second
|
|
10
|
-
*
|
|
11
|
-
* intervalCovers([0,20], [5,15])
|
|
12
|
-
* returns true
|
|
7
|
+
/**
|
|
8
|
+
* Checks if interval covers another
|
|
9
|
+
* Accepts two intervals and checks whether the first covers the second
|
|
10
|
+
*
|
|
11
|
+
* intervalCovers([0,20], [5,15])
|
|
12
|
+
* returns true
|
|
13
13
|
*/
|
|
14
14
|
function intervalCovers(firstInterval, secondInterval) {
|
|
15
15
|
return firstInterval[0] <= secondInterval[0] && firstInterval[1] >= secondInterval[1];
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.intervalIntersectsEnd = intervalIntersectsEnd;
|
|
7
|
-
/**
|
|
8
|
-
* Check if interval intersects another interval's end
|
|
9
|
-
* Accepts two intervals and checks whether the first intersects the second's end
|
|
10
|
-
*
|
|
11
|
-
* intervalIntersectsEnd([12,20], [5,15]))
|
|
12
|
-
* returns true
|
|
7
|
+
/**
|
|
8
|
+
* Check if interval intersects another interval's end
|
|
9
|
+
* Accepts two intervals and checks whether the first intersects the second's end
|
|
10
|
+
*
|
|
11
|
+
* intervalIntersectsEnd([12,20], [5,15]))
|
|
12
|
+
* returns true
|
|
13
13
|
*/
|
|
14
14
|
function intervalIntersectsEnd(firstInterval, secondInterval) {
|
|
15
15
|
return firstInterval[1] >= secondInterval[1] && firstInterval[0] < secondInterval[1];
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.intervalIntersectsStart = intervalIntersectsStart;
|
|
7
|
-
/**
|
|
8
|
-
* Check if interval intersects another interval's start
|
|
9
|
-
* Accepts two intervals and checks whether the first intersects the second's start
|
|
10
|
-
*
|
|
11
|
-
* intervalIntersectsStart([2,10], [5,15])
|
|
12
|
-
* returns true
|
|
7
|
+
/**
|
|
8
|
+
* Check if interval intersects another interval's start
|
|
9
|
+
* Accepts two intervals and checks whether the first intersects the second's start
|
|
10
|
+
*
|
|
11
|
+
* intervalIntersectsStart([2,10], [5,15])
|
|
12
|
+
* returns true
|
|
13
13
|
*/
|
|
14
14
|
function intervalIntersectsStart(firstInterval, secondInterval) {
|
|
15
15
|
return firstInterval[0] <= secondInterval[0] && firstInterval[1] > secondInterval[0];
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.intervalOnlyIntersectsEnd = intervalOnlyIntersectsEnd;
|
|
7
7
|
var _intervalIntersectsEnd = require("./intervalIntersectsEnd");
|
|
8
8
|
var _intervalIntersectsStart = require("./intervalIntersectsStart");
|
|
9
|
-
/**
|
|
10
|
-
* Check if interval only intersects another interval's end
|
|
11
|
-
* Accepts two intervals and checks whether the first only intersects the second's end
|
|
12
|
-
*
|
|
13
|
-
* intervalIntersectsEnd([12,20], [5,15]))
|
|
14
|
-
* returns true
|
|
9
|
+
/**
|
|
10
|
+
* Check if interval only intersects another interval's end
|
|
11
|
+
* Accepts two intervals and checks whether the first only intersects the second's end
|
|
12
|
+
*
|
|
13
|
+
* intervalIntersectsEnd([12,20], [5,15]))
|
|
14
|
+
* returns true
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
function intervalOnlyIntersectsEnd(firstInterval, secondInterval) {
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.intervalOnlyIntersectsStart = intervalOnlyIntersectsStart;
|
|
7
7
|
var _intervalIntersectsEnd = require("./intervalIntersectsEnd");
|
|
8
8
|
var _intervalIntersectsStart = require("./intervalIntersectsStart");
|
|
9
|
-
/**
|
|
10
|
-
* Check if interval only intersects another interval's start
|
|
11
|
-
* Accepts two intervals and checks whether the first only intersects the second's start
|
|
12
|
-
*
|
|
13
|
-
* intervalOnlyIntersectsStart([2,10], [5,15])
|
|
14
|
-
* returns true
|
|
9
|
+
/**
|
|
10
|
+
* Check if interval only intersects another interval's start
|
|
11
|
+
* Accepts two intervals and checks whether the first only intersects the second's start
|
|
12
|
+
*
|
|
13
|
+
* intervalOnlyIntersectsStart([2,10], [5,15])
|
|
14
|
+
* returns true
|
|
15
15
|
*/
|
|
16
16
|
function intervalOnlyIntersectsStart(firstInterval, secondInterval) {
|
|
17
17
|
return (0, _intervalIntersectsStart.intervalIntersectsStart)(firstInterval, secondInterval) && !(0, _intervalIntersectsEnd.intervalIntersectsEnd)(firstInterval, secondInterval);
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.intervalOutside = intervalOutside;
|
|
7
|
-
/**
|
|
8
|
-
* Check if interval outside another interval
|
|
9
|
-
* Accepts two intervals and checks whether other interval is in the past or future
|
|
10
|
-
*
|
|
11
|
-
* intervalOutside([1, 4], [5,15])
|
|
12
|
-
* returns true
|
|
7
|
+
/**
|
|
8
|
+
* Check if interval outside another interval
|
|
9
|
+
* Accepts two intervals and checks whether other interval is in the past or future
|
|
10
|
+
*
|
|
11
|
+
* intervalOutside([1, 4], [5,15])
|
|
12
|
+
* returns true
|
|
13
13
|
*/
|
|
14
14
|
function intervalOutside(firstInterval, secondInterval) {
|
|
15
15
|
const future = firstInterval[0] > secondInterval[1] && firstInterval[1] > secondInterval[1];
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.intervalWithin = intervalWithin;
|
|
7
|
-
/**
|
|
8
|
-
* Checks if interval within another interval
|
|
9
|
-
* Accepts two intervals and checks whether within other interval
|
|
10
|
-
*
|
|
11
|
-
* intervalWithin([7,12], [5,15])
|
|
12
|
-
* returns true
|
|
7
|
+
/**
|
|
8
|
+
* Checks if interval within another interval
|
|
9
|
+
* Accepts two intervals and checks whether within other interval
|
|
10
|
+
*
|
|
11
|
+
* intervalWithin([7,12], [5,15])
|
|
12
|
+
* returns true
|
|
13
13
|
*/
|
|
14
14
|
function intervalWithin(firstInterval, secondInterval) {
|
|
15
15
|
return firstInterval[0] > secondInterval[0] && firstInterval[1] < secondInterval[1];
|
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.mergeIntervals = mergeIntervals;
|
|
7
7
|
var _fp = require("lodash/fp");
|
|
8
|
-
/**
|
|
9
|
-
* Merges overlapping intervals
|
|
10
|
-
* Accepts arrays of intervals and returns a flattened result of overlapping intervals
|
|
11
|
-
*
|
|
12
|
-
* mergeIntervals([[1,15], [11,25], [21,29], [40,1000]])
|
|
13
|
-
* returns [[1,29], [40,1000]]
|
|
8
|
+
/**
|
|
9
|
+
* Merges overlapping intervals
|
|
10
|
+
* Accepts arrays of intervals and returns a flattened result of overlapping intervals
|
|
11
|
+
*
|
|
12
|
+
* mergeIntervals([[1,15], [11,25], [21,29], [40,1000]])
|
|
13
|
+
* returns [[1,29], [40,1000]]
|
|
14
14
|
*/
|
|
15
15
|
function mergeIntervals(intervals) {
|
|
16
16
|
if ((0, _fp.isEmpty)(intervals)) return intervals;
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.splitIntervals = splitIntervals;
|
|
7
7
|
var _fp = require("lodash/fp");
|
|
8
8
|
var _ = require(".");
|
|
9
|
-
/**
|
|
10
|
-
* Applies closed intervals to intervals
|
|
11
|
-
* Accepts two sets of intervals and splits the first set by the second set
|
|
12
|
-
*
|
|
13
|
-
* splitIntervals([[1,10], [11,20], [21,29]], [[8,13]])
|
|
14
|
-
* returns [[1,8], [13,20], [21,29]]
|
|
9
|
+
/**
|
|
10
|
+
* Applies closed intervals to intervals
|
|
11
|
+
* Accepts two sets of intervals and splits the first set by the second set
|
|
12
|
+
*
|
|
13
|
+
* splitIntervals([[1,10], [11,20], [21,29]], [[8,13]])
|
|
14
|
+
* returns [[1,8], [13,20], [21,29]]
|
|
15
15
|
*/
|
|
16
16
|
function splitIntervals(intervals = [], closeIntervals = []) {
|
|
17
17
|
if ((0, _fp.isEmpty)(closeIntervals)) return intervals;
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getNext = getNext;
|
|
8
8
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
9
|
var _scheduling = require("../scheduling.types");
|
|
10
|
-
/**
|
|
11
|
-
* Generates next occurrence interval for stopwatch and window strategy
|
|
10
|
+
/**
|
|
11
|
+
* Generates next occurrence interval for stopwatch and window strategy
|
|
12
12
|
*/
|
|
13
13
|
function* getNext({
|
|
14
14
|
end,
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getNextExactDateOfMonth = getNextExactDateOfMonth;
|
|
8
8
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
9
|
var _scheduling = require("../scheduling.types");
|
|
10
|
-
/**
|
|
11
|
-
* Generates next occurrence interval for exact date of month strategy
|
|
10
|
+
/**
|
|
11
|
+
* Generates next occurrence interval for exact date of month strategy
|
|
12
12
|
*/
|
|
13
13
|
function* getNextExactDateOfMonth({
|
|
14
14
|
end,
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getNextLastDayOfMonth = getNextLastDayOfMonth;
|
|
8
8
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
9
|
var _scheduling = require("../scheduling.types");
|
|
10
|
-
/**
|
|
11
|
-
* Generates next occurrence interval for last day of month strategy
|
|
10
|
+
/**
|
|
11
|
+
* Generates next occurrence interval for last day of month strategy
|
|
12
12
|
*/
|
|
13
13
|
function* getNextLastDayOfMonth({
|
|
14
14
|
end,
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getNextLastWeekdayOfMonth = getNextLastWeekdayOfMonth;
|
|
8
8
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
9
|
var _scheduling = require("../scheduling.types");
|
|
10
|
-
/**
|
|
11
|
-
* Generates next occurrence interval for last weekday of month strategy
|
|
10
|
+
/**
|
|
11
|
+
* Generates next occurrence interval for last weekday of month strategy
|
|
12
12
|
*/
|
|
13
13
|
function* getNextLastWeekdayOfMonth({
|
|
14
14
|
end,
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getNextNoRepeat = getNextNoRepeat;
|
|
8
8
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
|
-
/**
|
|
10
|
-
* Generates next occurrence interval for non repeat strategy
|
|
9
|
+
/**
|
|
10
|
+
* Generates next occurrence interval for non repeat strategy
|
|
11
11
|
*/
|
|
12
12
|
function* getNextNoRepeat({
|
|
13
13
|
start,
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getNextWeekday = getNextWeekday;
|
|
8
8
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
9
|
var _scheduling = require("../scheduling.types");
|
|
10
|
-
/**
|
|
11
|
-
* Generates next occurrence interval for weekdays strategy
|
|
10
|
+
/**
|
|
11
|
+
* Generates next occurrence interval for weekdays strategy
|
|
12
12
|
*/
|
|
13
13
|
function* getNextWeekday({
|
|
14
14
|
end,
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getNextXDayOfXWeekOfMonth = getNextXDayOfXWeekOfMonth;
|
|
8
8
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
9
|
var _scheduling = require("../scheduling.types");
|
|
10
|
-
/**
|
|
11
|
-
* Generates next occurrence interval for x day of x week of month strategy
|
|
10
|
+
/**
|
|
11
|
+
* Generates next occurrence interval for x day of x week of month strategy
|
|
12
12
|
*/
|
|
13
13
|
function* getNextXDayOfXWeekOfMonth({
|
|
14
14
|
end,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Script to generate service hour definitions which is otherwise tedious to
|
|
5
|
-
* calculate as we store them in millisecond offsets
|
|
6
|
-
* Example Input: TUE 08:00 - TUE 17:00
|
|
3
|
+
/**
|
|
4
|
+
* Script to generate service hour definitions which is otherwise tedious to
|
|
5
|
+
* calculate as we store them in millisecond offsets
|
|
6
|
+
* Example Input: TUE 08:00 - TUE 17:00
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const days = {
|
|
@@ -9,8 +9,8 @@ var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
|
9
9
|
var _fp = require("lodash/fp");
|
|
10
10
|
var _generators = require("../../scheduling/generators");
|
|
11
11
|
var _scheduling = require("../../scheduling/scheduling.types");
|
|
12
|
-
/**
|
|
13
|
-
* Checks whether timestamp is within service hours for start and end
|
|
12
|
+
/**
|
|
13
|
+
* Checks whether timestamp is within service hours for start and end
|
|
14
14
|
*/
|
|
15
15
|
function isOpen({
|
|
16
16
|
serviceHours,
|
|
@@ -81,10 +81,10 @@ const schema = exports.schema = (0, _yup.object)({
|
|
|
81
81
|
return true;
|
|
82
82
|
})
|
|
83
83
|
});
|
|
84
|
-
/**
|
|
85
|
-
* validateOverlappingHours
|
|
86
|
-
* Validates that any hours do not overlap each other
|
|
87
|
-
* Validates default hours are within a week range
|
|
84
|
+
/**
|
|
85
|
+
* validateOverlappingHours
|
|
86
|
+
* Validates that any hours do not overlap each other
|
|
87
|
+
* Validates default hours are within a week range
|
|
88
88
|
*/
|
|
89
89
|
function validateOverlappingHours(options) {
|
|
90
90
|
const {
|
package/lib/constants.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LIGHTHOUSE_LOGO_URL = exports.DEFAULT_SUMMARY_FIELDS_COLUMN_LENGTH = exports.DEFAULT_PAGE_SIZE = exports.DEFAULT_PAGE_ORIENTATION = exports.DEFAULT_PAGE_MARGINS = exports.DEFAULT_IMAGE_COLUMN_LENGTH = void 0;
|
|
1
7
|
// pdf
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
const DEFAULT_IMAGE_COLUMN_LENGTH = exports.DEFAULT_IMAGE_COLUMN_LENGTH = 2;
|
|
9
|
+
const DEFAULT_SUMMARY_FIELDS_COLUMN_LENGTH = exports.DEFAULT_SUMMARY_FIELDS_COLUMN_LENGTH = 3;
|
|
10
|
+
const DEFAULT_PAGE_MARGINS = exports.DEFAULT_PAGE_MARGINS = [60, 130, 60, 80];
|
|
11
|
+
const DEFAULT_PAGE_ORIENTATION = exports.DEFAULT_PAGE_ORIENTATION = 'portrait';
|
|
12
|
+
const DEFAULT_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = 'A4';
|
|
13
|
+
const LIGHTHOUSE_LOGO_URL = exports.LIGHTHOUSE_LOGO_URL = 'https://assets-lighthouse-io.s3.amazonaws.com/img/lighthouse-color-logo-2023.png';
|
|
8
14
|
//# sourceMappingURL=constants.js.map
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["DEFAULT_IMAGE_COLUMN_LENGTH","DEFAULT_SUMMARY_FIELDS_COLUMN_LENGTH","DEFAULT_PAGE_MARGINS","DEFAULT_PAGE_ORIENTATION","DEFAULT_PAGE_SIZE","LIGHTHOUSE_LOGO_URL"],"sources":["../src/constants.js"],"sourcesContent":["// pdf\nexport const DEFAULT_IMAGE_COLUMN_LENGTH = 2\nexport const DEFAULT_SUMMARY_FIELDS_COLUMN_LENGTH = 3\nexport const DEFAULT_PAGE_MARGINS = [60, 130, 60, 80]\nexport const DEFAULT_PAGE_ORIENTATION = 'portrait'\nexport const DEFAULT_PAGE_SIZE = 'A4'\nexport const LIGHTHOUSE_LOGO_URL =\n 'https://assets-lighthouse-io.s3.amazonaws.com/img/lighthouse-color-logo-2023.png'\n"],"mappings":"AAAA;
|
|
1
|
+
{"version":3,"file":"constants.js","names":["DEFAULT_IMAGE_COLUMN_LENGTH","exports","DEFAULT_SUMMARY_FIELDS_COLUMN_LENGTH","DEFAULT_PAGE_MARGINS","DEFAULT_PAGE_ORIENTATION","DEFAULT_PAGE_SIZE","LIGHTHOUSE_LOGO_URL"],"sources":["../src/constants.js"],"sourcesContent":["// pdf\r\nexport const DEFAULT_IMAGE_COLUMN_LENGTH = 2\r\nexport const DEFAULT_SUMMARY_FIELDS_COLUMN_LENGTH = 3\r\nexport const DEFAULT_PAGE_MARGINS = [60, 130, 60, 80]\r\nexport const DEFAULT_PAGE_ORIENTATION = 'portrait'\r\nexport const DEFAULT_PAGE_SIZE = 'A4'\r\nexport const LIGHTHOUSE_LOGO_URL =\r\n 'https://assets-lighthouse-io.s3.amazonaws.com/img/lighthouse-color-logo-2023.png'\r\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,CAAC;AACrC,MAAME,oCAAoC,GAAAD,OAAA,CAAAC,oCAAA,GAAG,CAAC;AAC9C,MAAMC,oBAAoB,GAAAF,OAAA,CAAAE,oBAAA,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC;AAC9C,MAAMC,wBAAwB,GAAAH,OAAA,CAAAG,wBAAA,GAAG,UAAU;AAC3C,MAAMC,iBAAiB,GAAAJ,OAAA,CAAAI,iBAAA,GAAG,IAAI;AAC9B,MAAMC,mBAAmB,GAAAL,OAAA,CAAAK,mBAAA,GAC9B,kFAAkF","ignoreList":[]}
|
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
9
7
|
// TODO is this universal?
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_this = _callSuper(this, DomainError, [message]);
|
|
15
|
-
_this.name = _this.constructor.name;
|
|
8
|
+
class DomainError extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = this.constructor.name;
|
|
16
12
|
|
|
17
13
|
// @ts-ignore support both node and browser environments
|
|
18
14
|
if (typeof Error.captureStackTrace === 'function') {
|
|
19
15
|
// @ts-ignore
|
|
20
|
-
Error.captureStackTrace(
|
|
16
|
+
Error.captureStackTrace(this, this.constructor);
|
|
21
17
|
} else {
|
|
22
|
-
|
|
18
|
+
this.stack = new Error(message).stack;
|
|
23
19
|
}
|
|
24
|
-
return _this;
|
|
25
20
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
29
|
-
export { DomainError as default };
|
|
21
|
+
}
|
|
22
|
+
exports.default = DomainError;
|
|
30
23
|
//# sourceMappingURL=DomainError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomainError.js","names":["DomainError","
|
|
1
|
+
{"version":3,"file":"DomainError.js","names":["DomainError","Error","constructor","message","name","captureStackTrace","stack","exports","default"],"sources":["../../src/errors/DomainError.ts"],"sourcesContent":["// TODO is this universal?\r\nexport default class DomainError extends Error {\r\n constructor(message: string) {\r\n super(message)\r\n this.name = this.constructor.name\r\n\r\n // @ts-ignore support both node and browser environments\r\n if (typeof Error.captureStackTrace === 'function') {\r\n // @ts-ignore\r\n Error.captureStackTrace(this, this.constructor)\r\n } else { \r\n this.stack = (new Error(message)).stack\r\n }\r\n }\r\n}\r\n"],"mappings":";;;;;;AAAA;AACe,MAAMA,WAAW,SAASC,KAAK,CAAC;EAC7CC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,IAAI,CAACF,WAAW,CAACE,IAAI;;IAEjC;IACA,IAAI,OAAOH,KAAK,CAACI,iBAAiB,KAAK,UAAU,EAAE;MACjD;MACAJ,KAAK,CAACI,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAACH,WAAW,CAAC;IACjD,CAAC,MAAM;MACL,IAAI,CAACI,KAAK,GAAI,IAAIL,KAAK,CAACE,OAAO,CAAC,CAAEG,KAAK;IACzC;EACF;AACF;AAACC,OAAA,CAAAC,OAAA,GAAAR,WAAA","ignoreList":[]}
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* Custom error class for image fetching operations
|
|
11
|
-
* Includes context information for better debugging
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FetchImageError = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Custom error class for image fetching operations
|
|
9
|
+
* Includes context information for better debugging
|
|
12
10
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_this.name = 'FetchImageError';
|
|
20
|
-
_this.context = context;
|
|
21
|
-
_this.url = context.url;
|
|
22
|
-
return _this;
|
|
11
|
+
class FetchImageError extends Error {
|
|
12
|
+
constructor(message, context = {}) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'FetchImageError';
|
|
15
|
+
this.context = context;
|
|
16
|
+
this.url = context.url;
|
|
23
17
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
18
|
+
}
|
|
19
|
+
exports.FetchImageError = FetchImageError;
|
|
27
20
|
//# sourceMappingURL=FetchImageError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchImageError.js","names":["FetchImageError","
|
|
1
|
+
{"version":3,"file":"FetchImageError.js","names":["FetchImageError","Error","constructor","message","context","name","url","exports"],"sources":["../../src/errors/FetchImageError.js"],"sourcesContent":["/**\r\n * Custom error class for image fetching operations\r\n * Includes context information for better debugging\r\n */\r\nexport class FetchImageError extends Error {\r\n constructor(message, context = {}) {\r\n super(message)\r\n this.name = 'FetchImageError'\r\n this.context = context\r\n this.url = context.url\r\n }\r\n}\r\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,eAAe,SAASC,KAAK,CAAC;EACzCC,WAAWA,CAACC,OAAO,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;IACjC,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,iBAAiB;IAC7B,IAAI,CAACD,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACE,GAAG,GAAGF,OAAO,CAACE,GAAG;EACxB;AACF;AAACC,OAAA,CAAAP,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1,41 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _this;
|
|
17
|
-
var data = _ref.data,
|
|
18
|
-
_ref$message = _ref.message,
|
|
19
|
-
message = _ref$message === void 0 ? DEFAULT_MESSAGE : _ref$message;
|
|
20
|
-
_classCallCheck(this, ValidationError);
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _yup = require("yup");
|
|
9
|
+
var _DomainError = _interopRequireDefault(require("./DomainError"));
|
|
10
|
+
const DEFAULT_MESSAGE = 'The data you submitted was invalid. Please try again with valid data.';
|
|
11
|
+
class ValidationError extends _DomainError.default {
|
|
12
|
+
constructor({
|
|
13
|
+
data,
|
|
14
|
+
message = DEFAULT_MESSAGE
|
|
15
|
+
}) {
|
|
21
16
|
// When the data object is a schema validation error, take its data
|
|
22
17
|
// attributes and apply to our wrapped error
|
|
23
|
-
if (data instanceof
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
if (data instanceof _yup.ValidationError) {
|
|
19
|
+
const {
|
|
20
|
+
message: validationMessage,
|
|
21
|
+
name,
|
|
22
|
+
...other
|
|
23
|
+
} = data;
|
|
24
|
+
super(validationMessage);
|
|
25
|
+
this.data = other;
|
|
26
|
+
this.status = 400;
|
|
27
|
+
return;
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return _assertThisInitialized(_this);
|
|
29
|
+
super(message);
|
|
30
|
+
this.data = data;
|
|
31
|
+
this.status = 400;
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}(DomainError);
|
|
40
|
-
export { ValidationError as default };
|
|
33
|
+
}
|
|
34
|
+
exports.default = ValidationError;
|
|
41
35
|
//# sourceMappingURL=ValidationError.js.map
|