@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.cjs CHANGED
@@ -70,6 +70,7 @@ __export(index_exports, {
70
70
  defineLegacyMerge: () => defineLegacyMerge,
71
71
  defineMethod: () => defineMethod,
72
72
  defineMethodOverride: () => defineMethodOverride,
73
+ defineOverride: () => defineOverride,
73
74
  definePlugin: () => definePlugin,
74
75
  defineProperty: () => defineProperty,
75
76
  defineResolver: () => defineResolver,
@@ -85,6 +86,7 @@ __export(index_exports, {
85
86
  getFieldDescriptions: () => getFieldDescriptions,
86
87
  getNegatable: () => getNegatable,
87
88
  getOutputSchema: () => getOutputSchema,
89
+ getRegistry: () => getRegistry,
88
90
  getRegistryPlugin: () => getRegistryPlugin,
89
91
  getSchemaDescription: () => getSchemaDescription,
90
92
  initializeHttpRequestPlugin: () => initializeHttpRequestPlugin,
@@ -96,6 +98,7 @@ __export(index_exports, {
96
98
  isTelemetryNested: () => isTelemetryNested,
97
99
  normalizeConnectionPlugin: () => normalizeConnectionPlugin,
98
100
  normalizeStability: () => normalizeStability,
101
+ objectShapeOf: () => objectShapeOf,
99
102
  omitExports: () => omitExports,
100
103
  openEnum: () => openEnum,
101
104
  paginate: () => paginate,
@@ -117,6 +120,7 @@ __export(index_exports, {
117
120
  toIterable: () => toIterable,
118
121
  toSnakeCase: () => toSnakeCase,
119
122
  toTitleCase: () => toTitleCase,
123
+ unwrapSchema: () => unwrapSchema,
120
124
  validateOptions: () => validateOptions,
121
125
  withOutputSchema: () => withOutputSchema,
122
126
  withPositional: () => withPositional,
@@ -155,6 +159,30 @@ function canonicalInputSchema(schema) {
155
159
  }
156
160
  return schema;
157
161
  }
162
+ function unwrapSchema(schema) {
163
+ let inner = schema;
164
+ let required = true;
165
+ for (; ; ) {
166
+ if (inner instanceof import_zod.z.ZodOptional || inner instanceof import_zod.z.ZodDefault) {
167
+ required = false;
168
+ inner = inner.unwrap();
169
+ } else if (inner instanceof import_zod.z.ZodNullable) {
170
+ inner = inner.unwrap();
171
+ } else {
172
+ break;
173
+ }
174
+ }
175
+ return { inner, required };
176
+ }
177
+ function objectShapeOf(schema) {
178
+ const canonical = canonicalInputSchema(schema);
179
+ if (!canonical) return void 0;
180
+ const { inner } = unwrapSchema(canonical);
181
+ if (inner instanceof import_zod.z.ZodObject) {
182
+ return inner.shape;
183
+ }
184
+ return void 0;
185
+ }
158
186
  function getOutputSchema(inputSchema) {
159
187
  return inputSchema._zod.def.outputSchema;
160
188
  }
@@ -775,6 +803,120 @@ function createValidator(schema, { adaptError } = {}) {
775
803
  }
776
804
  var validateOptions = (schema, options, { adaptError } = {}) => parseOrThrow(schema, options, { adaptError });
777
805
 
806
+ // src/utils/call-options.ts
807
+ var import_zod2 = require("zod");
808
+ var CallFrameworkOptionsSchema = import_zod2.z.object({
809
+ /** Page to fetch. Opaque to kitcore: the head's API defines the format. */
810
+ cursor: import_zod2.z.string().optional(),
811
+ /** Items per page. */
812
+ pageSize: import_zod2.z.number().int().min(1).optional(),
813
+ /** Stop after this many items, across pages. */
814
+ maxItems: import_zod2.z.number().int().min(0).optional(),
815
+ /** Bypass output validation for this one call. */
816
+ skipOutputDataValidation: import_zod2.z.boolean().optional()
817
+ });
818
+ var ITEM_FRAMEWORK_OPTIONS = {
819
+ claims: ["skipOutputDataValidation"],
820
+ injects: []
821
+ };
822
+ var LIST_FRAMEWORK_OPTIONS = {
823
+ claims: ["cursor", "pageSize", "maxItems", "skipOutputDataValidation"],
824
+ injects: ["cursor", "pageSize"]
825
+ };
826
+ var PAGE_FRAMEWORK_OPTIONS = {
827
+ claims: ["cursor", "pageSize", "maxItems"],
828
+ injects: ["cursor", "pageSize", "maxItems"]
829
+ };
830
+ var NO_FRAMEWORK_OPTIONS = {
831
+ claims: [],
832
+ injects: []
833
+ };
834
+ function isRecord(value) {
835
+ return typeof value === "object" && value !== null && !Array.isArray(value);
836
+ }
837
+ function strictlyRefused(error, claims) {
838
+ const refused = /* @__PURE__ */ new Set();
839
+ for (const issue of error.issues) {
840
+ if (issue.code !== "unrecognized_keys" || issue.path.length > 0) continue;
841
+ for (const key of issue.keys) {
842
+ if (claims.includes(key)) refused.add(key);
843
+ }
844
+ }
845
+ return [...refused];
846
+ }
847
+ function withoutKeys(options, keys) {
848
+ const next = {};
849
+ for (const [key, value] of Object.entries(options)) {
850
+ if (!keys.includes(key)) next[key] = value;
851
+ }
852
+ return next;
853
+ }
854
+ function parseCallOptions(options, {
855
+ schema,
856
+ policy = NO_FRAMEWORK_OPTIONS,
857
+ adaptError
858
+ } = {}) {
859
+ const claims = policy.claims;
860
+ const call = isRecord(options) ? options : void 0;
861
+ let framework = {};
862
+ if (call && claims.length > 0) {
863
+ const present = {};
864
+ for (const key of claims) {
865
+ if (key in call) present[key] = call[key];
866
+ }
867
+ framework = parseOrThrow2(CallFrameworkOptionsSchema, present, adaptError);
868
+ }
869
+ if (!schema) return { framework, domain: options, supplied: /* @__PURE__ */ new Set() };
870
+ const first = schema.safeParse(options);
871
+ if (first.success) {
872
+ return { framework, domain: first.data, supplied: /* @__PURE__ */ new Set() };
873
+ }
874
+ const refused = call ? strictlyRefused(first.error, claims) : [];
875
+ if (refused.length === 0) throw toCoreError(first.error, options, adaptError);
876
+ const retry = schema.safeParse(withoutKeys(call, refused));
877
+ if (!retry.success) {
878
+ throw toCoreError(retry.error, options, adaptError);
879
+ }
880
+ return { framework, domain: retry.data, supplied: new Set(refused) };
881
+ }
882
+ function mergeCallOptions({
883
+ framework,
884
+ domain
885
+ }) {
886
+ const claimed = Object.entries(framework);
887
+ if (!isRecord(domain) || claimed.length === 0) return domain;
888
+ return { ...domain, ...Object.fromEntries(claimed) };
889
+ }
890
+ function withheldFromRun(policy) {
891
+ return new Set(policy.claims.filter((key) => !policy.injects.includes(key)));
892
+ }
893
+ function stripFrameworkOnlyOptions(options, withheld) {
894
+ if (withheld.size === 0 || !isRecord(options)) return options;
895
+ const entries = Object.entries(options);
896
+ if (!entries.some(([key]) => withheld.has(key))) return options;
897
+ return Object.fromEntries(entries.filter(([key]) => !withheld.has(key)));
898
+ }
899
+ function parseOrThrow2(schema, input, adaptError) {
900
+ const result = schema.safeParse(input);
901
+ if (result.success) return result.data;
902
+ throw toCoreError(result.error, input, adaptError);
903
+ }
904
+ function toCoreError(error, input, adaptError) {
905
+ const messages = error.issues.map((issue) => {
906
+ const path = issue.path.length > 0 ? issue.path.join(".") : "input";
907
+ return `${path}: ${issue.message}`;
908
+ });
909
+ return createCoreError(
910
+ {
911
+ code: CoreErrorCode.Validation,
912
+ message: `Validation failed:
913
+ ${messages.join("\n ")}`,
914
+ details: { zodErrors: error.issues, input }
915
+ },
916
+ adaptError
917
+ );
918
+ }
919
+
778
920
  // src/utils/async-context.ts
779
921
  var import_node_async_hooks = require("async_hooks");
780
922
  function createAsyncContext() {
@@ -972,7 +1114,15 @@ function normalizeError(error, adaptError) {
972
1114
  );
973
1115
  }
974
1116
  function createFunction(coreFn, options) {
975
- const { sdk, schema, name, annotator, getDeprecation, getStability } = options;
1117
+ const {
1118
+ sdk,
1119
+ schema,
1120
+ name,
1121
+ annotator,
1122
+ frameworkOptions,
1123
+ getDeprecation,
1124
+ getStability
1125
+ } = options;
976
1126
  const functionName = name || coreFn.name;
977
1127
  const namedFunctions = {
978
1128
  [functionName]: async function(callOptions) {
@@ -1008,25 +1158,15 @@ function createFunction(coreFn, options) {
1008
1158
  };
1009
1159
  hooks?.onMethodStart?.({ ...hookBase });
1010
1160
  try {
1011
- let result;
1012
- if (schema) {
1013
- const validatedOptions = validateOptions(
1014
- schema,
1015
- normalizedOptions,
1016
- {
1017
- adaptError
1018
- }
1019
- );
1020
- result = await coreFn(
1021
- {
1022
- ...normalizedOptions,
1023
- ...validatedOptions
1024
- },
1025
- context
1026
- );
1027
- } else {
1028
- result = await coreFn(normalizedOptions, context);
1029
- }
1161
+ const parsed = parseCallOptions(normalizedOptions, {
1162
+ schema,
1163
+ policy: frameworkOptions,
1164
+ adaptError
1165
+ });
1166
+ const result = await coreFn(
1167
+ mergeCallOptions(parsed),
1168
+ context
1169
+ );
1030
1170
  hooks?.onMethodEnd?.({
1031
1171
  ...hookBase,
1032
1172
  durationMs: Date.now() - startTime
@@ -1147,7 +1287,7 @@ function createPageFunction(coreFn, {
1147
1287
  `${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\`.`
1148
1288
  );
1149
1289
  }
1150
- return finalizePage ? finalizePage(page) : page;
1290
+ return finalizePage ? finalizePage(page, options) : page;
1151
1291
  } catch (error) {
1152
1292
  throw normalizeError(
1153
1293
  error,
@@ -1167,6 +1307,7 @@ function createPaginatedFunction(coreFn, options) {
1167
1307
  adaptPage,
1168
1308
  annotator,
1169
1309
  finalizePage,
1310
+ frameworkOptions,
1170
1311
  getDeprecation,
1171
1312
  getStability
1172
1313
  } = options;
@@ -1210,10 +1351,13 @@ function createPaginatedFunction(coreFn, options) {
1210
1351
  };
1211
1352
  hooks?.onMethodStart?.({ ...hookBase });
1212
1353
  try {
1213
- const validatedOptions = {
1214
- ...normalizedOptions,
1215
- ...schema ? createValidator(schema, { adaptError })(normalizedOptions) : normalizedOptions
1216
- };
1354
+ const validatedOptions = mergeCallOptions(
1355
+ parseCallOptions(normalizedOptions, {
1356
+ schema,
1357
+ policy: frameworkOptions,
1358
+ adaptError
1359
+ })
1360
+ );
1217
1361
  const pageSize = validatedOptions.pageSize ?? defaultPageSize;
1218
1362
  const optimizedOptions = {
1219
1363
  ...validatedOptions,
@@ -1339,6 +1483,10 @@ function createPaginatedPluginMethod(sdk, config) {
1339
1483
  sdk,
1340
1484
  schema: inputSchema,
1341
1485
  name,
1486
+ // The page loop reads the page controls out of the call object, so a
1487
+ // handler's schema does not have to declare them. It reads nothing else:
1488
+ // no legacy handler honors the caller's output skip.
1489
+ frameworkOptions: PAGE_FRAMEWORK_OPTIONS,
1342
1490
  defaultPageSize,
1343
1491
  adaptPage
1344
1492
  });
@@ -1582,6 +1730,7 @@ function buildPluginStack(head, callerLabel) {
1582
1730
  }
1583
1731
 
1584
1732
  // src/model/shared.ts
1733
+ var CONTEXT = Symbol.for("kitcore.context");
1585
1734
  function parseId(id) {
1586
1735
  const at = id.lastIndexOf("/");
1587
1736
  return at === -1 ? { name: id, namespace: void 0 } : { name: id.slice(at + 1), namespace: id.slice(0, at) };
@@ -1691,7 +1840,12 @@ function collectDynamicMembers(members) {
1691
1840
  };
1692
1841
  });
1693
1842
  }
1694
- function defineMethod(config) {
1843
+ function defineMethod(configOrRef, refConfig) {
1844
+ const config = refConfig === void 0 ? configOrRef : {
1845
+ ...refConfig,
1846
+ name: configOrRef.name,
1847
+ namespace: configOrRef.namespace
1848
+ };
1695
1849
  const deps = normalizeImports(config.imports);
1696
1850
  return {
1697
1851
  pluginType: "method",
@@ -1714,8 +1868,27 @@ function defineMethod(config) {
1714
1868
  run: config.run
1715
1869
  };
1716
1870
  }
1717
- function defineMethodOverride(config) {
1718
- const { target, namespace, ...rest } = config;
1871
+ var OVERRIDABLE = [
1872
+ "description",
1873
+ "categories",
1874
+ "itemType",
1875
+ "returnType",
1876
+ "packages",
1877
+ "experimental",
1878
+ "deprecation",
1879
+ "supportsJsonOutput"
1880
+ ];
1881
+ function assertOverridable(target, fields) {
1882
+ const offered = Object.keys(fields).filter(
1883
+ (key) => !OVERRIDABLE.includes(key)
1884
+ );
1885
+ if (offered.length === 0) return;
1886
+ throw new Error(
1887
+ `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(", ")}.`
1888
+ );
1889
+ }
1890
+ function buildOverride(target, namespace, fields) {
1891
+ assertOverridable(target, fields);
1719
1892
  return {
1720
1893
  pluginType: "method-override",
1721
1894
  name: `override:${target}`,
@@ -1723,12 +1896,34 @@ function defineMethodOverride(config) {
1723
1896
  target,
1724
1897
  imports: [],
1725
1898
  importBindings: [],
1726
- meta: collectLeafMeta(rest)
1899
+ meta: collectLeafMeta(fields)
1727
1900
  };
1728
1901
  }
1902
+ function defineOverride(ref, config = {}) {
1903
+ const { namespace, ...fields } = config;
1904
+ return buildOverride(ref.id, namespace, fields);
1905
+ }
1906
+ function defineMethodOverride(config) {
1907
+ logDeprecation(
1908
+ "defineMethodOverride({ target }) is deprecated. Use defineOverride(method, { ... }), which takes the method or its declareMethod stand-in."
1909
+ );
1910
+ const { target, namespace, ...fields } = config;
1911
+ return buildOverride(target, namespace, fields);
1912
+ }
1913
+ function assertRequirementPaths(requirements) {
1914
+ if (!requirements) return;
1915
+ for (const requirement of requirements) {
1916
+ if (typeof requirement !== "string" && requirement.length === 0) {
1917
+ throw new Error(
1918
+ "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."
1919
+ );
1920
+ }
1921
+ }
1922
+ }
1729
1923
  function defineResolver(config) {
1730
1924
  const deps = normalizeImports(config.imports);
1731
1925
  const base = { imports: deps.plugins, importBindings: deps.bindings };
1926
+ assertRequirementPaths(config.requireParameters);
1732
1927
  const gates = {
1733
1928
  requireParameters: config.requireParameters
1734
1929
  };
@@ -1832,21 +2027,26 @@ function declareOptionalMethod(config) {
1832
2027
  // `| undefined`.
1833
2028
  };
1834
2029
  }
1835
- function defineProperty(config) {
1836
- const deps = normalizeImports(config.imports);
2030
+ function defineProperty(config, refConfig) {
2031
+ const cfg = refConfig === void 0 ? config : {
2032
+ ...refConfig,
2033
+ name: config.name,
2034
+ namespace: config.namespace
2035
+ };
2036
+ const deps = normalizeImports(cfg.imports);
1837
2037
  return {
1838
2038
  pluginType: "property",
1839
- name: config.name,
1840
- namespace: config.namespace,
1841
- id: makeId(config.name, config.namespace),
2039
+ name: cfg.name,
2040
+ namespace: cfg.namespace,
2041
+ id: makeId(cfg.name, cfg.namespace),
1842
2042
  imports: deps.plugins,
1843
2043
  importBindings: deps.bindings,
1844
- setup: config.setup,
1845
- dispose: config.dispose,
1846
- value: config.value,
1847
- get: config.get,
1848
- meta: collectLeafMeta(config),
1849
- dynamicMembers: collectDynamicMembers(config.dynamicMembers)
2044
+ setup: cfg.setup,
2045
+ dispose: cfg.dispose,
2046
+ value: cfg.value,
2047
+ get: cfg.get,
2048
+ meta: collectLeafMeta(cfg),
2049
+ dynamicMembers: collectDynamicMembers(cfg.dynamicMembers)
1850
2050
  };
1851
2051
  }
1852
2052
  function declareProperty(config) {
@@ -2072,7 +2272,7 @@ function legacyGraphEntry(name, value, pluginMeta) {
2072
2272
  }
2073
2273
 
2074
2274
  // src/model/builtins.ts
2075
- var import_zod2 = require("zod");
2275
+ var import_zod3 = require("zod");
2076
2276
 
2077
2277
  // src/model/registry-support.ts
2078
2278
  function adaptLegacyFormatter(legacy, sdk) {
@@ -2150,6 +2350,34 @@ function collectSurfaceProjection(context, formatterSdk) {
2150
2350
  }
2151
2351
  return { meta, formatters, resolvers, positional, skipInputValidation };
2152
2352
  }
2353
+ var REGISTRY_CACHE = Symbol.for("kitcore.registryCache");
2354
+ function freezeContainers(registry) {
2355
+ Object.freeze(registry.functions);
2356
+ for (const category of registry.categories) {
2357
+ Object.freeze(category.functions);
2358
+ Object.freeze(category);
2359
+ }
2360
+ Object.freeze(registry.categories);
2361
+ return Object.freeze(registry);
2362
+ }
2363
+ function getCachedRegistry(context, packageFilter) {
2364
+ const key = packageFilter ?? "";
2365
+ const caching = context;
2366
+ let byFilter = caching[REGISTRY_CACHE];
2367
+ if (!byFilter) {
2368
+ byFilter = /* @__PURE__ */ new Map();
2369
+ caching[REGISTRY_CACHE] = byFilter;
2370
+ }
2371
+ let registry = byFilter.get(key);
2372
+ if (!registry) {
2373
+ registry = freezeContainers(buildSurfaceRegistry(context, packageFilter));
2374
+ byFilter.set(key, registry);
2375
+ }
2376
+ return registry;
2377
+ }
2378
+ function invalidateRegistryCache(context) {
2379
+ delete context[REGISTRY_CACHE];
2380
+ }
2153
2381
  function buildSurfaceRegistry(context, packageFilter) {
2154
2382
  const surface = {};
2155
2383
  for (const [binding, id] of Object.entries(context.surface)) {
@@ -2157,9 +2385,11 @@ function buildSurfaceRegistry(context, packageFilter) {
2157
2385
  if (!entry || entry.pluginType === "aggregate") continue;
2158
2386
  surface[binding] = entry.pluginType === "property" && entry.getValue ? entry.getValue() : entry.value;
2159
2387
  }
2388
+ const projection = collectSurfaceProjection(context, surface);
2389
+ Object.assign(projection.meta, context.meta);
2160
2390
  return buildRegistry({
2161
2391
  sdk: surface,
2162
- ...collectSurfaceProjection(context, surface),
2392
+ ...projection,
2163
2393
  packageFilter
2164
2394
  });
2165
2395
  }
@@ -2179,12 +2409,12 @@ var getRegistryPlugin = defineMethod({
2179
2409
  name: "getRegistry",
2180
2410
  namespace: "kitcore",
2181
2411
  imports: [dangerousContextPlugin],
2182
- inputSchema: import_zod2.z.object({ package: import_zod2.z.string().optional() }).optional(),
2183
- run: ({ imports, input }) => buildSurfaceRegistry(imports.context, input?.package)
2412
+ inputSchema: import_zod3.z.object({ package: import_zod3.z.string().optional() }).optional(),
2413
+ run: ({ imports, input }) => getCachedRegistry(imports.context, input?.package)
2184
2414
  });
2185
2415
 
2186
2416
  // src/utils/output-policy.ts
2187
- function isRecord(value) {
2417
+ function isRecord2(value) {
2188
2418
  return typeof value === "object" && value !== null && !Array.isArray(value);
2189
2419
  }
2190
2420
  function diffDroppedPaths(raw, parsed, prefix = "") {
@@ -2207,7 +2437,7 @@ function walkDroppedPaths(raw, parsed, prefix, out) {
2207
2437
  }
2208
2438
  return;
2209
2439
  }
2210
- if (isRecord(raw) && isRecord(parsed)) {
2440
+ if (isRecord2(raw) && isRecord2(parsed)) {
2211
2441
  for (const key of Object.keys(raw)) {
2212
2442
  const path = prefix ? `${prefix}.${key}` : key;
2213
2443
  if (!(key in parsed)) {
@@ -2219,7 +2449,22 @@ function walkDroppedPaths(raw, parsed, prefix, out) {
2219
2449
  return;
2220
2450
  }
2221
2451
  }
2222
- function parseOutput(schema, value, policy, locator) {
2452
+ var SKIP_OUTPUT_DATA_VALIDATION = "skipOutputDataValidation";
2453
+ function readSkipOutputDataValidation(options) {
2454
+ return isRecord2(options) && options[SKIP_OUTPUT_DATA_VALIDATION] === true;
2455
+ }
2456
+ function resolveValidatingSchema(policy) {
2457
+ if (policy.skipOutputValidation || policy.skippedByCaller) return void 0;
2458
+ return policy.outputSchema;
2459
+ }
2460
+ function shouldReport(policy) {
2461
+ return policy.skippedByCaller === true && policy.outputSchema !== void 0 && !policy.skipOutputValidation;
2462
+ }
2463
+ function parseOutput(schema, value, policy, {
2464
+ locator,
2465
+ hint,
2466
+ callerCanSkip = true
2467
+ } = {}) {
2223
2468
  const result = schema.safeParse(value);
2224
2469
  if (result.success) return result.data;
2225
2470
  const issues = result.error.issues.map((issue) => {
@@ -2234,43 +2479,91 @@ function parseOutput(schema, value, policy, locator) {
2234
2479
  message: `Output validation failed${subject}${at}:
2235
2480
  ${issues.join("\n ")}
2236
2481
 
2237
- 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.`,
2482
+ ` + (hint ? `${hint}
2483
+
2484
+ ` : "") + `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.` : ``),
2238
2485
  details: { zodErrors: result.error.issues, output: value }
2239
2486
  },
2240
2487
  policy.adaptError
2241
2488
  );
2242
2489
  }
2243
2490
  function applyItemOutputPolicy(result, policy) {
2244
- const schema = policy.outputSchema;
2245
- if (!schema || policy.skipOutputValidation) return result;
2246
- if (!isRecord(result) || !("data" in result)) return result;
2491
+ const schema = resolveValidatingSchema(policy);
2492
+ const report = shouldReport(policy);
2493
+ if (!schema && !report) return result;
2494
+ if (!isRecord2(result) || !("data" in result)) return result;
2495
+ if (!schema) {
2496
+ return {
2497
+ ...result,
2498
+ meta: withOutputValidation(result.meta, { skipped: true })
2499
+ };
2500
+ }
2247
2501
  const data = parseOutput(schema, result.data, policy);
2502
+ const validation = buildValidatedReport({
2503
+ policy,
2504
+ before: result.data,
2505
+ after: data
2506
+ });
2248
2507
  const next = { ...result, data };
2249
- if (policy.includeOutputValidationDroppedPaths) {
2250
- const droppedPaths = diffDroppedPaths(result.data, data);
2251
- if (droppedPaths.length > 0) {
2252
- next.meta = withOutputValidation(result.meta, droppedPaths);
2253
- }
2254
- }
2508
+ if (validation) next.meta = withOutputValidation(result.meta, validation);
2255
2509
  return next;
2256
2510
  }
2257
- function withOutputValidation(existing, droppedPaths) {
2258
- const base = isRecord(existing) ? existing : {};
2259
- return { ...base, outputValidation: { droppedPaths } };
2511
+ function applyRawOutputPolicy(result, policy) {
2512
+ const schema = resolveValidatingSchema(policy);
2513
+ if (!schema) return result;
2514
+ const looksLikeEnvelope = isRecord2(result) && "data" in result;
2515
+ parseOutput(schema, result, policy, {
2516
+ 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,
2517
+ // Raw reserves nothing in the caller's call object, so there is no per-call
2518
+ // skip to point at. Offering one would be advice that does nothing.
2519
+ callerCanSkip: false
2520
+ });
2521
+ return result;
2522
+ }
2523
+ function withOutputValidation(existing, outputDataValidation) {
2524
+ const base = isRecord2(existing) ? existing : {};
2525
+ const deprecated = outputDataValidation.skipped === false && outputDataValidation.droppedPaths ? {
2526
+ outputValidation: { droppedPaths: outputDataValidation.droppedPaths }
2527
+ } : {};
2528
+ return { ...base, outputDataValidation, ...deprecated };
2529
+ }
2530
+ function buildValidatedReport({
2531
+ policy,
2532
+ before,
2533
+ after
2534
+ }) {
2535
+ const droppedPaths = policy.includeOutputValidationDroppedPaths ? diffDroppedPaths(before, after) : [];
2536
+ if (droppedPaths.length === 0) return void 0;
2537
+ return {
2538
+ skipped: false,
2539
+ droppedPaths,
2540
+ instruction: `Some fields were removed from \`data\` by output validation. To receive the raw, unvalidated result instead, set \`${SKIP_OUTPUT_DATA_VALIDATION}\`.`
2541
+ };
2260
2542
  }
2261
2543
  function applyListOutputPolicy(page, policy) {
2262
- const schema = policy.outputSchema;
2263
- if (!schema || policy.skipOutputValidation) return page;
2544
+ const schema = resolveValidatingSchema(policy);
2545
+ const report = shouldReport(policy);
2546
+ if (!schema && !report) return page;
2547
+ if (!schema) {
2548
+ return {
2549
+ ...page,
2550
+ meta: withOutputValidation(page.meta, { skipped: true })
2551
+ };
2552
+ }
2264
2553
  const data = page.data.map(
2265
- (item, index) => parseOutput(schema, item, policy, `data[${index}]`)
2554
+ (item, index) => parseOutput(schema, item, policy, { locator: `data[${index}]` })
2266
2555
  );
2556
+ const validation = buildValidatedReport({
2557
+ policy,
2558
+ before: page.data,
2559
+ after: data
2560
+ });
2267
2561
  const next = { ...page, data };
2268
- if (policy.includeOutputValidationDroppedPaths) {
2269
- const droppedPaths = diffDroppedPaths(page.data, data);
2270
- if (droppedPaths.length > 0) {
2271
- next.meta = { ...page.meta, outputValidation: { droppedPaths } };
2272
- }
2273
- }
2562
+ if (validation)
2563
+ next.meta = withOutputValidation(
2564
+ page.meta,
2565
+ validation
2566
+ );
2274
2567
  return next;
2275
2568
  }
2276
2569
 
@@ -2278,15 +2571,44 @@ function applyListOutputPolicy(page, policy) {
2278
2571
  var FRAMEWORK_CONFIGURATION_IDS = /* @__PURE__ */ new Set([
2279
2572
  CORE_OPTIONS_ID
2280
2573
  ]);
2574
+ function isPromiseLike(value) {
2575
+ return value !== null && typeof value === "object" && typeof value.then === "function";
2576
+ }
2281
2577
  function normalizeOutput(output) {
2282
2578
  if (output === void 0) return { type: "raw" };
2283
2579
  if (typeof output === "string") return { type: output };
2284
2580
  return output;
2285
2581
  }
2286
- var CONTEXT = Symbol.for("kitcore.context");
2287
2582
  function getContext(sdk) {
2288
2583
  return sdk[CONTEXT];
2289
2584
  }
2585
+ function assertDynamicMemberRoot(entry) {
2586
+ if (!entry.dynamicMembers?.length) return;
2587
+ const value = entry.getValue ? entry.getValue() : entry.value;
2588
+ if (typeof value === "object" && value !== null) return;
2589
+ throw new Error(
2590
+ `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.`
2591
+ );
2592
+ }
2593
+ function getRegistry(sdk, packageFilter) {
2594
+ if (typeof sdk !== "object" && typeof sdk !== "function" || sdk === null)
2595
+ throw createNoRegistryError();
2596
+ const context = getContext(sdk);
2597
+ if (context?.surface) return getCachedRegistry(context, packageFilter);
2598
+ const surfaced = sdk.getRegistry;
2599
+ if (typeof surfaced === "function") {
2600
+ return surfaced.call(
2601
+ sdk,
2602
+ packageFilter ? { package: packageFilter } : void 0
2603
+ );
2604
+ }
2605
+ throw createNoRegistryError();
2606
+ }
2607
+ function createNoRegistryError() {
2608
+ return new Error(
2609
+ "getRegistry: sdk has no kitcore context and no surfaced getRegistry()."
2610
+ );
2611
+ }
2290
2612
  function isResolverRef(value) {
2291
2613
  return "ref" in value;
2292
2614
  }
@@ -2506,8 +2828,9 @@ function bindValue({
2506
2828
  frameworkOrigin = false
2507
2829
  }) {
2508
2830
  if (entry.pluginType === "property" && entry.getValue) {
2831
+ const getValue = entry.getValue;
2509
2832
  Object.defineProperty(target, key, {
2510
- get: entry.getValue,
2833
+ get: ctx ? () => getValue(ctx) : getValue,
2511
2834
  enumerable: true,
2512
2835
  configurable: true
2513
2836
  });
@@ -2791,23 +3114,17 @@ function runLegacyPass(descriptors, context) {
2791
3114
  Object.assign(context, contextRest);
2792
3115
  context.hooks = buildHooks(context.hooks, hooks);
2793
3116
  const exports2 = mirrorLegacyRootKeys(context, rootKeys, meta);
3117
+ for (const name of Object.keys(rootKeys)) context.surface[name] = name;
2794
3118
  if (!("getRegistry" in exports2)) {
2795
- let getRegistry2 = function(options) {
2796
- const sdk = this ?? exports2;
2797
- const projection = collectSurfaceProjection(context, sdk);
2798
- Object.assign(projection.meta, context.meta);
2799
- return buildRegistry({
2800
- sdk,
2801
- ...projection,
2802
- packageFilter: options?.package
2803
- });
3119
+ let getRegistry3 = function(options) {
3120
+ return getCachedRegistry(context, options?.package);
2804
3121
  };
2805
- var getRegistry = getRegistry2;
2806
- exports2.getRegistry = getRegistry2;
3122
+ var getRegistry2 = getRegistry3;
3123
+ exports2.getRegistry = getRegistry3;
2807
3124
  plugins.getRegistry = {
2808
3125
  pluginType: "method",
2809
3126
  name: "getRegistry",
2810
- value: getRegistry2,
3127
+ value: getRegistry3,
2811
3128
  chain: []
2812
3129
  };
2813
3130
  }
@@ -2871,50 +3188,73 @@ function buildMethodEntries(descriptors, context, states) {
2871
3188
  const sdk = { context };
2872
3189
  const methodAnnotator = descriptor.annotator;
2873
3190
  const boundAnnotator = methodAnnotator ? (input) => methodAnnotator({ input }) : void 0;
2874
- const outputPolicy = () => {
3191
+ const outputPolicy = (callOptions) => {
2875
3192
  const core = resolveCoreOptions(context);
2876
3193
  return {
2877
3194
  outputSchema: descriptor.meta?.outputSchema,
2878
3195
  skipOutputValidation: descriptor.skipOutputValidation,
3196
+ skippedByCaller: readSkipOutputDataValidation(callOptions),
2879
3197
  includeOutputValidationDroppedPaths: core?.includeOutputValidationDroppedPaths,
2880
3198
  methodName: descriptor.name,
2881
3199
  adaptError: core?.adaptError
2882
3200
  };
2883
3201
  };
3202
+ const frameworkOptions = out.type === "list" ? LIST_FRAMEWORK_OPTIONS : ITEM_FRAMEWORK_OPTIONS;
3203
+ const withheld = withheldFromRun(frameworkOptions);
2884
3204
  if (out.type === "list") {
2885
3205
  entry.value = createPaginatedFunction(
2886
- fold(callRun),
3206
+ fold(
3207
+ (input, ctx) => callRun(stripFrameworkOnlyOptions(input, withheld), ctx)
3208
+ ),
2887
3209
  {
2888
3210
  sdk,
2889
3211
  schema: descriptor.inputSchema,
2890
3212
  name: descriptor.name,
3213
+ frameworkOptions,
2891
3214
  defaultPageSize: out.defaultPageSize,
2892
3215
  adaptPage: out.adaptPage,
2893
3216
  annotator: boundAnnotator,
2894
3217
  // Validate + strip each item against the item `outputSchema`
2895
3218
  // (item mode's sibling); dropped paths surface as `[].x` in the page's
2896
3219
  // `meta`, unioned across items.
2897
- finalizePage: (page) => applyListOutputPolicy(page, outputPolicy()),
3220
+ finalizePage: (page, callOptions) => applyListOutputPolicy(page, outputPolicy(callOptions)),
2898
3221
  getDeprecation: () => entry.meta?.deprecation,
2899
3222
  getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
2900
3223
  }
2901
3224
  );
2902
3225
  } else if (out.type === "item") {
2903
- const itemCore = async (input, ctx) => applyItemOutputPolicy(await callRun(input, ctx), outputPolicy());
3226
+ const itemCore = async (input, ctx) => applyItemOutputPolicy(
3227
+ await callRun(stripFrameworkOnlyOptions(input, withheld), ctx),
3228
+ outputPolicy(input)
3229
+ );
2904
3230
  entry.value = createFunction(
2905
3231
  fold(itemCore),
2906
3232
  {
2907
3233
  sdk,
2908
3234
  schema: descriptor.inputSchema,
2909
3235
  name: descriptor.name,
3236
+ frameworkOptions,
2910
3237
  annotator: boundAnnotator,
2911
3238
  getDeprecation: () => entry.meta?.deprecation,
2912
3239
  getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
2913
3240
  }
2914
3241
  );
2915
3242
  } else {
3243
+ const rawValidates = descriptor.meta?.outputSchema !== void 0 && !descriptor.skipOutputValidation;
3244
+ const validateRaw = (out2) => {
3245
+ const policy = outputPolicy(void 0);
3246
+ if (isPromiseLike(out2)) {
3247
+ return Promise.resolve(out2).then(
3248
+ (value) => applyRawOutputPolicy(value, policy)
3249
+ );
3250
+ }
3251
+ return applyRawOutputPolicy(out2, policy);
3252
+ };
2916
3253
  entry.value = createRawFunction(
2917
- (input, ctx) => fold(callRun)(input, ctx),
3254
+ (input, ctx) => {
3255
+ const out2 = fold(callRun)(input, ctx);
3256
+ return rawValidates ? validateRaw(out2) : out2;
3257
+ },
2918
3258
  {
2919
3259
  sdk,
2920
3260
  name: descriptor.name,
@@ -3046,9 +3386,14 @@ function buildEagerArtifacts(descriptors, context, states) {
3046
3386
  plugins[id] = {
3047
3387
  pluginType: "property",
3048
3388
  name: descriptor.name,
3049
- getValue: () => get({
3050
- imports: buildImports({ plugins, importBindings }),
3051
- state: states.get(id)
3389
+ getValue: (callContext) => get({
3390
+ imports: buildImports({
3391
+ plugins,
3392
+ importBindings,
3393
+ ctx: callContext
3394
+ }),
3395
+ state: states.get(id),
3396
+ callContext
3052
3397
  }),
3053
3398
  meta: descriptor.meta,
3054
3399
  dynamicMembers: descriptor.dynamicMembers
@@ -3062,6 +3407,7 @@ function buildEagerArtifacts(descriptors, context, states) {
3062
3407
  dynamicMembers: descriptor.dynamicMembers
3063
3408
  };
3064
3409
  }
3410
+ assertDynamicMemberRoot(plugins[id]);
3065
3411
  }
3066
3412
  recordDisposer();
3067
3413
  building.delete(id);
@@ -3285,38 +3631,33 @@ function addModelPlugin(sdk, plugin, options = {}) {
3285
3631
  }
3286
3632
  }
3287
3633
  function addPlugin(sdk, plugin, options) {
3288
- if (typeof plugin === "function") {
3289
- const record = sdk;
3290
- const contribution = applyPluginToSdk(
3291
- record,
3292
- plugin,
3293
- options ?? {}
3294
- );
3295
- const context = record[CONTEXT];
3296
- if (context) {
3297
- mirrorLegacyRootKeys(context, contribution.rootKeys, contribution.meta);
3298
- for (const name of Object.keys(contribution.rootKeys)) {
3299
- context.surface[name] = name;
3634
+ const record = sdk;
3635
+ const context = getContext(record);
3636
+ try {
3637
+ if (typeof plugin === "function") {
3638
+ const contribution = applyPluginToSdk(
3639
+ record,
3640
+ plugin,
3641
+ options ?? {}
3642
+ );
3643
+ if (context) {
3644
+ mirrorLegacyRootKeys(context, contribution.rootKeys, contribution.meta);
3645
+ for (const name of Object.keys(contribution.rootKeys)) {
3646
+ context.surface[name] = name;
3647
+ }
3300
3648
  }
3649
+ } else if (plugin.pluginType === "method-override") {
3650
+ applyMethodOverride(context, plugin);
3651
+ } else {
3652
+ addModelPlugin(record, plugin, options ?? {});
3301
3653
  }
3302
- return;
3303
- }
3304
- if (plugin.pluginType === "method-override") {
3305
- applyMethodOverride(
3306
- getContext(sdk),
3307
- plugin
3308
- );
3309
- return;
3654
+ } finally {
3655
+ if (context) invalidateRegistryCache(context);
3310
3656
  }
3311
- addModelPlugin(
3312
- sdk,
3313
- plugin,
3314
- options ?? {}
3315
- );
3316
3657
  }
3317
3658
 
3318
3659
  // src/model/resolution/controller.ts
3319
- var import_zod4 = require("zod");
3660
+ var import_zod5 = require("zod");
3320
3661
 
3321
3662
  // src/types/signals.ts
3322
3663
  var CORE_SIGNAL_SYMBOL = Symbol.for("kitcore.signal");
@@ -3349,55 +3690,33 @@ function isCoreCancelledSignal(value) {
3349
3690
  }
3350
3691
 
3351
3692
  // src/model/resolution/plan.ts
3352
- var import_zod3 = require("zod");
3353
- function unwrap(schema) {
3354
- let inner = schema;
3355
- let required = true;
3356
- for (; ; ) {
3357
- if (inner instanceof import_zod3.z.ZodOptional) {
3358
- required = false;
3359
- inner = inner._zod.def.innerType;
3360
- } else if (inner instanceof import_zod3.z.ZodDefault) {
3361
- required = false;
3362
- inner = inner._zod.def.innerType;
3363
- } else if (inner instanceof import_zod3.z.ZodNullable) {
3364
- inner = inner._zod.def.innerType;
3365
- } else {
3366
- break;
3367
- }
3368
- }
3369
- return { inner, required };
3370
- }
3693
+ var import_zod4 = require("zod");
3371
3694
  function valueTypeOf(inner) {
3372
- if (inner instanceof import_zod3.z.ZodString) return "string";
3373
- if (inner instanceof import_zod3.z.ZodNumber) return "number";
3374
- if (inner instanceof import_zod3.z.ZodBoolean) return "boolean";
3375
- if (inner instanceof import_zod3.z.ZodEnum) return "string";
3376
- if (inner instanceof import_zod3.z.ZodArray) return "array";
3377
- if (inner instanceof import_zod3.z.ZodObject) return "object";
3378
- if (inner instanceof import_zod3.z.ZodRecord) return "object";
3695
+ if (inner instanceof import_zod4.z.ZodString) return "string";
3696
+ if (inner instanceof import_zod4.z.ZodNumber) return "number";
3697
+ if (inner instanceof import_zod4.z.ZodBoolean) return "boolean";
3698
+ if (inner instanceof import_zod4.z.ZodEnum) return "string";
3699
+ if (inner instanceof import_zod4.z.ZodArray) return "array";
3700
+ if (inner instanceof import_zod4.z.ZodObject) return "object";
3701
+ if (inner instanceof import_zod4.z.ZodRecord) return "object";
3379
3702
  return void 0;
3380
3703
  }
3381
3704
  function staticChoicesOf(inner) {
3382
- if (inner instanceof import_zod3.z.ZodEnum) {
3705
+ if (inner instanceof import_zod4.z.ZodEnum) {
3383
3706
  const values = inner.options;
3384
3707
  return values.map((value) => ({ label: value, value }));
3385
3708
  }
3386
3709
  return void 0;
3387
3710
  }
3388
- function objectShape(schema) {
3389
- const canonical = canonicalInputSchema(schema);
3390
- const { inner } = canonical ? unwrap(canonical) : { inner: void 0 };
3391
- if (inner instanceof import_zod3.z.ZodObject) {
3392
- return inner.shape;
3393
- }
3394
- return void 0;
3395
- }
3396
3711
  function topoOrder2(specs) {
3397
3712
  const byName = new Map(specs.map((s) => [s.name, s]));
3398
3713
  const placed = /* @__PURE__ */ new Set();
3399
3714
  const ordered = [];
3400
- const isReady = (spec) => spec.requires.every((r) => !byName.has(r) || placed.has(r));
3715
+ const topLevelNameOf = (r) => typeof r === "string" ? r : r.length === 1 && typeof r[0] === "string" ? r[0] : void 0;
3716
+ const isReady = (spec) => spec.requires.every((r) => {
3717
+ const name = topLevelNameOf(r);
3718
+ return name === void 0 || !byName.has(name) || placed.has(name);
3719
+ });
3401
3720
  for (; ; ) {
3402
3721
  const next = specs.find((s) => !placed.has(s.name) && isReady(s));
3403
3722
  if (!next) break;
@@ -3408,7 +3727,7 @@ function topoOrder2(specs) {
3408
3727
  return ordered;
3409
3728
  }
3410
3729
  function planParameters(entry) {
3411
- const shape = objectShape(entry.inputSchema);
3730
+ const shape = objectShapeOf(entry.inputSchema);
3412
3731
  const resolvers = entry.resolvers ?? {};
3413
3732
  const names = shape ? [
3414
3733
  ...Object.keys(shape),
@@ -3418,7 +3737,7 @@ function planParameters(entry) {
3418
3737
  ] : Object.keys(resolvers);
3419
3738
  const specs = names.map((name) => {
3420
3739
  const field = shape?.[name];
3421
- const { inner, required } = field ? unwrap(field) : { inner: void 0, required: false };
3740
+ const { inner, required } = field ? unwrapSchema(field) : { inner: void 0, required: false };
3422
3741
  const resolver = resolvers[name];
3423
3742
  return {
3424
3743
  name,
@@ -4067,9 +4386,13 @@ async function findNext(ctx, state, path = []) {
4067
4386
  const hasAskableRequired = children.some((c) => c.required && asksUser(c));
4068
4387
  for (const leaf of ordered) {
4069
4388
  const childPath = [...path, leaf.name];
4070
- if (!leaf.requires.every(
4071
- (r) => container[r] !== void 0 || getAtPath(state.resolved, [r]) !== void 0 || isSettled(state, [...path, r]) || isSettled(state, [r])
4072
- )) {
4389
+ if (!leaf.requires.every((r) => {
4390
+ if (typeof r !== "string") {
4391
+ if (getAtPath(state.resolved, [...r]) !== void 0) return true;
4392
+ return r.some((_, index) => isSettled(state, r.slice(0, index + 1)));
4393
+ }
4394
+ return container[r] !== void 0 || getAtPath(state.resolved, [r]) !== void 0 || isSettled(state, [...path, r]) || isSettled(state, [r]);
4395
+ })) {
4073
4396
  continue;
4074
4397
  }
4075
4398
  const inArrayItem = path.some((segment) => typeof segment === "number");
@@ -4473,7 +4796,7 @@ function positionAfter(pagination, action) {
4473
4796
  function toJsonSchema(schema) {
4474
4797
  if (!schema) return void 0;
4475
4798
  try {
4476
- return import_zod4.z.toJSONSchema(schema);
4799
+ return import_zod5.z.toJSONSchema(schema);
4477
4800
  } catch {
4478
4801
  return void 0;
4479
4802
  }
@@ -4511,7 +4834,7 @@ function projectMethod(entry) {
4511
4834
  }
4512
4835
  function createController(sdk) {
4513
4836
  function entryFor(method) {
4514
- const entry = sdk.getRegistry().functions.find((f) => f.name === method);
4837
+ const entry = getRegistry(sdk).functions.find((f) => f.name === method);
4515
4838
  if (!entry) throw new Error(`unknown method "${method}"`);
4516
4839
  return entry;
4517
4840
  }
@@ -4550,7 +4873,7 @@ function createController(sdk) {
4550
4873
  throw new Error(`invalid input for "${method}": ${detail}`);
4551
4874
  };
4552
4875
  const listMethods = () => ({
4553
- data: sdk.getRegistry().functions.map(projectSummary)
4876
+ data: getRegistry(sdk).functions.map(projectSummary)
4554
4877
  });
4555
4878
  const getMethod = ({ method }) => ({
4556
4879
  data: projectMethod(entryFor(method))
@@ -4591,10 +4914,10 @@ function createCorePlugin(options) {
4591
4914
  }
4592
4915
 
4593
4916
  // src/transport/attempt-http-request.ts
4594
- var import_zod9 = require("zod");
4917
+ var import_zod10 = require("zod");
4595
4918
 
4596
4919
  // src/transport/authorize-http-request.ts
4597
- var import_zod5 = require("zod");
4920
+ var import_zod6 = require("zod");
4598
4921
  function describeUnclaimedConnection(connection) {
4599
4922
  const delimiterIndex = connection.indexOf(":");
4600
4923
  if (delimiterIndex === -1) {
@@ -4605,7 +4928,7 @@ function describeUnclaimedConnection(connection) {
4605
4928
  var authorizeHttpRequestPlugin = defineMethod({
4606
4929
  name: "authorizeHttpRequest",
4607
4930
  namespace: "kitcore",
4608
- inputSchema: import_zod5.z.custom(),
4931
+ inputSchema: import_zod6.z.custom(),
4609
4932
  skipInputValidation: true,
4610
4933
  run: async ({ input }) => {
4611
4934
  const { connection } = input.request;
@@ -4620,7 +4943,7 @@ var authorizeHttpRequestPlugin = defineMethod({
4620
4943
  });
4621
4944
 
4622
4945
  // src/transport/dispatch-http-request.ts
4623
- var import_zod6 = require("zod");
4946
+ var import_zod7 = require("zod");
4624
4947
  function toFetchInput(request) {
4625
4948
  const init = { ...request };
4626
4949
  const { url } = request;
@@ -4631,7 +4954,7 @@ function toFetchInput(request) {
4631
4954
  var dispatchHttpRequestPlugin = defineMethod({
4632
4955
  name: "dispatchHttpRequest",
4633
4956
  namespace: "kitcore",
4634
- inputSchema: import_zod6.z.custom(),
4957
+ inputSchema: import_zod7.z.custom(),
4635
4958
  skipInputValidation: true,
4636
4959
  run: async ({ input }) => {
4637
4960
  const { url, init } = toFetchInput(input.request);
@@ -4640,21 +4963,21 @@ var dispatchHttpRequestPlugin = defineMethod({
4640
4963
  });
4641
4964
 
4642
4965
  // src/transport/prepare-http-request.ts
4643
- var import_zod7 = require("zod");
4966
+ var import_zod8 = require("zod");
4644
4967
  var prepareHttpRequestPlugin = defineMethod({
4645
4968
  name: "prepareHttpRequest",
4646
4969
  namespace: "kitcore",
4647
- inputSchema: import_zod7.z.custom(),
4970
+ inputSchema: import_zod8.z.custom(),
4648
4971
  skipInputValidation: true,
4649
4972
  run: async ({ input }) => input.request
4650
4973
  });
4651
4974
 
4652
4975
  // src/transport/receive-http-response.ts
4653
- var import_zod8 = require("zod");
4976
+ var import_zod9 = require("zod");
4654
4977
  var receiveHttpResponsePlugin = defineMethod({
4655
4978
  name: "receiveHttpResponse",
4656
4979
  namespace: "kitcore",
4657
- inputSchema: import_zod8.z.custom(),
4980
+ inputSchema: import_zod9.z.custom(),
4658
4981
  skipInputValidation: true,
4659
4982
  run: async ({ input }) => input.response
4660
4983
  });
@@ -4669,7 +4992,7 @@ var attemptHttpRequestPlugin = defineMethod({
4669
4992
  declareDefault({ plugin: dispatchHttpRequestPlugin }),
4670
4993
  declareDefault({ plugin: receiveHttpResponsePlugin })
4671
4994
  ],
4672
- inputSchema: import_zod9.z.custom(),
4995
+ inputSchema: import_zod10.z.custom(),
4673
4996
  skipInputValidation: true,
4674
4997
  run: async ({ input, imports }) => {
4675
4998
  const { attempt } = input;
@@ -4694,7 +5017,7 @@ var attemptHttpRequestPlugin = defineMethod({
4694
5017
  });
4695
5018
 
4696
5019
  // src/transport/initialize-http-request.ts
4697
- var import_zod10 = require("zod");
5020
+ var import_zod11 = require("zod");
4698
5021
  function isReplayableBody(body) {
4699
5022
  if (body == null || typeof body !== "object") return true;
4700
5023
  return typeof Blob !== "undefined" && body instanceof Blob || // File extends Blob
@@ -4706,7 +5029,7 @@ function withStringUrl(request) {
4706
5029
  var initializeHttpRequestPlugin = defineMethod({
4707
5030
  name: "initializeHttpRequest",
4708
5031
  namespace: "kitcore",
4709
- inputSchema: import_zod10.z.custom(),
5032
+ inputSchema: import_zod11.z.custom(),
4710
5033
  skipInputValidation: true,
4711
5034
  run: async ({ input }) => {
4712
5035
  const request = withStringUrl(input.request);
@@ -4843,7 +5166,7 @@ function canRetry(attemptNumber, maxAttempts, replayable) {
4843
5166
  }
4844
5167
 
4845
5168
  // src/transport/send-http-request.ts
4846
- var import_zod11 = require("zod");
5169
+ var import_zod12 = require("zod");
4847
5170
  function createOperationId() {
4848
5171
  return globalThis.crypto?.randomUUID?.() ?? `http-${Date.now()}`;
4849
5172
  }
@@ -4854,7 +5177,7 @@ var sendHttpRequestPlugin = defineMethod({
4854
5177
  declareDefault({ plugin: initializeHttpRequestPlugin }),
4855
5178
  declareDefault({ plugin: attemptHttpRequestPlugin })
4856
5179
  ],
4857
- inputSchema: import_zod11.z.custom(),
5180
+ inputSchema: import_zod12.z.custom(),
4858
5181
  skipInputValidation: true,
4859
5182
  run: async ({ input, imports }) => {
4860
5183
  const start2 = {
@@ -4878,13 +5201,13 @@ var sendHttpRequestPlugin = defineMethod({
4878
5201
  });
4879
5202
 
4880
5203
  // src/transport/fetch.ts
4881
- var import_zod12 = require("zod");
5204
+ var import_zod13 = require("zod");
4882
5205
  var fetchPlugin = defineMethod({
4883
5206
  name: "fetch",
4884
5207
  namespace: "kitcore",
4885
5208
  imports: [declareDefault({ plugin: sendHttpRequestPlugin })],
4886
5209
  positional: ["url", "init"],
4887
- inputSchema: import_zod12.z.custom(),
5210
+ inputSchema: import_zod13.z.custom(),
4888
5211
  skipInputValidation: true,
4889
5212
  run: ({ input, imports }) => {
4890
5213
  const { url, init } = input;
@@ -4927,22 +5250,22 @@ function redactHttpRequest(request) {
4927
5250
  }
4928
5251
 
4929
5252
  // src/connections/default-connection-scheme.ts
4930
- var import_zod13 = require("zod");
5253
+ var import_zod14 = require("zod");
4931
5254
  var defaultConnectionSchemePlugin = defineMethod({
4932
5255
  name: "defaultConnectionScheme",
4933
5256
  namespace: "kitcore",
4934
- inputSchema: import_zod13.z.custom(),
5257
+ inputSchema: import_zod14.z.custom(),
4935
5258
  skipInputValidation: true,
4936
5259
  run: () => void 0
4937
5260
  });
4938
5261
 
4939
5262
  // src/connections/normalize-connection.ts
4940
- var import_zod14 = require("zod");
5263
+ var import_zod15 = require("zod");
4941
5264
  var normalizeConnectionPlugin = defineMethod({
4942
5265
  name: "normalizeConnection",
4943
5266
  namespace: "kitcore",
4944
5267
  imports: [declareDefault({ plugin: defaultConnectionSchemePlugin })],
4945
- inputSchema: import_zod14.z.custom(),
5268
+ inputSchema: import_zod15.z.custom(),
4946
5269
  skipInputValidation: true,
4947
5270
  run: ({ input, imports }) => {
4948
5271
  const { connection } = input;
@@ -4967,11 +5290,11 @@ var normalizeConnectionPlugin = defineMethod({
4967
5290
  });
4968
5291
 
4969
5292
  // src/connections/resolve-connection.ts
4970
- var import_zod15 = require("zod");
5293
+ var import_zod16 = require("zod");
4971
5294
  var resolveConnectionPlugin = defineMethod({
4972
5295
  name: "resolveConnection",
4973
5296
  namespace: "kitcore",
4974
- inputSchema: import_zod15.z.custom(),
5297
+ inputSchema: import_zod16.z.custom(),
4975
5298
  skipInputValidation: true,
4976
5299
  run: ({ input }) => input.connection
4977
5300
  });
@@ -5027,6 +5350,7 @@ var resolveConnectionPlugin = defineMethod({
5027
5350
  defineLegacyMerge,
5028
5351
  defineMethod,
5029
5352
  defineMethodOverride,
5353
+ defineOverride,
5030
5354
  definePlugin,
5031
5355
  defineProperty,
5032
5356
  defineResolver,
@@ -5042,6 +5366,7 @@ var resolveConnectionPlugin = defineMethod({
5042
5366
  getFieldDescriptions,
5043
5367
  getNegatable,
5044
5368
  getOutputSchema,
5369
+ getRegistry,
5045
5370
  getRegistryPlugin,
5046
5371
  getSchemaDescription,
5047
5372
  initializeHttpRequestPlugin,
@@ -5053,6 +5378,7 @@ var resolveConnectionPlugin = defineMethod({
5053
5378
  isTelemetryNested,
5054
5379
  normalizeConnectionPlugin,
5055
5380
  normalizeStability,
5381
+ objectShapeOf,
5056
5382
  omitExports,
5057
5383
  openEnum,
5058
5384
  paginate,
@@ -5074,6 +5400,7 @@ var resolveConnectionPlugin = defineMethod({
5074
5400
  toIterable,
5075
5401
  toSnakeCase,
5076
5402
  toTitleCase,
5403
+ unwrapSchema,
5077
5404
  validateOptions,
5078
5405
  withOutputSchema,
5079
5406
  withPositional,