@squadbase/vite-server 0.1.9-dev.a70dcaa → 0.1.9-dev.c9c23a3

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/cli/index.js CHANGED
@@ -143905,10 +143905,12 @@ The business logic type for this connector is "typescript". Write handler code u
143905
143905
 
143906
143906
  SDK methods (client created via \`connection(connectionId)\`):
143907
143907
  - \`client.request(path, init?)\` \u2014 low-level authenticated fetch. Pass \`init.query\` to set query parameters; \`key\` is injected automatically
143908
- - \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns, rows, raw }\`
143908
+ - \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns: string[], rows: Record<string, string>[], raw: string }\`
143909
143909
  - \`client.trends(path, query?)\` \u2014 call a Trends API endpoint (\`/analytics/v1/...\`) and return parsed JSON
143910
143910
  - \`client.projects(path, init?)\` \u2014 call a Projects API endpoint (\`/management/v1/...\`) and return parsed JSON
143911
143911
 
143912
+ \u26A0\uFE0F **Important: \`report()\` row shape.** \`rows\` is \`Record<string, string>[]\` \u2014 each row is an object keyed by the CSV column NAME (matching \`columns\`), NOT a positional array. Access fields with \`row["Url"]\`, \`row["Keyword"]\`, \`row["Search Volume"]\` (column names may contain spaces). Do NOT use \`columns.indexOf("Url")\` and then \`row[index]\` \u2014 that returns \`undefined\` and silently produces empty results when combined with \`?? ""\` or \`Number(...) || 0\`. All values are strings; convert numeric columns with \`Number(row["Position"])\`.
143913
+
143912
143914
  \`\`\`ts
143913
143915
  import type { Context } from "hono";
143914
143916
  import { connection } from "@squadbase/vite-server/connectors/semrush";
@@ -143921,9 +143923,25 @@ export default async function handler(c: Context) {
143921
143923
  database?: string;
143922
143924
  }>();
143923
143925
 
143924
- const overview = await semrush.report("domain_overview", { domain, database });
143926
+ const result = await semrush.report("domain_organic", {
143927
+ domain,
143928
+ database,
143929
+ display_limit: "100",
143930
+ });
143931
+
143932
+ // \u2705 Correct: access by column name
143933
+ const rows = result.rows.map((row) => ({
143934
+ keyword: row["Keyword"],
143935
+ position: Number(row["Position"]) || 0,
143936
+ searchVolume: Number(row["Search Volume"]) || 0,
143937
+ url: row["Url"] ?? "",
143938
+ }));
143939
+
143940
+ // \u274C Wrong: do NOT do this \u2014 row[index] is undefined because rows are objects, not arrays
143941
+ // const urlIdx = result.columns.indexOf("Url");
143942
+ // const url = (row as unknown as string[])[urlIdx];
143925
143943
 
143926
- return c.json({ columns: overview.columns, rows: overview.rows });
143944
+ return c.json({ columns: result.columns, rows });
143927
143945
  }
143928
143946
  \`\`\`
143929
143947
 
@@ -143979,10 +143997,12 @@ To check remaining API units (free, does NOT consume units), call the request to
143979
143997
 
143980
143998
  SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
143981
143999
  - \`client.request(path, init?)\` \u2014 \u8A8D\u8A3C\u4ED8\u304D\u306E\u4F4E\u30EC\u30D9\u30EBfetch\u3002\`init.query\` \u3067\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6307\u5B9A\u3002\`key\` \u306F\u81EA\u52D5\u4ED8\u4E0E
143982
- - \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns, rows, raw }\` \u306B\u30D1\u30FC\u30B9
144000
+ - \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns: string[], rows: Record<string, string>[], raw: string }\` \u306B\u30D1\u30FC\u30B9
143983
144001
  - \`client.trends(path, query?)\` \u2014 Trends API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/analytics/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
143984
144002
  - \`client.projects(path, init?)\` \u2014 Projects API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/management/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
143985
144003
 
144004
+ \u26A0\uFE0F **\u91CD\u8981: \`report()\` \u306E\u884C\uFF08row\uFF09\u306E\u5F62\u72B6\u306B\u3064\u3044\u3066\u3002** \`rows\` \u306F \`Record<string, string>[]\` \u3067\u3059 \u2014 \u5404\u884C\u306F CSV \u306E\u30AB\u30E9\u30E0\u300C\u540D\u300D\uFF08\`columns\` \u3068\u4E00\u81F4\uFF09\u3092\u30AD\u30FC\u3068\u3057\u305F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u3001\u4F4D\u7F6E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u306E\u914D\u5217\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30D5\u30A3\u30FC\u30EB\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u306F\u5FC5\u305A \`row["Url"]\`\u3001\`row["Keyword"]\`\u3001\`row["Search Volume"]\`\uFF08\u30AB\u30E9\u30E0\u540D\u306B\u30B9\u30DA\u30FC\u30B9\u3092\u542B\u3080\u3053\u3068\u3042\u308A\uFF09\u306E\u3088\u3046\u306B\u30AB\u30E9\u30E0\u540D\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\`columns.indexOf("Url")\` \u3067\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u53D6\u5F97\u3057\u3066\u304B\u3089 \`row[index]\` \u3067\u30A2\u30AF\u30BB\u30B9\u3057\u3066\u306F\u3044\u3051\u307E\u305B\u3093 \u2014 \u305D\u308C\u306F \`undefined\` \u3092\u8FD4\u3057\u3001\`?? ""\` \u3084 \`Number(...) || 0\` \u3068\u7D44\u307F\u5408\u308F\u3055\u308B\u3053\u3068\u3067\u7D50\u679C\u304C\u7A7A\u306B\u306A\u308B\u7121\u97F3\u306E\u5931\u6557\u3092\u751F\u307F\u307E\u3059\u3002\u5168\u3066\u306E\u5024\u306F\u6587\u5B57\u5217\u306A\u306E\u3067\u3001\u6570\u5024\u30AB\u30E9\u30E0\u306F \`Number(row["Position"])\` \u3067\u660E\u793A\u5909\u63DB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
144005
+
143986
144006
  \`\`\`ts
143987
144007
  import type { Context } from "hono";
143988
144008
  import { connection } from "@squadbase/vite-server/connectors/semrush";
@@ -143995,9 +144015,25 @@ export default async function handler(c: Context) {
143995
144015
  database?: string;
143996
144016
  }>();
143997
144017
 
143998
- const overview = await semrush.report("domain_overview", { domain, database });
144018
+ const result = await semrush.report("domain_organic", {
144019
+ domain,
144020
+ database,
144021
+ display_limit: "100",
144022
+ });
144023
+
144024
+ // \u2705 \u6B63: \u30AB\u30E9\u30E0\u540D\u3067\u30A2\u30AF\u30BB\u30B9\u3059\u308B
144025
+ const rows = result.rows.map((row) => ({
144026
+ keyword: row["Keyword"],
144027
+ position: Number(row["Position"]) || 0,
144028
+ searchVolume: Number(row["Search Volume"]) || 0,
144029
+ url: row["Url"] ?? "",
144030
+ }));
144031
+
144032
+ // \u274C \u8AA4: \u884C\u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u914D\u5217\u3067\u306F\u306A\u3044\u305F\u3081 row[index] \u306F undefined \u306B\u306A\u308B
144033
+ // const urlIdx = result.columns.indexOf("Url");
144034
+ // const url = (row as unknown as string[])[urlIdx];
143999
144035
 
144000
- return c.json({ columns: overview.columns, rows: overview.rows });
144036
+ return c.json({ columns: result.columns, rows });
144001
144037
  }
144002
144038
  \`\`\`
144003
144039
 
@@ -504,10 +504,12 @@ The business logic type for this connector is "typescript". Write handler code u
504
504
 
505
505
  SDK methods (client created via \`connection(connectionId)\`):
506
506
  - \`client.request(path, init?)\` \u2014 low-level authenticated fetch. Pass \`init.query\` to set query parameters; \`key\` is injected automatically
507
- - \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns, rows, raw }\`
507
+ - \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns: string[], rows: Record<string, string>[], raw: string }\`
508
508
  - \`client.trends(path, query?)\` \u2014 call a Trends API endpoint (\`/analytics/v1/...\`) and return parsed JSON
509
509
  - \`client.projects(path, init?)\` \u2014 call a Projects API endpoint (\`/management/v1/...\`) and return parsed JSON
510
510
 
511
+ \u26A0\uFE0F **Important: \`report()\` row shape.** \`rows\` is \`Record<string, string>[]\` \u2014 each row is an object keyed by the CSV column NAME (matching \`columns\`), NOT a positional array. Access fields with \`row["Url"]\`, \`row["Keyword"]\`, \`row["Search Volume"]\` (column names may contain spaces). Do NOT use \`columns.indexOf("Url")\` and then \`row[index]\` \u2014 that returns \`undefined\` and silently produces empty results when combined with \`?? ""\` or \`Number(...) || 0\`. All values are strings; convert numeric columns with \`Number(row["Position"])\`.
512
+
511
513
  \`\`\`ts
512
514
  import type { Context } from "hono";
513
515
  import { connection } from "@squadbase/vite-server/connectors/semrush";
@@ -520,9 +522,25 @@ export default async function handler(c: Context) {
520
522
  database?: string;
521
523
  }>();
522
524
 
523
- const overview = await semrush.report("domain_overview", { domain, database });
525
+ const result = await semrush.report("domain_organic", {
526
+ domain,
527
+ database,
528
+ display_limit: "100",
529
+ });
530
+
531
+ // \u2705 Correct: access by column name
532
+ const rows = result.rows.map((row) => ({
533
+ keyword: row["Keyword"],
534
+ position: Number(row["Position"]) || 0,
535
+ searchVolume: Number(row["Search Volume"]) || 0,
536
+ url: row["Url"] ?? "",
537
+ }));
538
+
539
+ // \u274C Wrong: do NOT do this \u2014 row[index] is undefined because rows are objects, not arrays
540
+ // const urlIdx = result.columns.indexOf("Url");
541
+ // const url = (row as unknown as string[])[urlIdx];
524
542
 
525
- return c.json({ columns: overview.columns, rows: overview.rows });
543
+ return c.json({ columns: result.columns, rows });
526
544
  }
527
545
  \`\`\`
528
546
 
@@ -578,10 +596,12 @@ To check remaining API units (free, does NOT consume units), call the request to
578
596
 
579
597
  SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
580
598
  - \`client.request(path, init?)\` \u2014 \u8A8D\u8A3C\u4ED8\u304D\u306E\u4F4E\u30EC\u30D9\u30EBfetch\u3002\`init.query\` \u3067\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6307\u5B9A\u3002\`key\` \u306F\u81EA\u52D5\u4ED8\u4E0E
581
- - \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns, rows, raw }\` \u306B\u30D1\u30FC\u30B9
599
+ - \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns: string[], rows: Record<string, string>[], raw: string }\` \u306B\u30D1\u30FC\u30B9
582
600
  - \`client.trends(path, query?)\` \u2014 Trends API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/analytics/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
583
601
  - \`client.projects(path, init?)\` \u2014 Projects API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/management/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
584
602
 
603
+ \u26A0\uFE0F **\u91CD\u8981: \`report()\` \u306E\u884C\uFF08row\uFF09\u306E\u5F62\u72B6\u306B\u3064\u3044\u3066\u3002** \`rows\` \u306F \`Record<string, string>[]\` \u3067\u3059 \u2014 \u5404\u884C\u306F CSV \u306E\u30AB\u30E9\u30E0\u300C\u540D\u300D\uFF08\`columns\` \u3068\u4E00\u81F4\uFF09\u3092\u30AD\u30FC\u3068\u3057\u305F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u3001\u4F4D\u7F6E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u306E\u914D\u5217\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30D5\u30A3\u30FC\u30EB\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u306F\u5FC5\u305A \`row["Url"]\`\u3001\`row["Keyword"]\`\u3001\`row["Search Volume"]\`\uFF08\u30AB\u30E9\u30E0\u540D\u306B\u30B9\u30DA\u30FC\u30B9\u3092\u542B\u3080\u3053\u3068\u3042\u308A\uFF09\u306E\u3088\u3046\u306B\u30AB\u30E9\u30E0\u540D\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\`columns.indexOf("Url")\` \u3067\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u53D6\u5F97\u3057\u3066\u304B\u3089 \`row[index]\` \u3067\u30A2\u30AF\u30BB\u30B9\u3057\u3066\u306F\u3044\u3051\u307E\u305B\u3093 \u2014 \u305D\u308C\u306F \`undefined\` \u3092\u8FD4\u3057\u3001\`?? ""\` \u3084 \`Number(...) || 0\` \u3068\u7D44\u307F\u5408\u308F\u3055\u308B\u3053\u3068\u3067\u7D50\u679C\u304C\u7A7A\u306B\u306A\u308B\u7121\u97F3\u306E\u5931\u6557\u3092\u751F\u307F\u307E\u3059\u3002\u5168\u3066\u306E\u5024\u306F\u6587\u5B57\u5217\u306A\u306E\u3067\u3001\u6570\u5024\u30AB\u30E9\u30E0\u306F \`Number(row["Position"])\` \u3067\u660E\u793A\u5909\u63DB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
604
+
585
605
  \`\`\`ts
586
606
  import type { Context } from "hono";
587
607
  import { connection } from "@squadbase/vite-server/connectors/semrush";
@@ -594,9 +614,25 @@ export default async function handler(c: Context) {
594
614
  database?: string;
595
615
  }>();
596
616
 
597
- const overview = await semrush.report("domain_overview", { domain, database });
617
+ const result = await semrush.report("domain_organic", {
618
+ domain,
619
+ database,
620
+ display_limit: "100",
621
+ });
622
+
623
+ // \u2705 \u6B63: \u30AB\u30E9\u30E0\u540D\u3067\u30A2\u30AF\u30BB\u30B9\u3059\u308B
624
+ const rows = result.rows.map((row) => ({
625
+ keyword: row["Keyword"],
626
+ position: Number(row["Position"]) || 0,
627
+ searchVolume: Number(row["Search Volume"]) || 0,
628
+ url: row["Url"] ?? "",
629
+ }));
630
+
631
+ // \u274C \u8AA4: \u884C\u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u914D\u5217\u3067\u306F\u306A\u3044\u305F\u3081 row[index] \u306F undefined \u306B\u306A\u308B
632
+ // const urlIdx = result.columns.indexOf("Url");
633
+ // const url = (row as unknown as string[])[urlIdx];
598
634
 
599
- return c.json({ columns: overview.columns, rows: overview.rows });
635
+ return c.json({ columns: result.columns, rows });
600
636
  }
601
637
  \`\`\`
602
638
 
package/dist/index.js CHANGED
@@ -112364,10 +112364,12 @@ The business logic type for this connector is "typescript". Write handler code u
112364
112364
 
112365
112365
  SDK methods (client created via \`connection(connectionId)\`):
112366
112366
  - \`client.request(path, init?)\` \u2014 low-level authenticated fetch. Pass \`init.query\` to set query parameters; \`key\` is injected automatically
112367
- - \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns, rows, raw }\`
112367
+ - \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns: string[], rows: Record<string, string>[], raw: string }\`
112368
112368
  - \`client.trends(path, query?)\` \u2014 call a Trends API endpoint (\`/analytics/v1/...\`) and return parsed JSON
112369
112369
  - \`client.projects(path, init?)\` \u2014 call a Projects API endpoint (\`/management/v1/...\`) and return parsed JSON
112370
112370
 
112371
+ \u26A0\uFE0F **Important: \`report()\` row shape.** \`rows\` is \`Record<string, string>[]\` \u2014 each row is an object keyed by the CSV column NAME (matching \`columns\`), NOT a positional array. Access fields with \`row["Url"]\`, \`row["Keyword"]\`, \`row["Search Volume"]\` (column names may contain spaces). Do NOT use \`columns.indexOf("Url")\` and then \`row[index]\` \u2014 that returns \`undefined\` and silently produces empty results when combined with \`?? ""\` or \`Number(...) || 0\`. All values are strings; convert numeric columns with \`Number(row["Position"])\`.
112372
+
112371
112373
  \`\`\`ts
112372
112374
  import type { Context } from "hono";
112373
112375
  import { connection } from "@squadbase/vite-server/connectors/semrush";
@@ -112380,9 +112382,25 @@ export default async function handler(c: Context) {
112380
112382
  database?: string;
112381
112383
  }>();
112382
112384
 
112383
- const overview = await semrush.report("domain_overview", { domain, database });
112385
+ const result = await semrush.report("domain_organic", {
112386
+ domain,
112387
+ database,
112388
+ display_limit: "100",
112389
+ });
112390
+
112391
+ // \u2705 Correct: access by column name
112392
+ const rows = result.rows.map((row) => ({
112393
+ keyword: row["Keyword"],
112394
+ position: Number(row["Position"]) || 0,
112395
+ searchVolume: Number(row["Search Volume"]) || 0,
112396
+ url: row["Url"] ?? "",
112397
+ }));
112398
+
112399
+ // \u274C Wrong: do NOT do this \u2014 row[index] is undefined because rows are objects, not arrays
112400
+ // const urlIdx = result.columns.indexOf("Url");
112401
+ // const url = (row as unknown as string[])[urlIdx];
112384
112402
 
112385
- return c.json({ columns: overview.columns, rows: overview.rows });
112403
+ return c.json({ columns: result.columns, rows });
112386
112404
  }
112387
112405
  \`\`\`
112388
112406
 
@@ -112438,10 +112456,12 @@ To check remaining API units (free, does NOT consume units), call the request to
112438
112456
 
112439
112457
  SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
112440
112458
  - \`client.request(path, init?)\` \u2014 \u8A8D\u8A3C\u4ED8\u304D\u306E\u4F4E\u30EC\u30D9\u30EBfetch\u3002\`init.query\` \u3067\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6307\u5B9A\u3002\`key\` \u306F\u81EA\u52D5\u4ED8\u4E0E
112441
- - \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns, rows, raw }\` \u306B\u30D1\u30FC\u30B9
112459
+ - \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns: string[], rows: Record<string, string>[], raw: string }\` \u306B\u30D1\u30FC\u30B9
112442
112460
  - \`client.trends(path, query?)\` \u2014 Trends API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/analytics/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
112443
112461
  - \`client.projects(path, init?)\` \u2014 Projects API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/management/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
112444
112462
 
112463
+ \u26A0\uFE0F **\u91CD\u8981: \`report()\` \u306E\u884C\uFF08row\uFF09\u306E\u5F62\u72B6\u306B\u3064\u3044\u3066\u3002** \`rows\` \u306F \`Record<string, string>[]\` \u3067\u3059 \u2014 \u5404\u884C\u306F CSV \u306E\u30AB\u30E9\u30E0\u300C\u540D\u300D\uFF08\`columns\` \u3068\u4E00\u81F4\uFF09\u3092\u30AD\u30FC\u3068\u3057\u305F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u3001\u4F4D\u7F6E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u306E\u914D\u5217\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30D5\u30A3\u30FC\u30EB\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u306F\u5FC5\u305A \`row["Url"]\`\u3001\`row["Keyword"]\`\u3001\`row["Search Volume"]\`\uFF08\u30AB\u30E9\u30E0\u540D\u306B\u30B9\u30DA\u30FC\u30B9\u3092\u542B\u3080\u3053\u3068\u3042\u308A\uFF09\u306E\u3088\u3046\u306B\u30AB\u30E9\u30E0\u540D\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\`columns.indexOf("Url")\` \u3067\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u53D6\u5F97\u3057\u3066\u304B\u3089 \`row[index]\` \u3067\u30A2\u30AF\u30BB\u30B9\u3057\u3066\u306F\u3044\u3051\u307E\u305B\u3093 \u2014 \u305D\u308C\u306F \`undefined\` \u3092\u8FD4\u3057\u3001\`?? ""\` \u3084 \`Number(...) || 0\` \u3068\u7D44\u307F\u5408\u308F\u3055\u308B\u3053\u3068\u3067\u7D50\u679C\u304C\u7A7A\u306B\u306A\u308B\u7121\u97F3\u306E\u5931\u6557\u3092\u751F\u307F\u307E\u3059\u3002\u5168\u3066\u306E\u5024\u306F\u6587\u5B57\u5217\u306A\u306E\u3067\u3001\u6570\u5024\u30AB\u30E9\u30E0\u306F \`Number(row["Position"])\` \u3067\u660E\u793A\u5909\u63DB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
112464
+
112445
112465
  \`\`\`ts
112446
112466
  import type { Context } from "hono";
112447
112467
  import { connection } from "@squadbase/vite-server/connectors/semrush";
@@ -112454,9 +112474,25 @@ export default async function handler(c: Context) {
112454
112474
  database?: string;
112455
112475
  }>();
112456
112476
 
112457
- const overview = await semrush.report("domain_overview", { domain, database });
112477
+ const result = await semrush.report("domain_organic", {
112478
+ domain,
112479
+ database,
112480
+ display_limit: "100",
112481
+ });
112482
+
112483
+ // \u2705 \u6B63: \u30AB\u30E9\u30E0\u540D\u3067\u30A2\u30AF\u30BB\u30B9\u3059\u308B
112484
+ const rows = result.rows.map((row) => ({
112485
+ keyword: row["Keyword"],
112486
+ position: Number(row["Position"]) || 0,
112487
+ searchVolume: Number(row["Search Volume"]) || 0,
112488
+ url: row["Url"] ?? "",
112489
+ }));
112490
+
112491
+ // \u274C \u8AA4: \u884C\u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u914D\u5217\u3067\u306F\u306A\u3044\u305F\u3081 row[index] \u306F undefined \u306B\u306A\u308B
112492
+ // const urlIdx = result.columns.indexOf("Url");
112493
+ // const url = (row as unknown as string[])[urlIdx];
112458
112494
 
112459
- return c.json({ columns: overview.columns, rows: overview.rows });
112495
+ return c.json({ columns: result.columns, rows });
112460
112496
  }
112461
112497
  \`\`\`
112462
112498
 
package/dist/main.js CHANGED
@@ -112364,10 +112364,12 @@ The business logic type for this connector is "typescript". Write handler code u
112364
112364
 
112365
112365
  SDK methods (client created via \`connection(connectionId)\`):
112366
112366
  - \`client.request(path, init?)\` \u2014 low-level authenticated fetch. Pass \`init.query\` to set query parameters; \`key\` is injected automatically
112367
- - \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns, rows, raw }\`
112367
+ - \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns: string[], rows: Record<string, string>[], raw: string }\`
112368
112368
  - \`client.trends(path, query?)\` \u2014 call a Trends API endpoint (\`/analytics/v1/...\`) and return parsed JSON
112369
112369
  - \`client.projects(path, init?)\` \u2014 call a Projects API endpoint (\`/management/v1/...\`) and return parsed JSON
112370
112370
 
112371
+ \u26A0\uFE0F **Important: \`report()\` row shape.** \`rows\` is \`Record<string, string>[]\` \u2014 each row is an object keyed by the CSV column NAME (matching \`columns\`), NOT a positional array. Access fields with \`row["Url"]\`, \`row["Keyword"]\`, \`row["Search Volume"]\` (column names may contain spaces). Do NOT use \`columns.indexOf("Url")\` and then \`row[index]\` \u2014 that returns \`undefined\` and silently produces empty results when combined with \`?? ""\` or \`Number(...) || 0\`. All values are strings; convert numeric columns with \`Number(row["Position"])\`.
112372
+
112371
112373
  \`\`\`ts
112372
112374
  import type { Context } from "hono";
112373
112375
  import { connection } from "@squadbase/vite-server/connectors/semrush";
@@ -112380,9 +112382,25 @@ export default async function handler(c: Context) {
112380
112382
  database?: string;
112381
112383
  }>();
112382
112384
 
112383
- const overview = await semrush.report("domain_overview", { domain, database });
112385
+ const result = await semrush.report("domain_organic", {
112386
+ domain,
112387
+ database,
112388
+ display_limit: "100",
112389
+ });
112390
+
112391
+ // \u2705 Correct: access by column name
112392
+ const rows = result.rows.map((row) => ({
112393
+ keyword: row["Keyword"],
112394
+ position: Number(row["Position"]) || 0,
112395
+ searchVolume: Number(row["Search Volume"]) || 0,
112396
+ url: row["Url"] ?? "",
112397
+ }));
112398
+
112399
+ // \u274C Wrong: do NOT do this \u2014 row[index] is undefined because rows are objects, not arrays
112400
+ // const urlIdx = result.columns.indexOf("Url");
112401
+ // const url = (row as unknown as string[])[urlIdx];
112384
112402
 
112385
- return c.json({ columns: overview.columns, rows: overview.rows });
112403
+ return c.json({ columns: result.columns, rows });
112386
112404
  }
112387
112405
  \`\`\`
112388
112406
 
@@ -112438,10 +112456,12 @@ To check remaining API units (free, does NOT consume units), call the request to
112438
112456
 
112439
112457
  SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
112440
112458
  - \`client.request(path, init?)\` \u2014 \u8A8D\u8A3C\u4ED8\u304D\u306E\u4F4E\u30EC\u30D9\u30EBfetch\u3002\`init.query\` \u3067\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6307\u5B9A\u3002\`key\` \u306F\u81EA\u52D5\u4ED8\u4E0E
112441
- - \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns, rows, raw }\` \u306B\u30D1\u30FC\u30B9
112459
+ - \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns: string[], rows: Record<string, string>[], raw: string }\` \u306B\u30D1\u30FC\u30B9
112442
112460
  - \`client.trends(path, query?)\` \u2014 Trends API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/analytics/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
112443
112461
  - \`client.projects(path, init?)\` \u2014 Projects API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/management/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
112444
112462
 
112463
+ \u26A0\uFE0F **\u91CD\u8981: \`report()\` \u306E\u884C\uFF08row\uFF09\u306E\u5F62\u72B6\u306B\u3064\u3044\u3066\u3002** \`rows\` \u306F \`Record<string, string>[]\` \u3067\u3059 \u2014 \u5404\u884C\u306F CSV \u306E\u30AB\u30E9\u30E0\u300C\u540D\u300D\uFF08\`columns\` \u3068\u4E00\u81F4\uFF09\u3092\u30AD\u30FC\u3068\u3057\u305F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u3001\u4F4D\u7F6E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u306E\u914D\u5217\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30D5\u30A3\u30FC\u30EB\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u306F\u5FC5\u305A \`row["Url"]\`\u3001\`row["Keyword"]\`\u3001\`row["Search Volume"]\`\uFF08\u30AB\u30E9\u30E0\u540D\u306B\u30B9\u30DA\u30FC\u30B9\u3092\u542B\u3080\u3053\u3068\u3042\u308A\uFF09\u306E\u3088\u3046\u306B\u30AB\u30E9\u30E0\u540D\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\`columns.indexOf("Url")\` \u3067\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u53D6\u5F97\u3057\u3066\u304B\u3089 \`row[index]\` \u3067\u30A2\u30AF\u30BB\u30B9\u3057\u3066\u306F\u3044\u3051\u307E\u305B\u3093 \u2014 \u305D\u308C\u306F \`undefined\` \u3092\u8FD4\u3057\u3001\`?? ""\` \u3084 \`Number(...) || 0\` \u3068\u7D44\u307F\u5408\u308F\u3055\u308B\u3053\u3068\u3067\u7D50\u679C\u304C\u7A7A\u306B\u306A\u308B\u7121\u97F3\u306E\u5931\u6557\u3092\u751F\u307F\u307E\u3059\u3002\u5168\u3066\u306E\u5024\u306F\u6587\u5B57\u5217\u306A\u306E\u3067\u3001\u6570\u5024\u30AB\u30E9\u30E0\u306F \`Number(row["Position"])\` \u3067\u660E\u793A\u5909\u63DB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
112464
+
112445
112465
  \`\`\`ts
112446
112466
  import type { Context } from "hono";
112447
112467
  import { connection } from "@squadbase/vite-server/connectors/semrush";
@@ -112454,9 +112474,25 @@ export default async function handler(c: Context) {
112454
112474
  database?: string;
112455
112475
  }>();
112456
112476
 
112457
- const overview = await semrush.report("domain_overview", { domain, database });
112477
+ const result = await semrush.report("domain_organic", {
112478
+ domain,
112479
+ database,
112480
+ display_limit: "100",
112481
+ });
112482
+
112483
+ // \u2705 \u6B63: \u30AB\u30E9\u30E0\u540D\u3067\u30A2\u30AF\u30BB\u30B9\u3059\u308B
112484
+ const rows = result.rows.map((row) => ({
112485
+ keyword: row["Keyword"],
112486
+ position: Number(row["Position"]) || 0,
112487
+ searchVolume: Number(row["Search Volume"]) || 0,
112488
+ url: row["Url"] ?? "",
112489
+ }));
112490
+
112491
+ // \u274C \u8AA4: \u884C\u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u914D\u5217\u3067\u306F\u306A\u3044\u305F\u3081 row[index] \u306F undefined \u306B\u306A\u308B
112492
+ // const urlIdx = result.columns.indexOf("Url");
112493
+ // const url = (row as unknown as string[])[urlIdx];
112458
112494
 
112459
- return c.json({ columns: overview.columns, rows: overview.rows });
112495
+ return c.json({ columns: result.columns, rows });
112460
112496
  }
112461
112497
  \`\`\`
112462
112498
 
@@ -112365,10 +112365,12 @@ The business logic type for this connector is "typescript". Write handler code u
112365
112365
 
112366
112366
  SDK methods (client created via \`connection(connectionId)\`):
112367
112367
  - \`client.request(path, init?)\` \u2014 low-level authenticated fetch. Pass \`init.query\` to set query parameters; \`key\` is injected automatically
112368
- - \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns, rows, raw }\`
112368
+ - \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns: string[], rows: Record<string, string>[], raw: string }\`
112369
112369
  - \`client.trends(path, query?)\` \u2014 call a Trends API endpoint (\`/analytics/v1/...\`) and return parsed JSON
112370
112370
  - \`client.projects(path, init?)\` \u2014 call a Projects API endpoint (\`/management/v1/...\`) and return parsed JSON
112371
112371
 
112372
+ \u26A0\uFE0F **Important: \`report()\` row shape.** \`rows\` is \`Record<string, string>[]\` \u2014 each row is an object keyed by the CSV column NAME (matching \`columns\`), NOT a positional array. Access fields with \`row["Url"]\`, \`row["Keyword"]\`, \`row["Search Volume"]\` (column names may contain spaces). Do NOT use \`columns.indexOf("Url")\` and then \`row[index]\` \u2014 that returns \`undefined\` and silently produces empty results when combined with \`?? ""\` or \`Number(...) || 0\`. All values are strings; convert numeric columns with \`Number(row["Position"])\`.
112373
+
112372
112374
  \`\`\`ts
112373
112375
  import type { Context } from "hono";
112374
112376
  import { connection } from "@squadbase/vite-server/connectors/semrush";
@@ -112381,9 +112383,25 @@ export default async function handler(c: Context) {
112381
112383
  database?: string;
112382
112384
  }>();
112383
112385
 
112384
- const overview = await semrush.report("domain_overview", { domain, database });
112386
+ const result = await semrush.report("domain_organic", {
112387
+ domain,
112388
+ database,
112389
+ display_limit: "100",
112390
+ });
112391
+
112392
+ // \u2705 Correct: access by column name
112393
+ const rows = result.rows.map((row) => ({
112394
+ keyword: row["Keyword"],
112395
+ position: Number(row["Position"]) || 0,
112396
+ searchVolume: Number(row["Search Volume"]) || 0,
112397
+ url: row["Url"] ?? "",
112398
+ }));
112399
+
112400
+ // \u274C Wrong: do NOT do this \u2014 row[index] is undefined because rows are objects, not arrays
112401
+ // const urlIdx = result.columns.indexOf("Url");
112402
+ // const url = (row as unknown as string[])[urlIdx];
112385
112403
 
112386
- return c.json({ columns: overview.columns, rows: overview.rows });
112404
+ return c.json({ columns: result.columns, rows });
112387
112405
  }
112388
112406
  \`\`\`
112389
112407
 
@@ -112439,10 +112457,12 @@ To check remaining API units (free, does NOT consume units), call the request to
112439
112457
 
112440
112458
  SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
112441
112459
  - \`client.request(path, init?)\` \u2014 \u8A8D\u8A3C\u4ED8\u304D\u306E\u4F4E\u30EC\u30D9\u30EBfetch\u3002\`init.query\` \u3067\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6307\u5B9A\u3002\`key\` \u306F\u81EA\u52D5\u4ED8\u4E0E
112442
- - \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns, rows, raw }\` \u306B\u30D1\u30FC\u30B9
112460
+ - \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns: string[], rows: Record<string, string>[], raw: string }\` \u306B\u30D1\u30FC\u30B9
112443
112461
  - \`client.trends(path, query?)\` \u2014 Trends API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/analytics/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
112444
112462
  - \`client.projects(path, init?)\` \u2014 Projects API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/management/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
112445
112463
 
112464
+ \u26A0\uFE0F **\u91CD\u8981: \`report()\` \u306E\u884C\uFF08row\uFF09\u306E\u5F62\u72B6\u306B\u3064\u3044\u3066\u3002** \`rows\` \u306F \`Record<string, string>[]\` \u3067\u3059 \u2014 \u5404\u884C\u306F CSV \u306E\u30AB\u30E9\u30E0\u300C\u540D\u300D\uFF08\`columns\` \u3068\u4E00\u81F4\uFF09\u3092\u30AD\u30FC\u3068\u3057\u305F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u3001\u4F4D\u7F6E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u306E\u914D\u5217\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30D5\u30A3\u30FC\u30EB\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u306F\u5FC5\u305A \`row["Url"]\`\u3001\`row["Keyword"]\`\u3001\`row["Search Volume"]\`\uFF08\u30AB\u30E9\u30E0\u540D\u306B\u30B9\u30DA\u30FC\u30B9\u3092\u542B\u3080\u3053\u3068\u3042\u308A\uFF09\u306E\u3088\u3046\u306B\u30AB\u30E9\u30E0\u540D\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\`columns.indexOf("Url")\` \u3067\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u53D6\u5F97\u3057\u3066\u304B\u3089 \`row[index]\` \u3067\u30A2\u30AF\u30BB\u30B9\u3057\u3066\u306F\u3044\u3051\u307E\u305B\u3093 \u2014 \u305D\u308C\u306F \`undefined\` \u3092\u8FD4\u3057\u3001\`?? ""\` \u3084 \`Number(...) || 0\` \u3068\u7D44\u307F\u5408\u308F\u3055\u308B\u3053\u3068\u3067\u7D50\u679C\u304C\u7A7A\u306B\u306A\u308B\u7121\u97F3\u306E\u5931\u6557\u3092\u751F\u307F\u307E\u3059\u3002\u5168\u3066\u306E\u5024\u306F\u6587\u5B57\u5217\u306A\u306E\u3067\u3001\u6570\u5024\u30AB\u30E9\u30E0\u306F \`Number(row["Position"])\` \u3067\u660E\u793A\u5909\u63DB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
112465
+
112446
112466
  \`\`\`ts
112447
112467
  import type { Context } from "hono";
112448
112468
  import { connection } from "@squadbase/vite-server/connectors/semrush";
@@ -112455,9 +112475,25 @@ export default async function handler(c: Context) {
112455
112475
  database?: string;
112456
112476
  }>();
112457
112477
 
112458
- const overview = await semrush.report("domain_overview", { domain, database });
112478
+ const result = await semrush.report("domain_organic", {
112479
+ domain,
112480
+ database,
112481
+ display_limit: "100",
112482
+ });
112483
+
112484
+ // \u2705 \u6B63: \u30AB\u30E9\u30E0\u540D\u3067\u30A2\u30AF\u30BB\u30B9\u3059\u308B
112485
+ const rows = result.rows.map((row) => ({
112486
+ keyword: row["Keyword"],
112487
+ position: Number(row["Position"]) || 0,
112488
+ searchVolume: Number(row["Search Volume"]) || 0,
112489
+ url: row["Url"] ?? "",
112490
+ }));
112491
+
112492
+ // \u274C \u8AA4: \u884C\u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u914D\u5217\u3067\u306F\u306A\u3044\u305F\u3081 row[index] \u306F undefined \u306B\u306A\u308B
112493
+ // const urlIdx = result.columns.indexOf("Url");
112494
+ // const url = (row as unknown as string[])[urlIdx];
112459
112495
 
112460
- return c.json({ columns: overview.columns, rows: overview.rows });
112496
+ return c.json({ columns: result.columns, rows });
112461
112497
  }
112462
112498
  \`\`\`
112463
112499
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squadbase/vite-server",
3
- "version": "0.1.9-dev.a70dcaa",
3
+ "version": "0.1.9-dev.c9c23a3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {