@zapier/kitcore 0.15.0 → 0.17.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.
package/dist/index.mjs CHANGED
@@ -29,6 +29,30 @@ function canonicalInputSchema(schema) {
29
29
  }
30
30
  return schema;
31
31
  }
32
+ function unwrapSchema(schema) {
33
+ let inner = schema;
34
+ let required = true;
35
+ for (; ; ) {
36
+ if (inner instanceof z.ZodOptional || inner instanceof z.ZodDefault) {
37
+ required = false;
38
+ inner = inner.unwrap();
39
+ } else if (inner instanceof z.ZodNullable) {
40
+ inner = inner.unwrap();
41
+ } else {
42
+ break;
43
+ }
44
+ }
45
+ return { inner, required };
46
+ }
47
+ function objectShapeOf(schema) {
48
+ const canonical = canonicalInputSchema(schema);
49
+ if (!canonical) return void 0;
50
+ const { inner } = unwrapSchema(canonical);
51
+ if (inner instanceof z.ZodObject) {
52
+ return inner.shape;
53
+ }
54
+ return void 0;
55
+ }
32
56
  function getOutputSchema(inputSchema) {
33
57
  return inputSchema._zod.def.outputSchema;
34
58
  }
@@ -649,6 +673,120 @@ function createValidator(schema, { adaptError } = {}) {
649
673
  }
650
674
  var validateOptions = (schema, options, { adaptError } = {}) => parseOrThrow(schema, options, { adaptError });
651
675
 
676
+ // src/utils/call-options.ts
677
+ import { z as z2 } from "zod";
678
+ var CallFrameworkOptionsSchema = z2.object({
679
+ /** Page to fetch. Opaque to kitcore: the head's API defines the format. */
680
+ cursor: z2.string().optional(),
681
+ /** Items per page. */
682
+ pageSize: z2.number().int().min(1).optional(),
683
+ /** Stop after this many items, across pages. */
684
+ maxItems: z2.number().int().min(0).optional(),
685
+ /** Bypass output validation for this one call. */
686
+ skipOutputDataValidation: z2.boolean().optional()
687
+ });
688
+ var ITEM_FRAMEWORK_OPTIONS = {
689
+ claims: ["skipOutputDataValidation"],
690
+ injects: []
691
+ };
692
+ var LIST_FRAMEWORK_OPTIONS = {
693
+ claims: ["cursor", "pageSize", "maxItems", "skipOutputDataValidation"],
694
+ injects: ["cursor", "pageSize"]
695
+ };
696
+ var PAGE_FRAMEWORK_OPTIONS = {
697
+ claims: ["cursor", "pageSize", "maxItems"],
698
+ injects: ["cursor", "pageSize", "maxItems"]
699
+ };
700
+ var NO_FRAMEWORK_OPTIONS = {
701
+ claims: [],
702
+ injects: []
703
+ };
704
+ function isRecord(value) {
705
+ return typeof value === "object" && value !== null && !Array.isArray(value);
706
+ }
707
+ function strictlyRefused(error, claims) {
708
+ const refused = /* @__PURE__ */ new Set();
709
+ for (const issue of error.issues) {
710
+ if (issue.code !== "unrecognized_keys" || issue.path.length > 0) continue;
711
+ for (const key of issue.keys) {
712
+ if (claims.includes(key)) refused.add(key);
713
+ }
714
+ }
715
+ return [...refused];
716
+ }
717
+ function withoutKeys(options, keys) {
718
+ const next = {};
719
+ for (const [key, value] of Object.entries(options)) {
720
+ if (!keys.includes(key)) next[key] = value;
721
+ }
722
+ return next;
723
+ }
724
+ function parseCallOptions(options, {
725
+ schema,
726
+ policy = NO_FRAMEWORK_OPTIONS,
727
+ adaptError
728
+ } = {}) {
729
+ const claims = policy.claims;
730
+ const call = isRecord(options) ? options : void 0;
731
+ let framework = {};
732
+ if (call && claims.length > 0) {
733
+ const present = {};
734
+ for (const key of claims) {
735
+ if (key in call) present[key] = call[key];
736
+ }
737
+ framework = parseOrThrow2(CallFrameworkOptionsSchema, present, adaptError);
738
+ }
739
+ if (!schema) return { framework, domain: options, supplied: /* @__PURE__ */ new Set() };
740
+ const first = schema.safeParse(options);
741
+ if (first.success) {
742
+ return { framework, domain: first.data, supplied: /* @__PURE__ */ new Set() };
743
+ }
744
+ const refused = call ? strictlyRefused(first.error, claims) : [];
745
+ if (refused.length === 0) throw toCoreError(first.error, options, adaptError);
746
+ const retry = schema.safeParse(withoutKeys(call, refused));
747
+ if (!retry.success) {
748
+ throw toCoreError(retry.error, options, adaptError);
749
+ }
750
+ return { framework, domain: retry.data, supplied: new Set(refused) };
751
+ }
752
+ function mergeCallOptions({
753
+ framework,
754
+ domain
755
+ }) {
756
+ const claimed = Object.entries(framework);
757
+ if (!isRecord(domain) || claimed.length === 0) return domain;
758
+ return { ...domain, ...Object.fromEntries(claimed) };
759
+ }
760
+ function withheldFromRun(policy) {
761
+ return new Set(policy.claims.filter((key) => !policy.injects.includes(key)));
762
+ }
763
+ function stripFrameworkOnlyOptions(options, withheld) {
764
+ if (withheld.size === 0 || !isRecord(options)) return options;
765
+ const entries = Object.entries(options);
766
+ if (!entries.some(([key]) => withheld.has(key))) return options;
767
+ return Object.fromEntries(entries.filter(([key]) => !withheld.has(key)));
768
+ }
769
+ function parseOrThrow2(schema, input, adaptError) {
770
+ const result = schema.safeParse(input);
771
+ if (result.success) return result.data;
772
+ throw toCoreError(result.error, input, adaptError);
773
+ }
774
+ function toCoreError(error, input, adaptError) {
775
+ const messages = error.issues.map((issue) => {
776
+ const path = issue.path.length > 0 ? issue.path.join(".") : "input";
777
+ return `${path}: ${issue.message}`;
778
+ });
779
+ return createCoreError(
780
+ {
781
+ code: CoreErrorCode.Validation,
782
+ message: `Validation failed:
783
+ ${messages.join("\n ")}`,
784
+ details: { zodErrors: error.issues, input }
785
+ },
786
+ adaptError
787
+ );
788
+ }
789
+
652
790
  // src/utils/async-context.ts
653
791
  import {
654
792
  AsyncLocalStorage
@@ -848,7 +986,15 @@ function normalizeError(error, adaptError) {
848
986
  );
849
987
  }
850
988
  function createFunction(coreFn, options) {
851
- const { sdk, schema, name, annotator, getDeprecation, getStability } = options;
989
+ const {
990
+ sdk,
991
+ schema,
992
+ name,
993
+ annotator,
994
+ frameworkOptions,
995
+ getDeprecation,
996
+ getStability
997
+ } = options;
852
998
  const functionName = name || coreFn.name;
853
999
  const namedFunctions = {
854
1000
  [functionName]: async function(callOptions) {
@@ -884,25 +1030,15 @@ function createFunction(coreFn, options) {
884
1030
  };
885
1031
  hooks?.onMethodStart?.({ ...hookBase });
886
1032
  try {
887
- let result;
888
- if (schema) {
889
- const validatedOptions = validateOptions(
890
- schema,
891
- normalizedOptions,
892
- {
893
- adaptError
894
- }
895
- );
896
- result = await coreFn(
897
- {
898
- ...normalizedOptions,
899
- ...validatedOptions
900
- },
901
- context
902
- );
903
- } else {
904
- result = await coreFn(normalizedOptions, context);
905
- }
1033
+ const parsed = parseCallOptions(normalizedOptions, {
1034
+ schema,
1035
+ policy: frameworkOptions,
1036
+ adaptError
1037
+ });
1038
+ const result = await coreFn(
1039
+ mergeCallOptions(parsed),
1040
+ context
1041
+ );
906
1042
  hooks?.onMethodEnd?.({
907
1043
  ...hookBase,
908
1044
  durationMs: Date.now() - startTime
@@ -1023,7 +1159,7 @@ function createPageFunction(coreFn, {
1023
1159
  `${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\`.`
1024
1160
  );
1025
1161
  }
1026
- return finalizePage ? finalizePage(page) : page;
1162
+ return finalizePage ? finalizePage(page, options) : page;
1027
1163
  } catch (error) {
1028
1164
  throw normalizeError(
1029
1165
  error,
@@ -1043,6 +1179,7 @@ function createPaginatedFunction(coreFn, options) {
1043
1179
  adaptPage,
1044
1180
  annotator,
1045
1181
  finalizePage,
1182
+ frameworkOptions,
1046
1183
  getDeprecation,
1047
1184
  getStability
1048
1185
  } = options;
@@ -1086,10 +1223,13 @@ function createPaginatedFunction(coreFn, options) {
1086
1223
  };
1087
1224
  hooks?.onMethodStart?.({ ...hookBase });
1088
1225
  try {
1089
- const validatedOptions = {
1090
- ...normalizedOptions,
1091
- ...schema ? createValidator(schema, { adaptError })(normalizedOptions) : normalizedOptions
1092
- };
1226
+ const validatedOptions = mergeCallOptions(
1227
+ parseCallOptions(normalizedOptions, {
1228
+ schema,
1229
+ policy: frameworkOptions,
1230
+ adaptError
1231
+ })
1232
+ );
1093
1233
  const pageSize = validatedOptions.pageSize ?? defaultPageSize;
1094
1234
  const optimizedOptions = {
1095
1235
  ...validatedOptions,
@@ -1215,6 +1355,10 @@ function createPaginatedPluginMethod(sdk, config) {
1215
1355
  sdk,
1216
1356
  schema: inputSchema,
1217
1357
  name,
1358
+ // The page loop reads the page controls out of the call object, so a
1359
+ // handler's schema does not have to declare them. It reads nothing else:
1360
+ // no legacy handler honors the caller's output skip.
1361
+ frameworkOptions: PAGE_FRAMEWORK_OPTIONS,
1218
1362
  defaultPageSize,
1219
1363
  adaptPage
1220
1364
  });
@@ -1458,6 +1602,7 @@ function buildPluginStack(head, callerLabel) {
1458
1602
  }
1459
1603
 
1460
1604
  // src/model/shared.ts
1605
+ var CONTEXT = Symbol.for("kitcore.context");
1461
1606
  function parseId(id) {
1462
1607
  const at = id.lastIndexOf("/");
1463
1608
  return at === -1 ? { name: id, namespace: void 0 } : { name: id.slice(at + 1), namespace: id.slice(0, at) };
@@ -1567,7 +1712,12 @@ function collectDynamicMembers(members) {
1567
1712
  };
1568
1713
  });
1569
1714
  }
1570
- function defineMethod(config) {
1715
+ function defineMethod(configOrRef, refConfig) {
1716
+ const config = refConfig === void 0 ? configOrRef : {
1717
+ ...refConfig,
1718
+ name: configOrRef.name,
1719
+ namespace: configOrRef.namespace
1720
+ };
1571
1721
  const deps = normalizeImports(config.imports);
1572
1722
  return {
1573
1723
  pluginType: "method",
@@ -1590,8 +1740,27 @@ function defineMethod(config) {
1590
1740
  run: config.run
1591
1741
  };
1592
1742
  }
1593
- function defineMethodOverride(config) {
1594
- const { target, namespace, ...rest } = config;
1743
+ var OVERRIDABLE = [
1744
+ "description",
1745
+ "categories",
1746
+ "itemType",
1747
+ "returnType",
1748
+ "packages",
1749
+ "experimental",
1750
+ "deprecation",
1751
+ "supportsJsonOutput"
1752
+ ];
1753
+ function assertOverridable(target, fields) {
1754
+ const offered = Object.keys(fields).filter(
1755
+ (key) => !OVERRIDABLE.includes(key)
1756
+ );
1757
+ if (offered.length === 0) return;
1758
+ throw new Error(
1759
+ `defineOverride("${target}"): cannot override ${offered.join(", ")}. An override changes how a surface presents a method, never what it does. The method's declared type is fixed at \`defineMethod\` and nothing re-checks it afterwards, so patching behavior here would let a call fail against a contract its own return type says it satisfies. Overridable: ${OVERRIDABLE.join(", ")}.`
1760
+ );
1761
+ }
1762
+ function buildOverride(target, namespace, fields) {
1763
+ assertOverridable(target, fields);
1595
1764
  return {
1596
1765
  pluginType: "method-override",
1597
1766
  name: `override:${target}`,
@@ -1599,12 +1768,34 @@ function defineMethodOverride(config) {
1599
1768
  target,
1600
1769
  imports: [],
1601
1770
  importBindings: [],
1602
- meta: collectLeafMeta(rest)
1771
+ meta: collectLeafMeta(fields)
1603
1772
  };
1604
1773
  }
1774
+ function defineOverride(ref, config = {}) {
1775
+ const { namespace, ...fields } = config;
1776
+ return buildOverride(ref.id, namespace, fields);
1777
+ }
1778
+ function defineMethodOverride(config) {
1779
+ logDeprecation(
1780
+ "defineMethodOverride({ target }) is deprecated. Use defineOverride(method, { ... }), which takes the method or its declareMethod stand-in."
1781
+ );
1782
+ const { target, namespace, ...fields } = config;
1783
+ return buildOverride(target, namespace, fields);
1784
+ }
1785
+ function assertRequirementPaths(requirements) {
1786
+ if (!requirements) return;
1787
+ for (const requirement of requirements) {
1788
+ if (typeof requirement !== "string" && requirement.length === 0) {
1789
+ throw new Error(
1790
+ "defineResolver: a requireParameters path must name at least one segment. An empty path names no parameter, and the engine would read it as already satisfied."
1791
+ );
1792
+ }
1793
+ }
1794
+ }
1605
1795
  function defineResolver(config) {
1606
1796
  const deps = normalizeImports(config.imports);
1607
1797
  const base = { imports: deps.plugins, importBindings: deps.bindings };
1798
+ assertRequirementPaths(config.requireParameters);
1608
1799
  const gates = {
1609
1800
  requireParameters: config.requireParameters
1610
1801
  };
@@ -1708,21 +1899,26 @@ function declareOptionalMethod(config) {
1708
1899
  // `| undefined`.
1709
1900
  };
1710
1901
  }
1711
- function defineProperty(config) {
1712
- const deps = normalizeImports(config.imports);
1902
+ function defineProperty(config, refConfig) {
1903
+ const cfg = refConfig === void 0 ? config : {
1904
+ ...refConfig,
1905
+ name: config.name,
1906
+ namespace: config.namespace
1907
+ };
1908
+ const deps = normalizeImports(cfg.imports);
1713
1909
  return {
1714
1910
  pluginType: "property",
1715
- name: config.name,
1716
- namespace: config.namespace,
1717
- id: makeId(config.name, config.namespace),
1911
+ name: cfg.name,
1912
+ namespace: cfg.namespace,
1913
+ id: makeId(cfg.name, cfg.namespace),
1718
1914
  imports: deps.plugins,
1719
1915
  importBindings: deps.bindings,
1720
- setup: config.setup,
1721
- dispose: config.dispose,
1722
- value: config.value,
1723
- get: config.get,
1724
- meta: collectLeafMeta(config),
1725
- dynamicMembers: collectDynamicMembers(config.dynamicMembers)
1916
+ setup: cfg.setup,
1917
+ dispose: cfg.dispose,
1918
+ value: cfg.value,
1919
+ get: cfg.get,
1920
+ meta: collectLeafMeta(cfg),
1921
+ dynamicMembers: collectDynamicMembers(cfg.dynamicMembers)
1726
1922
  };
1727
1923
  }
1728
1924
  function declareProperty(config) {
@@ -1948,7 +2144,7 @@ function legacyGraphEntry(name, value, pluginMeta) {
1948
2144
  }
1949
2145
 
1950
2146
  // src/model/builtins.ts
1951
- import { z as z2 } from "zod";
2147
+ import { z as z3 } from "zod";
1952
2148
 
1953
2149
  // src/model/registry-support.ts
1954
2150
  function adaptLegacyFormatter(legacy, sdk) {
@@ -2026,6 +2222,34 @@ function collectSurfaceProjection(context, formatterSdk) {
2026
2222
  }
2027
2223
  return { meta, formatters, resolvers, positional, skipInputValidation };
2028
2224
  }
2225
+ var REGISTRY_CACHE = Symbol.for("kitcore.registryCache");
2226
+ function freezeContainers(registry) {
2227
+ Object.freeze(registry.functions);
2228
+ for (const category of registry.categories) {
2229
+ Object.freeze(category.functions);
2230
+ Object.freeze(category);
2231
+ }
2232
+ Object.freeze(registry.categories);
2233
+ return Object.freeze(registry);
2234
+ }
2235
+ function getCachedRegistry(context, packageFilter) {
2236
+ const key = packageFilter ?? "";
2237
+ const caching = context;
2238
+ let byFilter = caching[REGISTRY_CACHE];
2239
+ if (!byFilter) {
2240
+ byFilter = /* @__PURE__ */ new Map();
2241
+ caching[REGISTRY_CACHE] = byFilter;
2242
+ }
2243
+ let registry = byFilter.get(key);
2244
+ if (!registry) {
2245
+ registry = freezeContainers(buildSurfaceRegistry(context, packageFilter));
2246
+ byFilter.set(key, registry);
2247
+ }
2248
+ return registry;
2249
+ }
2250
+ function invalidateRegistryCache(context) {
2251
+ delete context[REGISTRY_CACHE];
2252
+ }
2029
2253
  function buildSurfaceRegistry(context, packageFilter) {
2030
2254
  const surface = {};
2031
2255
  for (const [binding, id] of Object.entries(context.surface)) {
@@ -2033,9 +2257,11 @@ function buildSurfaceRegistry(context, packageFilter) {
2033
2257
  if (!entry || entry.pluginType === "aggregate") continue;
2034
2258
  surface[binding] = entry.pluginType === "property" && entry.getValue ? entry.getValue() : entry.value;
2035
2259
  }
2260
+ const projection = collectSurfaceProjection(context, surface);
2261
+ Object.assign(projection.meta, context.meta);
2036
2262
  return buildRegistry({
2037
2263
  sdk: surface,
2038
- ...collectSurfaceProjection(context, surface),
2264
+ ...projection,
2039
2265
  packageFilter
2040
2266
  });
2041
2267
  }
@@ -2055,12 +2281,12 @@ var getRegistryPlugin = defineMethod({
2055
2281
  name: "getRegistry",
2056
2282
  namespace: "kitcore",
2057
2283
  imports: [dangerousContextPlugin],
2058
- inputSchema: z2.object({ package: z2.string().optional() }).optional(),
2059
- run: ({ imports, input }) => buildSurfaceRegistry(imports.context, input?.package)
2284
+ inputSchema: z3.object({ package: z3.string().optional() }).optional(),
2285
+ run: ({ imports, input }) => getCachedRegistry(imports.context, input?.package)
2060
2286
  });
2061
2287
 
2062
2288
  // src/utils/output-policy.ts
2063
- function isRecord(value) {
2289
+ function isRecord2(value) {
2064
2290
  return typeof value === "object" && value !== null && !Array.isArray(value);
2065
2291
  }
2066
2292
  function diffDroppedPaths(raw, parsed, prefix = "") {
@@ -2083,7 +2309,7 @@ function walkDroppedPaths(raw, parsed, prefix, out) {
2083
2309
  }
2084
2310
  return;
2085
2311
  }
2086
- if (isRecord(raw) && isRecord(parsed)) {
2312
+ if (isRecord2(raw) && isRecord2(parsed)) {
2087
2313
  for (const key of Object.keys(raw)) {
2088
2314
  const path = prefix ? `${prefix}.${key}` : key;
2089
2315
  if (!(key in parsed)) {
@@ -2095,7 +2321,22 @@ function walkDroppedPaths(raw, parsed, prefix, out) {
2095
2321
  return;
2096
2322
  }
2097
2323
  }
2098
- function parseOutput(schema, value, policy, locator) {
2324
+ var SKIP_OUTPUT_DATA_VALIDATION = "skipOutputDataValidation";
2325
+ function readSkipOutputDataValidation(options) {
2326
+ return isRecord2(options) && options[SKIP_OUTPUT_DATA_VALIDATION] === true;
2327
+ }
2328
+ function resolveValidatingSchema(policy) {
2329
+ if (policy.skipOutputValidation || policy.skippedByCaller) return void 0;
2330
+ return policy.outputSchema;
2331
+ }
2332
+ function shouldReport(policy) {
2333
+ return policy.skippedByCaller === true && policy.outputSchema !== void 0 && !policy.skipOutputValidation;
2334
+ }
2335
+ function parseOutput(schema, value, policy, {
2336
+ locator,
2337
+ hint,
2338
+ callerCanSkip = true
2339
+ } = {}) {
2099
2340
  const result = schema.safeParse(value);
2100
2341
  if (result.success) return result.data;
2101
2342
  const issues = result.error.issues.map((issue) => {
@@ -2110,43 +2351,91 @@ function parseOutput(schema, value, policy, locator) {
2110
2351
  message: `Output validation failed${subject}${at}:
2111
2352
  ${issues.join("\n ")}
2112
2353
 
2113
- 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.`,
2354
+ ` + (hint ? `${hint}
2355
+
2356
+ ` : "") + `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.` + (callerCanSkip ? ` A caller who cannot change the method can pass \`skipOutputDataValidation: true\` with the input to bypass this one call.` : ``),
2114
2357
  details: { zodErrors: result.error.issues, output: value }
2115
2358
  },
2116
2359
  policy.adaptError
2117
2360
  );
2118
2361
  }
2119
2362
  function applyItemOutputPolicy(result, policy) {
2120
- const schema = policy.outputSchema;
2121
- if (!schema || policy.skipOutputValidation) return result;
2122
- if (!isRecord(result) || !("data" in result)) return result;
2363
+ const schema = resolveValidatingSchema(policy);
2364
+ const report = shouldReport(policy);
2365
+ if (!schema && !report) return result;
2366
+ if (!isRecord2(result) || !("data" in result)) return result;
2367
+ if (!schema) {
2368
+ return {
2369
+ ...result,
2370
+ meta: withOutputValidation(result.meta, { skipped: true })
2371
+ };
2372
+ }
2123
2373
  const data = parseOutput(schema, result.data, policy);
2374
+ const validation = buildValidatedReport({
2375
+ policy,
2376
+ before: result.data,
2377
+ after: data
2378
+ });
2124
2379
  const next = { ...result, data };
2125
- if (policy.includeOutputValidationDroppedPaths) {
2126
- const droppedPaths = diffDroppedPaths(result.data, data);
2127
- if (droppedPaths.length > 0) {
2128
- next.meta = withOutputValidation(result.meta, droppedPaths);
2129
- }
2130
- }
2380
+ if (validation) next.meta = withOutputValidation(result.meta, validation);
2131
2381
  return next;
2132
2382
  }
2133
- function withOutputValidation(existing, droppedPaths) {
2134
- const base = isRecord(existing) ? existing : {};
2135
- return { ...base, outputValidation: { droppedPaths } };
2383
+ function applyRawOutputPolicy(result, policy) {
2384
+ const schema = resolveValidatingSchema(policy);
2385
+ if (!schema) return result;
2386
+ const looksLikeEnvelope = isRecord2(result) && "data" in result;
2387
+ parseOutput(schema, result, policy, {
2388
+ hint: looksLikeEnvelope ? 'This returned a `{ data }` envelope, and with no `output` mode the schema is matched against the WHOLE return. Did you mean `output: "item"` (or `"list"`)?' : void 0,
2389
+ // Raw reserves nothing in the caller's call object, so there is no per-call
2390
+ // skip to point at. Offering one would be advice that does nothing.
2391
+ callerCanSkip: false
2392
+ });
2393
+ return result;
2394
+ }
2395
+ function withOutputValidation(existing, outputDataValidation) {
2396
+ const base = isRecord2(existing) ? existing : {};
2397
+ const deprecated = outputDataValidation.skipped === false && outputDataValidation.droppedPaths ? {
2398
+ outputValidation: { droppedPaths: outputDataValidation.droppedPaths }
2399
+ } : {};
2400
+ return { ...base, outputDataValidation, ...deprecated };
2401
+ }
2402
+ function buildValidatedReport({
2403
+ policy,
2404
+ before,
2405
+ after
2406
+ }) {
2407
+ const droppedPaths = policy.includeOutputValidationDroppedPaths ? diffDroppedPaths(before, after) : [];
2408
+ if (droppedPaths.length === 0) return void 0;
2409
+ return {
2410
+ skipped: false,
2411
+ droppedPaths,
2412
+ instruction: `Some fields were removed from \`data\` by output validation. To receive the raw, unvalidated result instead, set \`${SKIP_OUTPUT_DATA_VALIDATION}\`.`
2413
+ };
2136
2414
  }
2137
2415
  function applyListOutputPolicy(page, policy) {
2138
- const schema = policy.outputSchema;
2139
- if (!schema || policy.skipOutputValidation) return page;
2416
+ const schema = resolveValidatingSchema(policy);
2417
+ const report = shouldReport(policy);
2418
+ if (!schema && !report) return page;
2419
+ if (!schema) {
2420
+ return {
2421
+ ...page,
2422
+ meta: withOutputValidation(page.meta, { skipped: true })
2423
+ };
2424
+ }
2140
2425
  const data = page.data.map(
2141
- (item, index) => parseOutput(schema, item, policy, `data[${index}]`)
2426
+ (item, index) => parseOutput(schema, item, policy, { locator: `data[${index}]` })
2142
2427
  );
2428
+ const validation = buildValidatedReport({
2429
+ policy,
2430
+ before: page.data,
2431
+ after: data
2432
+ });
2143
2433
  const next = { ...page, data };
2144
- if (policy.includeOutputValidationDroppedPaths) {
2145
- const droppedPaths = diffDroppedPaths(page.data, data);
2146
- if (droppedPaths.length > 0) {
2147
- next.meta = { ...page.meta, outputValidation: { droppedPaths } };
2148
- }
2149
- }
2434
+ if (validation)
2435
+ next.meta = withOutputValidation(
2436
+ page.meta,
2437
+ validation
2438
+ );
2150
2439
  return next;
2151
2440
  }
2152
2441
 
@@ -2154,15 +2443,44 @@ function applyListOutputPolicy(page, policy) {
2154
2443
  var FRAMEWORK_CONFIGURATION_IDS = /* @__PURE__ */ new Set([
2155
2444
  CORE_OPTIONS_ID
2156
2445
  ]);
2446
+ function isPromiseLike(value) {
2447
+ return value !== null && typeof value === "object" && typeof value.then === "function";
2448
+ }
2157
2449
  function normalizeOutput(output) {
2158
2450
  if (output === void 0) return { type: "raw" };
2159
2451
  if (typeof output === "string") return { type: output };
2160
2452
  return output;
2161
2453
  }
2162
- var CONTEXT = Symbol.for("kitcore.context");
2163
2454
  function getContext(sdk) {
2164
2455
  return sdk[CONTEXT];
2165
2456
  }
2457
+ function assertDynamicMemberRoot(entry) {
2458
+ if (!entry.dynamicMembers?.length) return;
2459
+ const value = entry.getValue ? entry.getValue() : entry.value;
2460
+ if (typeof value === "object" && value !== null) return;
2461
+ throw new Error(
2462
+ `Property "${entry.name}" declares dynamicMembers, so its value must be an object when the SDK is built; got ${value === null ? "null" : typeof value}. Build the root in \`setup\` and return it from \`get\`, so members like "${entry.dynamicMembers[0].name}" are reportable from the first registry read.`
2463
+ );
2464
+ }
2465
+ function getRegistry(sdk, packageFilter) {
2466
+ if (typeof sdk !== "object" && typeof sdk !== "function" || sdk === null)
2467
+ throw createNoRegistryError();
2468
+ const context = getContext(sdk);
2469
+ if (context?.surface) return getCachedRegistry(context, packageFilter);
2470
+ const surfaced = sdk.getRegistry;
2471
+ if (typeof surfaced === "function") {
2472
+ return surfaced.call(
2473
+ sdk,
2474
+ packageFilter ? { package: packageFilter } : void 0
2475
+ );
2476
+ }
2477
+ throw createNoRegistryError();
2478
+ }
2479
+ function createNoRegistryError() {
2480
+ return new Error(
2481
+ "getRegistry: sdk has no kitcore context and no surfaced getRegistry()."
2482
+ );
2483
+ }
2166
2484
  function isResolverRef(value) {
2167
2485
  return "ref" in value;
2168
2486
  }
@@ -2382,8 +2700,9 @@ function bindValue({
2382
2700
  frameworkOrigin = false
2383
2701
  }) {
2384
2702
  if (entry.pluginType === "property" && entry.getValue) {
2703
+ const getValue = entry.getValue;
2385
2704
  Object.defineProperty(target, key, {
2386
- get: entry.getValue,
2705
+ get: ctx ? () => getValue(ctx) : getValue,
2387
2706
  enumerable: true,
2388
2707
  configurable: true
2389
2708
  });
@@ -2667,23 +2986,17 @@ function runLegacyPass(descriptors, context) {
2667
2986
  Object.assign(context, contextRest);
2668
2987
  context.hooks = buildHooks(context.hooks, hooks);
2669
2988
  const exports = mirrorLegacyRootKeys(context, rootKeys, meta);
2989
+ for (const name of Object.keys(rootKeys)) context.surface[name] = name;
2670
2990
  if (!("getRegistry" in exports)) {
2671
- let getRegistry2 = function(options) {
2672
- const sdk = this ?? exports;
2673
- const projection = collectSurfaceProjection(context, sdk);
2674
- Object.assign(projection.meta, context.meta);
2675
- return buildRegistry({
2676
- sdk,
2677
- ...projection,
2678
- packageFilter: options?.package
2679
- });
2991
+ let getRegistry3 = function(options) {
2992
+ return getCachedRegistry(context, options?.package);
2680
2993
  };
2681
- var getRegistry = getRegistry2;
2682
- exports.getRegistry = getRegistry2;
2994
+ var getRegistry2 = getRegistry3;
2995
+ exports.getRegistry = getRegistry3;
2683
2996
  plugins.getRegistry = {
2684
2997
  pluginType: "method",
2685
2998
  name: "getRegistry",
2686
- value: getRegistry2,
2999
+ value: getRegistry3,
2687
3000
  chain: []
2688
3001
  };
2689
3002
  }
@@ -2747,50 +3060,73 @@ function buildMethodEntries(descriptors, context, states) {
2747
3060
  const sdk = { context };
2748
3061
  const methodAnnotator = descriptor.annotator;
2749
3062
  const boundAnnotator = methodAnnotator ? (input) => methodAnnotator({ input }) : void 0;
2750
- const outputPolicy = () => {
3063
+ const outputPolicy = (callOptions) => {
2751
3064
  const core = resolveCoreOptions(context);
2752
3065
  return {
2753
3066
  outputSchema: descriptor.meta?.outputSchema,
2754
3067
  skipOutputValidation: descriptor.skipOutputValidation,
3068
+ skippedByCaller: readSkipOutputDataValidation(callOptions),
2755
3069
  includeOutputValidationDroppedPaths: core?.includeOutputValidationDroppedPaths,
2756
3070
  methodName: descriptor.name,
2757
3071
  adaptError: core?.adaptError
2758
3072
  };
2759
3073
  };
3074
+ const frameworkOptions = out.type === "list" ? LIST_FRAMEWORK_OPTIONS : ITEM_FRAMEWORK_OPTIONS;
3075
+ const withheld = withheldFromRun(frameworkOptions);
2760
3076
  if (out.type === "list") {
2761
3077
  entry.value = createPaginatedFunction(
2762
- fold(callRun),
3078
+ fold(
3079
+ (input, ctx) => callRun(stripFrameworkOnlyOptions(input, withheld), ctx)
3080
+ ),
2763
3081
  {
2764
3082
  sdk,
2765
3083
  schema: descriptor.inputSchema,
2766
3084
  name: descriptor.name,
3085
+ frameworkOptions,
2767
3086
  defaultPageSize: out.defaultPageSize,
2768
3087
  adaptPage: out.adaptPage,
2769
3088
  annotator: boundAnnotator,
2770
3089
  // Validate + strip each item against the item `outputSchema`
2771
3090
  // (item mode's sibling); dropped paths surface as `[].x` in the page's
2772
3091
  // `meta`, unioned across items.
2773
- finalizePage: (page) => applyListOutputPolicy(page, outputPolicy()),
3092
+ finalizePage: (page, callOptions) => applyListOutputPolicy(page, outputPolicy(callOptions)),
2774
3093
  getDeprecation: () => entry.meta?.deprecation,
2775
3094
  getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
2776
3095
  }
2777
3096
  );
2778
3097
  } else if (out.type === "item") {
2779
- const itemCore = async (input, ctx) => applyItemOutputPolicy(await callRun(input, ctx), outputPolicy());
3098
+ const itemCore = async (input, ctx) => applyItemOutputPolicy(
3099
+ await callRun(stripFrameworkOnlyOptions(input, withheld), ctx),
3100
+ outputPolicy(input)
3101
+ );
2780
3102
  entry.value = createFunction(
2781
3103
  fold(itemCore),
2782
3104
  {
2783
3105
  sdk,
2784
3106
  schema: descriptor.inputSchema,
2785
3107
  name: descriptor.name,
3108
+ frameworkOptions,
2786
3109
  annotator: boundAnnotator,
2787
3110
  getDeprecation: () => entry.meta?.deprecation,
2788
3111
  getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
2789
3112
  }
2790
3113
  );
2791
3114
  } else {
3115
+ const rawValidates = descriptor.meta?.outputSchema !== void 0 && !descriptor.skipOutputValidation;
3116
+ const validateRaw = (out2) => {
3117
+ const policy = outputPolicy(void 0);
3118
+ if (isPromiseLike(out2)) {
3119
+ return Promise.resolve(out2).then(
3120
+ (value) => applyRawOutputPolicy(value, policy)
3121
+ );
3122
+ }
3123
+ return applyRawOutputPolicy(out2, policy);
3124
+ };
2792
3125
  entry.value = createRawFunction(
2793
- (input, ctx) => fold(callRun)(input, ctx),
3126
+ (input, ctx) => {
3127
+ const out2 = fold(callRun)(input, ctx);
3128
+ return rawValidates ? validateRaw(out2) : out2;
3129
+ },
2794
3130
  {
2795
3131
  sdk,
2796
3132
  name: descriptor.name,
@@ -2922,9 +3258,14 @@ function buildEagerArtifacts(descriptors, context, states) {
2922
3258
  plugins[id] = {
2923
3259
  pluginType: "property",
2924
3260
  name: descriptor.name,
2925
- getValue: () => get({
2926
- imports: buildImports({ plugins, importBindings }),
2927
- state: states.get(id)
3261
+ getValue: (callContext) => get({
3262
+ imports: buildImports({
3263
+ plugins,
3264
+ importBindings,
3265
+ ctx: callContext
3266
+ }),
3267
+ state: states.get(id),
3268
+ callContext
2928
3269
  }),
2929
3270
  meta: descriptor.meta,
2930
3271
  dynamicMembers: descriptor.dynamicMembers
@@ -2938,6 +3279,7 @@ function buildEagerArtifacts(descriptors, context, states) {
2938
3279
  dynamicMembers: descriptor.dynamicMembers
2939
3280
  };
2940
3281
  }
3282
+ assertDynamicMemberRoot(plugins[id]);
2941
3283
  }
2942
3284
  recordDisposer();
2943
3285
  building.delete(id);
@@ -3161,38 +3503,33 @@ function addModelPlugin(sdk, plugin, options = {}) {
3161
3503
  }
3162
3504
  }
3163
3505
  function addPlugin(sdk, plugin, options) {
3164
- if (typeof plugin === "function") {
3165
- const record = sdk;
3166
- const contribution = applyPluginToSdk(
3167
- record,
3168
- plugin,
3169
- options ?? {}
3170
- );
3171
- const context = record[CONTEXT];
3172
- if (context) {
3173
- mirrorLegacyRootKeys(context, contribution.rootKeys, contribution.meta);
3174
- for (const name of Object.keys(contribution.rootKeys)) {
3175
- context.surface[name] = name;
3506
+ const record = sdk;
3507
+ const context = getContext(record);
3508
+ try {
3509
+ if (typeof plugin === "function") {
3510
+ const contribution = applyPluginToSdk(
3511
+ record,
3512
+ plugin,
3513
+ options ?? {}
3514
+ );
3515
+ if (context) {
3516
+ mirrorLegacyRootKeys(context, contribution.rootKeys, contribution.meta);
3517
+ for (const name of Object.keys(contribution.rootKeys)) {
3518
+ context.surface[name] = name;
3519
+ }
3176
3520
  }
3521
+ } else if (plugin.pluginType === "method-override") {
3522
+ applyMethodOverride(context, plugin);
3523
+ } else {
3524
+ addModelPlugin(record, plugin, options ?? {});
3177
3525
  }
3178
- return;
3179
- }
3180
- if (plugin.pluginType === "method-override") {
3181
- applyMethodOverride(
3182
- getContext(sdk),
3183
- plugin
3184
- );
3185
- return;
3526
+ } finally {
3527
+ if (context) invalidateRegistryCache(context);
3186
3528
  }
3187
- addModelPlugin(
3188
- sdk,
3189
- plugin,
3190
- options ?? {}
3191
- );
3192
3529
  }
3193
3530
 
3194
3531
  // src/model/resolution/controller.ts
3195
- import { z as z4 } from "zod";
3532
+ import { z as z5 } from "zod";
3196
3533
 
3197
3534
  // src/types/signals.ts
3198
3535
  var CORE_SIGNAL_SYMBOL = Symbol.for("kitcore.signal");
@@ -3225,55 +3562,33 @@ function isCoreCancelledSignal(value) {
3225
3562
  }
3226
3563
 
3227
3564
  // src/model/resolution/plan.ts
3228
- import { z as z3 } from "zod";
3229
- function unwrap(schema) {
3230
- let inner = schema;
3231
- let required = true;
3232
- for (; ; ) {
3233
- if (inner instanceof z3.ZodOptional) {
3234
- required = false;
3235
- inner = inner._zod.def.innerType;
3236
- } else if (inner instanceof z3.ZodDefault) {
3237
- required = false;
3238
- inner = inner._zod.def.innerType;
3239
- } else if (inner instanceof z3.ZodNullable) {
3240
- inner = inner._zod.def.innerType;
3241
- } else {
3242
- break;
3243
- }
3244
- }
3245
- return { inner, required };
3246
- }
3565
+ import { z as z4 } from "zod";
3247
3566
  function valueTypeOf(inner) {
3248
- if (inner instanceof z3.ZodString) return "string";
3249
- if (inner instanceof z3.ZodNumber) return "number";
3250
- if (inner instanceof z3.ZodBoolean) return "boolean";
3251
- if (inner instanceof z3.ZodEnum) return "string";
3252
- if (inner instanceof z3.ZodArray) return "array";
3253
- if (inner instanceof z3.ZodObject) return "object";
3254
- if (inner instanceof z3.ZodRecord) return "object";
3567
+ if (inner instanceof z4.ZodString) return "string";
3568
+ if (inner instanceof z4.ZodNumber) return "number";
3569
+ if (inner instanceof z4.ZodBoolean) return "boolean";
3570
+ if (inner instanceof z4.ZodEnum) return "string";
3571
+ if (inner instanceof z4.ZodArray) return "array";
3572
+ if (inner instanceof z4.ZodObject) return "object";
3573
+ if (inner instanceof z4.ZodRecord) return "object";
3255
3574
  return void 0;
3256
3575
  }
3257
3576
  function staticChoicesOf(inner) {
3258
- if (inner instanceof z3.ZodEnum) {
3577
+ if (inner instanceof z4.ZodEnum) {
3259
3578
  const values = inner.options;
3260
3579
  return values.map((value) => ({ label: value, value }));
3261
3580
  }
3262
3581
  return void 0;
3263
3582
  }
3264
- function objectShape(schema) {
3265
- const canonical = canonicalInputSchema(schema);
3266
- const { inner } = canonical ? unwrap(canonical) : { inner: void 0 };
3267
- if (inner instanceof z3.ZodObject) {
3268
- return inner.shape;
3269
- }
3270
- return void 0;
3271
- }
3272
3583
  function topoOrder2(specs) {
3273
3584
  const byName = new Map(specs.map((s) => [s.name, s]));
3274
3585
  const placed = /* @__PURE__ */ new Set();
3275
3586
  const ordered = [];
3276
- const isReady = (spec) => spec.requires.every((r) => !byName.has(r) || placed.has(r));
3587
+ const topLevelNameOf = (r) => typeof r === "string" ? r : r.length === 1 && typeof r[0] === "string" ? r[0] : void 0;
3588
+ const isReady = (spec) => spec.requires.every((r) => {
3589
+ const name = topLevelNameOf(r);
3590
+ return name === void 0 || !byName.has(name) || placed.has(name);
3591
+ });
3277
3592
  for (; ; ) {
3278
3593
  const next = specs.find((s) => !placed.has(s.name) && isReady(s));
3279
3594
  if (!next) break;
@@ -3284,7 +3599,7 @@ function topoOrder2(specs) {
3284
3599
  return ordered;
3285
3600
  }
3286
3601
  function planParameters(entry) {
3287
- const shape = objectShape(entry.inputSchema);
3602
+ const shape = objectShapeOf(entry.inputSchema);
3288
3603
  const resolvers = entry.resolvers ?? {};
3289
3604
  const names = shape ? [
3290
3605
  ...Object.keys(shape),
@@ -3294,7 +3609,7 @@ function planParameters(entry) {
3294
3609
  ] : Object.keys(resolvers);
3295
3610
  const specs = names.map((name) => {
3296
3611
  const field = shape?.[name];
3297
- const { inner, required } = field ? unwrap(field) : { inner: void 0, required: false };
3612
+ const { inner, required } = field ? unwrapSchema(field) : { inner: void 0, required: false };
3298
3613
  const resolver = resolvers[name];
3299
3614
  return {
3300
3615
  name,
@@ -3943,9 +4258,13 @@ async function findNext(ctx, state, path = []) {
3943
4258
  const hasAskableRequired = children.some((c) => c.required && asksUser(c));
3944
4259
  for (const leaf of ordered) {
3945
4260
  const childPath = [...path, leaf.name];
3946
- if (!leaf.requires.every(
3947
- (r) => container[r] !== void 0 || getAtPath(state.resolved, [r]) !== void 0 || isSettled(state, [...path, r]) || isSettled(state, [r])
3948
- )) {
4261
+ if (!leaf.requires.every((r) => {
4262
+ if (typeof r !== "string") {
4263
+ if (getAtPath(state.resolved, [...r]) !== void 0) return true;
4264
+ return r.some((_, index) => isSettled(state, r.slice(0, index + 1)));
4265
+ }
4266
+ return container[r] !== void 0 || getAtPath(state.resolved, [r]) !== void 0 || isSettled(state, [...path, r]) || isSettled(state, [r]);
4267
+ })) {
3949
4268
  continue;
3950
4269
  }
3951
4270
  const inArrayItem = path.some((segment) => typeof segment === "number");
@@ -4349,7 +4668,7 @@ function positionAfter(pagination, action) {
4349
4668
  function toJsonSchema(schema) {
4350
4669
  if (!schema) return void 0;
4351
4670
  try {
4352
- return z4.toJSONSchema(schema);
4671
+ return z5.toJSONSchema(schema);
4353
4672
  } catch {
4354
4673
  return void 0;
4355
4674
  }
@@ -4387,7 +4706,7 @@ function projectMethod(entry) {
4387
4706
  }
4388
4707
  function createController(sdk) {
4389
4708
  function entryFor(method) {
4390
- const entry = sdk.getRegistry().functions.find((f) => f.name === method);
4709
+ const entry = getRegistry(sdk).functions.find((f) => f.name === method);
4391
4710
  if (!entry) throw new Error(`unknown method "${method}"`);
4392
4711
  return entry;
4393
4712
  }
@@ -4426,7 +4745,7 @@ function createController(sdk) {
4426
4745
  throw new Error(`invalid input for "${method}": ${detail}`);
4427
4746
  };
4428
4747
  const listMethods = () => ({
4429
- data: sdk.getRegistry().functions.map(projectSummary)
4748
+ data: getRegistry(sdk).functions.map(projectSummary)
4430
4749
  });
4431
4750
  const getMethod = ({ method }) => ({
4432
4751
  data: projectMethod(entryFor(method))
@@ -4467,10 +4786,10 @@ function createCorePlugin(options) {
4467
4786
  }
4468
4787
 
4469
4788
  // src/transport/attempt-http-request.ts
4470
- import { z as z9 } from "zod";
4789
+ import { z as z10 } from "zod";
4471
4790
 
4472
4791
  // src/transport/authorize-http-request.ts
4473
- import { z as z5 } from "zod";
4792
+ import { z as z6 } from "zod";
4474
4793
  function describeUnclaimedConnection(connection) {
4475
4794
  const delimiterIndex = connection.indexOf(":");
4476
4795
  if (delimiterIndex === -1) {
@@ -4481,7 +4800,7 @@ function describeUnclaimedConnection(connection) {
4481
4800
  var authorizeHttpRequestPlugin = defineMethod({
4482
4801
  name: "authorizeHttpRequest",
4483
4802
  namespace: "kitcore",
4484
- inputSchema: z5.custom(),
4803
+ inputSchema: z6.custom(),
4485
4804
  skipInputValidation: true,
4486
4805
  run: async ({ input }) => {
4487
4806
  const { connection } = input.request;
@@ -4496,7 +4815,7 @@ var authorizeHttpRequestPlugin = defineMethod({
4496
4815
  });
4497
4816
 
4498
4817
  // src/transport/dispatch-http-request.ts
4499
- import { z as z6 } from "zod";
4818
+ import { z as z7 } from "zod";
4500
4819
  function toFetchInput(request) {
4501
4820
  const init = { ...request };
4502
4821
  const { url } = request;
@@ -4507,7 +4826,7 @@ function toFetchInput(request) {
4507
4826
  var dispatchHttpRequestPlugin = defineMethod({
4508
4827
  name: "dispatchHttpRequest",
4509
4828
  namespace: "kitcore",
4510
- inputSchema: z6.custom(),
4829
+ inputSchema: z7.custom(),
4511
4830
  skipInputValidation: true,
4512
4831
  run: async ({ input }) => {
4513
4832
  const { url, init } = toFetchInput(input.request);
@@ -4516,21 +4835,21 @@ var dispatchHttpRequestPlugin = defineMethod({
4516
4835
  });
4517
4836
 
4518
4837
  // src/transport/prepare-http-request.ts
4519
- import { z as z7 } from "zod";
4838
+ import { z as z8 } from "zod";
4520
4839
  var prepareHttpRequestPlugin = defineMethod({
4521
4840
  name: "prepareHttpRequest",
4522
4841
  namespace: "kitcore",
4523
- inputSchema: z7.custom(),
4842
+ inputSchema: z8.custom(),
4524
4843
  skipInputValidation: true,
4525
4844
  run: async ({ input }) => input.request
4526
4845
  });
4527
4846
 
4528
4847
  // src/transport/receive-http-response.ts
4529
- import { z as z8 } from "zod";
4848
+ import { z as z9 } from "zod";
4530
4849
  var receiveHttpResponsePlugin = defineMethod({
4531
4850
  name: "receiveHttpResponse",
4532
4851
  namespace: "kitcore",
4533
- inputSchema: z8.custom(),
4852
+ inputSchema: z9.custom(),
4534
4853
  skipInputValidation: true,
4535
4854
  run: async ({ input }) => input.response
4536
4855
  });
@@ -4545,7 +4864,7 @@ var attemptHttpRequestPlugin = defineMethod({
4545
4864
  declareDefault({ plugin: dispatchHttpRequestPlugin }),
4546
4865
  declareDefault({ plugin: receiveHttpResponsePlugin })
4547
4866
  ],
4548
- inputSchema: z9.custom(),
4867
+ inputSchema: z10.custom(),
4549
4868
  skipInputValidation: true,
4550
4869
  run: async ({ input, imports }) => {
4551
4870
  const { attempt } = input;
@@ -4570,7 +4889,7 @@ var attemptHttpRequestPlugin = defineMethod({
4570
4889
  });
4571
4890
 
4572
4891
  // src/transport/initialize-http-request.ts
4573
- import { z as z10 } from "zod";
4892
+ import { z as z11 } from "zod";
4574
4893
  function isReplayableBody(body) {
4575
4894
  if (body == null || typeof body !== "object") return true;
4576
4895
  return typeof Blob !== "undefined" && body instanceof Blob || // File extends Blob
@@ -4582,7 +4901,7 @@ function withStringUrl(request) {
4582
4901
  var initializeHttpRequestPlugin = defineMethod({
4583
4902
  name: "initializeHttpRequest",
4584
4903
  namespace: "kitcore",
4585
- inputSchema: z10.custom(),
4904
+ inputSchema: z11.custom(),
4586
4905
  skipInputValidation: true,
4587
4906
  run: async ({ input }) => {
4588
4907
  const request = withStringUrl(input.request);
@@ -4719,7 +5038,7 @@ function canRetry(attemptNumber, maxAttempts, replayable) {
4719
5038
  }
4720
5039
 
4721
5040
  // src/transport/send-http-request.ts
4722
- import { z as z11 } from "zod";
5041
+ import { z as z12 } from "zod";
4723
5042
  function createOperationId() {
4724
5043
  return globalThis.crypto?.randomUUID?.() ?? `http-${Date.now()}`;
4725
5044
  }
@@ -4730,7 +5049,7 @@ var sendHttpRequestPlugin = defineMethod({
4730
5049
  declareDefault({ plugin: initializeHttpRequestPlugin }),
4731
5050
  declareDefault({ plugin: attemptHttpRequestPlugin })
4732
5051
  ],
4733
- inputSchema: z11.custom(),
5052
+ inputSchema: z12.custom(),
4734
5053
  skipInputValidation: true,
4735
5054
  run: async ({ input, imports }) => {
4736
5055
  const start2 = {
@@ -4754,13 +5073,13 @@ var sendHttpRequestPlugin = defineMethod({
4754
5073
  });
4755
5074
 
4756
5075
  // src/transport/fetch.ts
4757
- import { z as z12 } from "zod";
5076
+ import { z as z13 } from "zod";
4758
5077
  var fetchPlugin = defineMethod({
4759
5078
  name: "fetch",
4760
5079
  namespace: "kitcore",
4761
5080
  imports: [declareDefault({ plugin: sendHttpRequestPlugin })],
4762
5081
  positional: ["url", "init"],
4763
- inputSchema: z12.custom(),
5082
+ inputSchema: z13.custom(),
4764
5083
  skipInputValidation: true,
4765
5084
  run: ({ input, imports }) => {
4766
5085
  const { url, init } = input;
@@ -4803,22 +5122,22 @@ function redactHttpRequest(request) {
4803
5122
  }
4804
5123
 
4805
5124
  // src/connections/default-connection-scheme.ts
4806
- import { z as z13 } from "zod";
5125
+ import { z as z14 } from "zod";
4807
5126
  var defaultConnectionSchemePlugin = defineMethod({
4808
5127
  name: "defaultConnectionScheme",
4809
5128
  namespace: "kitcore",
4810
- inputSchema: z13.custom(),
5129
+ inputSchema: z14.custom(),
4811
5130
  skipInputValidation: true,
4812
5131
  run: () => void 0
4813
5132
  });
4814
5133
 
4815
5134
  // src/connections/normalize-connection.ts
4816
- import { z as z14 } from "zod";
5135
+ import { z as z15 } from "zod";
4817
5136
  var normalizeConnectionPlugin = defineMethod({
4818
5137
  name: "normalizeConnection",
4819
5138
  namespace: "kitcore",
4820
5139
  imports: [declareDefault({ plugin: defaultConnectionSchemePlugin })],
4821
- inputSchema: z14.custom(),
5140
+ inputSchema: z15.custom(),
4822
5141
  skipInputValidation: true,
4823
5142
  run: ({ input, imports }) => {
4824
5143
  const { connection } = input;
@@ -4843,11 +5162,11 @@ var normalizeConnectionPlugin = defineMethod({
4843
5162
  });
4844
5163
 
4845
5164
  // src/connections/resolve-connection.ts
4846
- import { z as z15 } from "zod";
5165
+ import { z as z16 } from "zod";
4847
5166
  var resolveConnectionPlugin = defineMethod({
4848
5167
  name: "resolveConnection",
4849
5168
  namespace: "kitcore",
4850
- inputSchema: z15.custom(),
5169
+ inputSchema: z16.custom(),
4851
5170
  skipInputValidation: true,
4852
5171
  run: ({ input }) => input.connection
4853
5172
  });
@@ -4902,6 +5221,7 @@ export {
4902
5221
  defineLegacyMerge,
4903
5222
  defineMethod,
4904
5223
  defineMethodOverride,
5224
+ defineOverride,
4905
5225
  definePlugin,
4906
5226
  defineProperty,
4907
5227
  defineResolver,
@@ -4917,6 +5237,7 @@ export {
4917
5237
  getFieldDescriptions,
4918
5238
  getNegatable,
4919
5239
  getOutputSchema,
5240
+ getRegistry,
4920
5241
  getRegistryPlugin,
4921
5242
  getSchemaDescription,
4922
5243
  initializeHttpRequestPlugin,
@@ -4928,6 +5249,7 @@ export {
4928
5249
  isTelemetryNested,
4929
5250
  normalizeConnectionPlugin,
4930
5251
  normalizeStability,
5252
+ objectShapeOf,
4931
5253
  omitExports,
4932
5254
  openEnum,
4933
5255
  paginate,
@@ -4949,6 +5271,7 @@ export {
4949
5271
  toIterable,
4950
5272
  toSnakeCase,
4951
5273
  toTitleCase,
5274
+ unwrapSchema,
4952
5275
  validateOptions,
4953
5276
  withOutputSchema,
4954
5277
  withPositional,