@synterai/sdk-js 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # @synterai/sdk-js
2
2
 
3
- TypeScript SDK for the [Synter](https://syntermedia.ai) advertising API — manage campaigns across Google Ads, Meta, LinkedIn, Microsoft Ads, Reddit, TikTok, and X from your own code, with full types and IDE autocomplete.
3
+ TypeScript SDK for the [Synter](https://syntermedia.ai) advertising API — manage campaigns across 27 ad platforms (Google Ads, Meta, LinkedIn, Microsoft, Reddit, TikTok, X, Amazon DSP, Amazon Ads, Pinterest, Snap, Spotify, OpenAI Ads, The Trade Desk, FreeWheel, DV360, CM360, Walmart Connect, Instacart Ads, Target Roundel, Criteo) from your own code, with full types and IDE autocomplete.
4
4
 
5
- > **`0.1.0` — early release.** Live on npm and installable, but pre-1.0: the surface may change before a stable `1.0`. Pin a version in production.
5
+ > **`0.1.2` — live on npm.** Pre-1.0: the surface may change before a stable `1.0`. Pin a version in production. `0.1.2` fixes `analytics.getPerformance({ platform: "google" | "linkedin" })`, which in `0.1.0`/`0.1.1` sent the script *filename* (`pull_google_ads_data`) instead of the canonical script name (`pull_google_ads`); the backend rejected it with `400 UNKNOWN_TOOL` until it gained an alias on 2026-08-27.
6
6
 
7
7
  ## What this actually talks to
8
8
 
9
- Every method in this SDK calls the same live, production endpoint that powers Synter's MCP server (`@synterai/mcp-server`) and the `synter` CLI: `POST https://syntermedia.ai/api/v1/tools/run`. There is no separate "SDK backend" — if a method works here, it works because the exact same call already works for every MCP client (Claude, Cursor, Codex, ChatGPT) today.
9
+ Every method in this SDK calls the same live, production endpoint that powers Synter's MCP server (`@synterai/mcp-server`) and the `synter` CLI: `POST https://syntermedia.ai/api/v1/tools/run`. There is no separate "SDK backend" — if a method works here, it works because the exact same call already works for every MCP client (Claude, Cursor, Codex, Devin, ChatGPT) today.
10
10
 
11
11
  See [`../sdk-shared/SPEC.md`](../sdk-shared/SPEC.md) and [`../sdk-shared/catalog.json`](../sdk-shared/catalog.json) for the full transport contract this SDK — and every sibling-language SDK — implements.
12
12
 
@@ -18,7 +18,7 @@ npm install @synterai/sdk-js
18
18
 
19
19
  ## Authentication
20
20
 
21
- Get an API key at [syntermedia.ai/developer](https://syntermedia.ai/developer). Keys look like `syn_` followed by 32 base64url characters.
21
+ Get an API key at [syntermedia.ai/developer](https://syntermedia.ai/developer). Keys look like `syn_` followed by 32 base64url characters. Keys issued from a sandbox workspace use the `syn_test_` prefix instead and only work against that sandbox — no live ad-account risk.
22
22
 
23
23
  > **⚠️ Server-side only.** Your `SYNTER_API_KEY` is a secret that can spend money and modify your ad accounts. Use this SDK from a **backend** — a Node service, a Next.js API route or Server Action, an edge/serverless function. **Never** instantiate `Synter` in client-side code (React components, browser bundles, mobile apps); the key would ship to every visitor. For a React/SPA frontend, call your own backend, and have the backend call Synter.
24
24
 
package/dist/index.d.mts CHANGED
@@ -161,9 +161,7 @@ declare class CampaignsResource {
161
161
  * Both are custom-dispatch per SPEC.md's testing bar (not forced through
162
162
  * the generic argMapping-only path): get_performance has a platform-scoped
163
163
  * `onlyForPlatform` flag and a `dateRangeToDays` transform; get_daily_spend
164
- * has a fixed script name but still resolves/sends a platform, and (unlike
165
- * any other tool) also re-emits that resolved platform as an uppercased
166
- * CLI flag.
164
+ * uses the same platform-routed pull scripts with `--days` (default 7).
167
165
  */
168
166
 
169
167
  interface GetPerformanceInput {
package/dist/index.d.ts CHANGED
@@ -161,9 +161,7 @@ declare class CampaignsResource {
161
161
  * Both are custom-dispatch per SPEC.md's testing bar (not forced through
162
162
  * the generic argMapping-only path): get_performance has a platform-scoped
163
163
  * `onlyForPlatform` flag and a `dateRangeToDays` transform; get_daily_spend
164
- * has a fixed script name but still resolves/sends a platform, and (unlike
165
- * any other tool) also re-emits that resolved platform as an uppercased
166
- * CLI flag.
164
+ * uses the same platform-routed pull scripts with `--days` (default 7).
167
165
  */
168
166
 
169
167
  interface GetPerformanceInput {
package/dist/index.js CHANGED
@@ -151,7 +151,7 @@ function flattenArgsToFlags(args) {
151
151
 
152
152
  // src/resources/campaigns.ts
153
153
  var LIST_CAMPAIGNS_SCRIPT_BY_PLATFORM = {
154
- google: "google_ads_list_campaigns",
154
+ google: "google_ads_get_campaigns",
155
155
  meta: "meta_ads_list_campaigns",
156
156
  linkedin: "linkedin_ads_list_campaigns",
157
157
  microsoft: "microsoft_ads_list_campaigns",
@@ -279,9 +279,9 @@ var CampaignsResource = class {
279
279
 
280
280
  // src/resources/analytics.ts
281
281
  var GET_PERFORMANCE_SCRIPT_BY_PLATFORM = {
282
- google: "pull_google_ads_data",
282
+ google: "pull_google_ads",
283
283
  meta: "pull_meta_ads",
284
- linkedin: "pull_linkedin_ads_data",
284
+ linkedin: "pull_linkedin_ads",
285
285
  microsoft: "pull_microsoft_ads",
286
286
  reddit: "pull_reddit_ads",
287
287
  tiktok: "pull_tiktok_ads",
@@ -313,17 +313,22 @@ var AnalyticsResource = class {
313
313
  "google",
314
314
  input.platform
315
315
  );
316
- const args = buildArgsFromMapping(GET_PERFORMANCE_ARG_MAPPING, input, platform);
316
+ const args = buildArgsFromMapping(
317
+ GET_PERFORMANCE_ARG_MAPPING,
318
+ { ...input, date_range: input.date_range ?? "LAST_7_DAYS" },
319
+ platform
320
+ );
317
321
  return this.client.runTool(scriptName, args, platform);
318
322
  }
319
323
  /** Get daily spend breakdown across all connected ad accounts. */
320
324
  async getDailySpend(input = {}) {
321
- const platform = input.platform ?? "google";
322
- const args = ["--platform", platform.toUpperCase()];
323
- if (input.days !== void 0) {
324
- args.push("--days", String(input.days));
325
- }
326
- return this.client.runTool("get_account_daily_spend", args, platform);
325
+ const { platform, scriptName } = resolvePlatformScriptName(
326
+ GET_PERFORMANCE_SCRIPT_BY_PLATFORM,
327
+ "google",
328
+ input.platform
329
+ );
330
+ const days = input.days ?? 7;
331
+ return this.client.runTool(scriptName, ["--days", String(days)], platform);
327
332
  }
328
333
  };
329
334
 
@@ -906,7 +911,7 @@ var Synter = class {
906
911
  // ---------------------------------------------------------------------
907
912
  /** List all connected ad accounts across platforms. */
908
913
  async listAdAccounts() {
909
- return this.runTool("google_ads_list_customers", [], "google");
914
+ return this.runTool("google_ads_get_customers", [], "google");
910
915
  }
911
916
  /**
912
917
  * Upload an image as an asset for use in ads.
package/dist/index.mjs CHANGED
@@ -98,7 +98,7 @@ function flattenArgsToFlags(args) {
98
98
 
99
99
  // src/resources/campaigns.ts
100
100
  var LIST_CAMPAIGNS_SCRIPT_BY_PLATFORM = {
101
- google: "google_ads_list_campaigns",
101
+ google: "google_ads_get_campaigns",
102
102
  meta: "meta_ads_list_campaigns",
103
103
  linkedin: "linkedin_ads_list_campaigns",
104
104
  microsoft: "microsoft_ads_list_campaigns",
@@ -226,9 +226,9 @@ var CampaignsResource = class {
226
226
 
227
227
  // src/resources/analytics.ts
228
228
  var GET_PERFORMANCE_SCRIPT_BY_PLATFORM = {
229
- google: "pull_google_ads_data",
229
+ google: "pull_google_ads",
230
230
  meta: "pull_meta_ads",
231
- linkedin: "pull_linkedin_ads_data",
231
+ linkedin: "pull_linkedin_ads",
232
232
  microsoft: "pull_microsoft_ads",
233
233
  reddit: "pull_reddit_ads",
234
234
  tiktok: "pull_tiktok_ads",
@@ -260,17 +260,22 @@ var AnalyticsResource = class {
260
260
  "google",
261
261
  input.platform
262
262
  );
263
- const args = buildArgsFromMapping(GET_PERFORMANCE_ARG_MAPPING, input, platform);
263
+ const args = buildArgsFromMapping(
264
+ GET_PERFORMANCE_ARG_MAPPING,
265
+ { ...input, date_range: input.date_range ?? "LAST_7_DAYS" },
266
+ platform
267
+ );
264
268
  return this.client.runTool(scriptName, args, platform);
265
269
  }
266
270
  /** Get daily spend breakdown across all connected ad accounts. */
267
271
  async getDailySpend(input = {}) {
268
- const platform = input.platform ?? "google";
269
- const args = ["--platform", platform.toUpperCase()];
270
- if (input.days !== void 0) {
271
- args.push("--days", String(input.days));
272
- }
273
- return this.client.runTool("get_account_daily_spend", args, platform);
272
+ const { platform, scriptName } = resolvePlatformScriptName(
273
+ GET_PERFORMANCE_SCRIPT_BY_PLATFORM,
274
+ "google",
275
+ input.platform
276
+ );
277
+ const days = input.days ?? 7;
278
+ return this.client.runTool(scriptName, ["--days", String(days)], platform);
274
279
  }
275
280
  };
276
281
 
@@ -853,7 +858,7 @@ var Synter = class {
853
858
  // ---------------------------------------------------------------------
854
859
  /** List all connected ad accounts across platforms. */
855
860
  async listAdAccounts() {
856
- return this.runTool("google_ads_list_customers", [], "google");
861
+ return this.runTool("google_ads_get_customers", [], "google");
857
862
  }
858
863
  /**
859
864
  * Upload an image as an asset for use in ads.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synterai/sdk-js",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "TypeScript SDK for the Synter advertising API — manage campaigns across Google Ads, Meta, LinkedIn, Reddit, Microsoft, TikTok, and X",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",