@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
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# common
|
|
1
|
+
# common
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.FetchImageError = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Custom error class for image fetching operations
|
|
9
|
-
* Includes context information for better debugging
|
|
7
|
+
/**
|
|
8
|
+
* Custom error class for image fetching operations
|
|
9
|
+
* Includes context information for better debugging
|
|
10
10
|
*/
|
|
11
11
|
class FetchImageError extends Error {
|
|
12
12
|
constructor(message, context = {}) {
|
|
@@ -176,13 +176,13 @@ function formatBase64Image({
|
|
|
176
176
|
return fullDataUrl;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
/**
|
|
180
|
-
* Parses a URL-like string into path and query parameters
|
|
181
|
-
* @param {string} urlString - String like "https://example.cloudfront.net/<applicationId>/<path>/filename.jpeg?width=100&height=100"
|
|
182
|
-
* @returns {Object} - Object with { path: string, queryString: string, searchParamsObject: Object }
|
|
183
|
-
* @example
|
|
184
|
-
* parseUrlString("https://example.cloudfront.net/abc123/folder/image.jpeg?width=100&height=100")
|
|
185
|
-
* // Returns: { path: "abc123/folder/image.jpeg", queryString: "width=100,t=456", searchParamsObject: { width: "100", height: "100" } }
|
|
179
|
+
/**
|
|
180
|
+
* Parses a URL-like string into path and query parameters
|
|
181
|
+
* @param {string} urlString - String like "https://example.cloudfront.net/<applicationId>/<path>/filename.jpeg?width=100&height=100"
|
|
182
|
+
* @returns {Object} - Object with { path: string, queryString: string, searchParamsObject: Object }
|
|
183
|
+
* @example
|
|
184
|
+
* parseUrlString("https://example.cloudfront.net/abc123/folder/image.jpeg?width=100&height=100")
|
|
185
|
+
* // Returns: { path: "abc123/folder/image.jpeg", queryString: "width=100,t=456", searchParamsObject: { width: "100", height: "100" } }
|
|
186
186
|
*/
|
|
187
187
|
function parseUrlString(urlString) {
|
|
188
188
|
if (!urlString || typeof urlString !== 'string') {
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = floatify;
|
|
7
|
-
/**
|
|
8
|
-
* floatify
|
|
9
|
-
* Accepts a number and returns a float rounded to the expected precision,
|
|
10
|
-
* avoiding floating point errors
|
|
11
|
-
* https://stackoverflow.com/questions/588004/is-floating-point-math-broken/51723472#51723472
|
|
12
|
-
* @param {Number} number
|
|
7
|
+
/**
|
|
8
|
+
* floatify
|
|
9
|
+
* Accepts a number and returns a float rounded to the expected precision,
|
|
10
|
+
* avoiding floating point errors
|
|
11
|
+
* https://stackoverflow.com/questions/588004/is-floating-point-math-broken/51723472#51723472
|
|
12
|
+
* @param {Number} number
|
|
13
13
|
*/
|
|
14
14
|
function floatify(number) {
|
|
15
15
|
return parseFloat(number.toFixed(10));
|
|
@@ -53,42 +53,53 @@ function getAuditItemsData(items, data) {
|
|
|
53
53
|
const hasScore = item.score !== null && item.score !== -1;
|
|
54
54
|
const rawAssets = item.assets || [];
|
|
55
55
|
const assetCount = rawAssets.length;
|
|
56
|
-
const assets = rawAssets.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
56
|
+
const assets = rawAssets.reduce((acc, asset, assetIndex) => {
|
|
57
|
+
try {
|
|
58
|
+
const assetUrl = (0, _.buildFetchUrl)(asset, {
|
|
59
|
+
awsS3BaseUrl,
|
|
60
|
+
cloudfrontBaseUrl,
|
|
61
|
+
cloudinaryBaseUrl,
|
|
62
|
+
height: 400,
|
|
63
|
+
width: 600,
|
|
64
|
+
quality: 50,
|
|
65
|
+
fit: true,
|
|
66
|
+
shouldUseCloudfront,
|
|
67
|
+
Policy,
|
|
68
|
+
KeyPairId,
|
|
69
|
+
Signature
|
|
70
|
+
});
|
|
71
|
+
const link = shouldUseCloudfront ? `${cloudfrontBaseUrl}/${item.signedAssets[assetIndex]}` : `${awsS3BaseUrl}/${asset}`;
|
|
72
|
+
const thumbnailUrl = (0, _.buildFetchUrl)(asset, {
|
|
73
|
+
awsS3BaseUrl,
|
|
74
|
+
cloudfrontBaseUrl,
|
|
75
|
+
cloudinaryBaseUrl,
|
|
76
|
+
shouldUseCloudfront,
|
|
77
|
+
width: 100,
|
|
78
|
+
quality: 50,
|
|
79
|
+
fit: true,
|
|
80
|
+
shouldUseCloudfront,
|
|
81
|
+
Policy,
|
|
82
|
+
KeyPairId,
|
|
83
|
+
Signature
|
|
84
|
+
});
|
|
85
|
+
const key = `${groupIndex}-item-asset-${assetIndex}`;
|
|
86
|
+
acc.push({
|
|
87
|
+
assetUrl,
|
|
88
|
+
key,
|
|
89
|
+
link,
|
|
90
|
+
thumbnailUrl
|
|
91
|
+
});
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error({
|
|
94
|
+
message: 'Failed to build asset URL',
|
|
95
|
+
asset,
|
|
96
|
+
assetIndex,
|
|
97
|
+
groupIndex,
|
|
98
|
+
error: error.message
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return acc;
|
|
102
|
+
}, []);
|
|
92
103
|
const comments = item.comments;
|
|
93
104
|
const label = item.label;
|
|
94
105
|
const score = item.score;
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isAbsoluteUrl = isAbsoluteUrl;
|
|
7
|
-
/**
|
|
8
|
-
* Checks if a URL is absolute (starts with http:// or https://)
|
|
9
|
-
* @param {string} url - The URL to validate
|
|
10
|
-
* @returns {boolean} - True if URL is absolute, false otherwise
|
|
7
|
+
/**
|
|
8
|
+
* Checks if a URL is absolute (starts with http:// or https://)
|
|
9
|
+
* @param {string} url - The URL to validate
|
|
10
|
+
* @returns {boolean} - True if URL is absolute, false otherwise
|
|
11
11
|
*/
|
|
12
12
|
function isAbsoluteUrl(url) {
|
|
13
13
|
if (!url || typeof url !== 'string') return false;
|
|
@@ -15,38 +15,38 @@ const DEFAULT_MAX_SCANS = 200;
|
|
|
15
15
|
const MAX_ATTACHMENTS = 100;
|
|
16
16
|
const LIGHTHOUSE_BASE_URL = 'https://app.lighthouse.io';
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* buildActivityPdf
|
|
20
|
-
*
|
|
21
|
-
* @param {object} pdfOptions - the pdf options
|
|
22
|
-
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
23
|
-
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
24
|
-
* @param {function} pdfOptions.header - function executed to generate header
|
|
25
|
-
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
26
|
-
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
27
|
-
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
28
|
-
* @param {string} pdfOptions.pageSize - pdf page size
|
|
29
|
-
* @param {object} pdfOptions.styles - pdf styles
|
|
30
|
-
* @param {object} pdfOptions.title - pdf title
|
|
31
|
-
* @param {object} data - pdf data
|
|
32
|
-
* @param {array} data.audits - audit documents
|
|
33
|
-
* @param {string} data.end - end datetime of summary report
|
|
34
|
-
* @param {array} data.events - event documents
|
|
35
|
-
* @param {object} data.location - location document
|
|
36
|
-
* @param {array} data.locations - location documents
|
|
37
|
-
* @param {array} data.issues - issue documents
|
|
38
|
-
* @param {bool} data.maxScans - max scans to include in standard report
|
|
39
|
-
* @param {bool} data.showAlternate - show alternate summary report
|
|
40
|
-
* @param {string} data.start - start datetime of summary report
|
|
41
|
-
* @param {object} data.settings - settings properties
|
|
42
|
-
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
43
|
-
* @param {string} data.settings.
|
|
44
|
-
* @param {array} data.tasks - task documents
|
|
45
|
-
* @param {string} data.timestamp - timestamp string
|
|
46
|
-
* @param {string} data.timezone - timezone string
|
|
47
|
-
* @param {array} data.zones - zone documents
|
|
48
|
-
* @param {array} data.users - user documents
|
|
49
|
-
* @returns {Promise} returns pdfmake definition object
|
|
18
|
+
/**
|
|
19
|
+
* buildActivityPdf
|
|
20
|
+
*
|
|
21
|
+
* @param {object} pdfOptions - the pdf options
|
|
22
|
+
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
23
|
+
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
24
|
+
* @param {function} pdfOptions.header - function executed to generate header
|
|
25
|
+
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
26
|
+
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
27
|
+
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
28
|
+
* @param {string} pdfOptions.pageSize - pdf page size
|
|
29
|
+
* @param {object} pdfOptions.styles - pdf styles
|
|
30
|
+
* @param {object} pdfOptions.title - pdf title
|
|
31
|
+
* @param {object} data - pdf data
|
|
32
|
+
* @param {array} data.audits - audit documents
|
|
33
|
+
* @param {string} data.end - end datetime of summary report
|
|
34
|
+
* @param {array} data.events - event documents
|
|
35
|
+
* @param {object} data.location - location document
|
|
36
|
+
* @param {array} data.locations - location documents
|
|
37
|
+
* @param {array} data.issues - issue documents
|
|
38
|
+
* @param {bool} data.maxScans - max scans to include in standard report
|
|
39
|
+
* @param {bool} data.showAlternate - show alternate summary report
|
|
40
|
+
* @param {string} data.start - start datetime of summary report
|
|
41
|
+
* @param {object} data.settings - settings properties
|
|
42
|
+
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
43
|
+
* @param {string} data.settings.cloudinaryBaseUrl - cloudinary base url
|
|
44
|
+
* @param {array} data.tasks - task documents
|
|
45
|
+
* @param {string} data.timestamp - timestamp string
|
|
46
|
+
* @param {string} data.timezone - timezone string
|
|
47
|
+
* @param {array} data.zones - zone documents
|
|
48
|
+
* @param {array} data.users - user documents
|
|
49
|
+
* @returns {Promise} returns pdfmake definition object
|
|
50
50
|
*/
|
|
51
51
|
async function buildActivityPdf(pdfOptions, data) {
|
|
52
52
|
const {
|
package/dist/pdf/audit/index.js
CHANGED
|
@@ -10,29 +10,29 @@ var _lodash = require("lodash");
|
|
|
10
10
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
11
11
|
var _helpers = require("../helpers");
|
|
12
12
|
var _helpers2 = require("../../helpers");
|
|
13
|
-
/**
|
|
14
|
-
* buildAuditPdf
|
|
15
|
-
*
|
|
16
|
-
* @param {object} pdfOptions - the pdf options
|
|
17
|
-
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
18
|
-
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
19
|
-
* @param {function} pdfOptions.header - function executed to generate header
|
|
20
|
-
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
21
|
-
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
22
|
-
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
23
|
-
* @param {string} pdfOptions.pageSize - pdf page size
|
|
24
|
-
* @param {object} pdfOptions.styles - pdf styles
|
|
25
|
-
* @param {object} pdfOptions.title - pdf title
|
|
26
|
-
* @param {object} pdfOptions.flags - flags to conditionally render parts of the pdf
|
|
27
|
-
* @param {object} data - pdf data
|
|
28
|
-
* @param {object} data.entity - audit document
|
|
29
|
-
* @param {object} data.locations - locations documents
|
|
30
|
-
* @param {object} data.settings - settings properties
|
|
31
|
-
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
32
|
-
* @param {string} data.settings.
|
|
33
|
-
* @param {string} data.timezone - timezone string
|
|
34
|
-
* @param {object} data.users - application user documents
|
|
35
|
-
* @returns {Promise} returns pdfmake definition object
|
|
13
|
+
/**
|
|
14
|
+
* buildAuditPdf
|
|
15
|
+
*
|
|
16
|
+
* @param {object} pdfOptions - the pdf options
|
|
17
|
+
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
18
|
+
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
19
|
+
* @param {function} pdfOptions.header - function executed to generate header
|
|
20
|
+
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
21
|
+
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
22
|
+
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
23
|
+
* @param {string} pdfOptions.pageSize - pdf page size
|
|
24
|
+
* @param {object} pdfOptions.styles - pdf styles
|
|
25
|
+
* @param {object} pdfOptions.title - pdf title
|
|
26
|
+
* @param {object} pdfOptions.flags - flags to conditionally render parts of the pdf
|
|
27
|
+
* @param {object} data - pdf data
|
|
28
|
+
* @param {object} data.entity - audit document
|
|
29
|
+
* @param {object} data.locations - locations documents
|
|
30
|
+
* @param {object} data.settings - settings properties
|
|
31
|
+
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
32
|
+
* @param {string} data.settings.cloudinaryBaseUrl - cloudinary base url
|
|
33
|
+
* @param {string} data.timezone - timezone string
|
|
34
|
+
* @param {object} data.users - application user documents
|
|
35
|
+
* @returns {Promise} returns pdfmake definition object
|
|
36
36
|
*/
|
|
37
37
|
function buildAuditPdf(pdfOptions, data) {
|
|
38
38
|
const {
|
|
@@ -61,32 +61,49 @@ function buildImage(options) {
|
|
|
61
61
|
link
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
const normalizedPath = typeof filepath === 'object' && filepath !== null ? filepath.path || filepath.url || String(filepath) : filepath;
|
|
65
|
+
try {
|
|
66
|
+
const url = (0, _helpers.buildFetchUrl)(normalizedPath, {
|
|
67
|
+
awsS3BaseUrl,
|
|
68
|
+
cloudfrontBaseUrl,
|
|
69
|
+
cloudinaryBaseUrl,
|
|
70
|
+
fit: true,
|
|
71
|
+
height: 400,
|
|
72
|
+
width: 600,
|
|
73
|
+
quality: 50,
|
|
74
|
+
shouldUseCloudfront
|
|
75
|
+
});
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
// NOTE: shouldUseCloudfront, Signature, Policy and KeyPairId from settings are used in this context
|
|
78
|
+
return (0, _helpers.fetchImage)(url, {
|
|
79
|
+
...settings,
|
|
80
|
+
context: {
|
|
81
|
+
stage: 'field',
|
|
82
|
+
fieldLabel,
|
|
83
|
+
fieldType,
|
|
84
|
+
filepath: normalizedPath
|
|
85
|
+
}
|
|
86
|
+
}).then(base64String => ({
|
|
87
|
+
alignment,
|
|
88
|
+
fit: [width, height],
|
|
89
|
+
image: base64String,
|
|
90
|
+
link
|
|
91
|
+
}));
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error({
|
|
94
|
+
message: 'Failed to build image URL',
|
|
95
|
+
filepath,
|
|
80
96
|
fieldLabel,
|
|
81
97
|
fieldType,
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
98
|
+
error: error.message
|
|
99
|
+
});
|
|
100
|
+
return {
|
|
101
|
+
alignment,
|
|
102
|
+
fit: [width, height],
|
|
103
|
+
image: _images.imageNotFound,
|
|
104
|
+
link: ''
|
|
105
|
+
};
|
|
106
|
+
}
|
|
90
107
|
}
|
|
91
108
|
function buildSummaryField({
|
|
92
109
|
field,
|
|
@@ -147,15 +164,16 @@ function buildSummaryField({
|
|
|
147
164
|
});
|
|
148
165
|
}
|
|
149
166
|
if (isPhotoField) {
|
|
150
|
-
const
|
|
167
|
+
const rawFilepath = (0, _lodash.first)(value);
|
|
151
168
|
|
|
152
169
|
// NOTE: if no filepath return empty text as user has not uploaded an image
|
|
153
170
|
// for this field
|
|
154
|
-
if (!
|
|
171
|
+
if (!rawFilepath) {
|
|
155
172
|
return {
|
|
156
173
|
text: ''
|
|
157
174
|
};
|
|
158
175
|
}
|
|
176
|
+
const filepath = typeof rawFilepath === 'object' && rawFilepath !== null ? rawFilepath.path || rawFilepath.url || rawFilepath : rawFilepath;
|
|
159
177
|
const image = buildImage({
|
|
160
178
|
alignment: 'left',
|
|
161
179
|
filepath,
|
|
@@ -287,7 +305,8 @@ function buildTemplateFieldRow({
|
|
|
287
305
|
|
|
288
306
|
// Ensure value is always treated as an array of filepaths
|
|
289
307
|
const filepaths = (0, _lodash.isArray)(value) ? value : [value];
|
|
290
|
-
return _bluebird.default.map(filepaths, (
|
|
308
|
+
return _bluebird.default.map(filepaths, (rawFilepath, index) => {
|
|
309
|
+
const filepath = typeof rawFilepath === 'object' && rawFilepath !== null ? rawFilepath.path || rawFilepath.url || rawFilepath : rawFilepath;
|
|
291
310
|
const signedAssetValue = (0, _lodash.isArray)(signedAssets) ? signedAssets[index] : signedAssets;
|
|
292
311
|
return buildImage({
|
|
293
312
|
filepath,
|
|
@@ -305,7 +324,8 @@ function buildTemplateFieldRow({
|
|
|
305
324
|
text: ''
|
|
306
325
|
}];
|
|
307
326
|
}
|
|
308
|
-
return _bluebird.default.map(value, (
|
|
327
|
+
return _bluebird.default.map(value, (rawFilepath, index) => {
|
|
328
|
+
const filepath = typeof rawFilepath === 'object' && rawFilepath !== null ? rawFilepath.path || rawFilepath.url || rawFilepath : rawFilepath;
|
|
309
329
|
const signedAssetValue = (0, _lodash.isArray)(signedAssets) ? signedAssets[index] : signedAssets;
|
|
310
330
|
return buildImage({
|
|
311
331
|
filepath,
|
package/dist/pdf/issue/index.js
CHANGED
|
@@ -9,29 +9,29 @@ var _lodash = require("lodash");
|
|
|
9
9
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
10
10
|
var _helpers = require("../helpers");
|
|
11
11
|
var _helpers2 = require("../../helpers");
|
|
12
|
-
/**
|
|
13
|
-
* buildIssuePdf
|
|
14
|
-
*
|
|
15
|
-
* @param {object} pdfOptions - the pdf options
|
|
16
|
-
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
17
|
-
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
18
|
-
* @param {function} pdfOptions.header - function executed to generate header
|
|
19
|
-
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
20
|
-
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
21
|
-
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
22
|
-
* @param {string} pdfOptions.pageSize - pdf page size
|
|
23
|
-
* @param {object} pdfOptions.styles - pdf styles
|
|
24
|
-
* @param {object} pdfOptions.title - pdf title
|
|
25
|
-
* @param {object} data - pdf data
|
|
26
|
-
* @param {object} data.entity - issue document
|
|
27
|
-
* @param {object} data.locations - locations documents
|
|
28
|
-
* @param {object} data.settings - settings properties
|
|
29
|
-
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
30
|
-
* @param {string} data.settings.
|
|
31
|
-
* @param {string} data.timezone - timezone string
|
|
32
|
-
* @param {object} data.users - application user documents
|
|
33
|
-
* @param {object} data.zones - zone documents
|
|
34
|
-
* @returns {Promise} returns pdfmake definition object
|
|
12
|
+
/**
|
|
13
|
+
* buildIssuePdf
|
|
14
|
+
*
|
|
15
|
+
* @param {object} pdfOptions - the pdf options
|
|
16
|
+
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
17
|
+
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
18
|
+
* @param {function} pdfOptions.header - function executed to generate header
|
|
19
|
+
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
20
|
+
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
21
|
+
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
22
|
+
* @param {string} pdfOptions.pageSize - pdf page size
|
|
23
|
+
* @param {object} pdfOptions.styles - pdf styles
|
|
24
|
+
* @param {object} pdfOptions.title - pdf title
|
|
25
|
+
* @param {object} data - pdf data
|
|
26
|
+
* @param {object} data.entity - issue document
|
|
27
|
+
* @param {object} data.locations - locations documents
|
|
28
|
+
* @param {object} data.settings - settings properties
|
|
29
|
+
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
30
|
+
* @param {string} data.settings.cloudinaryBaseUrl - cloudinary base url
|
|
31
|
+
* @param {string} data.timezone - timezone string
|
|
32
|
+
* @param {object} data.users - application user documents
|
|
33
|
+
* @param {object} data.zones - zone documents
|
|
34
|
+
* @returns {Promise} returns pdfmake definition object
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
const publicSubmissionTextColor = '#FF8C2F';
|
package/dist/pdf/job/index.js
CHANGED
|
@@ -32,28 +32,28 @@ const ACTIVITY_COLUMN_HEADERS = [{
|
|
|
32
32
|
bold: true
|
|
33
33
|
}];
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* buildJobPdf
|
|
37
|
-
*
|
|
38
|
-
* @param {object} pdfOptions - the pdf options
|
|
39
|
-
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
40
|
-
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
41
|
-
* @param {function} pdfOptions.header - function executed to generate header
|
|
42
|
-
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
43
|
-
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
44
|
-
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
45
|
-
* @param {string} pdfOptions.pageSize - pdf page size
|
|
46
|
-
* @param {object} pdfOptions.styles - pdf styles
|
|
47
|
-
* @param {object} pdfOptions.title - pdf title
|
|
48
|
-
* @param {object} data - pdf data
|
|
49
|
-
* @param {object} data.entity - job document
|
|
50
|
-
* @param {array} data.jobActivities - job activities documents
|
|
51
|
-
* @param {object} data.settings - settings properties
|
|
52
|
-
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
53
|
-
* @param {string} data.settings.
|
|
54
|
-
* @param {string} data.timezone - timezone string
|
|
55
|
-
* @param {object} data.users - application user documents
|
|
56
|
-
* @returns {Promise} returns pdfmake definition object
|
|
35
|
+
/**
|
|
36
|
+
* buildJobPdf
|
|
37
|
+
*
|
|
38
|
+
* @param {object} pdfOptions - the pdf options
|
|
39
|
+
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
40
|
+
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
41
|
+
* @param {function} pdfOptions.header - function executed to generate header
|
|
42
|
+
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
43
|
+
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
44
|
+
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
45
|
+
* @param {string} pdfOptions.pageSize - pdf page size
|
|
46
|
+
* @param {object} pdfOptions.styles - pdf styles
|
|
47
|
+
* @param {object} pdfOptions.title - pdf title
|
|
48
|
+
* @param {object} data - pdf data
|
|
49
|
+
* @param {object} data.entity - job document
|
|
50
|
+
* @param {array} data.jobActivities - job activities documents
|
|
51
|
+
* @param {object} data.settings - settings properties
|
|
52
|
+
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
53
|
+
* @param {string} data.settings.cloudinaryBaseUrl - cloudinary base url
|
|
54
|
+
* @param {string} data.timezone - timezone string
|
|
55
|
+
* @param {object} data.users - application user documents
|
|
56
|
+
* @returns {Promise} returns pdfmake definition object
|
|
57
57
|
*/
|
|
58
58
|
function buildJobPdf(pdfOptions, data) {
|
|
59
59
|
const {
|
|
@@ -15,34 +15,34 @@ var _helpers2 = require("../helpers");
|
|
|
15
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
16
|
const LIGHTHOUSE_BASE_URL = 'https://app.lighthouse.io';
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* buildActivityPdf
|
|
20
|
-
* @param {object} pdfOptions - the pdf options
|
|
21
|
-
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
22
|
-
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
23
|
-
* @param {function} pdfOptions.header - function executed to generate header
|
|
24
|
-
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
25
|
-
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
26
|
-
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
27
|
-
* @param {string} pdfOptions.pageSize - pdf page size
|
|
28
|
-
* @param {object} pdfOptions.styles - pdf styles
|
|
29
|
-
* @param {object} pdfOptions.title - pdf title
|
|
30
|
-
* @param {object} data - pdf data
|
|
31
|
-
* @param {array} data.audits - audit documents
|
|
32
|
-
* @param {array} data.events - event documents
|
|
33
|
-
* @param {array} data.locations - location documents
|
|
34
|
-
* @param {array} data.issues - issue documents
|
|
35
|
-
* @param {array} data.audits - audit documents
|
|
36
|
-
* @param {object} data.shift - shift document
|
|
37
|
-
* @param {object} data.settings - settings properties
|
|
38
|
-
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
39
|
-
* @param {string} data.settings.
|
|
40
|
-
* @param {array} data.tasks - task documents
|
|
41
|
-
* @param {string} data.timestamp - timestamp string
|
|
42
|
-
* @param {string} data.timezone - timezone string
|
|
43
|
-
* @param {array} data.zones - zone documents
|
|
44
|
-
* @param {array} data.user - user document
|
|
45
|
-
* @returns {Promise} returns pdfmake definition object
|
|
18
|
+
/**
|
|
19
|
+
* buildActivityPdf
|
|
20
|
+
* @param {object} pdfOptions - the pdf options
|
|
21
|
+
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
22
|
+
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
23
|
+
* @param {function} pdfOptions.header - function executed to generate header
|
|
24
|
+
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
25
|
+
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
26
|
+
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
27
|
+
* @param {string} pdfOptions.pageSize - pdf page size
|
|
28
|
+
* @param {object} pdfOptions.styles - pdf styles
|
|
29
|
+
* @param {object} pdfOptions.title - pdf title
|
|
30
|
+
* @param {object} data - pdf data
|
|
31
|
+
* @param {array} data.audits - audit documents
|
|
32
|
+
* @param {array} data.events - event documents
|
|
33
|
+
* @param {array} data.locations - location documents
|
|
34
|
+
* @param {array} data.issues - issue documents
|
|
35
|
+
* @param {array} data.audits - audit documents
|
|
36
|
+
* @param {object} data.shift - shift document
|
|
37
|
+
* @param {object} data.settings - settings properties
|
|
38
|
+
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
39
|
+
* @param {string} data.settings.cloudinaryBaseUrl - cloudinary base url
|
|
40
|
+
* @param {array} data.tasks - task documents
|
|
41
|
+
* @param {string} data.timestamp - timestamp string
|
|
42
|
+
* @param {string} data.timezone - timezone string
|
|
43
|
+
* @param {array} data.zones - zone documents
|
|
44
|
+
* @param {array} data.user - user document
|
|
45
|
+
* @returns {Promise} returns pdfmake definition object
|
|
46
46
|
*/
|
|
47
47
|
|
|
48
48
|
async function buildShiftPdf(pdfOptions, data) {
|
package/dist/pdf/task/index.js
CHANGED
|
@@ -9,29 +9,29 @@ var _lodash = require("lodash");
|
|
|
9
9
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
10
10
|
var _helpers = require("../helpers");
|
|
11
11
|
var _helpers2 = require("../../helpers");
|
|
12
|
-
/**
|
|
13
|
-
* buildTaskPdf
|
|
14
|
-
*
|
|
15
|
-
* @param {object} pdfOptions - the pdf options
|
|
16
|
-
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
17
|
-
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
18
|
-
* @param {function} pdfOptions.header - function executed to generate header
|
|
19
|
-
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
20
|
-
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
21
|
-
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
22
|
-
* @param {string} pdfOptions.pageSize - pdf page size
|
|
23
|
-
* @param {object} pdfOptions.styles - pdf styles
|
|
24
|
-
* @param {object} pdfOptions.title - pdf title
|
|
25
|
-
* @param {object} data - pdf data
|
|
26
|
-
* @param {object} data.entity - task document
|
|
27
|
-
* @param {object} data.locations - locations documents
|
|
28
|
-
* @param {object} data.settings - settings properties
|
|
29
|
-
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
30
|
-
* @param {string} data.settings.
|
|
31
|
-
* @param {string} data.timezone - timezone string
|
|
32
|
-
* @param {object} data.users - application user documents
|
|
33
|
-
* @param {object} data.zones - zone documents
|
|
34
|
-
* @returns {Promise} returns pdfmake definition object
|
|
12
|
+
/**
|
|
13
|
+
* buildTaskPdf
|
|
14
|
+
*
|
|
15
|
+
* @param {object} pdfOptions - the pdf options
|
|
16
|
+
* @param {string} pdfOptions.fileTitle - pdf file title
|
|
17
|
+
* @param {function} pdfOptions.footer - function executed to generate footer
|
|
18
|
+
* @param {function} pdfOptions.header - function executed to generate header
|
|
19
|
+
* @param {string} pdfOptions.logoUrl - pdf logo url
|
|
20
|
+
* @param {array} pdfOptions.pageMargins - pdf page margins
|
|
21
|
+
* @param {string} pdfOptions.pageOrientation - pdf page orientation
|
|
22
|
+
* @param {string} pdfOptions.pageSize - pdf page size
|
|
23
|
+
* @param {object} pdfOptions.styles - pdf styles
|
|
24
|
+
* @param {object} pdfOptions.title - pdf title
|
|
25
|
+
* @param {object} data - pdf data
|
|
26
|
+
* @param {object} data.entity - task document
|
|
27
|
+
* @param {object} data.locations - locations documents
|
|
28
|
+
* @param {object} data.settings - settings properties
|
|
29
|
+
* @param {string} data.settings.awsS3BaseUrl - aws S3 base url
|
|
30
|
+
* @param {string} data.settings.cloudinaryBaseUrl - cloudinary base url
|
|
31
|
+
* @param {string} data.timezone - timezone string
|
|
32
|
+
* @param {object} data.users - application user documents
|
|
33
|
+
* @param {object} data.zones - zone documents
|
|
34
|
+
* @returns {Promise} returns pdfmake definition object
|
|
35
35
|
*/
|
|
36
36
|
function buildTaskPdf(pdfOptions, data) {
|
|
37
37
|
const {
|
|
@@ -17,8 +17,8 @@ const strategyTypeMap = exports.strategyTypeMap = {
|
|
|
17
17
|
[_scheduling.StrategyTypes.Window]: _strategies.getNext,
|
|
18
18
|
[_scheduling.StrategyTypes.XDayOfXWeekOfMonth]: _strategies.getNextXDayOfXWeekOfMonth
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
21
|
-
* Generates occurrence intervals for service intervals using strategy
|
|
20
|
+
/**
|
|
21
|
+
* Generates occurrence intervals for service intervals using strategy
|
|
22
22
|
*/
|
|
23
23
|
function* occurrenceIntervalsGenerator(props) {
|
|
24
24
|
const {
|