@jjlmoya/utils-travel 1.28.0 → 1.29.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.
Files changed (42) hide show
  1. package/package.json +1 -1
  2. package/src/entries.ts +2 -1
  3. package/src/index.ts +1 -0
  4. package/src/tests/locale_completeness.test.ts +2 -2
  5. package/src/tests/mfe_assets_contract.test.ts +48 -0
  6. package/src/tests/tool_validation.test.ts +2 -2
  7. package/src/tool/airport-connection-buffer-calculator/airport-connection-buffer-calculator.css +683 -0
  8. package/src/tool/airport-connection-buffer-calculator/airport-data.test.ts +15 -0
  9. package/src/tool/airport-connection-buffer-calculator/airport-data.ts +76 -0
  10. package/src/tool/airport-connection-buffer-calculator/bcbp.test.ts +17 -0
  11. package/src/tool/airport-connection-buffer-calculator/bcbp.ts +33 -0
  12. package/src/tool/airport-connection-buffer-calculator/bibliography.astro +6 -0
  13. package/src/tool/airport-connection-buffer-calculator/bibliography.ts +29 -0
  14. package/src/tool/airport-connection-buffer-calculator/component.astro +97 -0
  15. package/src/tool/airport-connection-buffer-calculator/controller.ts +253 -0
  16. package/src/tool/airport-connection-buffer-calculator/dom-views.ts +71 -0
  17. package/src/tool/airport-connection-buffer-calculator/entry.ts +30 -0
  18. package/src/tool/airport-connection-buffer-calculator/evaluator.ts +12 -0
  19. package/src/tool/airport-connection-buffer-calculator/i18n/de.ts +66 -0
  20. package/src/tool/airport-connection-buffer-calculator/i18n/en.ts +161 -0
  21. package/src/tool/airport-connection-buffer-calculator/i18n/es.ts +51 -0
  22. package/src/tool/airport-connection-buffer-calculator/i18n/fr.ts +40 -0
  23. package/src/tool/airport-connection-buffer-calculator/i18n/id.ts +23 -0
  24. package/src/tool/airport-connection-buffer-calculator/i18n/it.ts +23 -0
  25. package/src/tool/airport-connection-buffer-calculator/i18n/ja.ts +16 -0
  26. package/src/tool/airport-connection-buffer-calculator/i18n/ko.ts +16 -0
  27. package/src/tool/airport-connection-buffer-calculator/i18n/nl.ts +16 -0
  28. package/src/tool/airport-connection-buffer-calculator/i18n/pl.ts +16 -0
  29. package/src/tool/airport-connection-buffer-calculator/i18n/pt.ts +16 -0
  30. package/src/tool/airport-connection-buffer-calculator/i18n/ru.ts +16 -0
  31. package/src/tool/airport-connection-buffer-calculator/i18n/shared.ts +144 -0
  32. package/src/tool/airport-connection-buffer-calculator/i18n/sv.ts +16 -0
  33. package/src/tool/airport-connection-buffer-calculator/i18n/tr.ts +16 -0
  34. package/src/tool/airport-connection-buffer-calculator/i18n/zh.ts +16 -0
  35. package/src/tool/airport-connection-buffer-calculator/index.ts +11 -0
  36. package/src/tool/airport-connection-buffer-calculator/logic.test.ts +94 -0
  37. package/src/tool/airport-connection-buffer-calculator/logic.ts +107 -0
  38. package/src/tool/airport-connection-buffer-calculator/scanner.ts +54 -0
  39. package/src/tool/airport-connection-buffer-calculator/seo.astro +14 -0
  40. package/src/tool/airport-connection-buffer-calculator/storage.ts +88 -0
  41. package/src/tool/airport-connection-buffer-calculator/ui.ts +88 -0
  42. package/src/tools.ts +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjlmoya/utils-travel",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/entries.ts CHANGED
@@ -6,5 +6,6 @@ import { schengenCalculator } from './tool/schengen-calculator/entry';
6
6
  import { fuelCostCalculator } from './tool/fuel-cost-calculator/entry';
7
7
  import { tripExpenseSplitter } from './tool/trip-expense-splitter/entry';
8
8
  import { jetLagRecoveryPlanner } from './tool/jet-lag-recovery-planner/entry';
9
+ import { airportConnectionBuffer } from './tool/airport-connection-buffer-calculator/entry';
9
10
 
10
- export const ALL_ENTRIES = [luggageCalculator, miniAdventures, suitcaseChecklist, tipCalculator, schengenCalculator, fuelCostCalculator, tripExpenseSplitter, jetLagRecoveryPlanner];
11
+ export const ALL_ENTRIES = [luggageCalculator, miniAdventures, suitcaseChecklist, tipCalculator, schengenCalculator, fuelCostCalculator, tripExpenseSplitter, jetLagRecoveryPlanner, airportConnectionBuffer];
package/src/index.ts CHANGED
@@ -22,3 +22,4 @@ export { suitcaseChecklist, SUITCASE_CHECKLIST_TOOL } from './tool/suitcase-chec
22
22
  export { miniAdventures, MINI_ADVENTURES_TOOL } from './tool/mini-adventures';
23
23
  export { schengenCalculator, SCHENGEN_CALCULATOR_TOOL } from './tool/schengen-calculator';
24
24
  export { fuelCostCalculator, FUEL_COST_CALCULATOR_TOOL } from './tool/fuel-cost-calculator';
25
+ export { airportConnectionBuffer, AIRPORT_CONNECTION_BUFFER_TOOL } from './tool/airport-connection-buffer-calculator';
@@ -22,7 +22,7 @@ describe('Locale Completeness Validation', () => {
22
22
  });
23
23
  });
24
24
 
25
- it('all 8 tools registered', () => {
26
- expect(ALL_TOOLS.length).toBe(8);
25
+ it('all 9 tools registered', () => {
26
+ expect(ALL_TOOLS.length).toBe(9);
27
27
  });
28
28
  });
@@ -0,0 +1,48 @@
1
+ import { existsSync, readdirSync, statSync } from 'node:fs';
2
+ import { basename, join } from 'node:path';
3
+ import { describe, expect, it } from 'vitest';
4
+ import { ALL_TOOLS } from '../tools';
5
+ import { CATEGORY_OG_IMAGE, getUtilityOgImage } from '../mfe/assets';
6
+
7
+ const categoryImageMatch = CATEGORY_OG_IMAGE.match(
8
+ /^(\/_utilities\/[^/]+\/images)\/([^/]+\.webp)\?version=(.+)$/,
9
+ );
10
+
11
+ if (!categoryImageMatch) {
12
+ throw new Error(`Unexpected CATEGORY_OG_IMAGE format: ${CATEGORY_OG_IMAGE}`);
13
+ }
14
+
15
+ const [, imageUrlRoot, categoryImage, assetVersion] = categoryImageMatch;
16
+ const assetRoot = join(process.cwd(), 'public', imageUrlRoot.slice(1));
17
+ const categorySlug = basename(categoryImage, '.webp');
18
+
19
+ describe('MFE asset contract', () => {
20
+ it('has one non-empty English-slug OG image per category and registered tool', async () => {
21
+ const expectedSlugs = new Set([categorySlug]);
22
+
23
+ for (const { entry } of ALL_TOOLS) {
24
+ const englishLoader = entry.i18n.en;
25
+ if (!englishLoader) throw new Error(`Missing English locale for ${entry.id}`);
26
+
27
+ const englishContent = await englishLoader();
28
+ expectedSlugs.add(englishContent.slug);
29
+ }
30
+
31
+ const actualSlugs = new Set(
32
+ readdirSync(assetRoot)
33
+ .filter((filename) => filename.endsWith('.webp'))
34
+ .map((filename) => filename.slice(0, -'.webp'.length)),
35
+ );
36
+
37
+ expect(actualSlugs).toEqual(expectedSlugs);
38
+
39
+ for (const slug of expectedSlugs) {
40
+ const imagePath = join(assetRoot, `${slug}.webp`);
41
+ expect(existsSync(imagePath), `${imagePath} should exist`).toBe(true);
42
+ expect(statSync(imagePath).size, `${imagePath} should not be empty`).toBeGreaterThan(0);
43
+ expect(getUtilityOgImage(slug)).toBe(
44
+ `${imageUrlRoot}/${slug}.webp?version=${assetVersion}`,
45
+ );
46
+ }
47
+ }, 30000);
48
+ });
@@ -4,8 +4,8 @@ import { travelCategory } from '../category';
4
4
 
5
5
  describe('Tool Validation Suite', () => {
6
6
  describe('Library Registration', () => {
7
- it('should have 8 tools in ALL_TOOLS', () => {
8
- expect(ALL_TOOLS.length).toBe(8);
7
+ it('should have 9 tools in ALL_TOOLS', () => {
8
+ expect(ALL_TOOLS.length).toBe(9);
9
9
  });
10
10
 
11
11
  it('travelCategory should be defined', () => {