@zapier/zapier-sdk 0.91.0 → 0.92.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.
@@ -821,7 +821,8 @@ function isSdkPage(value) {
821
821
  }
822
822
  function createPageFunction(coreFn, {
823
823
  sdk,
824
- adaptPage
824
+ adaptPage,
825
+ finalizePage
825
826
  }) {
826
827
  const functionName = coreFn.name + "Page";
827
828
  const namedFunctions = {
@@ -834,7 +835,7 @@ function createPageFunction(coreFn, {
834
835
  `${functionName}: paginated result must be exactly { data: TItem[], nextCursor? } (produced by the handler or its \`adaptPage\`); got keys [${page && typeof page === "object" ? Object.keys(page).join(", ") : typeof page}]. If the handler returns a raw shape, set \`adaptPage\` to translate it; if \`adaptPage\` already runs, it must return only \`data\`/\`nextCursor\`.`
835
836
  );
836
837
  }
837
- return page;
838
+ return finalizePage ? finalizePage(page) : page;
838
839
  } catch (error) {
839
840
  throw normalizeError(
840
841
  error,
@@ -853,9 +854,14 @@ function createPaginatedFunction(coreFn, options) {
853
854
  defaultPageSize,
854
855
  adaptPage,
855
856
  annotator,
857
+ finalizePage,
856
858
  getDeprecation
857
859
  } = options;
858
- const pageFunction = createPageFunction(coreFn, { sdk, adaptPage });
860
+ const pageFunction = createPageFunction(coreFn, {
861
+ sdk,
862
+ adaptPage,
863
+ finalizePage
864
+ });
859
865
  const functionName = name || coreFn.name;
860
866
  const namedFunctions = {
861
867
  [functionName]: function(callOptions) {
@@ -1372,6 +1378,7 @@ function defineMethod(config) {
1372
1378
  importBindings: deps.bindings,
1373
1379
  inputSchema: config.inputSchema,
1374
1380
  skipInputValidation: config.skipInputValidation,
1381
+ skipOutputValidation: config.skipOutputValidation,
1375
1382
  meta: collectLeafMeta(config),
1376
1383
  resolvers: config.resolvers,
1377
1384
  formatter: config.formatter,
@@ -1812,6 +1819,95 @@ var getRegistryPlugin = defineMethod({
1812
1819
  inputSchema: z.object({ package: z.string().optional() }).optional(),
1813
1820
  run: ({ imports, input }) => buildSurfaceRegistry(imports.context, input?.package)
1814
1821
  });
1822
+ function isRecord(value) {
1823
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1824
+ }
1825
+ function diffDroppedPaths(raw, parsed, prefix = "") {
1826
+ const paths = [];
1827
+ walkDroppedPaths(raw, parsed, prefix, paths);
1828
+ return paths;
1829
+ }
1830
+ function walkDroppedPaths(raw, parsed, prefix, out) {
1831
+ if (Array.isArray(raw) && Array.isArray(parsed)) {
1832
+ const seen = /* @__PURE__ */ new Set();
1833
+ const length = Math.min(raw.length, parsed.length);
1834
+ for (let index = 0; index < length; index++) {
1835
+ const elementPaths = [];
1836
+ walkDroppedPaths(raw[index], parsed[index], `${prefix}[]`, elementPaths);
1837
+ for (const path of elementPaths) {
1838
+ if (seen.has(path)) continue;
1839
+ seen.add(path);
1840
+ out.push(path);
1841
+ }
1842
+ }
1843
+ return;
1844
+ }
1845
+ if (isRecord(raw) && isRecord(parsed)) {
1846
+ for (const key of Object.keys(raw)) {
1847
+ const path = prefix ? `${prefix}.${key}` : key;
1848
+ if (!(key in parsed)) {
1849
+ out.push(path);
1850
+ continue;
1851
+ }
1852
+ walkDroppedPaths(raw[key], parsed[key], path, out);
1853
+ }
1854
+ return;
1855
+ }
1856
+ }
1857
+ function parseOutput(schema, value, policy, locator) {
1858
+ const result = schema.safeParse(value);
1859
+ if (result.success) return result.data;
1860
+ const issues = result.error.issues.map((issue) => {
1861
+ const path = issue.path.length > 0 ? issue.path.join(".") : "data";
1862
+ return `${path}: ${issue.message}`;
1863
+ });
1864
+ const subject = policy.methodName ? ` for "${policy.methodName}"` : "";
1865
+ const at = locator ? ` at ${locator}` : "";
1866
+ throw createCoreError(
1867
+ {
1868
+ code: CoreErrorCode.Validation,
1869
+ message: `Output validation failed${subject}${at}:
1870
+ ${issues.join("\n ")}
1871
+
1872
+ The response does not match the method's \`outputSchema\`. Correct the schema, or set \`skipOutputValidation: true\` on the method to pass the response through unvalidated.`,
1873
+ details: { zodErrors: result.error.issues, output: value }
1874
+ },
1875
+ policy.adaptError
1876
+ );
1877
+ }
1878
+ function applyItemOutputPolicy(result, policy) {
1879
+ const schema = policy.outputSchema;
1880
+ if (!schema || policy.skipOutputValidation) return result;
1881
+ if (!isRecord(result) || !("data" in result)) return result;
1882
+ const data = parseOutput(schema, result.data, policy);
1883
+ const next = { ...result, data };
1884
+ if (policy.includeOutputValidationDroppedPaths) {
1885
+ const droppedPaths = diffDroppedPaths(result.data, data);
1886
+ if (droppedPaths.length > 0) {
1887
+ next.meta = withOutputValidation(result.meta, droppedPaths);
1888
+ }
1889
+ }
1890
+ return next;
1891
+ }
1892
+ function withOutputValidation(existing, droppedPaths) {
1893
+ const base = isRecord(existing) ? existing : {};
1894
+ return { ...base, outputValidation: { droppedPaths } };
1895
+ }
1896
+ function applyListOutputPolicy(page, policy) {
1897
+ const schema = policy.outputSchema;
1898
+ if (!schema || policy.skipOutputValidation) return page;
1899
+ const data = page.data.map(
1900
+ (item, index) => parseOutput(schema, item, policy, `data[${index}]`)
1901
+ );
1902
+ const next = { ...page, data };
1903
+ if (policy.includeOutputValidationDroppedPaths) {
1904
+ const droppedPaths = diffDroppedPaths(page.data, data);
1905
+ if (droppedPaths.length > 0) {
1906
+ next.meta = { ...page.meta, outputValidation: { droppedPaths } };
1907
+ }
1908
+ }
1909
+ return next;
1910
+ }
1815
1911
  var FRAMEWORK_CONFIGURATION_IDS = /* @__PURE__ */ new Set([
1816
1912
  CORE_OPTIONS_ID
1817
1913
  ]);
@@ -1874,6 +1970,9 @@ function edgesOf(plugin) {
1874
1970
  function isStandIn(plugin) {
1875
1971
  return (plugin.pluginType === "method" || plugin.pluginType === "property" || plugin.pluginType === "aggregate") && plugin.standIn === true;
1876
1972
  }
1973
+ function isDefault(plugin) {
1974
+ return (plugin.pluginType === "method" || plugin.pluginType === "property") && plugin.defaultSource !== void 0;
1975
+ }
1877
1976
  function topoOrder(descriptors) {
1878
1977
  const order = [];
1879
1978
  const visited = /* @__PURE__ */ new Set();
@@ -1888,28 +1987,89 @@ function topoOrder(descriptors) {
1888
1987
  return order;
1889
1988
  }
1890
1989
  function collectPlugins(root, materialized = /* @__PURE__ */ new Set(), configuration) {
1990
+ const rank = (plugin) => isStandIn(plugin) ? 0 : isDefault(plugin) ? 1 : 2;
1991
+ const allNodes = [];
1992
+ const seen = /* @__PURE__ */ new Set();
1993
+ const collect = (plugin) => {
1994
+ if (materialized.has(plugin.id) || seen.has(plugin)) return;
1995
+ seen.add(plugin);
1996
+ allNodes.push(plugin);
1997
+ for (const edge of edgesOf(plugin)) collect(edge);
1998
+ };
1999
+ collect(root);
2000
+ const childrenOf = /* @__PURE__ */ new Map();
2001
+ const candidatesById = /* @__PURE__ */ new Map();
2002
+ for (const node of allNodes) {
2003
+ childrenOf.set(
2004
+ node,
2005
+ edgesOf(node).filter((edge) => seen.has(edge))
2006
+ );
2007
+ const candidates = candidatesById.get(node.id);
2008
+ if (candidates) candidates.push(node);
2009
+ else candidatesById.set(node.id, [node]);
2010
+ }
2011
+ const live = new Set(allNodes);
2012
+ for (; ; ) {
2013
+ const reachable = /* @__PURE__ */ new Set();
2014
+ if (live.has(root)) reachable.add(root);
2015
+ const queue = reachable.has(root) ? [root] : [];
2016
+ while (queue.length) {
2017
+ const node = queue.pop();
2018
+ for (const child of childrenOf.get(node) ?? []) {
2019
+ if (reachable.has(child)) continue;
2020
+ reachable.add(child);
2021
+ if (live.has(child)) queue.push(child);
2022
+ }
2023
+ }
2024
+ let changed = false;
2025
+ for (const node of live) {
2026
+ if (!reachable.has(node)) {
2027
+ live.delete(node);
2028
+ changed = true;
2029
+ }
2030
+ }
2031
+ for (const candidates of candidatesById.values()) {
2032
+ let maxRank = -1;
2033
+ for (const candidate of candidates) {
2034
+ if (live.has(candidate)) maxRank = Math.max(maxRank, rank(candidate));
2035
+ }
2036
+ if (maxRank < 0) continue;
2037
+ for (const candidate of candidates) {
2038
+ if (live.has(candidate) && rank(candidate) < maxRank) {
2039
+ live.delete(candidate);
2040
+ changed = true;
2041
+ }
2042
+ }
2043
+ }
2044
+ if (!changed) break;
2045
+ }
1891
2046
  const byId = /* @__PURE__ */ new Map();
1892
- const visit = (plugin) => {
1893
- if (materialized.has(plugin.id)) return;
1894
- const existing = byId.get(plugin.id);
1895
- if (existing === plugin) return;
1896
- if (existing) {
1897
- const bothReal = !isStandIn(existing) && !isStandIn(plugin);
1898
- if (bothReal) {
2047
+ const conflictedDefaults = /* @__PURE__ */ new Set();
2048
+ const isOptional = (plugin) => "optional" in plugin && plugin.optional === true;
2049
+ for (const [id, candidates] of candidatesById) {
2050
+ const liveCandidates = candidates.filter(
2051
+ (candidate) => live.has(candidate)
2052
+ );
2053
+ const winner = liveCandidates.find((candidate) => !isOptional(candidate)) ?? liveCandidates[0];
2054
+ if (!winner) continue;
2055
+ if (liveCandidates.length > 1) {
2056
+ const winnerRank = rank(winner);
2057
+ if (winnerRank === 2) {
1899
2058
  throw new Error(
1900
- `createSdk: duplicate plugin id "${plugin.id}". Two different plugins registered under the same id.`
2059
+ `createSdk: duplicate plugin id "${id}". Two different plugins registered under the same id.`
1901
2060
  );
1902
2061
  }
1903
- if (isStandIn(existing) && !isStandIn(plugin)) {
1904
- byId.set(plugin.id, plugin);
1905
- for (const edge of edgesOf(plugin)) visit(edge);
2062
+ if (winnerRank === 1) {
2063
+ const sources = new Set(
2064
+ liveCandidates.map(
2065
+ (candidate) => candidate.defaultSource
2066
+ )
2067
+ );
2068
+ if (sources.size > 1) conflictedDefaults.add(id);
1906
2069
  }
1907
- return;
1908
2070
  }
1909
- byId.set(plugin.id, plugin);
1910
- for (const edge of edgesOf(plugin)) visit(edge);
1911
- };
1912
- visit(root);
2071
+ byId.set(id, winner);
2072
+ }
1913
2073
  if (configuration) {
1914
2074
  for (const [id, value] of Object.entries(configuration)) {
1915
2075
  const existing = byId.get(id);
@@ -1960,6 +2120,14 @@ function collectPlugins(root, materialized = /* @__PURE__ */ new Set(), configur
1960
2120
  );
1961
2121
  }
1962
2122
  }
2123
+ for (const id of conflictedDefaults) {
2124
+ const winner = byId.get(id);
2125
+ if (winner && isDefault(winner)) {
2126
+ throw new Error(
2127
+ `createSdk: conflicting defaults for "${id}". Two different plugins were declared as defaults for the same id and nothing else provides it. Register an explicit (non-default) plugin for this id to choose the winner, or give the implementations distinct ids if they are meant to coexist.`
2128
+ );
2129
+ }
2130
+ }
1963
2131
  return byId;
1964
2132
  }
1965
2133
  function bindValue({
@@ -2282,6 +2450,7 @@ function buildMethodEntries(descriptors, context, states) {
2282
2450
  const plugins = context.plugins;
2283
2451
  for (const [id, descriptor] of descriptors) {
2284
2452
  if (descriptor.pluginType !== "method") continue;
2453
+ if (isStandIn(descriptor)) continue;
2285
2454
  const out = normalizeOutput(descriptor.output);
2286
2455
  const entry = {
2287
2456
  pluginType: "method",
@@ -2334,6 +2503,16 @@ function buildMethodEntries(descriptors, context, states) {
2334
2503
  const sdk = { context };
2335
2504
  const methodAnnotator = descriptor.annotator;
2336
2505
  const boundAnnotator = methodAnnotator ? (input) => methodAnnotator({ input }) : void 0;
2506
+ const outputPolicy = () => {
2507
+ const core = resolveCoreOptions(context);
2508
+ return {
2509
+ outputSchema: descriptor.meta?.outputSchema,
2510
+ skipOutputValidation: descriptor.skipOutputValidation,
2511
+ includeOutputValidationDroppedPaths: core?.includeOutputValidationDroppedPaths,
2512
+ methodName: descriptor.name,
2513
+ adaptError: core?.adaptError
2514
+ };
2515
+ };
2337
2516
  if (out.type === "list") {
2338
2517
  entry.value = createPaginatedFunction(
2339
2518
  fold(callRun),
@@ -2344,11 +2523,15 @@ function buildMethodEntries(descriptors, context, states) {
2344
2523
  defaultPageSize: out.defaultPageSize,
2345
2524
  adaptPage: out.adaptPage,
2346
2525
  annotator: boundAnnotator,
2526
+ // Validate + strip each item against the item `outputSchema`
2527
+ // (item mode's sibling); dropped paths surface as `[].x` in the page's
2528
+ // `meta`, unioned across items.
2529
+ finalizePage: (page) => applyListOutputPolicy(page, outputPolicy()),
2347
2530
  getDeprecation: () => entry.meta?.deprecation
2348
2531
  }
2349
2532
  );
2350
2533
  } else if (out.type === "item") {
2351
- const itemCore = async (input, ctx) => callRun(input, ctx);
2534
+ const itemCore = async (input, ctx) => applyItemOutputPolicy(await callRun(input, ctx), outputPolicy());
2352
2535
  entry.value = createFunction(
2353
2536
  fold(itemCore),
2354
2537
  {
@@ -4288,6 +4471,7 @@ var ZapierConflictError = class extends ZapierError {
4288
4471
  this.name = "ZapierConflictError";
4289
4472
  this.code = "ZAPIER_CONFLICT_ERROR";
4290
4473
  this.resourceType = options.resourceType;
4474
+ this.meta = options.meta;
4291
4475
  }
4292
4476
  };
4293
4477
  var ZapierRateLimitError = class extends ZapierError {
@@ -5997,7 +6181,7 @@ function parseDeprecationDate(value) {
5997
6181
  }
5998
6182
 
5999
6183
  // src/sdk-version.ts
6000
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.91.0" : void 0) || "unknown";
6184
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.92.0" : void 0) || "unknown";
6001
6185
 
6002
6186
  // src/utils/open-url.ts
6003
6187
  var nodePrefix = "node:";
@@ -9958,6 +10142,7 @@ var listActionsPlugin = defineMethod({
9958
10142
  itemType: "Action",
9959
10143
  inputSchema: ListActionsInputSchema,
9960
10144
  outputSchema: ActionItemSchema,
10145
+ skipOutputValidation: true,
9961
10146
  formatter: actionItemFormatter,
9962
10147
  output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
9963
10148
  // Only `app` carries a resolver: `actionType` is an optional filter, and the
@@ -10022,6 +10207,7 @@ var getActionPlugin = defineMethod({
10022
10207
  itemType: "Action",
10023
10208
  inputSchema: GetActionInputSchema,
10024
10209
  outputSchema: ActionItemSchema,
10210
+ skipOutputValidation: true,
10025
10211
  output: "item",
10026
10212
  formatter: actionItemFormatter,
10027
10213
  resolvers: {
@@ -10113,6 +10299,7 @@ var runActionPlugin = defineMethod({
10113
10299
  itemType: "ActionResult",
10114
10300
  inputSchema: RunActionInputSchema,
10115
10301
  outputSchema: ActionResultItemSchema,
10302
+ skipOutputValidation: true,
10116
10303
  formatter: actionResultItemFormatter,
10117
10304
  // No defaultPageSize — leave the default to the Actions API rather than
10118
10305
  // eagerly running more actions than the user intends (avoids app rate limits).
@@ -10228,12 +10415,18 @@ var runActionPlugin = defineMethod({
10228
10415
  timeoutMilliseconds
10229
10416
  });
10230
10417
  if (result.errors && result.errors.length > 0) {
10231
- const errorMessage2 = result.errors.map(
10232
- (error) => error.detail || error.title || "Unknown error"
10233
- ).join("; ");
10418
+ const errorMessage2 = result.errors.map((error) => error.detail || error.title || "Unknown error").join("; ");
10234
10419
  throw new ZapierActionError(`Action execution failed: ${errorMessage2}`, {
10235
10420
  appKey,
10236
- actionKey
10421
+ actionKey,
10422
+ errors: result.errors.map(
10423
+ (error) => ({
10424
+ status: 200,
10425
+ code: error.code ?? "unknown",
10426
+ title: error.title ?? "",
10427
+ detail: error.detail ?? ""
10428
+ })
10429
+ )
10237
10430
  });
10238
10431
  }
10239
10432
  return {
@@ -10433,7 +10626,8 @@ var appsPlugin = defineProperty({
10433
10626
  type: "list",
10434
10627
  inputSchema: ActionExecutionInputSchema,
10435
10628
  itemType: "ActionResult",
10436
- outputSchema: ActionResultItemSchema
10629
+ outputSchema: ActionResultItemSchema,
10630
+ skipOutputValidation: true
10437
10631
  }
10438
10632
  ]
10439
10633
  });
@@ -10481,6 +10675,7 @@ var listAppsPlugin = defineMethod({
10481
10675
  itemType: "App",
10482
10676
  inputSchema: ListAppsSchema,
10483
10677
  outputSchema: AppItemSchema,
10678
+ skipOutputValidation: true,
10484
10679
  formatter: appItemFormatter,
10485
10680
  output: {
10486
10681
  type: "list",
@@ -10838,6 +11033,7 @@ var listActionInputFieldsPlugin = defineMethod({
10838
11033
  itemType: "RootField",
10839
11034
  inputSchema: ListActionInputFieldsInputSchema,
10840
11035
  outputSchema: RootFieldItemSchema,
11036
+ skipOutputValidation: true,
10841
11037
  formatter: rootFieldItemFormatter,
10842
11038
  output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
10843
11039
  resolvers: {
@@ -10974,6 +11170,7 @@ var listActionInputFieldChoicesPlugin = defineMethod({
10974
11170
  itemType: "InputFieldChoice",
10975
11171
  inputSchema: ListActionInputFieldChoicesInputSchema,
10976
11172
  outputSchema: InputFieldChoiceItemSchema,
11173
+ skipOutputValidation: true,
10977
11174
  formatter: inputFieldChoiceItemFormatter,
10978
11175
  output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
10979
11176
  resolvers: {
@@ -11282,6 +11479,7 @@ var listConnectionsPlugin = defineMethod({
11282
11479
  itemType: "Connection",
11283
11480
  inputSchema: ListConnectionsQuerySchema,
11284
11481
  outputSchema: ConnectionItemSchema,
11482
+ skipOutputValidation: true,
11285
11483
  formatter: connectionItemFormatter,
11286
11484
  // `app` is an optional, search-backed filter: the controller offers the app
11287
11485
  // search (skippable) so you can narrow connections to one app.
@@ -11423,6 +11621,7 @@ var listClientCredentialsPlugin = defineMethod({
11423
11621
  itemType: "ClientCredentials",
11424
11622
  inputSchema: ListClientCredentialsQuerySchema,
11425
11623
  outputSchema: ClientCredentialsItemSchema,
11624
+ skipOutputValidation: true,
11426
11625
  formatter: clientCredentialsItemFormatter,
11427
11626
  output: {
11428
11627
  type: "list",
@@ -11463,6 +11662,7 @@ var createClientCredentialsPlugin = defineMethod({
11463
11662
  itemType: "ClientCredentials",
11464
11663
  inputSchema: CreateClientCredentialsSchema,
11465
11664
  outputSchema: ClientCredentialsCreatedItemSchema,
11665
+ skipOutputValidation: true,
11466
11666
  formatter: clientCredentialsCreatedItemFormatter,
11467
11667
  confirm: "create-secret",
11468
11668
  output: "item",
@@ -11529,6 +11729,7 @@ var getAppPlugin = defineMethod({
11529
11729
  itemType: "App",
11530
11730
  inputSchema: GetAppInputSchema,
11531
11731
  outputSchema: AppItemSchema,
11732
+ skipOutputValidation: true,
11532
11733
  output: "item",
11533
11734
  formatter: appItemFormatter,
11534
11735
  resolvers: { app: appKeyResolver },
@@ -11566,6 +11767,7 @@ var getConnectionPlugin = defineMethod({
11566
11767
  itemType: "Connection",
11567
11768
  inputSchema: GetConnectionInputSchema,
11568
11769
  outputSchema: ConnectionItemSchema,
11770
+ skipOutputValidation: true,
11569
11771
  output: "item",
11570
11772
  formatter: connectionItemFormatter,
11571
11773
  resolvers: { connection: connectionIdGenericResolver },
@@ -11603,6 +11805,7 @@ var findFirstConnectionPlugin = defineMethod({
11603
11805
  itemType: "Connection",
11604
11806
  inputSchema: FindFirstConnectionSchema,
11605
11807
  outputSchema: ConnectionItemSchema,
11808
+ skipOutputValidation: true,
11606
11809
  output: "item",
11607
11810
  formatter: connectionItemFormatter,
11608
11811
  run: async ({ imports, input }) => {
@@ -11638,6 +11841,7 @@ var findUniqueConnectionPlugin = defineMethod({
11638
11841
  itemType: "Connection",
11639
11842
  inputSchema: FindUniqueConnectionSchema,
11640
11843
  outputSchema: ConnectionItemSchema,
11844
+ skipOutputValidation: true,
11641
11845
  output: "item",
11642
11846
  formatter: connectionItemFormatter,
11643
11847
  run: async ({ imports, input }) => {
@@ -11766,6 +11970,7 @@ var getProfilePlugin = defineMethod({
11766
11970
  categories: ["account"],
11767
11971
  itemType: "Profile",
11768
11972
  outputSchema: UserProfileItemSchema,
11973
+ skipOutputValidation: true,
11769
11974
  run: async ({ imports }) => {
11770
11975
  const api = imports.api;
11771
11976
  const profile = await api.get("/zapier/api/v4/profile/", {
@@ -11824,6 +12029,7 @@ var getConnectionStartUrlPlugin = defineMethod({
11824
12029
  itemType: "ConnectionStartUrl",
11825
12030
  inputSchema: GetConnectionStartUrlSchema,
11826
12031
  outputSchema: GetConnectionStartUrlItemSchema,
12032
+ skipOutputValidation: true,
11827
12033
  output: "item",
11828
12034
  resolvers: { app: appKeyResolver },
11829
12035
  run: async ({ imports, input, annotate }) => {
@@ -11888,6 +12094,7 @@ var waitForNewConnectionPlugin = defineMethod({
11888
12094
  itemType: "Connection",
11889
12095
  inputSchema: WaitForNewConnectionSchema,
11890
12096
  outputSchema: WaitForNewConnectionItemSchema,
12097
+ skipOutputValidation: true,
11891
12098
  output: "item",
11892
12099
  resolvers: { app: appKeyResolver },
11893
12100
  run: async ({ imports, input, annotate }) => {
@@ -12001,6 +12208,7 @@ var createConnectionPlugin = defineMethod({
12001
12208
  itemType: "Connection",
12002
12209
  inputSchema: CreateConnectionSchema,
12003
12210
  outputSchema: CreateConnectionItemSchema,
12211
+ skipOutputValidation: true,
12004
12212
  output: "item",
12005
12213
  resolvers: { app: appKeyResolver },
12006
12214
  formatter: defineFormatter({
@@ -12066,6 +12274,10 @@ var listAuthenticationsPlugin = defineMethod({
12066
12274
  deprecation: { message: "Use listConnections instead." },
12067
12275
  itemType: "Connection",
12068
12276
  outputSchema: ConnectionItemSchema,
12277
+ // Matches `listConnections`: an alias must not enforce a schema its target
12278
+ // passes through, or the deprecated name strips (or rejects) responses the
12279
+ // supported name returns intact.
12280
+ skipOutputValidation: true,
12069
12281
  formatter: connectionItemFormatter,
12070
12282
  run: async ({ imports, input }) => {
12071
12283
  return await imports.listConnections(input);
@@ -12083,6 +12295,10 @@ var getAuthenticationPlugin = defineMethod({
12083
12295
  type: "item",
12084
12296
  itemType: "Connection",
12085
12297
  outputSchema: ConnectionItemSchema,
12298
+ // Inert while the output is `raw` (that mode never validates), set so every
12299
+ // method declaring an `outputSchema` states its stance, and so switching this
12300
+ // alias to `item` keeps mirroring `getConnection`'s opt-out.
12301
+ skipOutputValidation: true,
12086
12302
  formatter: connectionItemFormatter,
12087
12303
  run: ({ imports, input }) => {
12088
12304
  return imports.getConnection(input);
@@ -12100,6 +12316,7 @@ var findFirstAuthenticationPlugin = defineMethod({
12100
12316
  type: "item",
12101
12317
  itemType: "Connection",
12102
12318
  outputSchema: ConnectionItemSchema,
12319
+ skipOutputValidation: true,
12103
12320
  formatter: connectionItemFormatter,
12104
12321
  run: ({ imports, input }) => {
12105
12322
  return imports.findFirstConnection(input);
@@ -12117,6 +12334,7 @@ var findUniqueAuthenticationPlugin = defineMethod({
12117
12334
  type: "item",
12118
12335
  itemType: "Connection",
12119
12336
  outputSchema: ConnectionItemSchema,
12337
+ skipOutputValidation: true,
12120
12338
  formatter: connectionItemFormatter,
12121
12339
  run: ({ imports, input }) => {
12122
12340
  return imports.findUniqueConnection(input);
@@ -12138,6 +12356,10 @@ var listInputFieldsDeprecatedPlugin = defineMethod({
12138
12356
  deprecation: { message: "Use listActionInputFields instead." },
12139
12357
  itemType: "RootField",
12140
12358
  outputSchema: RootFieldItemSchema,
12359
+ // Matches `listActionInputFields`: an alias must not enforce a schema its
12360
+ // target passes through, or the deprecated name strips (or rejects)
12361
+ // responses the supported name returns intact.
12362
+ skipOutputValidation: true,
12141
12363
  formatter: rootFieldItemFormatter,
12142
12364
  run: async ({ imports, input }) => {
12143
12365
  return await imports.listActionInputFields(input);
@@ -12152,6 +12374,8 @@ var listInputFieldChoicesDeprecatedPlugin = defineMethod({
12152
12374
  deprecation: { message: "Use listActionInputFieldChoices instead." },
12153
12375
  itemType: "InputFieldChoiceItem",
12154
12376
  outputSchema: InputFieldChoiceItemSchema,
12377
+ // See `listInputFields` above: the alias mirrors its target's opt-out.
12378
+ skipOutputValidation: true,
12155
12379
  formatter: inputFieldChoiceItemFormatter,
12156
12380
  run: async ({ imports, input }) => {
12157
12381
  return await imports.listActionInputFieldChoices(input);
@@ -12319,6 +12543,7 @@ var createTriggerInboxPlugin = defineMethod({
12319
12543
  itemType: "TriggerInbox",
12320
12544
  inputSchema: CreateTriggerInboxSchema,
12321
12545
  outputSchema: TriggerInboxItemSchema,
12546
+ skipOutputValidation: true,
12322
12547
  output: "item",
12323
12548
  formatter: triggerInboxItemFormatter,
12324
12549
  annotator: deriveReadOperation,
@@ -12424,6 +12649,7 @@ var ensureTriggerInboxPlugin = defineMethod({
12424
12649
  itemType: "TriggerInbox",
12425
12650
  inputSchema: EnsureTriggerInboxInputSchema,
12426
12651
  outputSchema: TriggerInboxItemSchema,
12652
+ skipOutputValidation: true,
12427
12653
  output: "item",
12428
12654
  formatter: triggerInboxItemFormatter,
12429
12655
  annotator: deriveReadOperation,
@@ -12524,6 +12750,7 @@ var listTriggerInboxesPlugin = defineMethod({
12524
12750
  itemType: "TriggerInbox",
12525
12751
  inputSchema: ListTriggerInboxesSchema,
12526
12752
  outputSchema: TriggerInboxItemSchema,
12753
+ skipOutputValidation: true,
12527
12754
  // The handler returns a raw `{ data, next }` wire envelope, so `adaptPage`
12528
12755
  // normalizes it into an `SdkPage` (cursor pulled from the `next` URL).
12529
12756
  output: {
@@ -12571,6 +12798,7 @@ var getTriggerInboxPlugin = defineMethod({
12571
12798
  itemType: "TriggerInbox",
12572
12799
  inputSchema: GetTriggerInboxSchema,
12573
12800
  outputSchema: TriggerInboxItemSchema,
12801
+ skipOutputValidation: true,
12574
12802
  output: "item",
12575
12803
  formatter: triggerInboxItemFormatter,
12576
12804
  resolvers: { inbox: triggerInboxResolver },
@@ -12604,6 +12832,7 @@ var updateTriggerInboxPlugin = defineMethod({
12604
12832
  itemType: "TriggerInbox",
12605
12833
  inputSchema: UpdateTriggerInboxSchema,
12606
12834
  outputSchema: TriggerInboxItemSchema,
12835
+ skipOutputValidation: true,
12607
12836
  output: "item",
12608
12837
  formatter: triggerInboxItemFormatter,
12609
12838
  resolvers: { inbox: triggerInboxResolver },
@@ -12639,6 +12868,7 @@ var deleteTriggerInboxPlugin = defineMethod({
12639
12868
  itemType: "TriggerInbox",
12640
12869
  inputSchema: DeleteTriggerInboxSchema,
12641
12870
  outputSchema: TriggerInboxItemSchema,
12871
+ skipOutputValidation: true,
12642
12872
  // Delete returns the deleted inbox verbatim (the legacy `{ data }` surface),
12643
12873
  // so `output: "raw"` passes the handler's shape through unwrapped.
12644
12874
  output: "raw",
@@ -12673,6 +12903,7 @@ var pauseTriggerInboxPlugin = defineMethod({
12673
12903
  itemType: "TriggerInbox",
12674
12904
  inputSchema: PauseTriggerInboxSchema,
12675
12905
  outputSchema: TriggerInboxItemSchema,
12906
+ skipOutputValidation: true,
12676
12907
  output: "item",
12677
12908
  formatter: triggerInboxItemFormatter,
12678
12909
  resolvers: { inbox: triggerInboxResolver },
@@ -12704,6 +12935,7 @@ var resumeTriggerInboxPlugin = defineMethod({
12704
12935
  itemType: "TriggerInbox",
12705
12936
  inputSchema: ResumeTriggerInboxSchema,
12706
12937
  outputSchema: TriggerInboxItemSchema,
12938
+ skipOutputValidation: true,
12707
12939
  output: "item",
12708
12940
  formatter: triggerInboxItemFormatter,
12709
12941
  resolvers: { inbox: triggerInboxResolver },
@@ -12798,6 +13030,7 @@ var listTriggerInboxMessagesPlugin = defineMethod({
12798
13030
  itemType: "TriggerMessage",
12799
13031
  inputSchema: ListTriggerInboxMessagesSchema,
12800
13032
  outputSchema: TriggerMessageItemSchema,
13033
+ skipOutputValidation: true,
12801
13034
  // The handler returns a raw `{ data, next }` wire envelope, so `adaptPage`
12802
13035
  // normalizes it into an `SdkPage` (cursor pulled from the `next` URL).
12803
13036
  output: {
@@ -12873,6 +13106,7 @@ var leaseTriggerInboxMessagesPlugin = defineMethod({
12873
13106
  itemType: "TriggerInboxLease",
12874
13107
  inputSchema: LeaseTriggerInboxMessagesSchema,
12875
13108
  outputSchema: LeaseTriggerInboxMessagesItemSchema,
13109
+ skipOutputValidation: true,
12876
13110
  output: "item",
12877
13111
  resolvers: {
12878
13112
  inbox: triggerInboxResolver,
@@ -12934,6 +13168,7 @@ var ackTriggerInboxMessagesPlugin = defineMethod({
12934
13168
  itemType: "TriggerInboxAck",
12935
13169
  inputSchema: AckTriggerInboxMessagesSchema,
12936
13170
  outputSchema: AckTriggerInboxMessagesItemSchema,
13171
+ skipOutputValidation: true,
12937
13172
  output: "item",
12938
13173
  resolvers: {
12939
13174
  inbox: triggerInboxResolver,
@@ -12984,6 +13219,7 @@ var releaseTriggerInboxMessagesPlugin = defineMethod({
12984
13219
  itemType: "TriggerInboxRelease",
12985
13220
  inputSchema: ReleaseTriggerInboxMessagesSchema,
12986
13221
  outputSchema: ReleaseTriggerInboxMessagesItemSchema,
13222
+ skipOutputValidation: true,
12987
13223
  output: "item",
12988
13224
  resolvers: {
12989
13225
  inbox: triggerInboxResolver,
@@ -13696,6 +13932,7 @@ var listTriggersPlugin = defineMethod({
13696
13932
  itemType: "Action",
13697
13933
  inputSchema: ListTriggersSchema,
13698
13934
  outputSchema: ActionItemSchema,
13935
+ skipOutputValidation: true,
13699
13936
  output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
13700
13937
  formatter: actionItemFormatter,
13701
13938
  resolvers: { app: appKeyResolver },
@@ -13729,6 +13966,7 @@ var listTriggerInputFieldsPlugin = defineMethod({
13729
13966
  itemType: "RootField",
13730
13967
  inputSchema: ListTriggerInputFieldsSchema,
13731
13968
  outputSchema: RootFieldItemSchema,
13969
+ skipOutputValidation: true,
13732
13970
  output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
13733
13971
  formatter: rootFieldItemFormatter,
13734
13972
  annotator: deriveReadOperation,
@@ -13776,6 +14014,7 @@ var listTriggerInputFieldChoicesPlugin = defineMethod({
13776
14014
  itemType: "InputFieldChoice",
13777
14015
  inputSchema: ListTriggerInputFieldChoicesSchema,
13778
14016
  outputSchema: InputFieldChoiceItemSchema,
14017
+ skipOutputValidation: true,
13779
14018
  output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
13780
14019
  formatter: inputFieldChoiceItemFormatter,
13781
14020
  annotator: deriveReadOperation,
@@ -13963,6 +14202,7 @@ var listTablesPlugin = defineMethod({
13963
14202
  itemType: "Table",
13964
14203
  inputSchema: ListTablesOptionsSchema,
13965
14204
  outputSchema: TableItemSchema,
14205
+ skipOutputValidation: true,
13966
14206
  output: "list",
13967
14207
  run: async ({ imports, input }) => {
13968
14208
  return await imports.listTablesInternal({
@@ -13991,6 +14231,7 @@ var getTablePlugin = defineMethod({
13991
14231
  itemType: "Table",
13992
14232
  inputSchema: GetTableOptionsInputSchema,
13993
14233
  outputSchema: TableItemSchema,
14234
+ skipOutputValidation: true,
13994
14235
  output: "item",
13995
14236
  resolvers: { table: tableIdResolver },
13996
14237
  run: async ({ imports, input }) => {
@@ -14051,6 +14292,7 @@ var createTablePlugin = defineMethod({
14051
14292
  type: "create",
14052
14293
  inputSchema: CreateTableOptionsSchema,
14053
14294
  outputSchema: TableItemSchema,
14295
+ skipOutputValidation: true,
14054
14296
  output: "item",
14055
14297
  resolvers: { name: tableNameResolver },
14056
14298
  run: async ({ imports, input }) => {
@@ -14087,6 +14329,7 @@ var listTableFieldsPlugin = defineMethod({
14087
14329
  type: "list",
14088
14330
  inputSchema: ListTableFieldsOptionsInputSchema,
14089
14331
  outputSchema: FieldItemSchema,
14332
+ skipOutputValidation: true,
14090
14333
  output: "item",
14091
14334
  formatter: tableFieldItemFormatter,
14092
14335
  resolvers: { table: tableIdResolver },
@@ -14156,6 +14399,7 @@ var createTableFieldsPlugin = defineMethod({
14156
14399
  returnType: "FieldItem[]",
14157
14400
  inputSchema: CreateTableFieldsOptionsInputSchema,
14158
14401
  outputSchema: FieldItemSchema,
14402
+ skipOutputValidation: true,
14159
14403
  // Item output with an array payload: callers get `{ data: FieldItem[] }`
14160
14404
  // directly rather than a paginated list.
14161
14405
  output: "item",
@@ -14295,6 +14539,7 @@ var getTableRecordPlugin = defineMethod({
14295
14539
  itemType: "Record",
14296
14540
  inputSchema: GetTableRecordOptionsInputSchema,
14297
14541
  outputSchema: RecordItemSchema,
14542
+ skipOutputValidation: true,
14298
14543
  output: "item",
14299
14544
  resolvers: { table: tableIdResolver, record: tableRecordIdResolver },
14300
14545
  formatter: tableRecordFormatter,
@@ -14386,6 +14631,7 @@ var listTableRecordsPlugin = defineMethod({
14386
14631
  itemType: "Record",
14387
14632
  inputSchema: ListTableRecordsOptionsInputSchema,
14388
14633
  outputSchema: RecordItemSchema,
14634
+ skipOutputValidation: true,
14389
14635
  // The handler already returns a clean `{ data, nextCursor }` page, so the
14390
14636
  // standard list output (no `adaptPage`) applies.
14391
14637
  output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
@@ -14495,6 +14741,7 @@ var createTableRecordsPlugin = defineMethod({
14495
14741
  returnType: "RecordItem[]",
14496
14742
  inputSchema: CreateTableRecordsOptionsInputSchema,
14497
14743
  outputSchema: RecordItemSchema,
14744
+ skipOutputValidation: true,
14498
14745
  // Item output with an array payload: callers get `{ data: RecordItem[] }`
14499
14746
  // directly rather than a paginated list.
14500
14747
  output: "item",
@@ -14607,6 +14854,7 @@ var updateTableRecordsPlugin = defineMethod({
14607
14854
  returnType: "RecordItem[]",
14608
14855
  inputSchema: UpdateTableRecordsOptionsInputSchema,
14609
14856
  outputSchema: RecordItemSchema,
14857
+ skipOutputValidation: true,
14610
14858
  // Item output with an array payload: callers get `{ data: RecordItem[] }`
14611
14859
  // directly rather than a paginated list.
14612
14860
  output: "item",