@mindful-web/export-framework 1.57.0 → 1.68.7
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/admin/components/document.marko.js +2 -2
- package/admin/components/export.marko.js +2 -2
- package/admin/components/styles.marko.js +2 -2
- package/admin/templates/index.marko.js +2 -2
- package/package.json +5 -3
- package/utils/README.md +29 -0
- package/utils/abbreviation-to-name.js +71 -0
- package/utils/country-to-abbreviation.js +1138 -0
- package/utils/format-text.js +69 -0
- package/utils/get-child-sections.js +11 -0
- package/utils/image-handler.js +54 -0
- package/utils/paginate-query.js +74 -0
- package/utils/replace-characters.js +6 -0
- package/utils/retrieve-companies.js +109 -0
- package/utils/retrieve-sections.js +8 -0
- package/utils/state-abbreviations-list.js +258 -0
- package/utils/state-name-to-abrev.js +70 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/export-framework$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/export-framework$1.68.7/admin/components/document.marko",
|
|
6
6
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
7
|
styles_template = require("./styles.marko"),
|
|
8
8
|
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
@@ -42,7 +42,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
marko_template.meta = {
|
|
45
|
-
id: "/@mindful-web/export-framework$1.
|
|
45
|
+
id: "/@mindful-web/export-framework$1.68.7/admin/components/document.marko",
|
|
46
46
|
tags: [
|
|
47
47
|
"./styles.marko",
|
|
48
48
|
"marko/dist/core-tags/components/init-components-tag",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/export-framework$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/export-framework$1.68.7/admin/components/export.marko",
|
|
6
6
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
7
|
helpers_escape_xml = require("marko/dist/runtime/html/helpers/escape-xml"),
|
|
8
8
|
marko_escapeXml = helpers_escape_xml.x,
|
|
@@ -28,5 +28,5 @@ marko_template._ = marko_renderer(render, {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
marko_template.meta = {
|
|
31
|
-
id: "/@mindful-web/export-framework$1.
|
|
31
|
+
id: "/@mindful-web/export-framework$1.68.7/admin/components/export.marko"
|
|
32
32
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/export-framework$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/export-framework$1.68.7/admin/components/styles.marko",
|
|
6
6
|
marko_renderer = require("marko/dist/runtime/components/renderer");
|
|
7
7
|
|
|
8
8
|
function render(input, out, __component, component, state) {
|
|
@@ -17,5 +17,5 @@ marko_template._ = marko_renderer(render, {
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
marko_template.meta = {
|
|
20
|
-
id: "/@mindful-web/export-framework$1.
|
|
20
|
+
id: "/@mindful-web/export-framework$1.68.7/admin/components/styles.marko"
|
|
21
21
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/export-framework$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/export-framework$1.68.7/admin/templates/index.marko",
|
|
6
6
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
7
|
marko_forOf = require("marko/dist/runtime/helpers/for-of"),
|
|
8
8
|
export_template = require("../components/export.marko"),
|
|
@@ -82,7 +82,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
marko_template.meta = {
|
|
85
|
-
id: "/@mindful-web/export-framework$1.
|
|
85
|
+
id: "/@mindful-web/export-framework$1.68.7/admin/templates/index.marko",
|
|
86
86
|
tags: [
|
|
87
87
|
"../components/export.marko",
|
|
88
88
|
"../components/document.marko"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindful-web/export-framework",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.68.7",
|
|
4
4
|
"description": "Core framework for Mindful Web Exports.",
|
|
5
5
|
"author": "Josh Worden <josh@parameter1.com>",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@mindful-web/tenant-context": "^1.0.0",
|
|
24
24
|
"@mindful-web/utils": "^1.57.0",
|
|
25
25
|
"@mindful-web/web-common": "^1.57.0",
|
|
26
|
+
"aws-sdk": "^2.1693.0",
|
|
26
27
|
"express": "^4.18.2",
|
|
27
28
|
"graphql": "^14.7.0",
|
|
28
29
|
"graphql-tag": "^2.12.6",
|
|
@@ -32,7 +33,8 @@
|
|
|
32
33
|
"moment": "^2.29.1",
|
|
33
34
|
"moment-timezone": "^0.5.40",
|
|
34
35
|
"node-fetch": "^2.6.9",
|
|
35
|
-
"recursive-readdir": "^2.2.3"
|
|
36
|
+
"recursive-readdir": "^2.2.3",
|
|
37
|
+
"zip-folder": "^1.0.0"
|
|
36
38
|
},
|
|
37
39
|
"peerDependencies": {
|
|
38
40
|
"@mindful-web/marko-core": "^1.0.0"
|
|
@@ -40,5 +42,5 @@
|
|
|
40
42
|
"publishConfig": {
|
|
41
43
|
"access": "public"
|
|
42
44
|
},
|
|
43
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "102f5970279bda3f1473132df51b82381eb6dc46"
|
|
44
46
|
}
|
package/utils/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# common utilities
|
|
2
|
+
|
|
3
|
+
| Module | When to reach for it |
|
|
4
|
+
| ---------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
5
|
+
| `retrieve-companies` | Paginated companies query with optional filters (magazineSchedule, descendantSectionIds, taxonomy). Has a JSDoc with per-site examples. |
|
|
6
|
+
| `retrieve-sections` | Fetch a section + its descendant tree by alias. Most category-style exports use this. |
|
|
7
|
+
| `get-child-sections` | Walk a section's immediate children. |
|
|
8
|
+
| `format-text` | Normalize HTML entities and Unicode for InDesign-tagged text output. |
|
|
9
|
+
| `replace-characters` | Lower-level helper used by `format-text`; rarely imported directly. |
|
|
10
|
+
| `image-handler` | Download images to a tmp dir, zip the result, optionally upload to S3 (`downloadImages`, `zipItUp`, `uploadToS3`). |
|
|
11
|
+
| `abbreviation-to-name` | Object-form state/province lookup, e.g. `{ us: { AL: 'Alabama', ... }, canada: { ... } }`. Use when consumers look up by abbreviation key. |
|
|
12
|
+
| `state-abbreviations-list` | Array-form `[{ key, name }, ...]` of the same data. Use when consumers iterate the list (e.g. to render in display order). |
|
|
13
|
+
| `state-name-to-abrev` | Reverse lookup (name → 2-letter code), including Canadian provinces. |
|
|
14
|
+
| `country-to-abbreviation` | Array of `{ abbreviation, name }` country entries. |
|
|
15
|
+
| `load-exports` | _Framework-internal._ Boot-time loader used by [start-server.js](../start-server.js). Recursively scans the site's `exportPath`, matches files against `coreConfig.fileExtensions`, and returns descriptors `{ key, route, format, filename, fn, name, site? }`. Memoized as a singleton promise — not intended for per-request use. |
|
|
16
|
+
| `website-factory` | _Framework-internal._ Wraps a site record with `get` / `getAsArray` / `getAsObject` accessors (backed by `@mindful-web/object-path`) so [express/template-router.js](../express/template-router.js) can expose a uniform `website` helper to export functions. |
|
|
17
|
+
|
|
18
|
+
## Patterns
|
|
19
|
+
|
|
20
|
+
Several of these started life as duplicated per-site files. They were
|
|
21
|
+
consolidated here once they were byte-identical across 3+ sites. When a util
|
|
22
|
+
would otherwise need to vary per-site, prefer the **options-object pattern**
|
|
23
|
+
demonstrated by `retrieve-companies`:
|
|
24
|
+
|
|
25
|
+
- The exported function takes an `options` object with documented defaults
|
|
26
|
+
- Per-site behavior expressed by importing the function and passing different
|
|
27
|
+
options — typically via a per-site `utils/retrieve-companies-options.js`
|
|
28
|
+
- This keeps the function shared while letting each site customize behavior
|
|
29
|
+
without forking the file
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
us: {
|
|
3
|
+
AL: 'Alabama',
|
|
4
|
+
AK: 'Alaska',
|
|
5
|
+
AZ: 'Arizona',
|
|
6
|
+
AR: 'Arkansas',
|
|
7
|
+
CA: 'California',
|
|
8
|
+
CO: 'Colorado',
|
|
9
|
+
CT: 'Connecticut',
|
|
10
|
+
DE: 'Delaware',
|
|
11
|
+
DC: 'District of Columbia',
|
|
12
|
+
FL: 'Florida',
|
|
13
|
+
GA: 'Georgia',
|
|
14
|
+
HI: 'Hawaii',
|
|
15
|
+
ID: 'Idaho',
|
|
16
|
+
IL: 'Illinois',
|
|
17
|
+
IN: 'Indiana',
|
|
18
|
+
IA: 'Iowa',
|
|
19
|
+
KS: 'Kansas',
|
|
20
|
+
KY: 'Kentucky',
|
|
21
|
+
LA: 'Louisiana',
|
|
22
|
+
ME: 'Maine',
|
|
23
|
+
MD: 'Maryland',
|
|
24
|
+
MA: 'Massachusetts',
|
|
25
|
+
MI: 'Michigan',
|
|
26
|
+
MN: 'Minnesota',
|
|
27
|
+
MS: 'Mississippi',
|
|
28
|
+
MO: 'Missouri',
|
|
29
|
+
MT: 'Montana',
|
|
30
|
+
NE: 'Nebraska',
|
|
31
|
+
NV: 'Nevada',
|
|
32
|
+
NH: 'New Hampshire',
|
|
33
|
+
NJ: 'New Jersey',
|
|
34
|
+
NM: 'New Mexico',
|
|
35
|
+
NY: 'New York',
|
|
36
|
+
NC: 'North Carolina',
|
|
37
|
+
ND: 'North Dakota',
|
|
38
|
+
OH: 'Ohio',
|
|
39
|
+
OK: 'Oklahoma',
|
|
40
|
+
OR: 'Oregon',
|
|
41
|
+
PA: 'Pennsylvania',
|
|
42
|
+
RI: 'Rhode Island',
|
|
43
|
+
SC: 'South Carolina',
|
|
44
|
+
SD: 'South Dakota',
|
|
45
|
+
TN: 'Tennessee',
|
|
46
|
+
TX: 'Texas',
|
|
47
|
+
UT: 'Utah',
|
|
48
|
+
VT: 'Vermont',
|
|
49
|
+
VA: 'Virginia',
|
|
50
|
+
WA: 'Washington',
|
|
51
|
+
WV: 'West Virginia',
|
|
52
|
+
WI: 'Wisconsin',
|
|
53
|
+
WY: 'Wyoming',
|
|
54
|
+
},
|
|
55
|
+
canada: {
|
|
56
|
+
AB: 'Alberta',
|
|
57
|
+
BC: 'British Columbia',
|
|
58
|
+
MB: 'Manitoba',
|
|
59
|
+
NB: 'New Brunswick',
|
|
60
|
+
NL: 'Newfoundland and Labrador',
|
|
61
|
+
NF: 'Newfoundland and Labrador',
|
|
62
|
+
NT: 'Northwest Territories',
|
|
63
|
+
NS: 'Nova Scotia',
|
|
64
|
+
NU: 'Nunavut',
|
|
65
|
+
ON: 'Ontario',
|
|
66
|
+
PE: 'Prince Edward Island',
|
|
67
|
+
QC: 'Quebec',
|
|
68
|
+
SK: 'Saskatchewan',
|
|
69
|
+
YT: 'Yukon',
|
|
70
|
+
},
|
|
71
|
+
};
|