@mohasinac/appkit 4.48.1 → 4.49.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/dist/.build-stamp.json +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11 -0
- package/dist/seed/_helpers/category-images-generated.d.ts +18 -0
- package/dist/seed/_helpers/category-images-generated.js +214 -0
- package/dist/seed/_helpers/category-parts-glossary-map.d.ts +1 -0
- package/dist/seed/_helpers/category-parts-glossary-map.js +763 -0
- package/dist/seed/categories-seed-data.js +47 -0
- package/dist/seed/index.d.ts +2 -0
- package/dist/seed/index.js +2 -0
- package/dist/seed/media-assets-seed-data.d.ts +22 -0
- package/dist/seed/media-assets-seed-data.js +1953 -0
- package/dist/seed/products-catalogue-seed-data.d.ts +22 -0
- package/dist/seed/products-catalogue-seed-data.js +27971 -0
- package/dist/seed/seed-purpose.js +8 -0
- package/package.json +1 -1
- package/scripts/seed-cli.mjs +17 -0
|
@@ -60,6 +60,7 @@ import { MODEL_LEAF_COUNT } from "./_helpers/category-models.js";
|
|
|
60
60
|
import { PART_LEAF_COUNT } from "./_helpers/category-parts.js";
|
|
61
61
|
import { MARKET_BAND_LEAF_IDS } from "./_helpers/category-content.js";
|
|
62
62
|
import { GENERATED_CATEGORY_CONTENT, GENERATED_CATEGORY_CONTENT_COUNT, } from "./_helpers/category-content-generated.js";
|
|
63
|
+
import { GENERATED_CATEGORY_IMAGES, GENERATED_CATEGORY_IMAGE_COUNT, } from "./_helpers/category-images-generated.js";
|
|
63
64
|
import { productsStandardSeedData } from "./products-standard-seed-data.js";
|
|
64
65
|
const NOW = new Date();
|
|
65
66
|
const daysAgo = (n) => new Date(NOW.getTime() - n * 86400000);
|
|
@@ -471,6 +472,34 @@ function withGeneratedContent(row) {
|
|
|
471
472
|
const generated = row.id ? GENERATED_CATEGORY_CONTENT[row.id] : undefined;
|
|
472
473
|
return generated ? { ...row, contentBody: generated } : row;
|
|
473
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* Attach a fetched cover image to a bey-model leaf that has no hand-authored one.
|
|
477
|
+
*
|
|
478
|
+
* Same three rules as `withGeneratedContent`, for the same reasons: a
|
|
479
|
+
* hand-authored `display.coverImage` wins, a row absent from the map keeps
|
|
480
|
+
* nothing rather than being given a placeholder, and the map is keyed on
|
|
481
|
+
* category id so it needs no transformation here.
|
|
482
|
+
*
|
|
483
|
+
* 🛑 These are LOCAL paths under `public/images/beys/`, never `seedExtMedia()`.
|
|
484
|
+
* Wrapping a third-party image URL in `/api/media/ext` makes every render a
|
|
485
|
+
* lambda plus an upstream fetch plus a sharp watermark pass — that is Root Cause
|
|
486
|
+
* #104, and it is part of why this project was suspended on Fast Origin
|
|
487
|
+
* Transfer. 195 proxied covers would have been a direct repeat.
|
|
488
|
+
*
|
|
489
|
+
* 🛑 Measured before this existed: **1,131 of 1,177** categories had no cover at
|
|
490
|
+
* all, and the 46 that did shared six generic SVG colour tiles. So the
|
|
491
|
+
* alternative to this map is not "a different image" — it is a grid of blank
|
|
492
|
+
* cards.
|
|
493
|
+
*/
|
|
494
|
+
function withGeneratedCoverImage(row) {
|
|
495
|
+
const existing = row.display?.coverImage;
|
|
496
|
+
if (typeof existing === "string" && existing.trim().length > 0)
|
|
497
|
+
return row;
|
|
498
|
+
const generated = row.id ? GENERATED_CATEGORY_IMAGES[row.id] : undefined;
|
|
499
|
+
if (!generated)
|
|
500
|
+
return row;
|
|
501
|
+
return { ...row, display: { ...(row.display ?? {}), coverImage: generated } };
|
|
502
|
+
}
|
|
474
503
|
const allCategoryRows = [
|
|
475
504
|
...rawCategories.map((c) => ({ ancestors: [], ...c, createdByType: "admin" })),
|
|
476
505
|
...sublistingRows.map((s) => ({ ancestors: [], ...s, createdByType: "admin" })),
|
|
@@ -478,6 +507,7 @@ const allCategoryRows = [
|
|
|
478
507
|
...bundleRows.map((b) => ({ ancestors: [], ...b })),
|
|
479
508
|
]
|
|
480
509
|
.map(withGeneratedContent)
|
|
510
|
+
.map(withGeneratedCoverImage)
|
|
481
511
|
.map(withCategorySearchTxt);
|
|
482
512
|
/*
|
|
483
513
|
* ── Assertions, at MODULE LOAD, so a silent drop is loud ─────────────────────
|
|
@@ -541,6 +571,23 @@ if (generatedApplied < Math.floor(GENERATED_CATEGORY_CONTENT_COUNT * 0.9)) {
|
|
|
541
571
|
`the key space has drifted — re-run scripts/gen-category-content.mjs against the ` +
|
|
542
572
|
`current forest. Nothing would error at load time: the pages would simply have no body.`);
|
|
543
573
|
}
|
|
574
|
+
/*
|
|
575
|
+
* The same assertion for the cover images, and the same reasoning: the map is
|
|
576
|
+
* keyed on category ids, so a key that stops matching a row is invisible —
|
|
577
|
+
* the map still exports its count, the seed still loads every row, and the
|
|
578
|
+
* pages simply go back to having no image.
|
|
579
|
+
*
|
|
580
|
+
* The floor is 90% for the one legitimate reason a row can be missing: a
|
|
581
|
+
* hand-authored `display.coverImage` wins, so the number of rows carrying a
|
|
582
|
+
* GENERATED path is `COUNT` minus however many have been art-directed by hand.
|
|
583
|
+
*/
|
|
584
|
+
const generatedImagesApplied = allCategoryRows.filter((c) => typeof c.id === "string" && GENERATED_CATEGORY_IMAGES[c.id] === c.display?.coverImage).length;
|
|
585
|
+
if (generatedImagesApplied < Math.floor(GENERATED_CATEGORY_IMAGE_COUNT * 0.9)) {
|
|
586
|
+
throw new Error(`category seed: only ${generatedImagesApplied} of ${GENERATED_CATEGORY_IMAGE_COUNT} generated ` +
|
|
587
|
+
`cover images matched a row id — the key space has drifted. Re-run ` +
|
|
588
|
+
`scripts/fetch-taxonomy-images.mjs against the current forest. Nothing would error ` +
|
|
589
|
+
`at load time: the category grids would just go back to blank cards.`);
|
|
590
|
+
}
|
|
544
591
|
const allIds = allCategoryRows.map((c) => c.id).filter((x) => typeof x === "string");
|
|
545
592
|
const duplicateIds = [...new Set(allIds.filter((id, i) => allIds.indexOf(id) !== i))];
|
|
546
593
|
if (duplicateIds.length > 0) {
|
package/dist/seed/index.d.ts
CHANGED
|
@@ -76,6 +76,8 @@ export { carouselsSeedData } from "./carousels-seed-data";
|
|
|
76
76
|
export { wishlistsSeedData } from "./wishlists-seed-data";
|
|
77
77
|
export { historySeedData } from "./history-seed-data";
|
|
78
78
|
export { groupedListingsSeedData } from "./grouped-listings-seed-data";
|
|
79
|
+
export { mediaAssetsSeedData, MEDIA_ASSET_SEED_COUNT, } from "./media-assets-seed-data";
|
|
80
|
+
export { productsCatalogueSeedData, CATALOGUE_LISTING_COUNT, } from "./products-catalogue-seed-data";
|
|
79
81
|
export { scammersSeedData } from "./scammers-seed-data";
|
|
80
82
|
export { supportTicketsSeedData } from "./support-tickets-seed-data";
|
|
81
83
|
export { testerChecklistSeedData, testerResponsesSeedData, } from "../features/tester/seed-data";
|
package/dist/seed/index.js
CHANGED
|
@@ -75,6 +75,8 @@ export { carouselsSeedData } from "./carousels-seed-data.js";
|
|
|
75
75
|
export { wishlistsSeedData } from "./wishlists-seed-data.js";
|
|
76
76
|
export { historySeedData } from "./history-seed-data.js";
|
|
77
77
|
export { groupedListingsSeedData } from "./grouped-listings-seed-data.js";
|
|
78
|
+
export { mediaAssetsSeedData, MEDIA_ASSET_SEED_COUNT, } from "./media-assets-seed-data.js";
|
|
79
|
+
export { productsCatalogueSeedData, CATALOGUE_LISTING_COUNT, } from "./products-catalogue-seed-data.js";
|
|
78
80
|
export { scammersSeedData } from "./scammers-seed-data.js";
|
|
79
81
|
export { supportTicketsSeedData } from "./support-tickets-seed-data.js";
|
|
80
82
|
// Tester checklist/response seed data lives in ../features/tester/seed-data (isolated from
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED by scripts/upload-taxonomy-images.mjs — do not edit by hand.
|
|
3
|
+
*
|
|
4
|
+
* One `mediaAssets` row per taxonomy cover image. These are what make
|
|
5
|
+
* `/media/<shortId>` resolve: the proxy looks a single-segment slug up here to
|
|
6
|
+
* find its Storage path, so **without these rows every category cover 404s**,
|
|
7
|
+
* even though the objects are sitting in the bucket.
|
|
8
|
+
*
|
|
9
|
+
* That is why they are seeded rather than created as a side effect of the
|
|
10
|
+
* upload — a Firestore wipe must not be able to orphan the bucket. Re-create
|
|
11
|
+
* the whole chain from a clean checkout with:
|
|
12
|
+
*
|
|
13
|
+
* node scripts/fetch-taxonomy-images.mjs
|
|
14
|
+
* node scripts/upload-taxonomy-images.mjs --yes
|
|
15
|
+
* npx appkit-seed load --collections mediaAssets,categories
|
|
16
|
+
*
|
|
17
|
+
* `status: "finalized"` because these were uploaded straight to `media/`,
|
|
18
|
+
* never staged in `tmp/` — so `mediaTmpCleanup` has no claim on them.
|
|
19
|
+
*/
|
|
20
|
+
import type { MediaAssetDocument } from "../features/media/repository/media-assets.repository";
|
|
21
|
+
export declare const mediaAssetsSeedData: Partial<MediaAssetDocument>[];
|
|
22
|
+
export declare const MEDIA_ASSET_SEED_COUNT = 195;
|