@farm.js/create-app 0.1.1-beta.1 → 0.1.1-beta.4

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/index.mjs CHANGED
@@ -430,6 +430,16 @@ function sanityContentUIFeature() {
430
430
  files: () => [componentFile("sanity-content-console.tsx", sanityContentTemplate()), integrationPageFile("sanity", "SanityContentConsole")]
431
431
  };
432
432
  }
433
+ function strapiContentUIFeature() {
434
+ return {
435
+ name: "strapi-content",
436
+ description: "Strapi content list UI",
437
+ components: ["badge", "card"],
438
+ needsApiClient: false,
439
+ notes: ["Open \"/integrations/strapi\" to check the Strapi connection."],
440
+ files: () => [componentFile("strapi-content-console.tsx", strapiContentTemplate()), integrationPageFile("strapi", "StrapiContentConsole")]
441
+ };
442
+ }
433
443
  function billingUIFeature(input) {
434
444
  return {
435
445
  name: `${input.provider}-billing`,
@@ -1675,30 +1685,48 @@ export function UnkeyApiKeysConsole() {
1675
1685
  `;
1676
1686
  }
1677
1687
  function sanityContentTemplate() {
1688
+ return contentConsoleTemplate({
1689
+ componentName: "SanityContentConsole",
1690
+ label: "Sanity",
1691
+ description: "Query documents with createServerQuery and invalidate them from the Sanity webhook.",
1692
+ example: "cms.fetch('*[_type == "post"]{\"{\"} title {\"}\"}')",
1693
+ webhook: "Point a Sanity webhook at /api/sanity/webhook to keep cached pages fresh."
1694
+ });
1695
+ }
1696
+ function strapiContentTemplate() {
1697
+ return contentConsoleTemplate({
1698
+ componentName: "StrapiContentConsole",
1699
+ label: "Strapi",
1700
+ description: "Query typed documents from server queries and invalidate them from the Strapi webhook.",
1701
+ example: "createStrapiCollection(cms, "articles").find()",
1702
+ webhook: "Send the configured secret header to /api/strapi/webhook when content changes."
1703
+ });
1704
+ }
1705
+ function contentConsoleTemplate(input) {
1678
1706
  return `import { Badge } from "@/components/ui/badge";
1679
1707
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
1680
1708
 
1681
- export function SanityContentConsole() {
1709
+ export function ${input.componentName}() {
1682
1710
  return (
1683
1711
  <main className="min-h-screen bg-background px-6 py-12 text-foreground">
1684
1712
  <section className="mx-auto flex w-full max-w-3xl flex-col gap-6">
1685
1713
  <div className="space-y-3">
1686
- <Badge variant="secondary">Sanity</Badge>
1714
+ <Badge variant="secondary">${input.label}</Badge>
1687
1715
  <h1 className="text-3xl font-semibold tracking-normal">Content</h1>
1688
1716
  </div>
1689
1717
  <Card>
1690
1718
  <CardHeader>
1691
- <CardTitle className="text-xl">Connected to Sanity</CardTitle>
1719
+ <CardTitle className="text-xl">Connected to ${input.label}</CardTitle>
1692
1720
  <CardDescription>
1693
- Query documents with createServerQuery and invalidate them from the Sanity webhook.
1721
+ ${input.description}
1694
1722
  </CardDescription>
1695
1723
  </CardHeader>
1696
1724
  <CardContent className="space-y-3">
1697
1725
  <code className="block overflow-x-auto rounded-md border bg-muted/30 p-3 text-xs">
1698
- cms.fetch(&apos;*[_type == &quot;post&quot;]{"{"} title {"}"}&apos;)
1726
+ ${input.example}
1699
1727
  </code>
1700
1728
  <p className="text-sm text-muted-foreground">
1701
- Point a Sanity webhook at /api/sanity/webhook to keep cached pages fresh.
1729
+ ${input.webhook}
1702
1730
  </p>
1703
1731
  </CardContent>
1704
1732
  </Card>
@@ -2287,6 +2315,41 @@ export const sanityIntegration = sanity({
2287
2315
  console.log("[sanity]", event.phase, event.route?.path || "none");
2288
2316
  },
2289
2317
  });
2318
+ `
2319
+ },
2320
+ {
2321
+ provider: "strapi",
2322
+ aliases: ["strapi-cms"],
2323
+ defaultKey: "cms",
2324
+ packageName: "@farm.js/strapi",
2325
+ fileName: "strapi",
2326
+ exportName: "strapiIntegration",
2327
+ description: "Strapi content with typed reads, responsive media, and webhook invalidation",
2328
+ env: [
2329
+ "STRAPI_API_URL",
2330
+ "STRAPI_API_TOKEN",
2331
+ "STRAPI_MEDIA_URL",
2332
+ "STRAPI_WEBHOOK_SECRET"
2333
+ ],
2334
+ dependencies: { "@strapi/client": "^1.6.2" },
2335
+ ui: strapiContentUIFeature(),
2336
+ template: () => `import { strapi } from "@farm.js/strapi";
2337
+
2338
+ export const strapiIntegration = strapi({
2339
+ apiUrl: process.env.STRAPI_API_URL,
2340
+ token: process.env.STRAPI_API_TOKEN,
2341
+ mediaUrl: process.env.STRAPI_MEDIA_URL,
2342
+ webhook: {
2343
+ secret: process.env.STRAPI_WEBHOOK_SECRET,
2344
+ onChange(payload) {
2345
+ console.log("[strapi]", payload.event, payload.model);
2346
+ return undefined;
2347
+ },
2348
+ },
2349
+ log(event) {
2350
+ console.log("[strapi]", event.phase, event.route?.path || "none");
2351
+ },
2352
+ });
2290
2353
  `
2291
2354
  }
2292
2355
  ];
@@ -2627,6 +2690,7 @@ const FARM_TELEMETRY_TEMPLATES = [
2627
2690
  "polar",
2628
2691
  "resend",
2629
2692
  "sanity",
2693
+ "strapi",
2630
2694
  "stripe",
2631
2695
  "supabase",
2632
2696
  "unkey",