create-stitchkit 0.6.16 → 0.6.18

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 (36) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/examples/repository/packages/frontend/src/app/[locale]/page.tsx +2 -0
  3. package/examples/repository/packages/frontend/src/app/[locale]/starter-page.tsx +12 -8
  4. package/examples/repository/project.json +9 -0
  5. package/package.json +2 -2
  6. package/template/README.md +7 -0
  7. package/template/_env.example +5 -0
  8. package/template/bun.lock +2 -2
  9. package/template/docs/ADMIN_MOCK.md +38 -0
  10. package/template/package.json +2 -1
  11. package/template/packages/backend/src/index.ts +2 -1
  12. package/template/packages/backend/src/surface.ts +7 -6
  13. package/template/packages/backend/src/trusted-origins.test.ts +40 -0
  14. package/template/packages/backend/src/trusted-origins.ts +21 -0
  15. package/template/packages/config/src/variables.ts +16 -1
  16. package/template/packages/frontend/next.config.ts +10 -1
  17. package/template/packages/frontend/src/app/[locale]/admin/[[...section]]/page.dev.tsx +21 -0
  18. package/template/packages/frontend/src/app/[locale]/page.tsx +2 -1
  19. package/template/packages/frontend/src/app/[locale]/starter-page.tsx +12 -8
  20. package/template/packages/frontend/src/app/api/[...path]/route.ts +2 -37
  21. package/template/packages/frontend/src/app/sitemap.ts +4 -1
  22. package/template/packages/frontend/src/env.ts +11 -1
  23. package/template/packages/frontend/src/features/admin/admin-data.ts +13 -0
  24. package/template/packages/frontend/src/features/admin/admin-sections.ts +78 -0
  25. package/template/packages/frontend/src/features/admin/admin-workspace.test.tsx +59 -0
  26. package/template/packages/frontend/src/features/admin/admin-workspace.tsx +127 -0
  27. package/template/packages/frontend/src/features/admin/fixture/admin-fixture.ts +35 -0
  28. package/template/packages/frontend/src/lib/api-proxy.test.ts +131 -0
  29. package/template/packages/frontend/src/lib/api-proxy.ts +89 -0
  30. package/template/packages/frontend/src/proxy.ts +12 -1
  31. package/template/project.json +9 -0
  32. package/template/scripts/acceptance-local.ts +8 -1
  33. package/template/scripts/fixture-boundary.test.ts +34 -0
  34. package/template/scripts/fixture-boundary.ts +25 -0
  35. package/template/scripts/service-surfaces-closed.ts +13 -0
  36. package/template/scripts/web-surface-smoke.ts +33 -0
@@ -39,6 +39,39 @@ export async function assertPublicWebSurface(webOrigin: string): Promise<void> {
39
39
  }
40
40
  }
41
41
 
42
+ /** The paths a production deployment hides, with what still has to answer beside them. */
43
+ export async function assertServiceSurfacesClosed(
44
+ webOrigin: string,
45
+ apiOrigin: string,
46
+ ): Promise<void> {
47
+ const home = await dial(publicUrl(webOrigin, '/en'));
48
+ if (home.status !== 200) throw new Error(`GET /en returned ${home.status}`);
49
+ const health = await dial(publicUrl(apiOrigin, '/health'));
50
+ if (health.status !== 200)
51
+ throw new Error(`GET ${apiOrigin}/health returned ${health.status}`);
52
+ const closed = [
53
+ ...[
54
+ '/ui',
55
+ '/starter',
56
+ '/en/ui',
57
+ '/en/ui/components',
58
+ '/ru/ui/themes',
59
+ '/en/admin',
60
+ '/en/admin/people',
61
+ '/openapi.json',
62
+ ].map((path) => publicUrl(webOrigin, path)),
63
+ publicUrl(apiOrigin, '/openapi.json'),
64
+ ];
65
+ for (const url of closed) {
66
+ const response = await dial(url);
67
+ if (response.status !== 404) throw new Error(`GET ${url} returned ${response.status}`);
68
+ }
69
+ const sitemap = await dial(publicUrl(webOrigin, SITEMAP_PATH));
70
+ if ((await sitemap.text()).includes('/ui/')) {
71
+ throw new Error(`GET ${SITEMAP_PATH} still lists the closed catalogue`);
72
+ }
73
+ }
74
+
42
75
  /** What the deployment has been told about the addresses it serves. */
43
76
  export interface PublicHostPolicy {
44
77
  /** `PUBLIC_WEB_ORIGIN` — a single public address, stated outright. */