doc-detective-common 1.19.1 → 1.19.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doc-detective-common",
3
- "version": "1.19.1",
3
+ "version": "1.19.2",
4
4
  "description": "Shared components for Doc Detective projects.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -22,7 +22,7 @@
22
22
  "jest": "^29.7.0"
23
23
  },
24
24
  "dependencies": {
25
- "@apidevtools/json-schema-ref-parser": "^11.6.4",
25
+ "@apidevtools/json-schema-ref-parser": "^11.7.0",
26
26
  "ajv": "8.16.0",
27
27
  "ajv-errors": "^3.0.0",
28
28
  "ajv-formats": "^3.0.1",
@@ -109,9 +109,23 @@ async function resolvePaths(
109
109
  );
110
110
  } else if (typeof object[property] === "string") {
111
111
  // If the property is a string, check if it matches any of the path properties and resolve it if it does
112
- pathProperties.forEach((path) => {
113
- if (object[path]) {
114
- object[path] = resolve(relativePathBase, object[path], filePath);
112
+ pathProperties.forEach((pathProperty) => {
113
+ if (object[pathProperty]) {
114
+ if (pathProperty === "path" && object.directory) {
115
+ if (path.isAbsolute(object.directory)){
116
+ object[pathProperty] = resolve(relativePathBase, object[pathProperty], object.directory);
117
+ } else {
118
+ object[pathProperty] = path.join(object.directory, object[pathProperty]);
119
+ }
120
+ }
121
+ if (pathProperty === "savePath" && object.saveDirectory) {
122
+ if (path.isAbsolute(object.saveDirectory)){
123
+ object[pathProperty] = resolve(relativePathBase, object[pathProperty], object.saveDirectory);
124
+ } else {
125
+ object[pathProperty] = path.join(object.saveDirectory, object[pathProperty]);
126
+ }
127
+ }
128
+ object[pathProperty] = resolve(relativePathBase, object[pathProperty], filePath);
115
129
  }
116
130
  });
117
131
  }
@@ -128,7 +128,7 @@
128
128
  "default": false
129
129
  },
130
130
  "mediaDirectory": {
131
- "description": "Path of the directory in which to store output media files.",
131
+ "description": "DEPRECATED.",
132
132
  "type": "string",
133
133
  "default": "."
134
134
  },
@@ -1271,7 +1271,7 @@
1271
1271
  },
1272
1272
  "directory": {
1273
1273
  "type": "string",
1274
- "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory."
1274
+ "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory."
1275
1275
  },
1276
1276
  "maxVariation": {
1277
1277
  "type": "number",
@@ -1378,12 +1378,12 @@
1378
1378
  },
1379
1379
  "path": {
1380
1380
  "type": "string",
1381
- "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file path is your media directory, the file name is the ID of the step, and the extension is `.mp4`.",
1381
+ "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file name is the ID of the step, and the extension is `.mp4`.",
1382
1382
  "pattern": "([A-Za-z0-9_-]*\\.(mp4|webm|gif)$|\\$[A-Za-z0-9_]+)"
1383
1383
  },
1384
1384
  "directory": {
1385
1385
  "type": "string",
1386
- "description": "Directory of the file. Attempts to create the directory if it doesn't exist. If not specified, the directory is your media directory."
1386
+ "description": "Directory of the file. Attempts to create the directory if it doesn't exist."
1387
1387
  },
1388
1388
  "overwrite": {
1389
1389
  "type": "boolean",
@@ -1843,7 +1843,6 @@
1843
1843
  "setup": "",
1844
1844
  "cleanup": "",
1845
1845
  "recursive": true,
1846
- "mediaDirectory": ".",
1847
1846
  "downloadDirectory": ".",
1848
1847
  "contexts": [
1849
1848
  {
@@ -1872,7 +1871,6 @@
1872
1871
  "setup": "",
1873
1872
  "cleanup": "",
1874
1873
  "recursive": true,
1875
- "mediaDirectory": ".",
1876
1874
  "downloadDirectory": ".",
1877
1875
  "contexts": [
1878
1876
  {
@@ -2055,7 +2053,6 @@
2055
2053
  "."
2056
2054
  ],
2057
2055
  "recursive": true,
2058
- "mediaDirectory": ".",
2059
2056
  "downloadDirectory": ".",
2060
2057
  "contexts": [
2061
2058
  {
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "directory": {
25
25
  "type": "string",
26
- "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory."
26
+ "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory."
27
27
  },
28
28
  "maxVariation": {
29
29
  "type": "number",
@@ -901,7 +901,7 @@
901
901
  },
902
902
  "directory": {
903
903
  "type": "string",
904
- "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory."
904
+ "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory."
905
905
  },
906
906
  "maxVariation": {
907
907
  "type": "number",
@@ -1008,12 +1008,12 @@
1008
1008
  },
1009
1009
  "path": {
1010
1010
  "type": "string",
1011
- "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file path is your media directory, the file name is the ID of the step, and the extension is `.mp4`.",
1011
+ "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file name is the ID of the step, and the extension is `.mp4`.",
1012
1012
  "pattern": "([A-Za-z0-9_-]*\\.(mp4|webm|gif)$|\\$[A-Za-z0-9_]+)"
1013
1013
  },
1014
1014
  "directory": {
1015
1015
  "type": "string",
1016
- "description": "Directory of the file. Attempts to create the directory if it doesn't exist. If not specified, the directory is your media directory."
1016
+ "description": "Directory of the file. Attempts to create the directory if it doesn't exist."
1017
1017
  },
1018
1018
  "overwrite": {
1019
1019
  "type": "boolean",
@@ -18,12 +18,12 @@
18
18
  },
19
19
  "path": {
20
20
  "type": "string",
21
- "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file path is your media directory, the file name is the ID of the step, and the extension is `.mp4`.",
21
+ "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file name is the ID of the step, and the extension is `.mp4`.",
22
22
  "pattern": "([A-Za-z0-9_-]*\\.(mp4|webm|gif)$|\\$[A-Za-z0-9_]+)"
23
23
  },
24
24
  "directory": {
25
25
  "type": "string",
26
- "description": "Directory of the file. Attempts to create the directory if it doesn't exist. If not specified, the directory is your media directory."
26
+ "description": "Directory of the file. Attempts to create the directory if it doesn't exist."
27
27
  },
28
28
  "overwrite": {
29
29
  "type": "boolean",
@@ -757,7 +757,7 @@
757
757
  },
758
758
  "directory": {
759
759
  "type": "string",
760
- "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory."
760
+ "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory."
761
761
  },
762
762
  "maxVariation": {
763
763
  "type": "number",
@@ -864,12 +864,12 @@
864
864
  },
865
865
  "path": {
866
866
  "type": "string",
867
- "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file path is your media directory, the file name is the ID of the step, and the extension is `.mp4`.",
867
+ "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file name is the ID of the step, and the extension is `.mp4`.",
868
868
  "pattern": "([A-Za-z0-9_-]*\\.(mp4|webm|gif)$|\\$[A-Za-z0-9_]+)"
869
869
  },
870
870
  "directory": {
871
871
  "type": "string",
872
- "description": "Directory of the file. Attempts to create the directory if it doesn't exist. If not specified, the directory is your media directory."
872
+ "description": "Directory of the file. Attempts to create the directory if it doesn't exist."
873
873
  },
874
874
  "overwrite": {
875
875
  "type": "boolean",
@@ -209,7 +209,7 @@
209
209
  "default": false
210
210
  },
211
211
  "mediaDirectory": {
212
- "description": "Path of the directory in which to store output media files.",
212
+ "description": "DEPRECATED.",
213
213
  "type": "string",
214
214
  "default": "."
215
215
  },
@@ -1352,7 +1352,7 @@
1352
1352
  },
1353
1353
  "directory": {
1354
1354
  "type": "string",
1355
- "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory."
1355
+ "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory."
1356
1356
  },
1357
1357
  "maxVariation": {
1358
1358
  "type": "number",
@@ -1459,12 +1459,12 @@
1459
1459
  },
1460
1460
  "path": {
1461
1461
  "type": "string",
1462
- "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file path is your media directory, the file name is the ID of the step, and the extension is `.mp4`.",
1462
+ "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file name is the ID of the step, and the extension is `.mp4`.",
1463
1463
  "pattern": "([A-Za-z0-9_-]*\\.(mp4|webm|gif)$|\\$[A-Za-z0-9_]+)"
1464
1464
  },
1465
1465
  "directory": {
1466
1466
  "type": "string",
1467
- "description": "Directory of the file. Attempts to create the directory if it doesn't exist. If not specified, the directory is your media directory."
1467
+ "description": "Directory of the file. Attempts to create the directory if it doesn't exist."
1468
1468
  },
1469
1469
  "overwrite": {
1470
1470
  "type": "boolean",
@@ -1924,7 +1924,6 @@
1924
1924
  "setup": "",
1925
1925
  "cleanup": "",
1926
1926
  "recursive": true,
1927
- "mediaDirectory": ".",
1928
1927
  "downloadDirectory": ".",
1929
1928
  "contexts": [
1930
1929
  {
@@ -1953,7 +1952,6 @@
1953
1952
  "setup": "",
1954
1953
  "cleanup": "",
1955
1954
  "recursive": true,
1956
- "mediaDirectory": ".",
1957
1955
  "downloadDirectory": ".",
1958
1956
  "contexts": [
1959
1957
  {
@@ -2136,7 +2134,6 @@
2136
2134
  "."
2137
2135
  ],
2138
2136
  "recursive": true,
2139
- "mediaDirectory": ".",
2140
2137
  "downloadDirectory": ".",
2141
2138
  "contexts": [
2142
2139
  {
@@ -3228,7 +3225,7 @@
3228
3225
  },
3229
3226
  "directory": {
3230
3227
  "type": "string",
3231
- "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory."
3228
+ "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory."
3232
3229
  },
3233
3230
  "maxVariation": {
3234
3231
  "type": "number",
@@ -3335,12 +3332,12 @@
3335
3332
  },
3336
3333
  "path": {
3337
3334
  "type": "string",
3338
- "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file path is your media directory, the file name is the ID of the step, and the extension is `.mp4`.",
3335
+ "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file name is the ID of the step, and the extension is `.mp4`.",
3339
3336
  "pattern": "([A-Za-z0-9_-]*\\.(mp4|webm|gif)$|\\$[A-Za-z0-9_]+)"
3340
3337
  },
3341
3338
  "directory": {
3342
3339
  "type": "string",
3343
- "description": "Directory of the file. Attempts to create the directory if it doesn't exist. If not specified, the directory is your media directory."
3340
+ "description": "Directory of the file. Attempts to create the directory if it doesn't exist."
3344
3341
  },
3345
3342
  "overwrite": {
3346
3343
  "type": "boolean",
@@ -4306,7 +4303,7 @@
4306
4303
  },
4307
4304
  "directory": {
4308
4305
  "type": "string",
4309
- "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory."
4306
+ "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory."
4310
4307
  },
4311
4308
  "maxVariation": {
4312
4309
  "type": "number",
@@ -4413,12 +4410,12 @@
4413
4410
  },
4414
4411
  "path": {
4415
4412
  "type": "string",
4416
- "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file path is your media directory, the file name is the ID of the step, and the extension is `.mp4`.",
4413
+ "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file name is the ID of the step, and the extension is `.mp4`.",
4417
4414
  "pattern": "([A-Za-z0-9_-]*\\.(mp4|webm|gif)$|\\$[A-Za-z0-9_]+)"
4418
4415
  },
4419
4416
  "directory": {
4420
4417
  "type": "string",
4421
- "description": "Directory of the file. Attempts to create the directory if it doesn't exist. If not specified, the directory is your media directory."
4418
+ "description": "Directory of the file. Attempts to create the directory if it doesn't exist."
4422
4419
  },
4423
4420
  "overwrite": {
4424
4421
  "type": "boolean",
@@ -5742,7 +5739,7 @@
5742
5739
  },
5743
5740
  "directory": {
5744
5741
  "type": "string",
5745
- "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory."
5742
+ "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory."
5746
5743
  },
5747
5744
  "maxVariation": {
5748
5745
  "type": "number",
@@ -5849,12 +5846,12 @@
5849
5846
  },
5850
5847
  "path": {
5851
5848
  "type": "string",
5852
- "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file path is your media directory, the file name is the ID of the step, and the extension is `.mp4`.",
5849
+ "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file name is the ID of the step, and the extension is `.mp4`.",
5853
5850
  "pattern": "([A-Za-z0-9_-]*\\.(mp4|webm|gif)$|\\$[A-Za-z0-9_]+)"
5854
5851
  },
5855
5852
  "directory": {
5856
5853
  "type": "string",
5857
- "description": "Directory of the file. Attempts to create the directory if it doesn't exist. If not specified, the directory is your media directory."
5854
+ "description": "Directory of the file. Attempts to create the directory if it doesn't exist."
5858
5855
  },
5859
5856
  "overwrite": {
5860
5857
  "type": "boolean",
@@ -87,7 +87,7 @@
87
87
  "default": false
88
88
  },
89
89
  "mediaDirectory": {
90
- "description": "Path of the directory in which to store output media files.",
90
+ "description": "DEPRECATED.",
91
91
  "type": "string",
92
92
  "default": "."
93
93
  },
@@ -573,7 +573,6 @@
573
573
  "setup": "",
574
574
  "cleanup": "",
575
575
  "recursive": true,
576
- "mediaDirectory": ".",
577
576
  "downloadDirectory": ".",
578
577
  "contexts": [
579
578
  {
@@ -598,7 +597,6 @@
598
597
  "setup": "",
599
598
  "cleanup": "",
600
599
  "recursive": true,
601
- "mediaDirectory": ".",
602
600
  "downloadDirectory": ".",
603
601
  "contexts": [
604
602
  {
@@ -740,7 +738,6 @@
740
738
  "setup": ["."],
741
739
  "cleanup": ["."],
742
740
  "recursive": true,
743
- "mediaDirectory": ".",
744
741
  "downloadDirectory": ".",
745
742
  "contexts": [
746
743
  {
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "directory": {
25
25
  "type": "string",
26
- "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory."
26
+ "description": "Directory of the PNG file. If the directory doesn't exist, creates the directory."
27
27
  },
28
28
  "maxVariation": {
29
29
  "type": "number",
@@ -18,12 +18,12 @@
18
18
  },
19
19
  "path": {
20
20
  "type": "string",
21
- "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file path is your media directory, the file name is the ID of the step, and the extension is `.mp4`.",
21
+ "description": "File path of the recording. Supports the `.mp4`, `.webm`, and `.gif` extensions. If not specified, the file name is the ID of the step, and the extension is `.mp4`.",
22
22
  "pattern": "([A-Za-z0-9_-]*\\.(mp4|webm|gif)$|\\$[A-Za-z0-9_]+)"
23
23
  },
24
24
  "directory": {
25
25
  "type": "string",
26
- "description": "Directory of the file. Attempts to create the directory if it doesn't exist. If not specified, the directory is your media directory."
26
+ "description": "Directory of the file. Attempts to create the directory if it doesn't exist."
27
27
  },
28
28
  "overwrite": {
29
29
  "type": "boolean",