@zapier/kitcore 0.16.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
  }
@@ -2792,23 +3114,17 @@ function runLegacyPass(descriptors, context) {
2792
3114
  Object.assign(context, contextRest);
2793
3115
  context.hooks = buildHooks(context.hooks, hooks);
2794
3116
  const exports2 = mirrorLegacyRootKeys(context, rootKeys, meta);
3117
+ for (const name of Object.keys(rootKeys)) context.surface[name] = name;
2795
3118
  if (!("getRegistry" in exports2)) {
2796
- let getRegistry2 = function(options) {
2797
- const sdk = this ?? exports2;
2798
- const projection = collectSurfaceProjection(context, sdk);
2799
- Object.assign(projection.meta, context.meta);
2800
- return buildRegistry({
2801
- sdk,
2802
- ...projection,
2803
- packageFilter: options?.package
2804
- });
3119
+ let getRegistry3 = function(options) {
3120
+ return getCachedRegistry(context, options?.package);
2805
3121
  };
2806
- var getRegistry = getRegistry2;
2807
- exports2.getRegistry = getRegistry2;
3122
+ var getRegistry2 = getRegistry3;
3123
+ exports2.getRegistry = getRegistry3;
2808
3124
  plugins.getRegistry = {
2809
3125
  pluginType: "method",
2810
3126
  name: "getRegistry",
2811
- value: getRegistry2,
3127
+ value: getRegistry3,
2812
3128
  chain: []
2813
3129
  };
2814
3130
  }
@@ -2872,50 +3188,73 @@ function buildMethodEntries(descriptors, context, states) {
2872
3188
  const sdk = { context };
2873
3189
  const methodAnnotator = descriptor.annotator;
2874
3190
  const boundAnnotator = methodAnnotator ? (input) => methodAnnotator({ input }) : void 0;
2875
- const outputPolicy = () => {
3191
+ const outputPolicy = (callOptions) => {
2876
3192
  const core = resolveCoreOptions(context);
2877
3193
  return {
2878
3194
  outputSchema: descriptor.meta?.outputSchema,
2879
3195
  skipOutputValidation: descriptor.skipOutputValidation,
3196
+ skippedByCaller: readSkipOutputDataValidation(callOptions),
2880
3197
  includeOutputValidationDroppedPaths: core?.includeOutputValidationDroppedPaths,
2881
3198
  methodName: descriptor.name,
2882
3199
  adaptError: core?.adaptError
2883
3200
  };
2884
3201
  };
3202
+ const frameworkOptions = out.type === "list" ? LIST_FRAMEWORK_OPTIONS : ITEM_FRAMEWORK_OPTIONS;
3203
+ const withheld = withheldFromRun(frameworkOptions);
2885
3204
  if (out.type === "list") {
2886
3205
  entry.value = createPaginatedFunction(
2887
- fold(callRun),
3206
+ fold(
3207
+ (input, ctx) => callRun(stripFrameworkOnlyOptions(input, withheld), ctx)
3208
+ ),
2888
3209
  {
2889
3210
  sdk,
2890
3211
  schema: descriptor.inputSchema,
2891
3212
  name: descriptor.name,
3213
+ frameworkOptions,
2892
3214
  defaultPageSize: out.defaultPageSize,
2893
3215
  adaptPage: out.adaptPage,
2894
3216
  annotator: boundAnnotator,
2895
3217
  // Validate + strip each item against the item `outputSchema`
2896
3218
  // (item mode's sibling); dropped paths surface as `[].x` in the page's
2897
3219
  // `meta`, unioned across items.
2898
- finalizePage: (page) => applyListOutputPolicy(page, outputPolicy()),
3220
+ finalizePage: (page, callOptions) => applyListOutputPolicy(page, outputPolicy(callOptions)),
2899
3221
  getDeprecation: () => entry.meta?.deprecation,
2900
3222
  getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
2901
3223
  }
2902
3224
  );
2903
3225
  } else if (out.type === "item") {
2904
- 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
+ );
2905
3230
  entry.value = createFunction(
2906
3231
  fold(itemCore),
2907
3232
  {
2908
3233
  sdk,
2909
3234
  schema: descriptor.inputSchema,
2910
3235
  name: descriptor.name,
3236
+ frameworkOptions,
2911
3237
  annotator: boundAnnotator,
2912
3238
  getDeprecation: () => entry.meta?.deprecation,
2913
3239
  getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
2914
3240
  }
2915
3241
  );
2916
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
+ };
2917
3253
  entry.value = createRawFunction(
2918
- (input, ctx) => fold(callRun)(input, ctx),
3254
+ (input, ctx) => {
3255
+ const out2 = fold(callRun)(input, ctx);
3256
+ return rawValidates ? validateRaw(out2) : out2;
3257
+ },
2919
3258
  {
2920
3259
  sdk,
2921
3260
  name: descriptor.name,
@@ -3068,6 +3407,7 @@ function buildEagerArtifacts(descriptors, context, states) {
3068
3407
  dynamicMembers: descriptor.dynamicMembers
3069
3408
  };
3070
3409
  }
3410
+ assertDynamicMemberRoot(plugins[id]);
3071
3411
  }
3072
3412
  recordDisposer();
3073
3413
  building.delete(id);
@@ -3291,38 +3631,33 @@ function addModelPlugin(sdk, plugin, options = {}) {
3291
3631
  }
3292
3632
  }
3293
3633
  function addPlugin(sdk, plugin, options) {
3294
- if (typeof plugin === "function") {
3295
- const record = sdk;
3296
- const contribution = applyPluginToSdk(
3297
- record,
3298
- plugin,
3299
- options ?? {}
3300
- );
3301
- const context = record[CONTEXT];
3302
- if (context) {
3303
- mirrorLegacyRootKeys(context, contribution.rootKeys, contribution.meta);
3304
- for (const name of Object.keys(contribution.rootKeys)) {
3305
- 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
+ }
3306
3648
  }
3649
+ } else if (plugin.pluginType === "method-override") {
3650
+ applyMethodOverride(context, plugin);
3651
+ } else {
3652
+ addModelPlugin(record, plugin, options ?? {});
3307
3653
  }
3308
- return;
3309
- }
3310
- if (plugin.pluginType === "method-override") {
3311
- applyMethodOverride(
3312
- getContext(sdk),
3313
- plugin
3314
- );
3315
- return;
3654
+ } finally {
3655
+ if (context) invalidateRegistryCache(context);
3316
3656
  }
3317
- addModelPlugin(
3318
- sdk,
3319
- plugin,
3320
- options ?? {}
3321
- );
3322
3657
  }
3323
3658
 
3324
3659
  // src/model/resolution/controller.ts
3325
- var import_zod4 = require("zod");
3660
+ var import_zod5 = require("zod");
3326
3661
 
3327
3662
  // src/types/signals.ts
3328
3663
  var CORE_SIGNAL_SYMBOL = Symbol.for("kitcore.signal");
@@ -3355,55 +3690,33 @@ function isCoreCancelledSignal(value) {
3355
3690
  }
3356
3691
 
3357
3692
  // src/model/resolution/plan.ts
3358
- var import_zod3 = require("zod");
3359
- function unwrap(schema) {
3360
- let inner = schema;
3361
- let required = true;
3362
- for (; ; ) {
3363
- if (inner instanceof import_zod3.z.ZodOptional) {
3364
- required = false;
3365
- inner = inner._zod.def.innerType;
3366
- } else if (inner instanceof import_zod3.z.ZodDefault) {
3367
- required = false;
3368
- inner = inner._zod.def.innerType;
3369
- } else if (inner instanceof import_zod3.z.ZodNullable) {
3370
- inner = inner._zod.def.innerType;
3371
- } else {
3372
- break;
3373
- }
3374
- }
3375
- return { inner, required };
3376
- }
3693
+ var import_zod4 = require("zod");
3377
3694
  function valueTypeOf(inner) {
3378
- if (inner instanceof import_zod3.z.ZodString) return "string";
3379
- if (inner instanceof import_zod3.z.ZodNumber) return "number";
3380
- if (inner instanceof import_zod3.z.ZodBoolean) return "boolean";
3381
- if (inner instanceof import_zod3.z.ZodEnum) return "string";
3382
- if (inner instanceof import_zod3.z.ZodArray) return "array";
3383
- if (inner instanceof import_zod3.z.ZodObject) return "object";
3384
- 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";
3385
3702
  return void 0;
3386
3703
  }
3387
3704
  function staticChoicesOf(inner) {
3388
- if (inner instanceof import_zod3.z.ZodEnum) {
3705
+ if (inner instanceof import_zod4.z.ZodEnum) {
3389
3706
  const values = inner.options;
3390
3707
  return values.map((value) => ({ label: value, value }));
3391
3708
  }
3392
3709
  return void 0;
3393
3710
  }
3394
- function objectShape(schema) {
3395
- const canonical = canonicalInputSchema(schema);
3396
- const { inner } = canonical ? unwrap(canonical) : { inner: void 0 };
3397
- if (inner instanceof import_zod3.z.ZodObject) {
3398
- return inner.shape;
3399
- }
3400
- return void 0;
3401
- }
3402
3711
  function topoOrder2(specs) {
3403
3712
  const byName = new Map(specs.map((s) => [s.name, s]));
3404
3713
  const placed = /* @__PURE__ */ new Set();
3405
3714
  const ordered = [];
3406
- 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
+ });
3407
3720
  for (; ; ) {
3408
3721
  const next = specs.find((s) => !placed.has(s.name) && isReady(s));
3409
3722
  if (!next) break;
@@ -3414,7 +3727,7 @@ function topoOrder2(specs) {
3414
3727
  return ordered;
3415
3728
  }
3416
3729
  function planParameters(entry) {
3417
- const shape = objectShape(entry.inputSchema);
3730
+ const shape = objectShapeOf(entry.inputSchema);
3418
3731
  const resolvers = entry.resolvers ?? {};
3419
3732
  const names = shape ? [
3420
3733
  ...Object.keys(shape),
@@ -3424,7 +3737,7 @@ function planParameters(entry) {
3424
3737
  ] : Object.keys(resolvers);
3425
3738
  const specs = names.map((name) => {
3426
3739
  const field = shape?.[name];
3427
- const { inner, required } = field ? unwrap(field) : { inner: void 0, required: false };
3740
+ const { inner, required } = field ? unwrapSchema(field) : { inner: void 0, required: false };
3428
3741
  const resolver = resolvers[name];
3429
3742
  return {
3430
3743
  name,
@@ -4073,9 +4386,13 @@ async function findNext(ctx, state, path = []) {
4073
4386
  const hasAskableRequired = children.some((c) => c.required && asksUser(c));
4074
4387
  for (const leaf of ordered) {
4075
4388
  const childPath = [...path, leaf.name];
4076
- if (!leaf.requires.every(
4077
- (r) => container[r] !== void 0 || getAtPath(state.resolved, [r]) !== void 0 || isSettled(state, [...path, r]) || isSettled(state, [r])
4078
- )) {
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
+ })) {
4079
4396
  continue;
4080
4397
  }
4081
4398
  const inArrayItem = path.some((segment) => typeof segment === "number");
@@ -4479,7 +4796,7 @@ function positionAfter(pagination, action) {
4479
4796
  function toJsonSchema(schema) {
4480
4797
  if (!schema) return void 0;
4481
4798
  try {
4482
- return import_zod4.z.toJSONSchema(schema);
4799
+ return import_zod5.z.toJSONSchema(schema);
4483
4800
  } catch {
4484
4801
  return void 0;
4485
4802
  }
@@ -4517,7 +4834,7 @@ function projectMethod(entry) {
4517
4834
  }
4518
4835
  function createController(sdk) {
4519
4836
  function entryFor(method) {
4520
- const entry = sdk.getRegistry().functions.find((f) => f.name === method);
4837
+ const entry = getRegistry(sdk).functions.find((f) => f.name === method);
4521
4838
  if (!entry) throw new Error(`unknown method "${method}"`);
4522
4839
  return entry;
4523
4840
  }
@@ -4556,7 +4873,7 @@ function createController(sdk) {
4556
4873
  throw new Error(`invalid input for "${method}": ${detail}`);
4557
4874
  };
4558
4875
  const listMethods = () => ({
4559
- data: sdk.getRegistry().functions.map(projectSummary)
4876
+ data: getRegistry(sdk).functions.map(projectSummary)
4560
4877
  });
4561
4878
  const getMethod = ({ method }) => ({
4562
4879
  data: projectMethod(entryFor(method))
@@ -4597,10 +4914,10 @@ function createCorePlugin(options) {
4597
4914
  }
4598
4915
 
4599
4916
  // src/transport/attempt-http-request.ts
4600
- var import_zod9 = require("zod");
4917
+ var import_zod10 = require("zod");
4601
4918
 
4602
4919
  // src/transport/authorize-http-request.ts
4603
- var import_zod5 = require("zod");
4920
+ var import_zod6 = require("zod");
4604
4921
  function describeUnclaimedConnection(connection) {
4605
4922
  const delimiterIndex = connection.indexOf(":");
4606
4923
  if (delimiterIndex === -1) {
@@ -4611,7 +4928,7 @@ function describeUnclaimedConnection(connection) {
4611
4928
  var authorizeHttpRequestPlugin = defineMethod({
4612
4929
  name: "authorizeHttpRequest",
4613
4930
  namespace: "kitcore",
4614
- inputSchema: import_zod5.z.custom(),
4931
+ inputSchema: import_zod6.z.custom(),
4615
4932
  skipInputValidation: true,
4616
4933
  run: async ({ input }) => {
4617
4934
  const { connection } = input.request;
@@ -4626,7 +4943,7 @@ var authorizeHttpRequestPlugin = defineMethod({
4626
4943
  });
4627
4944
 
4628
4945
  // src/transport/dispatch-http-request.ts
4629
- var import_zod6 = require("zod");
4946
+ var import_zod7 = require("zod");
4630
4947
  function toFetchInput(request) {
4631
4948
  const init = { ...request };
4632
4949
  const { url } = request;
@@ -4637,7 +4954,7 @@ function toFetchInput(request) {
4637
4954
  var dispatchHttpRequestPlugin = defineMethod({
4638
4955
  name: "dispatchHttpRequest",
4639
4956
  namespace: "kitcore",
4640
- inputSchema: import_zod6.z.custom(),
4957
+ inputSchema: import_zod7.z.custom(),
4641
4958
  skipInputValidation: true,
4642
4959
  run: async ({ input }) => {
4643
4960
  const { url, init } = toFetchInput(input.request);
@@ -4646,21 +4963,21 @@ var dispatchHttpRequestPlugin = defineMethod({
4646
4963
  });
4647
4964
 
4648
4965
  // src/transport/prepare-http-request.ts
4649
- var import_zod7 = require("zod");
4966
+ var import_zod8 = require("zod");
4650
4967
  var prepareHttpRequestPlugin = defineMethod({
4651
4968
  name: "prepareHttpRequest",
4652
4969
  namespace: "kitcore",
4653
- inputSchema: import_zod7.z.custom(),
4970
+ inputSchema: import_zod8.z.custom(),
4654
4971
  skipInputValidation: true,
4655
4972
  run: async ({ input }) => input.request
4656
4973
  });
4657
4974
 
4658
4975
  // src/transport/receive-http-response.ts
4659
- var import_zod8 = require("zod");
4976
+ var import_zod9 = require("zod");
4660
4977
  var receiveHttpResponsePlugin = defineMethod({
4661
4978
  name: "receiveHttpResponse",
4662
4979
  namespace: "kitcore",
4663
- inputSchema: import_zod8.z.custom(),
4980
+ inputSchema: import_zod9.z.custom(),
4664
4981
  skipInputValidation: true,
4665
4982
  run: async ({ input }) => input.response
4666
4983
  });
@@ -4675,7 +4992,7 @@ var attemptHttpRequestPlugin = defineMethod({
4675
4992
  declareDefault({ plugin: dispatchHttpRequestPlugin }),
4676
4993
  declareDefault({ plugin: receiveHttpResponsePlugin })
4677
4994
  ],
4678
- inputSchema: import_zod9.z.custom(),
4995
+ inputSchema: import_zod10.z.custom(),
4679
4996
  skipInputValidation: true,
4680
4997
  run: async ({ input, imports }) => {
4681
4998
  const { attempt } = input;
@@ -4700,7 +5017,7 @@ var attemptHttpRequestPlugin = defineMethod({
4700
5017
  });
4701
5018
 
4702
5019
  // src/transport/initialize-http-request.ts
4703
- var import_zod10 = require("zod");
5020
+ var import_zod11 = require("zod");
4704
5021
  function isReplayableBody(body) {
4705
5022
  if (body == null || typeof body !== "object") return true;
4706
5023
  return typeof Blob !== "undefined" && body instanceof Blob || // File extends Blob
@@ -4712,7 +5029,7 @@ function withStringUrl(request) {
4712
5029
  var initializeHttpRequestPlugin = defineMethod({
4713
5030
  name: "initializeHttpRequest",
4714
5031
  namespace: "kitcore",
4715
- inputSchema: import_zod10.z.custom(),
5032
+ inputSchema: import_zod11.z.custom(),
4716
5033
  skipInputValidation: true,
4717
5034
  run: async ({ input }) => {
4718
5035
  const request = withStringUrl(input.request);
@@ -4849,7 +5166,7 @@ function canRetry(attemptNumber, maxAttempts, replayable) {
4849
5166
  }
4850
5167
 
4851
5168
  // src/transport/send-http-request.ts
4852
- var import_zod11 = require("zod");
5169
+ var import_zod12 = require("zod");
4853
5170
  function createOperationId() {
4854
5171
  return globalThis.crypto?.randomUUID?.() ?? `http-${Date.now()}`;
4855
5172
  }
@@ -4860,7 +5177,7 @@ var sendHttpRequestPlugin = defineMethod({
4860
5177
  declareDefault({ plugin: initializeHttpRequestPlugin }),
4861
5178
  declareDefault({ plugin: attemptHttpRequestPlugin })
4862
5179
  ],
4863
- inputSchema: import_zod11.z.custom(),
5180
+ inputSchema: import_zod12.z.custom(),
4864
5181
  skipInputValidation: true,
4865
5182
  run: async ({ input, imports }) => {
4866
5183
  const start2 = {
@@ -4884,13 +5201,13 @@ var sendHttpRequestPlugin = defineMethod({
4884
5201
  });
4885
5202
 
4886
5203
  // src/transport/fetch.ts
4887
- var import_zod12 = require("zod");
5204
+ var import_zod13 = require("zod");
4888
5205
  var fetchPlugin = defineMethod({
4889
5206
  name: "fetch",
4890
5207
  namespace: "kitcore",
4891
5208
  imports: [declareDefault({ plugin: sendHttpRequestPlugin })],
4892
5209
  positional: ["url", "init"],
4893
- inputSchema: import_zod12.z.custom(),
5210
+ inputSchema: import_zod13.z.custom(),
4894
5211
  skipInputValidation: true,
4895
5212
  run: ({ input, imports }) => {
4896
5213
  const { url, init } = input;
@@ -4933,22 +5250,22 @@ function redactHttpRequest(request) {
4933
5250
  }
4934
5251
 
4935
5252
  // src/connections/default-connection-scheme.ts
4936
- var import_zod13 = require("zod");
5253
+ var import_zod14 = require("zod");
4937
5254
  var defaultConnectionSchemePlugin = defineMethod({
4938
5255
  name: "defaultConnectionScheme",
4939
5256
  namespace: "kitcore",
4940
- inputSchema: import_zod13.z.custom(),
5257
+ inputSchema: import_zod14.z.custom(),
4941
5258
  skipInputValidation: true,
4942
5259
  run: () => void 0
4943
5260
  });
4944
5261
 
4945
5262
  // src/connections/normalize-connection.ts
4946
- var import_zod14 = require("zod");
5263
+ var import_zod15 = require("zod");
4947
5264
  var normalizeConnectionPlugin = defineMethod({
4948
5265
  name: "normalizeConnection",
4949
5266
  namespace: "kitcore",
4950
5267
  imports: [declareDefault({ plugin: defaultConnectionSchemePlugin })],
4951
- inputSchema: import_zod14.z.custom(),
5268
+ inputSchema: import_zod15.z.custom(),
4952
5269
  skipInputValidation: true,
4953
5270
  run: ({ input, imports }) => {
4954
5271
  const { connection } = input;
@@ -4973,11 +5290,11 @@ var normalizeConnectionPlugin = defineMethod({
4973
5290
  });
4974
5291
 
4975
5292
  // src/connections/resolve-connection.ts
4976
- var import_zod15 = require("zod");
5293
+ var import_zod16 = require("zod");
4977
5294
  var resolveConnectionPlugin = defineMethod({
4978
5295
  name: "resolveConnection",
4979
5296
  namespace: "kitcore",
4980
- inputSchema: import_zod15.z.custom(),
5297
+ inputSchema: import_zod16.z.custom(),
4981
5298
  skipInputValidation: true,
4982
5299
  run: ({ input }) => input.connection
4983
5300
  });
@@ -5033,6 +5350,7 @@ var resolveConnectionPlugin = defineMethod({
5033
5350
  defineLegacyMerge,
5034
5351
  defineMethod,
5035
5352
  defineMethodOverride,
5353
+ defineOverride,
5036
5354
  definePlugin,
5037
5355
  defineProperty,
5038
5356
  defineResolver,
@@ -5048,6 +5366,7 @@ var resolveConnectionPlugin = defineMethod({
5048
5366
  getFieldDescriptions,
5049
5367
  getNegatable,
5050
5368
  getOutputSchema,
5369
+ getRegistry,
5051
5370
  getRegistryPlugin,
5052
5371
  getSchemaDescription,
5053
5372
  initializeHttpRequestPlugin,
@@ -5059,6 +5378,7 @@ var resolveConnectionPlugin = defineMethod({
5059
5378
  isTelemetryNested,
5060
5379
  normalizeConnectionPlugin,
5061
5380
  normalizeStability,
5381
+ objectShapeOf,
5062
5382
  omitExports,
5063
5383
  openEnum,
5064
5384
  paginate,
@@ -5080,6 +5400,7 @@ var resolveConnectionPlugin = defineMethod({
5080
5400
  toIterable,
5081
5401
  toSnakeCase,
5082
5402
  toTitleCase,
5403
+ unwrapSchema,
5083
5404
  validateOptions,
5084
5405
  withOutputSchema,
5085
5406
  withPositional,